Skip to content

Commit f5f4f16

Browse files
P33Mpopcornmix
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 <jonathan@raspberrypi.com>
1 parent acad47e commit f5f4f16

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
@@ -161,11 +161,15 @@
161161

162162
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK 0x2
163163
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_PERST_ASSERT_MASK 0x8
164+
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_ENABLE_MASK 0x10000
165+
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_OUT_MASK 0x100000
164166
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK 0x200000
165167
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000
166168
#define PCIE_BMIPS_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x00800000
167169
#define PCIE_CLKREQ_MASK \
168170
(PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK | \
171+
PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_ENABLE_MASK | \
172+
PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_OUT_MASK | \
169173
PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK)
170174

171175
#define PCIE_MISC_UBUS_BAR1_CONFIG_REMAP 0x40ac
@@ -1595,12 +1599,21 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie)
15951599

15961600
} else {
15971601
/*
1598-
* "safe" -- No power savings; refclk is driven by RC
1602+
* "safe" -- No power savings; refclk and CLKREQ# are driven by RC
15991603
* unconditionally.
16001604
*/
16011605
if (strcmp(mode, "safe") != 0)
16021606
dev_err(pcie->dev, err_msg);
16031607
mode = "safe";
1608+
clkreq_cntl |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_OUT_MASK;
1609+
clkreq_cntl |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_REFCLK_OVRD_ENABLE_MASK;
1610+
/*
1611+
* Un-advertise L1ss as configuring an EP to enter L1.x with CLKREQ#
1612+
* physically unconnected will result in a dead link.
1613+
*/
1614+
tmp = readl(pcie->base + PCIE_RC_CFG_PRIV1_ROOT_CAP);
1615+
u32p_replace_bits(&tmp, 2, PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK);
1616+
writel(tmp, pcie->base + PCIE_RC_CFG_PRIV1_ROOT_CAP);
16041617
}
16051618
writel(clkreq_cntl, pcie->base + HARD_DEBUG(pcie));
16061619

0 commit comments

Comments
 (0)