Skip to content

Commit a70c281

Browse files
jamesequinlanpopcornmix
authored andcommitted
PCI: brcmstb: Use same constant table for config space access
The constants EXT_CFG_DATA and EXT_CFG_INDEX vary by SOC. One of the map_bus methods used these constants, the other used different constants. Fortunately there was no problem because the SoCs that used the latter map_bus method all had the same register constants. Remove the redundant constants and adjust the code to use them. In addition, update EXT_CFG_DATA to use the 4k-page based config space access system, which is what the second map_bus method was already using. Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
1 parent 1974bc7 commit a70c281

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@
151151
#define MSI_INT_MASK_SET 0x10
152152
#define MSI_INT_MASK_CLR 0x14
153153

154-
#define PCIE_EXT_CFG_DATA 0x8000
155-
#define PCIE_EXT_CFG_INDEX 0x9000
156-
157154
#define PCIE_RGR1_SW_INIT_1_PERST_MASK 0x1
158155
#define PCIE_RGR1_SW_INIT_1_PERST_SHIFT 0x0
159156

@@ -728,8 +725,8 @@ static void __iomem *brcm_pcie_map_bus(struct pci_bus *bus,
728725

729726
/* For devices, write to the config space index register */
730727
idx = PCIE_ECAM_OFFSET(bus->number, devfn, 0);
731-
writel(idx, pcie->base + PCIE_EXT_CFG_INDEX);
732-
return base + PCIE_EXT_CFG_DATA + PCIE_ECAM_REG(where);
728+
writel(idx, base + IDX_ADDR(pcie));
729+
return base + DATA_ADDR(pcie) + PCIE_ECAM_REG(where);
733730
}
734731

735732
static void __iomem *brcm7425_pcie_map_bus(struct pci_bus *bus,
@@ -1712,15 +1709,15 @@ static void brcm_pcie_remove(struct platform_device *pdev)
17121709
static const int pcie_offsets[] = {
17131710
[RGR1_SW_INIT_1] = 0x9210,
17141711
[EXT_CFG_INDEX] = 0x9000,
1715-
[EXT_CFG_DATA] = 0x9004,
1712+
[EXT_CFG_DATA] = 0x8000,
17161713
[PCIE_HARD_DEBUG] = 0x4204,
17171714
[PCIE_INTR2_CPU_BASE] = 0x4300,
17181715
};
17191716

17201717
static const int pcie_offsets_bcm7278[] = {
17211718
[RGR1_SW_INIT_1] = 0xc010,
17221719
[EXT_CFG_INDEX] = 0x9000,
1723-
[EXT_CFG_DATA] = 0x9004,
1720+
[EXT_CFG_DATA] = 0x8000,
17241721
[PCIE_HARD_DEBUG] = 0x4204,
17251722
[PCIE_INTR2_CPU_BASE] = 0x4300,
17261723
};
@@ -1734,8 +1731,9 @@ static const int pcie_offsets_bcm7425[] = {
17341731
};
17351732

17361733
static const int pcie_offsets_bcm7712[] = {
1734+
[RGR1_SW_INIT_1] = 0x9210,
17371735
[EXT_CFG_INDEX] = 0x9000,
1738-
[EXT_CFG_DATA] = 0x9004,
1736+
[EXT_CFG_DATA] = 0x8000,
17391737
[PCIE_HARD_DEBUG] = 0x4304,
17401738
[PCIE_INTR2_CPU_BASE] = 0x4400,
17411739
};

0 commit comments

Comments
 (0)