Skip to content

Commit 897a66d

Browse files
jonhunterbjorn-helgaas
authored andcommitted
Revert "PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro"
This reverts commit 8bb7ff1. Commit 8bb7ff1 ("PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro") updated the Tegra PCI driver to use the macro PCI_CONF1_EXT_ADDRESS() instead of a local function in the Tegra PCI driver. This broke PCI for some Tegra platforms because, when calculating the offset value, the mask applied to the lower 8-bits changed from 0xff to 0xfc. For now, fix this by reverting this commit. Fixes: 8bb7ff1 ("PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jon Hunter <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Thierry Reding <[email protected]> Acked-by: Lorenzo Pieralisi <[email protected]>
1 parent 9abf231 commit 897a66d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/pci/controller/pci-tegra.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,13 @@ 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+
418425
static void __iomem *tegra_pcie_map_bus(struct pci_bus *bus,
419426
unsigned int devfn,
420427
int where)
@@ -436,9 +443,7 @@ static void __iomem *tegra_pcie_map_bus(struct pci_bus *bus,
436443
unsigned int offset;
437444
u32 base;
438445

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

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

0 commit comments

Comments
 (0)