Skip to contentSkip to conversation

PCI: brcmstb: Use "num-lanes" DT property if present

PATCH Applied Jim Quinlan 6 participants 18 messages May 30, 2025 – Jun 25, 2025

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

cover PCI: brcmstb: Use "num-lanes" DT property if present

v2:
-- DT bindings: Add default, maximum values for 'num-lanes' (Rob) -- Add 'if' clause to clamp maximum requested num-lanes

v1: original

Jim Quinlan (2):
dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
PCI: brcmstb: Use "num-lanes" DT property if present

 .../bindings/pci/brcm,stb-pcie.yaml           |  4 +++
 drivers/pci/controller/pcie-brcmstb.c         | 26 ++++++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

base-commit: 01f95500a162fca88cefab9ed64ceded5afabc12

Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property

Add optional num-lanes property Broadcom STB PCIe host controllers.

---
 Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +4 -0
index 29f0e1eb5096..cba227b19a5f 100644
@@ -107,6 +107,10 @@ properties:
       - const: bridge
       - const: swinit
 
+  num-lanes:
+    default: 1
+    maximum: 4
+
 required:
   - compatible
   - reg
Signature · 1 line
2.43.0
maintainer
#3 lore raw

Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property

Quoted 6 lines · Florian Fainelli
Quoted 3 lines · Jim Quinlan

Add optional num-lanes property Broadcom STB PCIe host controllers.

Sorry I take that back, I think this should be:

num-lanes:
enum: [ 1, 2, 4 ]

We are basically documenting the allowed values, not specifying that we can repeat the num-lames property between 1 and 4 times.

Signature · 1 line
Florian
#4 lore raw

Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property

Quoted 9 lines · Florian Fainelli
Quoted 6 lines · Florian Fainelli
Quoted 3 lines · Jim Quinlan

Add optional num-lanes property Broadcom STB PCIe host controllers.

Quoted 7 lines

Sorry I take that back, I think this should be:

num-lanes:

   enum: [ 1, 2, 4 ]

We are basically documenting the allowed values, not specifying that we can repeat the num-lames property between 1 and 4 times.

num-lanes is already defined as

    enum: [ 1, 2, 4, 8, 16, 32 ]
Quoted 2 lines

--
Florian

maintainer
#5 lore raw

Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property

Quoted 16 lines · Jim Quinlan
Quoted 14 lines · Florian Fainelli
Quoted 6 lines · Florian Fainelli
Quoted 3 lines · Jim Quinlan

Add optional num-lanes property Broadcom STB PCIe host controllers.

Sorry I take that back, I think this should be:

num-lanes:

    enum: [ 1, 2, 4 ]
Quoted 6 lines
Quoted 2 lines

We are basically documenting the allowed values, not specifying that we can repeat the num-lames property between 1 and 4 times.

num-lanes is already defined as

     enum: [ 1, 2, 4, 8, 16, 32 ]

Right, but then we need to re-define it with our own specific constraints, still, don't we?

Signature · 1 line
Florian
#6 lore raw

Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property

Quoted 21 lines · Florian Fainelli
Quoted 19 lines · Jim Quinlan
Quoted 16 lines · Florian Fainelli
Quoted 6 lines · Florian Fainelli
Quoted 3 lines · Jim Quinlan

Add optional num-lanes property Broadcom STB PCIe host controllers.

Sorry I take that back, I think this should be:

num-lanes:

    enum: [ 1, 2, 4 ]

We are basically documenting the allowed values, not specifying that we can repeat the num-lames property between 1 and 4 times.

Quoted 6 lines
Quoted 3 lines

num-lanes is already defined as

     enum: [ 1, 2, 4, 8, 16, 32 ]

Right, but then we need to re-define it with our own specific constraints, still, don't we?

We do; there is the provided enum and we provide the maximum and minimum. The AND-ing of all constraints yields [1, 2, 4].
Also, I'm not sure one can redefine an existing property or would want to.

Quoted 2 lines

--
Florian

maintainer
#7 lore raw

Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property

In reply to Florian Fainelli
Quoted 12 lines · Florian Fainelli
Quoted 11 lines · Jim Quinlan
Quoted 9 lines · Florian Fainelli
Quoted 6 lines · Florian Fainelli
Quoted 3 lines · Jim Quinlan

