[PATCH net-next v5 06/12] dt-bindings: net: dsa: lantiq,gswip: add support for MII delay properties

Daniel Golle posted 12 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH net-next v5 06/12] dt-bindings: net: dsa: lantiq,gswip: add support for MII delay properties
Posted by Daniel Golle 3 months, 1 week ago
Add support for standard tx-internal-delay-ps and rx-internal-delay-ps
properties on port nodes to allow fine-tuning of RGMII clock delays.

The GSWIP switch hardware supports delay values in 500 picosecond
increments from 0 to 3500 picoseconds, with a post-reset default of 2000
picoseconds for both TX and RX delays. The driver currently sets the
delay to 0 in case the PHY is setup to carry out the delay by the
corresponding interface modes ("rgmii-id", "rgmii-rxid", "rgmii-txid").

This corresponds to the driver changes that allow adjusting MII delays
using Device Tree properties instead of relying solely on the PHY
interface mode.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
v4:
 * remove misleading defaults

v3:
 * redefine ports node so properties are defined actually apply
 * RGMII port with 2ps delay is 'rgmii-id' mode

 .../bindings/net/dsa/lantiq,gswip.yaml        | 31 +++++++++++++++++--
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
index f3154b19af78..8ccbc8942eb3 100644
--- a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
@@ -6,8 +6,31 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: Lantiq GSWIP Ethernet switches
 
-allOf:
-  - $ref: dsa.yaml#/$defs/ethernet-ports
+$ref: dsa.yaml#
+
+patternProperties:
+  "^(ethernet-)?ports$":
+    type: object
+    patternProperties:
+      "^(ethernet-)?port@[0-6]$":
+        $ref: dsa-port.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          tx-internal-delay-ps:
+            enum: [0, 500, 1000, 1500, 2000, 2500, 3000, 3500]
+            description:
+              RGMII TX Clock Delay defined in pico seconds.
+              The delay lines adjust the MII clock vs. data timing.
+              If this property is not present the delay is determined by
+              the interface mode.
+          rx-internal-delay-ps:
+            enum: [0, 500, 1000, 1500, 2000, 2500, 3000, 3500]
+            description:
+              RGMII RX Clock Delay defined in pico seconds.
+              The delay lines adjust the MII clock vs. data timing.
+              If this property is not present the delay is determined by
+              the interface mode.
 
 maintainers:
   - Hauke Mehrtens <hauke@hauke-m.de>
