Skip to content

Commit 725e0c1

Browse files
P33Mpopcornmix
authored andcommitted
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 <jonathan@raspberrypi.com>
1 parent 279619d commit 725e0c1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
13581358
{
13591359
struct device *dev = pcie->dev;
13601360
void __iomem *base = pcie->base;
1361-
u16 nlw, cls, lnksta;
1361+
u16 nlw, cls, lnksta, tmp16;
13621362
bool ssc_good = false;
13631363
int ret, i;
13641364

@@ -1407,6 +1407,17 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
14071407
pci_speed_string(pcie_link_speed[cls]), nlw,
14081408
ssc_good ? "(SSC)" : "(!SSC)");
14091409

1410+
/*
1411+
* RootCtl bits are reset by perst_n, which undoes pci_enable_crs()
1412+
* called prior to pci_add_new_bus() during probe. Re-enable here.
1413+
*/
1414+
tmp16 = readw(base + BRCM_PCIE_CAP_REGS + PCI_EXP_RTCAP);
1415+
if (tmp16 & PCI_EXP_RTCAP_CRSVIS) {
1416+
tmp16 = readw(base + BRCM_PCIE_CAP_REGS + PCI_EXP_RTCTL);
1417+
u16p_replace_bits(&tmp16, 1, PCI_EXP_RTCTL_CRSSVE);
1418+
writew(tmp16, base + BRCM_PCIE_CAP_REGS + PCI_EXP_RTCTL);
1419+
}
1420+
14101421
return 0;
14111422
}
14121423

0 commit comments

Comments
 (0)