Add optional num-lanes property Broadcom STB PCIe host controllers.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Sorry I take that back, I think this should be:

num-lanes:

    enum: [ 1, 2, 4 ]

We are basically documenting the allowed values, not specifying that we can repeat the num-lames property between 1 and 4 times.

Are you confused with maxItems?

Quoted 7 lines
Quoted 4 lines

num-lanes is already defined as

     enum: [ 1, 2, 4, 8, 16, 32 ]

Right, but then we need to re-define it with our own specific constraints, still, don't we?

It is correct as-is.

Rob

maintainer
#8 lore raw

Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property

Quoted 15 lines · Rob Herring
Quoted 14 lines · Florian Fainelli
Quoted 13 lines · Jim Quinlan
Quoted 11 lines · Florian Fainelli
Quoted 6 lines · Florian Fainelli
Quoted 3 lines · Jim Quinlan

Add optional num-lanes property Broadcom STB PCIe host controllers.

Sorry I take that back, I think this should be:

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

num-lanes:

     enum: [ 1, 2, 4 ]

We are basically documenting the allowed values, not specifying that we can repeat the num-lames property between 1 and 4 times.

Are you confused with maxItems?

Yes I am.

Quoted 10 lines
Quoted 8 lines
Quoted 5 lines

num-lanes is already defined as

      enum: [ 1, 2, 4, 8, 16, 32 ]

Right, but then we need to re-define it with our own specific constraints, still, don't we?

It is correct as-is.

Thanks!

Signature · 1 line
Florian
#10 lore raw

PATCH 2/2 PCI: brcmstb: Use "num-lanes" DT property if present

In reply to Jim Quinlan

By default, we use automatic HW negotiation to ascertain the number of lanes of the PCIe connection. If the "num-lanes" DT property is present, assume that the chip's built-in capability information is incorrect or undesired, and use the specified value instead.

---
 drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +25 -1
index e19628e13898..79fc6d00b7bc 100644
@@ -46,6 +46,7 @@
 #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_MAX_LINK_WIDTH_MASK	0x1f0
 #define  PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK	0xc00
 
 #define PCIE_RC_CFG_PRIV1_ROOT_CAP			0x4f8
@@ -55,6 +56,9 @@
 #define PCIE_RC_DL_MDIO_WR_DATA				0x1104
 #define PCIE_RC_DL_MDIO_RD_DATA				0x1108
 
+#define PCIE_RC_PL_REG_PHY_CTL_1			0x1804
+#define  PCIE_RC_PL_REG_PHY_CTL_1_REG_P2_POWERDOWN_ENA_NOSYNC_MASK	0x8
+
 #define PCIE_RC_PL_PHY_CTL_15				0x184c
 #define  PCIE_RC_PL_PHY_CTL_15_DIS_PLL_PD_MASK		0x400000
 #define  PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK	0xff
@@ -1072,7 +1076,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 	void __iomem *base = pcie->base;
 	struct pci_host_bridge *bridge;
 	struct resource_entry *entry;
-	u32 tmp, burst, aspm_support;
+	u32 tmp, burst, aspm_support, num_lanes, num_lanes_cap;
 	u8 num_out_wins = 0;
 	int num_inbound_wins = 0;
 	int memc, ret;
@@ -1180,6 +1184,26 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 		PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK);
 	writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
 
