Revert "PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro"
Subsystems (4)
Jon Hunter
maintainerPATCH 1/1 Revert "PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro"
This reverts commit 8bb7ff12a91429eb76e093b517ae810b146448fe.
Commit 8bb7ff12a914 ("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 is breaking 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.
--- drivers/pci/controller/pci-tegra.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/pci/controller/pci-tegra.c +8 -3
@@ -415,6 +415,13 @@ static inline u32 pads_readl(struct tegra_pcie *pcie, unsigned long offset)* address (access to which generates correct config transaction) falls in * this 4 KiB region. */ +static unsigned int tegra_pcie_conf_offset (u8 bus,unsigned int devfn, +unsigned int where) +{ +return ((where &0xf00 ) <<16 ) | (bus <<16 ) | (PCI_SLOT (devfn) <<11 ) | + (PCI_FUNC (devfn) <<8 ) | (where &0xff ); +} +static void __iomem *tegra_pcie_map_bus (struct pci_bus *bus,unsigned int devfn,int where)
@@ -436,9 +443,7 @@ static void __iomem *tegra_pcie_map_bus(struct pci_bus *bus,unsigned int offset;u32 base; - offset =PCI_CONF1_EXT_ADDRESS (bus->number,PCI_SLOT (devfn), -PCI_FUNC (devfn), where) & - ~PCI_CONF1_ENABLE ; + offset =tegra_pcie_conf_offset (bus->number, devfn, where);/* move 4 KiB window to offset within the FPCI region */ base =0xfe100000 + ((offset & ~(SZ_4K -1 )) >>8 );
Signature · 1 line
2.25.1
Quoted 9 lines · Jon Hunter
This reverts commit
8bb7ff12a91429eb76e093b517ae810b146448fe.Commit
8bb7ff12a914("PCI: tegra: UsePCI_CONF1_EXT_ADDRESS()macro") updated the Tegra PCI driver to use the macroPCI_CONF1_EXT_ADDRESS()instead of a local function in the Tegra PCI driver. This is breaking PCI for some Tegra platforms because, when calculating the offset value, the mask applied to the lower 8-bits changed from0xffto0xfc. For now, fix this by reverting this commit.
Quoted 5 lines
Fixes 8bb7ff12a914 ("PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro")Signed-off-by Jon Hunter <[email protected]>--- drivers/pci/controller/pci-tegra.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Sorry for missing this during review:
Quoted 9 lines · Jon Hunter
This reverts commit
8bb7ff12a91429eb76e093b517ae810b146448fe.Commit
8bb7ff12a914("PCI: tegra: UsePCI_CONF1_EXT_ADDRESS()macro") updated the Tegra PCI driver to use the macroPCI_CONF1_EXT_ADDRESS()instead of a local function in the Tegra PCI driver. This is breaking PCI for some Tegra platforms because, when calculating the offset value, the mask applied to the lower 8-bits changed from0xffto0xfc. For now, fix this by reverting this commit.
Quoted 5 lines
Fixes 8bb7ff12a914 ("PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro")Signed-off-by Jon Hunter <[email protected]>--- drivers/pci/controller/pci-tegra.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Bjorn,
can we send it upstream for one of the upcoming -rcX please ?
Thanks,
Lorenzo
Quoted 32 lines
drivers/pci/controller/pci-tegra.c +8
-3@@ -415,6 +415,13 @@ static inline u32 pads_readl(struct tegra_pcie *pcie, unsigned long offset)* address (access to which generates correct config transaction) falls in * this 4 KiB region. */ +static unsigned int tegra_pcie_conf_offset (u8 bus,unsigned int devfn, +unsigned int where) +{ +return ((where &0xf00 ) <<16 ) | (bus <<16 ) | (PCI_SLOT (devfn) <<11 ) | + (PCI_FUNC (devfn) <<8 ) | (where &0xff ); +} +static void __iomem *tegra_pcie_map_bus (struct pci_bus *bus,unsigned int devfn,int where)@@ -436,9 +443,7 @@ static void __iomem *tegra_pcie_map_bus(struct pci_bus *bus,unsigned int offset;u32 base; - offset =PCI_CONF1_EXT_ADDRESS (bus->number,PCI_SLOT (devfn), -PCI_FUNC (devfn), where) & - ~PCI_CONF1_ENABLE ; + offset =tegra_pcie_conf_offset (bus->number, devfn, where);/* move 4 KiB window to offset within the FPCI region */ base =0xfe100000 + ((offset & ~(SZ_4K -1 )) >>8 );Signature · 1 line
2.25.1
Quoted 11 lines · Jon Hunter
This reverts commit
8bb7ff12a91429eb76e093b517ae810b146448fe.Commit
8bb7ff12a914("PCI: tegra: UsePCI_CONF1_EXT_ADDRESS()macro") updated the Tegra PCI driver to use the macroPCI_CONF1_EXT_ADDRESS()instead of a local function in the Tegra PCI driver. This is breaking PCI for some Tegra platforms because, when calculating the offset value, the mask applied to the lower 8-bits changed from0xffto0xfc. For now, fix this by reverting this commit.Fixes 8bb7ff12a914 ("PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro")Signed-off-by Jon Hunter <[email protected]>
Applied with acks from Thierry and Lorenzo to for-linus for v6.1, thanks!
Quoted 36 lines
--- drivers/pci/controller/pci-tegra.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/pci/controller/pci-tegra.c +8
-3@@ -415,6 +415,13 @@ static inline u32 pads_readl(struct tegra_pcie *pcie, unsigned long offset)* address (access to which generates correct config transaction) falls in * this 4 KiB region. */ +static unsigned int tegra_pcie_conf_offset (u8 bus,unsigned int devfn, +unsigned int where) +{ +return ((where &0xf00 ) <<16 ) | (bus <<16 ) | (PCI_SLOT (devfn) <<11 ) | + (PCI_FUNC (devfn) <<8 ) | (where &0xff ); +} +static void __iomem *tegra_pcie_map_bus (struct pci_bus *bus,unsigned int devfn,int where)@@ -436,9 +443,7 @@ static void __iomem *tegra_pcie_map_bus(struct pci_bus *bus,unsigned int offset;u32 base; - offset =PCI_CONF1_EXT_ADDRESS (bus->number,PCI_SLOT (devfn), -PCI_FUNC (devfn), where) & - ~PCI_CONF1_ENABLE ; + offset =tegra_pcie_conf_offset (bus->number, devfn, where);/* move 4 KiB window to offset within the FPCI region */ base =0xfe100000 + ((offset & ~(SZ_4K -1 )) >>8 );Signature · 1 line
2.25.1