Skip to content

Commit 53bec08

Browse files
committed
PCI: brcmstb: Enable CRS software visibility after linkup
It appears that bits in the Root Control Register are reset with perst_n, which means the PCI layer's call to enable CRS prior to adding/scanning the bus has no effect. Open-code the enable in brcm_pcie_start_link as a workaround. Without CRS visibility, configuration reads issued by the CPU don't retire if the endpoint returns a CRS response - the RC will poll until a (large) timeout is reached. This means the core can stall for a long time during boot. Signed-off-by: Jonathan Bell <[email protected]>
1 parent 667453a commit 53bec08

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
13851385
{
13861386
struct device *dev = pcie->dev;
13871387
void __iomem *base = pcie->base;
1388-
u16 nlw, cls, lnksta;
1388+
u16 nlw, cls, lnksta, tmp16;
13891389
bool ssc_good = false;
13901390
int ret, i;
13911391
u32 tmp;
@@ -1449,6 +1449,16 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
14491449
pci_speed_string(pcie_link_speed[cls]), nlw,
14501450
ssc_good ? "(SSC)" : "(!SSC)");
14511451

1452+
/*
1453+
* RootCtl bits are reset by perst_n, which undoes pci_enable_crs()
1454+
* called prior to pci_add_new_bus() during probe. Re-enable here.
1455+
*/
1456+
tmp16 = readw(base + BRCM_PCIE_CAP_REGS + PCI_EXP_RTCAP);
1457+
if (tmp16 & PCI_EXP_RTCAP_CRSVIS) {
1458+
tmp16 = readw(base + BRCM_PCIE_CAP_REGS + PCI_EXP_RTCTL);
1459+
u16p_replace_bits(&tmp16, 1, PCI_EXP_RTCTL_CRSSVE);
1460+
writew(tmp16, base + BRCM_PCIE_CAP_REGS + PCI_EXP_RTCTL);
1461+
}
14521462
return 0;
14531463
}
14541464

0 commit comments

Comments
 (0)