Skip to content

Commit 38aa6ca

Browse files
jamesequinlangregkh
authored andcommitted
PCI: brcmstb: Fix disabling L0s capability
[ Upstream commit 9583f9d ] caab002 ("PCI: brcmstb: Disable L0s component of ASPM if requested") set PCI_EXP_LNKCAP_ASPM_L1 and (optionally) PCI_EXP_LNKCAP_ASPM_L0S in PCI_EXP_LNKCAP (aka PCIE_RC_CFG_PRIV1_LINK_CAPABILITY in brcmstb). But instead of using PCI_EXP_LNKCAP_ASPM_L1 and PCI_EXP_LNKCAP_ASPM_L0S directly, it used PCIE_LINK_STATE_L1 and PCIE_LINK_STATE_L0S, which are Linux-created values that only coincidentally matched the PCIe spec. b478e16 ("PCI/ASPM: Consolidate link state defines") later changed them so they no longer matched the PCIe spec, so the bits ended up in the wrong place in PCI_EXP_LNKCAP. Use PCI_EXP_LNKCAP_ASPM_L0S to clear L0s support when there's an 'aspm-no-l0s' property. Rely on brcmstb hardware to advertise L0s and/or L1 support otherwise. Fixes: caab002 ("PCI: brcmstb: Disable L0s component of ASPM if requested") Reported-by: Bjorn Helgaas <bhelgaas@google.com> Closes: https://lore.kernel.org/linux-pci/20250925194424.GA2197200@bhelgaas Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com> [mani: reworded subject and description, added closes tag and CCed stable] Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20251003170436.1446030-1-james.quinlan@broadcom.com Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b4e2b74 commit 38aa6ca

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747

4848
#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY 0x04dc
4949
#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK 0x1f0
50-
#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00
5150

5251
#define PCIE_RC_CFG_PRIV1_ROOT_CAP 0x4f8
5352
#define PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK 0xf8
@@ -1029,7 +1028,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
10291028
void __iomem *base = pcie->base;
10301029
struct pci_host_bridge *bridge;
10311030
struct resource_entry *entry;
1032-
u32 tmp, burst, aspm_support, num_lanes, num_lanes_cap;
1031+
u32 tmp, burst, num_lanes, num_lanes_cap;
10331032
u8 num_out_wins = 0;
10341033
int num_inbound_wins = 0;
10351034
int memc, ret;
@@ -1129,12 +1128,9 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
11291128

11301129

11311130
/* Don't advertise L0s capability if 'aspm-no-l0s' */
1132-
aspm_support = PCIE_LINK_STATE_L1;
1133-
if (!of_property_read_bool(pcie->np, "aspm-no-l0s"))
1134-
aspm_support |= PCIE_LINK_STATE_L0S;
11351131
tmp = readl(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
1136-
u32p_replace_bits(&tmp, aspm_support,
1137-
PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK);
1132+
if (of_property_read_bool(pcie->np, "aspm-no-l0s"))
1133+
tmp &= ~PCI_EXP_LNKCAP_ASPM_L0S;
11381134
writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
11391135

11401136
/* 'tmp' still holds the contents of PRIV1_LINK_CAPABILITY */

0 commit comments

Comments
 (0)