+	/* 'tmp' still holds the contents of PRIV1_LINK_CAPABILITY */
+	num_lanes_cap = u32_get_bits(tmp, PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK);
+	num_lanes = 0;
+	/*
+	 * Use automatic num-lanes HW negotiation by default.  If the
+	 * "num-lanes" DT property is present, assume that the chip's
+	 * built-in link width capability information is
+	 * incorrect/undesired and use the specified value instead.
+	 */
+	if (!of_property_read_u32(pcie->np, "num-lanes", &num_lanes) &&
+	    num_lanes && num_lanes <= 4 && num_lanes_cap != num_lanes) {
+		u32p_replace_bits(&tmp, num_lanes,
+			PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK);
+		writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
+		tmp = readl(base + PCIE_RC_PL_REG_PHY_CTL_1);
+		u32p_replace_bits(&tmp, 1,
+			PCIE_RC_PL_REG_PHY_CTL_1_REG_P2_POWERDOWN_ENA_NOSYNC_MASK);
+		writel(tmp, base + PCIE_RC_PL_REG_PHY_CTL_1);
+	}
+
 	/*
 	 * 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.43.0
maintainer Reviewed-by on v1 2/2
#11 lore raw
Quoted 6 lines · Jim Quinlan

By default, we use automatic HW negotiation to ascertain the number of lanes of the PCIe connection. If the "num-lanes" DT property is present, assume that the chip's built-in capability information is incorrect or undesired, and use the specified value instead.

Signature · 1 line
Florian
#12 lore raw
In reply to Jim Quinlan
Quoted 42 lines · Jim Quinlan

By default, we use automatic HW negotiation to ascertain the number of lanes of the PCIe connection. If the "num-lanes" DT property is present, assume that the chip's built-in capability information is incorrect or undesired, and use the specified value instead.

---
 drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +5 -1
index e19628e13898..79fc6d00b7bc 100644
@@ -46,6 +46,7 @@
 #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_MAX_LINK_WIDTH_MASK	0x1f0
 #define  PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK	0xc00
 
 #define PCIE_RC_CFG_PRIV1_ROOT_CAP			0x4f8
@@ -55,6 +56,9 @@
 #define PCIE_RC_DL_MDIO_WR_DATA				0x1104
 #define PCIE_RC_DL_MDIO_RD_DATA				0x1108
 
+#define PCIE_RC_PL_REG_PHY_CTL_1			0x1804
+#define  PCIE_RC_PL_REG_PHY_CTL_1_REG_P2_POWERDOWN_ENA_NOSYNC_MASK	0x8
+
 #define PCIE_RC_PL_PHY_CTL_15				0x184c
 #define  PCIE_RC_PL_PHY_CTL_15_DIS_PLL_PD_MASK		0x400000
 #define  PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK	0xff
@@ -1072,7 +1076,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 	void __iomem *base = pcie->base;
 	struct pci_host_bridge *bridge;
 	struct resource_entry *entry;
-	u32 tmp, burst, aspm_support;
+	u32 tmp, burst, aspm_support, num_lanes, num_lanes_cap;
 	u8 num_out_wins = 0;
 	int num_inbound_wins = 0;
 	int memc, ret;

drivers/pci/controller/pcie-brcmstb.c static int brcm_pcie_setup(struct brcm_pcie *pcie) · line 1191

Quoted 8 lines
drivers/pci/controller/pcie-brcmstb.c +5 -0
@@ -1180,6 +1184,26 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
 		PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK);
 	writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
 
+	/* 'tmp' still holds the contents of PRIV1_LINK_CAPABILITY */
+	num_lanes_cap = u32_get_bits(tmp, PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK);
+	num_lanes = 0;
+	/*
+	 * Use automatic num-lanes HW negotiation by default.  If the

"Use hardware negotiated Max Link Width value by default."

drivers/pci/controller/pcie-brcmstb.c static int brcm_pcie_setup(struct brcm_pcie *pcie) · line 1197

Quoted 6 lines
drivers/pci/controller/pcie-brcmstb.c +6 -0
+	 * "num-lanes" DT property is present, assume that the chip's
+	 * built-in link width capability information is
+	 * incorrect/undesired and use the specified value instead.
+	 */
+	if (!of_property_read_u32(pcie->np, "num-lanes", &num_lanes) &&
+	    num_lanes && num_lanes <= 4 && num_lanes_cap != num_lanes) {

I think you should drop the 'num_lanes && num_lanes <= 4' check since the DT binding should take care of that. Otherwise, once link width gets increased, you need to update both binding and the driver, which is redundant.

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#13 lore raw
Quoted 62 lines · Manivannan Sadhasivam
Quoted 42 lines · Jim Quinlan

By default, we use automatic HW negotiation to ascertain the number of lanes of the PCIe connection. If the "num-lanes" DT property is present, assume that the chip's built-in capability information is incorrect or undesired, and use the specified value instead.

---
 drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +5 -1
index e19628e13898..79fc6d00b7bc 100644
@@ -46,6 +46,7 @@
 #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_MAX_LINK_WIDTH_MASK       0x1f0
 #define  PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00
 
 #define PCIE_RC_CFG_PRIV1_ROOT_CAP                   0x4f8
@@ -55,6 +56,9 @@
 #define PCIE_RC_DL_MDIO_WR_DATA                              0x1104
 #define PCIE_RC_DL_MDIO_RD_DATA                              0x1108
 
+#define PCIE_RC_PL_REG_PHY_CTL_1                     0x1804
+#define  PCIE_RC_PL_REG_PHY_CTL_1_REG_P2_POWERDOWN_ENA_NOSYNC_MASK   0x8
+
 #define PCIE_RC_PL_PHY_CTL_15                                0x184c
 #define  PCIE_RC_PL_PHY_CTL_15_DIS_PLL_PD_MASK               0x400000
 #define  PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK    0xff
@@ -1072,7 +1076,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
      void __iomem *base = pcie->base;
      struct pci_host_bridge *bridge;
      struct resource_entry *entry;
-     u32 tmp, burst, aspm_support;
+     u32 tmp, burst, aspm_support, num_lanes, num_lanes_cap;
      u8 num_out_wins = 0;
      int num_inbound_wins = 0;
      int memc, ret;

drivers/pci/controller/pcie-brcmstb.c static int brcm_pcie_setup(struct brcm_pcie *pcie) · line 1191

Quoted 8 lines
drivers/pci/controller/pcie-brcmstb.c +5 -0
@@ -1180,6 +1184,26 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
              PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK);
      writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
 