@@ -113,8 +136,10 @@ examples:
                     port@0 {
                             reg = <0>;
                             label = "lan3";
-                            phy-mode = "rgmii";
+                            phy-mode = "rgmii-id";
                             phy-handle = <&phy0>;
+                            tx-internal-delay-ps = <2000>;
+                            rx-internal-delay-ps = <2000>;
                     };
 
                     port@1 {
-- 
2.51.2
Re: [PATCH net-next v5 06/12] dt-bindings: net: dsa: lantiq,gswip: add support for MII delay properties
Posted by Rob Herring 3 months, 1 week ago
On Thu, Oct 30, 2025 at 11:28:35AM +0000, Daniel Golle wrote:
> Add support for standard tx-internal-delay-ps and rx-internal-delay-ps
> properties on port nodes to allow fine-tuning of RGMII clock delays.
> 
> The GSWIP switch hardware supports delay values in 500 picosecond
> increments from 0 to 3500 picoseconds, with a post-reset default of 2000
> picoseconds for both TX and RX delays. The driver currently sets the
> delay to 0 in case the PHY is setup to carry out the delay by the
> corresponding interface modes ("rgmii-id", "rgmii-rxid", "rgmii-txid").
> 
> This corresponds to the driver changes that allow adjusting MII delays
> using Device Tree properties instead of relying solely on the PHY
> interface mode.
> 
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> v4:
>  * remove misleading defaults
> 
> v3:
>  * redefine ports node so properties are defined actually apply
>  * RGMII port with 2ps delay is 'rgmii-id' mode
> 
>  .../bindings/net/dsa/lantiq,gswip.yaml        | 31 +++++++++++++++++--
>  1 file changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> index f3154b19af78..8ccbc8942eb3 100644
> --- a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> @@ -6,8 +6,31 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
>  
>  title: Lantiq GSWIP Ethernet switches
>  
> -allOf:
> -  - $ref: dsa.yaml#/$defs/ethernet-ports

I think you can keep this as you aren't adding custom properties.

> +$ref: dsa.yaml#
> +
> +patternProperties:
> +  "^(ethernet-)?ports$":
> +    type: object
> +    patternProperties:
> +      "^(ethernet-)?port@[0-6]$":

> +        $ref: dsa-port.yaml#
> +        unevaluatedProperties: false

And drop these lines. You may need 'additionalProperties: true' if the 
tools warn.

> +
> +        properties:
> +          tx-internal-delay-ps:
> +            enum: [0, 500, 1000, 1500, 2000, 2500, 3000, 3500]
> +            description:
> +              RGMII TX Clock Delay defined in pico seconds.
> +              The delay lines adjust the MII clock vs. data timing.
> +              If this property is not present the delay is determined by
> +              the interface mode.
> +          rx-internal-delay-ps:
> +            enum: [0, 500, 1000, 1500, 2000, 2500, 3000, 3500]
> +            description:
> +              RGMII RX Clock Delay defined in pico seconds.
> +              The delay lines adjust the MII clock vs. data timing.
> +              If this property is not present the delay is determined by
> +              the interface mode.
>  
>  maintainers:
>    - Hauke Mehrtens <hauke@hauke-m.de>
> @@ -113,8 +136,10 @@ examples:
>                      port@0 {
>                              reg = <0>;
>                              label = "lan3";
> -                            phy-mode = "rgmii";
> +                            phy-mode = "rgmii-id";
>                              phy-handle = <&phy0>;
> +                            tx-internal-delay-ps = <2000>;
> +                            rx-internal-delay-ps = <2000>;
>                      };
>  
>                      port@1 {
> -- 
> 2.51.2
Re: [PATCH net-next v5 06/12] dt-bindings: net: dsa: lantiq,gswip: add support for MII delay properties
Posted by Rob Herring 3 months, 1 week ago
On Thu, Oct 30, 2025 at 07:29:24PM -0500, Rob Herring wrote:
> On Thu, Oct 30, 2025 at 11:28:35AM +0000, Daniel Golle wrote:
> > Add support for standard tx-internal-delay-ps and rx-internal-delay-ps
> > properties on port nodes to allow fine-tuning of RGMII clock delays.
> > 
> > The GSWIP switch hardware supports delay values in 500 picosecond
> > increments from 0 to 3500 picoseconds, with a post-reset default of 2000
> > picoseconds for both TX and RX delays. The driver currently sets the
> > delay to 0 in case the PHY is setup to carry out the delay by the
> > corresponding interface modes ("rgmii-id", "rgmii-rxid", "rgmii-txid").
> > 
> > This corresponds to the driver changes that allow adjusting MII delays
> > using Device Tree properties instead of relying solely on the PHY
> > interface mode.
> > 
> > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > ---
> > v4:
> >  * remove misleading defaults
> > 
> > v3:
> >  * redefine ports node so properties are defined actually apply
> >  * RGMII port with 2ps delay is 'rgmii-id' mode
> > 
> >  .../bindings/net/dsa/lantiq,gswip.yaml        | 31 +++++++++++++++++--
> >  1 file changed, 28 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> > index f3154b19af78..8ccbc8942eb3 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> > @@ -6,8 +6,31 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
> >  
> >  title: Lantiq GSWIP Ethernet switches
> >  
> > -allOf:
> > -  - $ref: dsa.yaml#/$defs/ethernet-ports
> 
> I think you can keep this as you aren't adding custom properties.

Nevermind, I see the next patch now...
Re: [PATCH net-next v5 06/12] dt-bindings: net: dsa: lantiq,gswip: add support for MII delay properties
Posted by Daniel Golle 3 months, 1 week ago
On Thu, Oct 30, 2025 at 07:37:04PM -0500, Rob Herring wrote:
> On Thu, Oct 30, 2025 at 07:29:24PM -0500, Rob Herring wrote:
> > On Thu, Oct 30, 2025 at 11:28:35AM +0000, Daniel Golle wrote:
> > > Add support for standard tx-internal-delay-ps and rx-internal-delay-ps
> > > properties on port nodes to allow fine-tuning of RGMII clock delays.
> > > 
> > > The GSWIP switch hardware supports delay values in 500 picosecond
> > > increments from 0 to 3500 picoseconds, with a post-reset default of 2000
> > > picoseconds for both TX and RX delays. The driver currently sets the
> > > delay to 0 in case the PHY is setup to carry out the delay by the
> > > corresponding interface modes ("rgmii-id", "rgmii-rxid", "rgmii-txid").
> > > 
> > > This corresponds to the driver changes that allow adjusting MII delays
> > > using Device Tree properties instead of relying solely on the PHY
> > > interface mode.
> > > 
> > > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > > ---
> > > v4:
> > >  * remove misleading defaults
> > > 
> > > v3:
> > >  * redefine ports node so properties are defined actually apply
> > >  * RGMII port with 2ps delay is 'rgmii-id' mode
> > > 
> > >  .../bindings/net/dsa/lantiq,gswip.yaml        | 31 +++++++++++++++++--
> > >  1 file changed, 28 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> > > index f3154b19af78..8ccbc8942eb3 100644
> > > --- a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> > > +++ b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> > > @@ -6,8 +6,31 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
> > >  
> > >  title: Lantiq GSWIP Ethernet switches
> > >  
> > > -allOf:
> > > -  - $ref: dsa.yaml#/$defs/ethernet-ports
> > 
> > I think you can keep this as you aren't adding custom properties.
> 
> Nevermind, I see the next patch now...

I suppose you mean [08/12] ("dt-bindings: net: dsa: lantiq,gswip: add
MaxLinear RMII refclk output property"), right?

The intention to divert from dsa.yaml#/$defs/ethernet-ports
already in this patch was to enforce the possible values of
{rx,tx}-internal-delay-ps.

Anyway, so you are saying I can keep the change in this patch? Or
should I just drop the constraints on the possible values of the
delays and only divert from dsa.yaml#/$defs/ethernet-ports once I'm
actually adding maxlinear,rmii-refclk-out?
Re: [PATCH net-next v5 06/12] dt-bindings: net: dsa: lantiq,gswip: add support for MII delay properties
Posted by Rob Herring 3 months, 1 week ago
On Fri, Oct 31, 2025 at 02:12:26AM +0000, Daniel Golle wrote:
> On Thu, Oct 30, 2025 at 07:37:04PM -0500, Rob Herring wrote:
> > On Thu, Oct 30, 2025 at 07:29:24PM -0500, Rob Herring wrote:
> > > On Thu, Oct 30, 2025 at 11:28:35AM +0000, Daniel Golle wrote:
> > > > Add support for standard tx-internal-delay-ps and rx-internal-delay-ps
> > > > properties on port nodes to allow fine-tuning of RGMII clock delays.
> > > > 
> > > > The GSWIP switch hardware supports delay values in 500 picosecond
> > > > increments from 0 to 3500 picoseconds, with a post-reset default of 2000
> > > > picoseconds for both TX and RX delays. The driver currently sets the
> > > > delay to 0 in case the PHY is setup to carry out the delay by the
> > > > corresponding interface modes ("rgmii-id", "rgmii-rxid", "rgmii-txid").
> > > > 
> > > > This corresponds to the driver changes that allow adjusting MII delays
> > > > using Device Tree properties instead of relying solely on the PHY
> > > > interface mode.
> > > > 
> > > > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > > > ---
> > > > v4:
> > > >  * remove misleading defaults
> > > > 
> > > > v3:
> > > >  * redefine ports node so properties are defined actually apply
> > > >  * RGMII port with 2ps delay is 'rgmii-id' mode
> > > > 
> > > >  .../bindings/net/dsa/lantiq,gswip.yaml        | 31 +++++++++++++++++--
> > > >  1 file changed, 28 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> > > > index f3154b19af78..8ccbc8942eb3 100644
> > > > --- a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> > > > +++ b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml
> > > > @@ -6,8 +6,31 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
> > > >  
> > > >  title: Lantiq GSWIP Ethernet switches
> > > >  
> > > > -allOf:
> > > > -  - $ref: dsa.yaml#/$defs/ethernet-ports
> > > 
> > > I think you can keep this as you aren't adding custom properties.
> > 
> > Nevermind, I see the next patch now...
> 
> I suppose you mean [08/12] ("dt-bindings: net: dsa: lantiq,gswip: add
> MaxLinear RMII refclk output property"), right?
> 
> The intention to divert from dsa.yaml#/$defs/ethernet-ports
> already in this patch was to enforce the possible values of
> {rx,tx}-internal-delay-ps.
> 
> Anyway, so you are saying I can keep the change in this patch? Or
> should I just drop the constraints on the possible values of the
> delays and only divert from dsa.yaml#/$defs/ethernet-ports once I'm
> actually adding maxlinear,rmii-refclk-out?

You can keep it as-is, but strictly speaking, some of what's here is 
only needed for [08/12]. Perhaps reverse the order of the patches. Then 
it would be most of the changes here with the maxlinear,rmii-refclk-out 
added, and then the 2nd patch is constraints on 
{rx,tx}-internal-delay-ps.

Rob