]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: brcmstb: Use same constant table for config space access
authorJim Quinlan <james.quinlan@broadcom.com>
Fri, 14 Feb 2025 17:39:34 +0000 (12:39 -0500)
committerKrzysztof Wilczyński <kwilczynski@kernel.org>
Tue, 4 Mar 2025 16:01:43 +0000 (16:01 +0000)
The constants EXT_CFG_DATA and EXT_CFG_INDEX vary by SoC, where one of
the map_bus methods used these constants, and the other used a different
set of constants.

Thankfully, there was no problem because the SoCs that used the latter
map_bus method all had the same register constants.

Thus, remove redundant constants and adjust the code to use the correct
constants accordingly.

While at it, update the value of EXT_CFG_DATA to use the 4k-page based
configuration space access system, which is what the second map_bus
method was already using.

Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20250214173944.47506-7-james.quinlan@broadcom.com
[kwilczynski: commit log]
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
drivers/pci/controller/pcie-brcmstb.c

index d565153d8a379898e2dd8a45e459cfd996ac873f..76f51352709e913a67b2d249fb1e907735df7912 100644 (file)
 #define  MSI_INT_MASK_SET              0x10
 #define  MSI_INT_MASK_CLR              0x14
 
-#define PCIE_EXT_CFG_DATA                              0x8000
-#define PCIE_EXT_CFG_INDEX                             0x9000
-
 #define  PCIE_RGR1_SW_INIT_1_PERST_MASK                        0x1
 #define  PCIE_RGR1_SW_INIT_1_PERST_SHIFT               0x0
 
@@ -727,8 +724,8 @@ static void __iomem *brcm_pcie_map_bus(struct pci_bus *bus,
 
        /* For devices, write to the config space index register */
        idx = PCIE_ECAM_OFFSET(bus->number, devfn, 0);
-       writel(idx, pcie->base + PCIE_EXT_CFG_INDEX);
-       return base + PCIE_EXT_CFG_DATA + PCIE_ECAM_REG(where);
+       writel(idx, base + IDX_ADDR(pcie));
+       return base + DATA_ADDR(pcie) + PCIE_ECAM_REG(where);
 }
 
 static void __iomem *brcm7425_pcie_map_bus(struct pci_bus *bus,
@@ -1711,7 +1708,7 @@ static void brcm_pcie_remove(struct platform_device *pdev)
 static const int pcie_offsets[] = {
        [RGR1_SW_INIT_1]        = 0x9210,
        [EXT_CFG_INDEX]         = 0x9000,
-       [EXT_CFG_DATA]          = 0x9004,
+       [EXT_CFG_DATA]          = 0x8000,
        [PCIE_HARD_DEBUG]       = 0x4204,
        [PCIE_INTR2_CPU_BASE]   = 0x4300,
 };
@@ -1719,7 +1716,7 @@ static const int pcie_offsets[] = {
 static const int pcie_offsets_bcm7278[] = {
        [RGR1_SW_INIT_1]        = 0xc010,
        [EXT_CFG_INDEX]         = 0x9000,
-       [EXT_CFG_DATA]          = 0x9004,
+       [EXT_CFG_DATA]          = 0x8000,
        [PCIE_HARD_DEBUG]       = 0x4204,
        [PCIE_INTR2_CPU_BASE]   = 0x4300,
 };
@@ -1733,8 +1730,9 @@ static const int pcie_offsets_bcm7425[] = {
 };
 
 static const int pcie_offsets_bcm7712[] = {
+       [RGR1_SW_INIT_1]        = 0x9210,
        [EXT_CFG_INDEX]         = 0x9000,
-       [EXT_CFG_DATA]          = 0x9004,
+       [EXT_CFG_DATA]          = 0x8000,
        [PCIE_HARD_DEBUG]       = 0x4304,
        [PCIE_INTR2_CPU_BASE]   = 0x4400,
 };