+     /* 'tmp' still holds the contents of PRIV1_LINK_CAPABILITY */
+     num_lanes_cap = u32_get_bits(tmp, PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK);
+     num_lanes = 0;
+     /*
+      * Use automatic num-lanes HW negotiation by default.  If the

"Use hardware negotiated Max Link Width value by default."

drivers/pci/controller/pcie-brcmstb.c static int brcm_pcie_setup(struct brcm_pcie *pcie) · line 1197

Quoted 6 lines
drivers/pci/controller/pcie-brcmstb.c +6 -0
+      * "num-lanes" DT property is present, assume that the chip's
+      * built-in link width capability information is
+      * incorrect/undesired and use the specified value instead.
+      */
+     if (!of_property_read_u32(pcie->np, "num-lanes", &num_lanes) &&
+         num_lanes && num_lanes <= 4 && num_lanes_cap != num_lanes) {
Quoted 3 lines

I think you should drop the 'num_lanes && num_lanes <= 4' check since the DT binding should take care of that. Otherwise, once link width gets increased, you need to update both binding and the driver, which is redundant.

Not all Linux release configuration systems run a comprehensive DT validator before execution. Our bootloader modifies the DT blob on the fly and also permits -- with restrictions -- customers to modify the DT at the bootloader command line. Yes, we can do partial a priori DT validation, but there is still value to checking the params in the driver code, at least for us.

Quoted 5 lines

- Mani

--
மணிவண்ணன் சதாசிவம்

#14 lore raw
In reply to Jim Quinlan
Quoted 15 lines · Jim Quinlan

By default, we use automatic HW negotiation to ascertain the number of lanes of the PCIe connection. If the "num-lanes" DT property is present, assume that the chip's built-in capability information is incorrect or undesired, and use the specified value instead.

---
 drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +0 -0
index e19628e13898..79fc6d00b7bc 100644

drivers/pci/controller/pcie-brcmstb.c line 52

Quoted 7 lines
drivers/pci/controller/pcie-brcmstb.c +1 -0
@@ -46,6 +46,7 @@
 #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_MAX_LINK_WIDTH_MASK	0x1f0
 #define  PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK	0xc00
 
 #define PCIE_RC_CFG_PRIV1_ROOT_CAP			0x4f8

#define PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK 0xf8

If you squint, PCIE_RC_CFG_PRIV1_LINK_CAPABILITY looks a little like these standard PCIe things:

  #define PCI_EXP_LNKCAP          0x0c    /* Link Capabilities */
  #define  PCI_EXP_LNKCAP_MLW     0x000003f0 /* Maximum Link Width */
  #define  PCI_EXP_LNKCAP_ASPMS   0x00000c00 /* ASPM Support */
  #define PCI_EXP_DEVCTL2         0x28    /* Device Control 2 */

So I was hoping we had an opportunity to use PCI_EXP_LNKCAP_MLW and PCI_EXP_LNKCAP_ASPMS instead of PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK and PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK.

But I guess PCIE_RC_CFG_PRIV1_LINK_CAPABILITY is probably not actually PCI_EXP_LNKCAP, because PCI_EXP_LNKCAP being 0x0c into a PCIe Capability would mean the cap started at 0x04d0, and PCIE_RC_CFG_PRIV1_ROOT_CAP would be at offset 0x28
(0x04d0 + 0x28 == 0x04f8).

But offset 0x28 in a PCIe Capability would be PCI_EXP_DEVCTL2, not PCIE_RC_CFG_PRIV1_ROOT_CAP, and I can't squint hard enough to see anything related to L1SS anywhere in the PCIe Capability.

So never mind ;)

