* [PATCH 0/2] PCI: brcmstb: Use "num-lanes" DT property if present
@ 2025-05-09 22:28 Jim Quinlan
0 siblings, 0 replies; 19+ messages in thread
From: Jim Quinlan @ 2025-05-09 22:28 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
james.quinlan
Cc: Rob Herring,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE
If present, grok the "num-lanes" DT property for Broadcom STB chips and
configure accordingly.
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 | 2 ++
drivers/pci/controller/pcie-brcmstb.c | 26 ++++++++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
base-commit: 01f95500a162fca88cefab9ed64ceded5afabc12
--
2.43.0
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 0/2] PCI: brcmstb: Use "num-lanes" DT property if present
@ 2025-05-30 22:40 Jim Quinlan
2025-05-30 22:40 ` [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property Jim Quinlan
` (3 more replies)
0 siblings, 4 replies; 19+ messages in thread
From: Jim Quinlan @ 2025-05-30 22:40 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
james.quinlan
Cc: Rob Herring,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE
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
--
2.43.0
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
2025-05-30 22:40 [PATCH 0/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
@ 2025-05-30 22:40 ` Jim Quinlan
2025-05-30 23:32 ` Florian Fainelli
2025-06-05 22:41 ` Rob Herring (Arm)
2025-05-30 22:40 ` [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
` (2 subsequent siblings)
3 siblings, 2 replies; 19+ messages in thread
From: Jim Quinlan @ 2025-05-30 22:40 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
james.quinlan
Cc: Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
Add optional num-lanes property Broadcom STB PCIe host controllers.
Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
---
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
index 29f0e1eb5096..cba227b19a5f 100644
--- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
@@ -107,6 +107,10 @@ properties:
- const: bridge
- const: swinit
+ num-lanes:
+ default: 1
+ maximum: 4
+
required:
- compatible
- reg
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present
2025-05-30 22:40 [PATCH 0/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
2025-05-30 22:40 ` [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property Jim Quinlan
@ 2025-05-30 22:40 ` Jim Quinlan
2025-05-30 23:33 ` Florian Fainelli
` (2 more replies)
2025-05-30 23:34 ` [PATCH 0/2] " Florian Fainelli
2025-06-23 11:53 ` Manivannan Sadhasivam
3 siblings, 3 replies; 19+ messages in thread
From: Jim Quinlan @ 2025-05-30 22:40 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
james.quinlan
Cc: Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
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.
Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
---
drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index e19628e13898..79fc6d00b7bc 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -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).
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
2025-05-30 22:40 ` [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property Jim Quinlan
@ 2025-05-30 23:32 ` Florian Fainelli
2025-06-03 16:24 ` Florian Fainelli
2025-06-05 22:41 ` Rob Herring (Arm)
1 sibling, 1 reply; 19+ messages in thread
From: Florian Fainelli @ 2025-05-30 23:32 UTC (permalink / raw)
To: Jim Quinlan, linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
On 5/30/25 15:40, Jim Quinlan wrote:
> Add optional num-lanes property Broadcom STB PCIe host controllers.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present
2025-05-30 22:40 ` [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
@ 2025-05-30 23:33 ` Florian Fainelli
2025-05-31 6:34 ` Manivannan Sadhasivam
2025-06-24 22:01 ` Bjorn Helgaas
2 siblings, 0 replies; 19+ messages in thread
From: Florian Fainelli @ 2025-05-30 23:33 UTC (permalink / raw)
To: Jim Quinlan, linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
On 5/30/25 15:40, Jim Quinlan wrote:
> 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.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/2] PCI: brcmstb: Use "num-lanes" DT property if present
2025-05-30 22:40 [PATCH 0/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
2025-05-30 22:40 ` [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property Jim Quinlan
2025-05-30 22:40 ` [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
@ 2025-05-30 23:34 ` Florian Fainelli
2025-06-23 11:53 ` Manivannan Sadhasivam
3 siblings, 0 replies; 19+ messages in thread
From: Florian Fainelli @ 2025-05-30 23:34 UTC (permalink / raw)
To: Jim Quinlan, linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024
Cc: Rob Herring,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE
On 5/30/25 15:40, Jim Quinlan wrote:
> 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.
--
Florian
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present
2025-05-30 22:40 ` [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
2025-05-30 23:33 ` Florian Fainelli
@ 2025-05-31 6:34 ` Manivannan Sadhasivam
2025-06-02 15:36 ` Jim Quinlan
2025-06-24 22:01 ` Bjorn Helgaas
2 siblings, 1 reply; 19+ messages in thread
From: Manivannan Sadhasivam @ 2025-05-31 6:34 UTC (permalink / raw)
To: Jim Quinlan
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
On Fri, May 30, 2025 at 06:40:33PM -0400, Jim Quinlan wrote:
> 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.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> ---
> drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index e19628e13898..79fc6d00b7bc 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -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
"Use hardware negotiated Max Link Width value by default."
> + * "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
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present
2025-05-31 6:34 ` Manivannan Sadhasivam
@ 2025-06-02 15:36 ` Jim Quinlan
0 siblings, 0 replies; 19+ messages in thread
From: Jim Quinlan @ 2025-06-02 15:36 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
[-- Attachment #1: Type: text/plain, Size: 3890 bytes --]
On Sat, May 31, 2025 at 2:34 AM Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
>
> On Fri, May 30, 2025 at 06:40:33PM -0400, Jim Quinlan wrote:
> > 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.
> >
> > Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> > ---
> > drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
> > 1 file changed, 25 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> > index e19628e13898..79fc6d00b7bc 100644
> > --- a/drivers/pci/controller/pcie-brcmstb.c
> > +++ b/drivers/pci/controller/pcie-brcmstb.c
> > @@ -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
>
> "Use hardware negotiated Max Link Width value by default."
>
> > + * "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.
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.
>
> - Mani
>
> --
> மணிவண்ணன் சதாசிவம்
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4197 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
2025-05-30 23:32 ` Florian Fainelli
@ 2025-06-03 16:24 ` Florian Fainelli
2025-06-03 17:16 ` Jim Quinlan
0 siblings, 1 reply; 19+ messages in thread
From: Florian Fainelli @ 2025-06-03 16:24 UTC (permalink / raw)
To: Jim Quinlan, linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
On 5/30/25 16:32, Florian Fainelli wrote:
> On 5/30/25 15:40, Jim Quinlan wrote:
>> Add optional num-lanes property Broadcom STB PCIe host controllers.
>>
>> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
>
> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
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.
--
Florian
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
2025-06-03 16:24 ` Florian Fainelli
@ 2025-06-03 17:16 ` Jim Quinlan
2025-06-03 17:17 ` Florian Fainelli
0 siblings, 1 reply; 19+ messages in thread
From: Jim Quinlan @ 2025-06-03 17:16 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]
On Tue, Jun 3, 2025 at 12:24 PM Florian Fainelli
<florian.fainelli@broadcom.com> wrote:
>
> On 5/30/25 16:32, Florian Fainelli wrote:
> > On 5/30/25 15:40, Jim Quinlan wrote:
> >> Add optional num-lanes property Broadcom STB PCIe host controllers.
> >>
> >> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> >
> > Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
>
> 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 ]
> --
> Florian
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4197 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
2025-06-03 17:16 ` Jim Quinlan
@ 2025-06-03 17:17 ` Florian Fainelli
2025-06-03 17:24 ` Jim Quinlan
2025-06-05 22:36 ` Rob Herring
0 siblings, 2 replies; 19+ messages in thread
From: Florian Fainelli @ 2025-06-03 17:17 UTC (permalink / raw)
To: Jim Quinlan
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
On 6/3/25 10:16, Jim Quinlan wrote:
> On Tue, Jun 3, 2025 at 12:24 PM Florian Fainelli
> <florian.fainelli@broadcom.com> wrote:
>>
>> On 5/30/25 16:32, Florian Fainelli wrote:
>>> On 5/30/25 15:40, Jim Quinlan wrote:
>>>> Add optional num-lanes property Broadcom STB PCIe host controllers.
>>>>
>>>> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
>>>
>>> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
>>
>> 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 ]
Right, but then we need to re-define it with our own specific
constraints, still, don't we?
--
Florian
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
2025-06-03 17:17 ` Florian Fainelli
@ 2025-06-03 17:24 ` Jim Quinlan
2025-06-05 22:36 ` Rob Herring
1 sibling, 0 replies; 19+ messages in thread
From: Jim Quinlan @ 2025-06-03 17:24 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]
On Tue, Jun 3, 2025 at 1:17 PM Florian Fainelli
<florian.fainelli@broadcom.com> wrote:
>
> On 6/3/25 10:16, Jim Quinlan wrote:
> > On Tue, Jun 3, 2025 at 12:24 PM Florian Fainelli
> > <florian.fainelli@broadcom.com> wrote:
> >>
> >> On 5/30/25 16:32, Florian Fainelli wrote:
> >>> On 5/30/25 15:40, Jim Quinlan wrote:
> >>>> Add optional num-lanes property Broadcom STB PCIe host controllers.
> >>>>
> >>>> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> >>>
> >>> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
> >>
> >> 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 ]
>
> 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.
> --
> Florian
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4197 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
2025-06-03 17:17 ` Florian Fainelli
2025-06-03 17:24 ` Jim Quinlan
@ 2025-06-05 22:36 ` Rob Herring
2025-06-05 22:42 ` Florian Fainelli
1 sibling, 1 reply; 19+ messages in thread
From: Rob Herring @ 2025-06-05 22:36 UTC (permalink / raw)
To: Florian Fainelli
Cc: Jim Quinlan, linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Krzysztof Kozlowski, Conor Dooley,
moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
On Tue, Jun 03, 2025 at 10:17:26AM -0700, Florian Fainelli wrote:
> On 6/3/25 10:16, Jim Quinlan wrote:
> > On Tue, Jun 3, 2025 at 12:24 PM Florian Fainelli
> > <florian.fainelli@broadcom.com> wrote:
> > >
> > > On 5/30/25 16:32, Florian Fainelli wrote:
> > > > On 5/30/25 15:40, Jim Quinlan wrote:
> > > > > Add optional num-lanes property Broadcom STB PCIe host controllers.
> > > > >
> > > > > Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> > > >
> > > > Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
> > >
> > > 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?
> >
> > 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
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
2025-05-30 22:40 ` [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property Jim Quinlan
2025-05-30 23:32 ` Florian Fainelli
@ 2025-06-05 22:41 ` Rob Herring (Arm)
1 sibling, 0 replies; 19+ messages in thread
From: Rob Herring (Arm) @ 2025-06-05 22:41 UTC (permalink / raw)
To: Jim Quinlan
Cc: Manivannan Sadhasivam, Nicolas Saenz Julienne, linux-arm-kernel,
linux-rpi-kernel, jim2101024, Florian Fainelli, Lorenzo Pieralisi,
devicetree, linux-kernel, Conor Dooley, Krzysztof Kozlowski,
bcm-kernel-feedback-list, Krzysztof Wilczyński,
Lorenzo Pieralisi, linux-pci, Bjorn Helgaas
On Fri, 30 May 2025 18:40:32 -0400, Jim Quinlan wrote:
> Add optional num-lanes property Broadcom STB PCIe host controllers.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> ---
> Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 4 ++++
> 1 file changed, 4 insertions(+)
>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property
2025-06-05 22:36 ` Rob Herring
@ 2025-06-05 22:42 ` Florian Fainelli
0 siblings, 0 replies; 19+ messages in thread
From: Florian Fainelli @ 2025-06-05 22:42 UTC (permalink / raw)
To: Rob Herring
Cc: Jim Quinlan, linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Krzysztof Kozlowski, Conor Dooley,
moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
On 6/5/25 15:36, Rob Herring wrote:
> On Tue, Jun 03, 2025 at 10:17:26AM -0700, Florian Fainelli wrote:
>> On 6/3/25 10:16, Jim Quinlan wrote:
>>> On Tue, Jun 3, 2025 at 12:24 PM Florian Fainelli
>>> <florian.fainelli@broadcom.com> wrote:
>>>>
>>>> On 5/30/25 16:32, Florian Fainelli wrote:
>>>>> On 5/30/25 15:40, Jim Quinlan wrote:
>>>>>> Add optional num-lanes property Broadcom STB PCIe host controllers.
>>>>>>
>>>>>> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
>>>>>
>>>>> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
>>>>
>>>> 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?
Yes I am.
>
>>>
>>> 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!
--
Florian
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/2] PCI: brcmstb: Use "num-lanes" DT property if present
2025-05-30 22:40 [PATCH 0/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
` (2 preceding siblings ...)
2025-05-30 23:34 ` [PATCH 0/2] " Florian Fainelli
@ 2025-06-23 11:53 ` Manivannan Sadhasivam
3 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2025-06-23 11:53 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
bcm-kernel-feedback-list, jim2101024, Lorenzo Pieralisi,
Jim Quinlan
Cc: Rob Herring, devicetree, linux-arm-kernel, linux-kernel,
linux-rpi-kernel
On Fri, 30 May 2025 18:40:31 -0400, Jim Quinlan wrote:
> 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,
--
Manivannan Sadhasivam <mani@kernel.org>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present
2025-05-30 22:40 ` [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
2025-05-30 23:33 ` Florian Fainelli
2025-05-31 6:34 ` Manivannan Sadhasivam
@ 2025-06-24 22:01 ` Bjorn Helgaas
2025-06-25 19:46 ` Jim Quinlan
2 siblings, 1 reply; 19+ messages in thread
From: Bjorn Helgaas @ 2025-06-24 22:01 UTC (permalink / raw)
To: Jim Quinlan
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
On Fri, May 30, 2025 at 06:40:33PM -0400, Jim Quinlan wrote:
> 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.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> ---
> drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index e19628e13898..79fc6d00b7bc 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -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
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present
2025-06-24 22:01 ` Bjorn Helgaas
@ 2025-06-25 19:46 ` Jim Quinlan
0 siblings, 0 replies; 19+ messages in thread
From: Jim Quinlan @ 2025-06-25 19:46 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
[-- Attachment #1: Type: text/plain, Size: 2780 bytes --]
On Tue, Jun 24, 2025 at 6:01 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> On Fri, May 30, 2025 at 06:40:33PM -0400, Jim Quinlan wrote:
> > 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.
> >
> > Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> > ---
> > drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++++++++++++-
> > 1 file changed, 25 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> > index e19628e13898..79fc6d00b7bc 100644
> > --- a/drivers/pci/controller/pcie-brcmstb.c
> > +++ b/drivers/pci/controller/pcie-brcmstb.c
> > @@ -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 ;)
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
>
> Bjorn
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4197 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2025-06-25 19:46 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-30 22:40 [PATCH 0/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
2025-05-30 22:40 ` [PATCH 1/2] dt-bindings: PCI: brcm,stb-pcie: Add num-lanes property Jim Quinlan
2025-05-30 23:32 ` Florian Fainelli
2025-06-03 16:24 ` Florian Fainelli
2025-06-03 17:16 ` Jim Quinlan
2025-06-03 17:17 ` Florian Fainelli
2025-06-03 17:24 ` Jim Quinlan
2025-06-05 22:36 ` Rob Herring
2025-06-05 22:42 ` Florian Fainelli
2025-06-05 22:41 ` Rob Herring (Arm)
2025-05-30 22:40 ` [PATCH 2/2] PCI: brcmstb: Use "num-lanes" DT property if present Jim Quinlan
2025-05-30 23:33 ` Florian Fainelli
2025-05-31 6:34 ` Manivannan Sadhasivam
2025-06-02 15:36 ` Jim Quinlan
2025-06-24 22:01 ` Bjorn Helgaas
2025-06-25 19:46 ` Jim Quinlan
2025-05-30 23:34 ` [PATCH 0/2] " Florian Fainelli
2025-06-23 11:53 ` Manivannan Sadhasivam
-- strict thread matches above, loose matches on Subject: below --
2025-05-09 22:28 Jim Quinlan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).