Skip to contentSkip to conversation

PCI: brcmstb: Some minor fixes/features

PATCH Applied Jim Quinlan 4 participants 8 messages May 7, 2020 – May 11, 2020

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v3 cover PCI: brcmstb: Some minor fixes/features

v3 -- A change was submitted to [1] to make 'aspm-no-l0s' a general
property for PCIe devices. As such, the STB PCIe YAML file merely notes that it may be used.

v2 -- Dropped commit concerning CRS.
-- Chanded new prop 'brcm,aspm-en-l0s' to 'aspm-no-l0s'. -- Capitalize first letter in commit subject line; spelling.

v1 -- original

[1] https://github.com/devicetree-org/dt-schema/blob/master/schemas/pci/pci-bus.yaml

Jim Quinlan (4):
PCI: brcmstb: Don't clk_put() a managed clock
PCI: brcmstb: Fix window register offset from 4 to 8
dt-bindings: PCI: brcmstb: New prop 'aspm-no-l0s'
PCI: brcmstb: Disable L0s component of ASPM if requested

 .../bindings/pci/brcm,stb-pcie.yaml           |  2 ++
 drivers/pci/controller/pcie-brcmstb.c         | 19 +++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 1/4 PCI: brcmstb: Don't clk_put() a managed clock

From: Jim Quinlan <[email protected]>

clk_put() was being invoked on a clock obtained by devm_clk_get_optional().

---
 drivers/pci/controller/pcie-brcmstb.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +0 -1
index 6d79d14527a6..454917ee9241 100644
@@ -899,7 +899,6 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie)
 	brcm_msi_remove(pcie);
 	brcm_pcie_turn_off(pcie);
 	clk_disable_unprepare(pcie->clk);
-	clk_put(pcie->clk);
 }
 
 static int brcm_pcie_remove(struct platform_device *pdev)
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v3 1/4] PCI: brcmstb: Don't clk_put() a managed clock

Quoted 8 lines · Jim Quinlan

From: Jim Quinlan <[email protected]>

clk_put() was being invoked on a clock obtained by devm_clk_get_optional().

This one should also have:

Fixes c0452137034b ("PCI: brcmstb: Add Broadcom STB PCIe host

controller driver")

not sure if Bjorn can add it while applying.

Signature · 1 line
Florian
#3 lore raw

PATCH v3 2/4 PCI: brcmstb: Fix window register offset from 4 to 8

In reply to Jim Quinlan

From: Jim Quinlan <[email protected]>

The outbound memory window registers were being referenced with an incorrect stride offset. This probably wasn't noticed previously as there was likely only one such window employed.

Fixes c0452137034b ("PCI: brcmstb: Add Broadcom STB PCIe host controller driver")
---
 drivers/pci/controller/pcie-brcmstb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/pcie-brcmstb.c +2 -2
index 454917ee9241..5b0dec5971b8 100644
@@ -54,11 +54,11 @@
 
 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO		0x400c
 #define PCIE_MEM_WIN0_LO(win)	\
-		PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 4)
+		PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 8)
 
 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI		0x4010
 #define PCIE_MEM_WIN0_HI(win)	\
-		PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 4)
+		PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 8)
 
 #define PCIE_MISC_RC_BAR1_CONFIG_LO			0x402c
 #define  PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK		0x1f
Signature · 1 line
2.17.1
#4 lore raw

PATCH v3 3/4 dt-bindings: PCI: brcmstb: New prop 'aspm-no-l0s'

In reply to Jim Quinlan

From: Jim Quinlan <[email protected]>

For various reasons, one may want to disable the ASPM L0s capability.

---
 Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +2 -0
index 77d3e81a437b..8680a0f86c5a 100644
@@ -56,6 +56,8 @@ properties:
     description: Indicates usage of spread-spectrum clocking.
     type: boolean
 
+  aspm-no-l0s: true
+
 required:
   - reg
   - dma-ranges
Signature · 1 line
2.17.1
#6 lore raw

PATCH v3 4/4 PCI: brcmstb: Disable L0s component of ASPM if requested

In reply to Jim Quinlan

From: Jim Quinlan <[email protected]>

Some informal internal experiments has shown that the BrcmSTB ASPM L0s savings may introduce an undesirable noise signal on some customers' boards. In addition, L0s was found lacking in realized power savings, especially relative to the L1 ASPM component. This is BrcmSTB's experience and may not hold for others. At any rate, if the 'aspm-no-l0s' property is present L0s will be disabled.

---
 drivers/pci/controller/pcie-brcmstb.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +13 -1
index 5b0dec5971b8..73020b4ff090 100644
@@ -41,6 +41,9 @@
 #define PCIE_RC_CFG_PRIV1_ID_VAL3			0x043c
 #define  PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK	0xffffff
 
+#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY			0x04dc
+#define  PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK	0xc00
+
 #define PCIE_RC_DL_MDIO_ADDR				0x1100
 #define PCIE_RC_DL_MDIO_WR_DATA				0x1104
 #define PCIE_RC_DL_MDIO_RD_DATA				0x1108
@@ -693,7 +696,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 	int num_out_wins = 0;
 	u16 nlw, cls, lnksta;
 	int i, ret;
-	u32 tmp;
+	u32 tmp, aspm_support;
 
 	/* Reset the bridge */
 	brcm_pcie_bridge_sw_init_set(pcie, 1);
@@ -803,6 +806,15 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 		num_out_wins++;
 	}
 
+	/* Don't advertise L0s capability if 'aspm-no-l0s' */
+	aspm_support = PCIE_LINK_STATE_L1;
+	if (!of_property_read_bool(pcie->np, "aspm-no-l0s"))
+		aspm_support |= PCIE_LINK_STATE_L0S;
+	tmp = readl(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
+	u32p_replace_bits(&tmp, aspm_support,
+		PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK);
+	writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
+
 	/*
 	 * For config space accesses on the RC, show the right class for
 	 * a PCIe-PCIe bridge (the default setting is to be EP mode).
Signature · 1 line
2.17.1
#7 lore raw
In reply to Jim Quinlan
Quoted 18 lines · Jim Quinlan

v3 -- A change was submitted to [1] to make 'aspm-no-l0s' a general
property for PCIe devices. As such, the STB PCIe YAML file merely notes that it may be used.

v2 -- Dropped commit concerning CRS.
-- Chanded new prop 'brcm,aspm-en-l0s' to 'aspm-no-l0s'. -- Capitalize first letter in commit subject line; spelling.

v1 -- original

[1] https://github.com/devicetree-org/dt-schema/blob/master/schemas/pci/pci-bus.yaml

Jim Quinlan (4):
PCI: brcmstb: Don't clk_put() a managed clock
PCI: brcmstb: Fix window register offset from 4 to 8
dt-bindings: PCI: brcmstb: New prop 'aspm-no-l0s'
PCI: brcmstb: Disable L0s component of ASPM if requested

Quoted 3 lines
 .../bindings/pci/brcm,stb-pcie.yaml           |  2 ++
 drivers/pci/controller/pcie-brcmstb.c         | 19 +++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

Applied to pci/brcmstb, thanks !

Lorenzo