Skip to content

Commit 8bb7ff1

Browse files
paliLorenzo Pieralisi
authored andcommitted
PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro
Simplify pci-tegra.c driver code and use new PCI_CONF1_EXT_ADDRESS() macro for accessing PCI config space. Link: https://lore.kernel.org/r/20220928121911.14994-1-pali@kernel.org Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Acked-by: Thierry Reding <treding@nvidia.com>
1 parent 2301a3e commit 8bb7ff1

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/pci/controller/pci-tegra.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,6 @@ static inline u32 pads_readl(struct tegra_pcie *pcie, unsigned long offset)
415415
* address (access to which generates correct config transaction) falls in
416416
* this 4 KiB region.
417417
*/
418-
static unsigned int tegra_pcie_conf_offset(u8 bus, unsigned int devfn,
419-
unsigned int where)
420-
{
421-
return ((where & 0xf00) << 16) | (bus << 16) | (PCI_SLOT(devfn) << 11) |
422-
(PCI_FUNC(devfn) << 8) | (where & 0xff);
423-
}
424-
425418
static void __iomem *tegra_pcie_map_bus(struct pci_bus *bus,
426419
unsigned int devfn,
427420
int where)
@@ -443,7 +436,9 @@ static void __iomem *tegra_pcie_map_bus(struct pci_bus *bus,
443436
unsigned int offset;
444437
u32 base;
445438

446-
offset = tegra_pcie_conf_offset(bus->number, devfn, where);
439+
offset = PCI_CONF1_EXT_ADDRESS(bus->number, PCI_SLOT(devfn),
440+
PCI_FUNC(devfn), where) &
441+
~PCI_CONF1_ENABLE;
447442

448443
/* move 4 KiB window to offset within the FPCI region */
449444
base = 0xfe100000 + ((offset & ~(SZ_4K - 1)) >> 8);

0 commit comments

Comments
 (0)