u-boot/drivers
Pali Rohár cb056005dc arm: a37xx: pci: Add support for accessing PCI Bridge on root bus
Aardvark does not have a real PCIe Root Port device on the root bus.
Instead it has PCIe registers of PCIe Root Port device mapped in
internal Aardvark memory space starting at offset 0xc0.

The PCIe Root Port itself is normally available as a PCI Bridge device
on the root bus with bus number zero. Aardvark instead has the
configuration registers of this PCI Bridge at offset 0x00 of Aardvark's
memory space, but the class code of this device is Mass Storage
Controller (0x010400), instead of PCI Bridge (0x600400), which causes
U-Boot to fail to recognize it as a P2P Bridge

Add a hook into the pcie_advk_read_config() / pcie_advk_write_config()
functions to redirect access for root bus from PIO transfer to this
internal Aardvark memory space. This will allow U-Boot to access
configuration space of this PCI Bridge which represents PCIe Root Port.

Redirect access to PCI Bridge registers in range 0x10 - 0x34 to driver's
internal buffer (cfgcache[]). This is because at those addresses
Aardvark has different registers, incompatible with config space of a
PCI Bridge.

Redirect access to PCI Bridge register PCI_ROM_ADDRESS1 (0x38) to
Aardvark internal address for that register (0x30).

When reading PCI Bridge register PCI_HEADER_TYPE, set it explicitly to
value Type 1 (PCI_HEADER_TYPE_BRIDGE) as PCI Bridge must be of Type 1.

When writing to PCI_PRIMARY_BUS or PCI_SECONDARY_BUS registers on this
PCI Bridge, correctly update driver's first_busno and sec_busno
variables, so that pcie_advk_addr_valid() function can check if address
of any device behind the root bus is valid and that PIO transfers are
started with correct config type (1 vs 0), which is required for
accessing devices behind some PCI bridge after the root bus.

U-Boot's PCI_PNP code sets primary and secondary bus numbers as relative
to the configured bus number of the root bus. This is done so that
U-Boot can support multiple PCIe host bridges or multiple root port
buses, when internal bus numbers are different.

Now that root bus is available, update code in pcie_advk_read_config()
and pcie_advk_write_config() functions to correctly calculate real
Aardvark bus number of the target device from U-Boot's bus number as:
  busno = PCI_BUS(bdf) - dev_seq(bus)

Stefan: Small fix of header masking as suggested by Pali.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2021-10-08 08:37:55 +02:00
..
adc dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
ata pci: Fix mismerge with v2021.10-rc4 2021-09-16 11:46:44 -04:00
axi WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
bios_emulator pci: Drop DM_PCI check from bios_emul 2021-08-05 19:46:35 -04:00
block Kconfig: Remove all default n/no options 2021-08-31 17:47:49 -04:00
bootcount bootcount: add a new driver with syscon as backend 2021-08-22 11:04:52 +02:00
bus bus: ti-sysc: change in a normal driver 2021-03-22 19:23:27 +13:00
button dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
cache WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
clk clk: k210: Try harder to get the best config 2021-10-07 16:08:23 +08:00
core treewide: Use OF_REAL instead of !OF_PLATDATA 2021-09-25 09:46:15 -06:00
cpu sandbox: correct cpu nodes 2021-09-25 09:46:15 -06:00
crypto WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
ddr WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
demo demo: migrate uclass to livetree 2021-10-05 08:50:15 -04:00
dfu Kconfig: Remove all default n/no options 2021-08-31 17:47:49 -04:00
dma ti: keystone: dma: Migrate to Kconfig 2021-09-27 21:38:34 -04:00
fastboot Kconfig: Remove all default n/no options 2021-08-31 17:47:49 -04:00
firmware WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
fpga WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
gpio gpio: Factor out DT flag translation 2021-10-05 08:50:15 -04:00
hwspinlock dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
i2c WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
input i8042: Do not abuse CONFIG namespace 2021-08-30 14:13:28 -04:00
led dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
mailbox dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
memory keystone2: Move CONFIG_AEMIF_CNTRL_BASE out of CONFIG namespace 2021-09-27 21:38:34 -04:00
misc WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
mmc arm: Remove aspenite board 2021-10-01 12:10:09 -04:00
mtd Convert CONFIG_NAND_OMAP_ECCSCHEME to Kconfig 2021-10-06 09:16:24 -04:00
mux dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
net arm: Remove zmx25 board and ARCH_MX25 2021-10-01 21:08:18 -04:00
nvme dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
pch treewide: Simply conditions with the new OF_REAL 2021-09-25 09:46:15 -06:00
pci arm: a37xx: pci: Add support for accessing PCI Bridge on root bus 2021-10-08 08:37:55 +02:00
pci_endpoint dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
phy phy: marvell: a3700: Return correct error code when power up fails 2021-10-08 08:33:52 +02:00
pinctrl pinctrl: single: Add request() api 2021-10-05 08:43:03 -04:00
power WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
pwm WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
qe net: qe: uec: ensure mdiodev->name is NULL terminated after MDIO_NAME_LEN truncation 2021-09-28 18:50:56 +03:00
ram WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
reboot-mode reboot-mode: migrate uclass to livetree 2021-10-05 08:50:15 -04:00
remoteproc remoteproc: migrate uclass to livetree 2021-10-05 08:50:15 -04:00
reset WS cleanup: remove trailing white space 2021-09-30 08:08:56 -04:00
rng Kconfig: Remove all default n/no options 2021-08-31 17:47:49 -04:00
rtc rtc: rx8025: revise single register write to use offset 2021-10-03 14:40:56 -04:00
scsi sata: Rename SATA_SUPPORT to SATA 2021-09-04 12:26:02 -04:00
serial serial: Add a debug console using the RISC-V SBI interface 2021-10-07 16:08:23 +08:00
smem dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
soc soc: xilinx: versal: Add soc_xilinx_versal driver 2021-08-26 08:08:11 +02:00
sound dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
spi Merge branch 'next' 2021-10-04 11:28:16 -04:00
spmi dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
sysinfo sysinfo: rcar3: Add Renesas R-Car Gen3 sysinfo driver 2021-07-20 23:33:54 +02:00
sysreset sysreset: provide SBI based sysreset driver 2021-10-07 16:08:23 +08:00
tee tee: optee: sync cache on pre-reloc OP-TEE invocation 2021-07-23 07:13:25 -04:00
thermal WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
timer WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
tpm treewide: Simply conditions with the new OF_REAL 2021-09-25 09:46:15 -06:00
ufs dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
usb usb: dwc3: meson-gxl: add AXG compatible 2021-10-07 10:14:50 +02:00
video WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
virtio pci: Drop DM_PCI 2021-09-13 18:23:13 -04:00
w1 arm: Remove zmx25 board and ARCH_MX25 2021-10-01 21:08:18 -04:00
w1-eeprom dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
watchdog watchdog: rti_wdt: Add support for loading firmware 2021-10-03 14:40:56 -04:00
xen WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
Kconfig reboot-mode: add support for reboot mode control 2021-07-23 10:16:39 -04:00
Makefile net: Move network rules to drivers/net 2021-09-04 12:51:47 -04:00