Bjorn

#15 lore raw
Quoted 46 lines · Bjorn Helgaas
Quoted 15 lines · Jim Quinlan

By default, we use automatic HW negotiation to ascertain the number of lanes of the PCIe connection. If the "num-lanes" DT property is present, assume that the chip's built-in capability information is incorrect or undesired, and use the specified value instead.

---
 drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +0 -0
index e19628e13898..79fc6d00b7bc 100644

drivers/pci/controller/pcie-brcmstb.c line 52

Quoted 7 lines
drivers/pci/controller/pcie-brcmstb.c +1 -0
@@ -46,6 +46,7 @@
 #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_MAX_LINK_WIDTH_MASK       0x1f0
 #define  PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00
 
 #define PCIE_RC_CFG_PRIV1_ROOT_CAP                   0x4f8

#define PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK 0xf8

If you squint, PCIE_RC_CFG_PRIV1_LINK_CAPABILITY looks a little like these standard PCIe things:

  #define PCI_EXP_LNKCAP          0x0c    /* Link Capabilities */
  #define  PCI_EXP_LNKCAP_MLW     0x000003f0 /* Maximum Link Width */
  #define  PCI_EXP_LNKCAP_ASPMS   0x00000c00 /* ASPM Support */
  #define PCI_EXP_DEVCTL2         0x28    /* Device Control 2 */

So I was hoping we had an opportunity to use PCI_EXP_LNKCAP_MLW and PCI_EXP_LNKCAP_ASPMS instead of PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_MAX_LINK_WIDTH_MASK and PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK.

But I guess PCIE_RC_CFG_PRIV1_LINK_CAPABILITY is probably not actually PCI_EXP_LNKCAP, because PCI_EXP_LNKCAP being 0x0c into a PCIe Capability would mean the cap started at 0x04d0, and PCIE_RC_CFG_PRIV1_ROOT_CAP would be at offset 0x28
(0x04d0 + 0x28 == 0x04f8).

Quoted 5 lines

But offset 0x28 in a PCIe Capability would be PCI_EXP_DEVCTL2, not PCIE_RC_CFG_PRIV1_ROOT_CAP, and I can't squint hard enough to see anything related to L1SS anywhere in the PCIe Capability.

So never mind ;)

Hi Bjorn,

Not only are the "priv" register offsets slightly different, the values of the masks may be different as well. For example, PCI_EXP_LNKCAP_MLW is 0x3f0 while our "priv" version is 0x1f0, as something unrelated occupies the missing "priv" bit.

Cheers,
Jim Quinlan
Broadcom STB/CM

Quoted 2 lines

Bjorn

maintainer
#16 lore raw
In reply to Jim Quinlan
Quoted 3 lines · Jim Quinlan

v2:
-- DT bindings: Add default, maximum values for 'num-lanes' (Rob) -- Add 'if' clause to clamp maximum requested num-lanes

Subjects should have been "PATCH v2", FWIW.

Signature · 1 line
Florian
maintainer Applied
#17 lore raw
In reply to Jim Quinlan
Quoted 8 lines · Jim Quinlan

v2:
-- DT bindings: Add default, maximum values for 'num-lanes' (Rob) -- Add 'if' clause to clamp maximum requested num-lanes

v1: original

[...]

Applied, thanks!

[1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property

      commit: dbb1258daf75f2b98e465ba5a0e26073eda6e539
[2/2] PCI: brcmstb: Use "num-lanes" DT property if present
      commit: a364d10ffe361fb34c3838d33604da493045de1e

Best regards,

Signature · 1 line
Manivannan Sadhasivam <[email protected]>