Skip to content

Commit bf8a71d

Browse files
P33Mpelwell
authored andcommitted
PCI: pcie-brcmstb: add more safeguards for clkreq "safe" mode
The existing implementation for clkreq-mode="safe" leaves the HARD_DEBUG with both control bits clear. This can cause link failure if L1 sub-states are enabled and if either of these conditions occurrs: - The platform does not connect the CLRKEQ# signal to the EP, and a pull-up is present on the line - The platform connects the signal to the EP, and the EP enters an L1.x or ClkPM state Additional register bits in the HARD_DEBUG register can be used to force the RC to drive CLKREQ# low. Also, un-advertise L1ss as a) additional power savings can't be realised and b) enabling L1ss may incur additional wake latency from L1.0. Signed-off-by: Jonathan Bell <[email protected]>
1 parent faa9140 commit bf8a71d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,15 @@
164164

165165
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK 0x2
166166
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_PERST_ASSERT_MASK 0x8
167+
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_ENABLE_MASK 0x10000
168+
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_OUT_MASK 0x100000
167169
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK 0x200000
168170
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000
169171
#define PCIE_BMIPS_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x00800000
170172
#define PCIE_CLKREQ_MASK \
171173
(PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK | \
174+
PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_ENABLE_MASK | \
175+
PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_OUT_MASK | \
172176
PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK)
173177

174178
#define PCIE_MISC_UBUS_BAR1_CONFIG_REMAP 0x40ac
@@ -1599,12 +1603,21 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie)
15991603

16001604
} else {
16011605
/*
1602-
* "safe" -- No power savings; refclk is driven by RC
1606+
* "safe" -- No power savings; refclk and CLKREQ# are driven by RC
16031607
* unconditionally.
16041608
*/
16051609
if (strcmp(mode, "safe") != 0)
16061610
dev_err(pcie->dev, err_msg);
16071611
mode = "safe";
1612+
clkreq_cntl |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_OUT_MASK;
1613+
clkreq_cntl |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_ENABLE_MASK;
1614+
/*
1615+
* Un-advertise L1ss as configuring an EP to enter L1.x with CLKREQ#
1616+
* physically unconnected will result in a dead link.
1617+
*/
1618+
tmp = readl(pcie->base + PCIE_RC_CFG_PRIV1_ROOT_CAP);
1619+
u32p_replace_bits(&tmp, 2, PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK);
1620+
writel(tmp, pcie->base + PCIE_RC_CFG_PRIV1_ROOT_CAP);
16081621
}
16091622
writel(clkreq_cntl, pcie->base + HARD_DEBUG(pcie));
16101623

0 commit comments

Comments
 (0)