pci: Add standard PCIe ECAM macros
authorPali Rohár <pali@kernel.org>
Wed, 3 Nov 2021 00:01:05 +0000 (01:01 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 17 Nov 2021 22:04:58 +0000 (17:04 -0500)
commita4bc38da27dfc170e87b5849115cc8faedb6ae90
treee5006b98769297c7825a2d9111ee25cea3462ae9
parentb814e0007e060b5cce314edcf5c0507a67cafd73
pci: Add standard PCIe ECAM macros

Lot of PCIe controllers are using ECAM addressing. So add common ECAM
macros into U-Boot's pci.h header file which can be suitable for most
PCI controller drivers.

Replace custom ECAM address macros in every PCI controller driver by new
ECAM macros from U-Boot's pci.h header file.

Similar macros are defined also in Linux kernel. There is a small
difference between Linux and these new U-Boot macros.

U-Boot's PCIE_ECAM_OFFSET() takes device and function numbers in separate
arguments. Linux's PCIE_ECAM_OFFSET() takes device and function numbers
encoded in one argument. The reason is that U-Boot's PCI_DEVFN() macro is
different than Linux's PCI_SLOT() macro. So having device and function
numbers in separate arguments makes code more straightforward.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/pci/pci-aardvark.c
drivers/pci/pcie_ecam_generic.c
drivers/pci/pcie_ecam_synquacer.c
drivers/pci/pcie_phytium.c
drivers/pci/pcie_rockchip.c
drivers/pci/pcie_xilinx.c
include/pci.h