diff mbox series

[net-next,5/6] dt-bindings: net: dsa: sja1105: add {rx, tx}-internal-delay-ps

Message ID 20211013222313.3767605-6-vladimir.oltean@nxp.com (mailing list archive)
State New, archived
Headers show
Series New RGMII delay DT bindings for the SJA1105 DSA driver | expand

Commit Message

Vladimir Oltean Oct. 13, 2021, 10:23 p.m. UTC
Add a schema validator to nxp,sja1105.yaml and to dsa.yaml for explicit
MAC-level RGMII delays. These properties must be per port and must be
present only for a phy-mode that represents RGMII.

We tell dsa.yaml that these port properties might be present, we also
define their valid values for SJA1105. We create a common definition for
the RX and TX valid range, since it's quite a mouthful.

We also modify the example to include the explicit RGMII delay properties.
On the fixed-link ports (in the example, port 4), having these explicit
delays is actually mandatory, since with the new behavior, the driver
shouts that it is interpreting what delays to apply based on phy-mode.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 .../devicetree/bindings/net/dsa/dsa.yaml      |  4 ++
 .../bindings/net/dsa/nxp,sja1105.yaml         | 42 +++++++++++++++++++
 2 files changed, 46 insertions(+)

Comments

Rob Herring Oct. 14, 2021, 2:31 p.m. UTC | #1
On Thu, 14 Oct 2021 01:23:12 +0300, Vladimir Oltean wrote:
> Add a schema validator to nxp,sja1105.yaml and to dsa.yaml for explicit
> MAC-level RGMII delays. These properties must be per port and must be
> present only for a phy-mode that represents RGMII.
> 
> We tell dsa.yaml that these port properties might be present, we also
> define their valid values for SJA1105. We create a common definition for
> the RX and TX valid range, since it's quite a mouthful.
> 
> We also modify the example to include the explicit RGMII delay properties.
> On the fixed-link ports (in the example, port 4), having these explicit
> delays is actually mandatory, since with the new behavior, the driver
> shouts that it is interpreting what delays to apply based on phy-mode.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  .../devicetree/bindings/net/dsa/dsa.yaml      |  4 ++
>  .../bindings/net/dsa/nxp,sja1105.yaml         | 42 +++++++++++++++++++
>  2 files changed, 46 insertions(+)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:82:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:84:17: [warning] wrong indentation: expected 14 but found 16 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:85:21: [warning] wrong indentation: expected 18 but found 20 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:86:25: [warning] wrong indentation: expected 22 but found 24 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:93:17: [warning] wrong indentation: expected 14 but found 16 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:94:21: [warning] wrong indentation: expected 18 but found 20 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:96:21: [warning] wrong indentation: expected 18 but found 20 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:103:5: [warning] wrong indentation: expected 2 but found 4 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:104:9: [warning] wrong indentation: expected 6 but found 8 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:105:13: [warning] wrong indentation: expected 10 but found 12 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:109:13: [warning] wrong indentation: expected 10 but found 12 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:110:13: [warning] wrong indentation: expected 13 but found 12 (indentation)
./Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml:111:13: [warning] wrong indentation: expected 13 but found 12 (indentation)

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1540707

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Florian Fainelli Oct. 15, 2021, 4:53 p.m. UTC | #2
On 10/13/21 3:23 PM, Vladimir Oltean wrote:
> Add a schema validator to nxp,sja1105.yaml and to dsa.yaml for explicit
> MAC-level RGMII delays. These properties must be per port and must be
> present only for a phy-mode that represents RGMII.
> 
> We tell dsa.yaml that these port properties might be present, we also
> define their valid values for SJA1105. We create a common definition for
> the RX and TX valid range, since it's quite a mouthful.
> 
> We also modify the example to include the explicit RGMII delay properties.
> On the fixed-link ports (in the example, port 4), having these explicit
> delays is actually mandatory, since with the new behavior, the driver
> shouts that it is interpreting what delays to apply based on phy-mode.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Even if you need to make yamllint happy
Jakub Kicinski Oct. 15, 2021, 7:55 p.m. UTC | #3
On Thu, 14 Oct 2021 09:31:04 -0500 Rob Herring wrote:
> On Thu, 14 Oct 2021 01:23:12 +0300, Vladimir Oltean wrote:
> > Add a schema validator to nxp,sja1105.yaml and to dsa.yaml for explicit
> > MAC-level RGMII delays. These properties must be per port and must be
> > present only for a phy-mode that represents RGMII.
> > 
> > We tell dsa.yaml that these port properties might be present, we also
> > define their valid values for SJA1105. We create a common definition for
> > the RX and TX valid range, since it's quite a mouthful.
> > 
> > We also modify the example to include the explicit RGMII delay properties.
> > On the fixed-link ports (in the example, port 4), having these explicit
> > delays is actually mandatory, since with the new behavior, the driver
> > shouts that it is interpreting what delays to apply based on phy-mode.
> > 
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):

FWIW I dropped the set from pw based on Rob's report, I see a mention
of possible issues with fsl-lx2160a-bluebox3.dts, but it's not clear
to me which DT is disagreeing with the schema.. or is the schema itself
not 100?
Vladimir Oltean Oct. 15, 2021, 10:48 p.m. UTC | #4
On Fri, Oct 15, 2021 at 12:55:27PM -0700, Jakub Kicinski wrote:
> On Thu, 14 Oct 2021 09:31:04 -0500 Rob Herring wrote:
> > On Thu, 14 Oct 2021 01:23:12 +0300, Vladimir Oltean wrote:
> > > Add a schema validator to nxp,sja1105.yaml and to dsa.yaml for explicit
> > > MAC-level RGMII delays. These properties must be per port and must be
> > > present only for a phy-mode that represents RGMII.
> > >
> > > We tell dsa.yaml that these port properties might be present, we also
> > > define their valid values for SJA1105. We create a common definition for
> > > the RX and TX valid range, since it's quite a mouthful.
> > >
> > > We also modify the example to include the explicit RGMII delay properties.
> > > On the fixed-link ports (in the example, port 4), having these explicit
> > > delays is actually mandatory, since with the new behavior, the driver
> > > shouts that it is interpreting what delays to apply based on phy-mode.
> > >
> > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> >
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
>
> FWIW I dropped the set from pw based on Rob's report, I see a mention
> of possible issues with fsl-lx2160a-bluebox3.dts, but it's not clear
> to me which DT is disagreeing with the schema.. or is the schema itself
> not 100?

I am only saying that I am introducing a new DT binding scheme and
warning all users of the old one. That's also why I am updating the
device trees, to silence the newly introduced warnings. I would like
this series to go through net-next, but fsl-lx2160a-bluebox3.dts isn't
in net-next.
Rob Herring Oct. 18, 2021, 1:40 p.m. UTC | #5
On Fri, Oct 15, 2021 at 5:48 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
> On Fri, Oct 15, 2021 at 12:55:27PM -0700, Jakub Kicinski wrote:
> > On Thu, 14 Oct 2021 09:31:04 -0500 Rob Herring wrote:
> > > On Thu, 14 Oct 2021 01:23:12 +0300, Vladimir Oltean wrote:
> > > > Add a schema validator to nxp,sja1105.yaml and to dsa.yaml for explicit
> > > > MAC-level RGMII delays. These properties must be per port and must be
> > > > present only for a phy-mode that represents RGMII.
> > > >
> > > > We tell dsa.yaml that these port properties might be present, we also
> > > > define their valid values for SJA1105. We create a common definition for
> > > > the RX and TX valid range, since it's quite a mouthful.
> > > >
> > > > We also modify the example to include the explicit RGMII delay properties.
> > > > On the fixed-link ports (in the example, port 4), having these explicit
> > > > delays is actually mandatory, since with the new behavior, the driver
> > > > shouts that it is interpreting what delays to apply based on phy-mode.
> > > >
> > > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > >
> > > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> >
> > FWIW I dropped the set from pw based on Rob's report, I see a mention
> > of possible issues with fsl-lx2160a-bluebox3.dts, but it's not clear
> > to me which DT is disagreeing with the schema.. or is the schema itself
> > not 100?
>
> I am only saying that I am introducing a new DT binding scheme and
> warning all users of the old one. That's also why I am updating the
> device trees, to silence the newly introduced warnings. I would like
> this series to go through net-next, but fsl-lx2160a-bluebox3.dts isn't
> in net-next.

.dts changes should go in via the sub-arch's tree, not a subsystem tree.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
index 9cfd08cd31da..2ad7f79ad371 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -97,6 +97,10 @@  patternProperties:
 
           managed: true
 
+          rx-internal-delay-ps: true
+
+          tx-internal-delay-ps: true
+
         required:
           - reg
 
diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
index f97a22772e6f..0bbaefacdaba 100644
--- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
@@ -74,10 +74,42 @@  properties:
           - compatible
           - reg
 
+patternProperties:
+  "^(ethernet-)?ports$":
+    patternProperties:
+      "^(ethernet-)?port@[0-9]+$":
+        allOf:
+        - if:
+            properties:
+                phy-mode:
+                    contains:
+                        enum:
+                          - rgmii
+                          - rgmii-rxid
+                          - rgmii-txid
+                          - rgmii-id
+          then:
+            properties:
+                rx-internal-delay-ps:
+                    $ref: "#/$defs/internal-delay-ps"
+                tx-internal-delay-ps:
+                    $ref: "#/$defs/internal-delay-ps"
+
 required:
   - compatible
   - reg
 
+$defs:
+    internal-delay-ps:
+        description:
+            Disable tunable delay lines using 0 ps, or enable them and select
+            the phase between 1640 ps (73.8 degree shift at 1Gbps) and 2260 ps
+            (101.7 degree shift) in increments of 0.9 degrees (20 ps).
+        enum:
+            [0, 1640, 1660, 1680, 1700, 1720, 1740, 1760, 1780, 1800, 1820,
+            1840, 1860, 1880, 1900, 1920, 1940, 1960, 1980, 2000, 2020, 2040,
+            2060, 2080, 2100, 2120, 2140, 2160, 2180, 2200, 2220, 2240, 2260]
+
 unevaluatedProperties: false
 
 examples:
@@ -97,30 +129,40 @@  examples:
                             port@0 {
                                     phy-handle = <&rgmii_phy6>;
                                     phy-mode = "rgmii-id";
+                                    rx-internal-delay-ps = <0>;
+                                    tx-internal-delay-ps = <0>;
                                     reg = <0>;
                             };
 
                             port@1 {
                                     phy-handle = <&rgmii_phy3>;
                                     phy-mode = "rgmii-id";
+                                    rx-internal-delay-ps = <0>;
+                                    tx-internal-delay-ps = <0>;
                                     reg = <1>;
                             };
 
                             port@2 {
                                     phy-handle = <&rgmii_phy4>;
                                     phy-mode = "rgmii-id";
+                                    rx-internal-delay-ps = <0>;
+                                    tx-internal-delay-ps = <0>;
                                     reg = <2>;
                             };
 
                             port@3 {
                                     phy-handle = <&rgmii_phy4>;
                                     phy-mode = "rgmii-id";
+                                    rx-internal-delay-ps = <0>;
+                                    tx-internal-delay-ps = <0>;
                                     reg = <3>;
                             };
 
                             port@4 {
                                     ethernet = <&enet2>;
                                     phy-mode = "rgmii";
+                                    rx-internal-delay-ps = <0>;
+                                    tx-internal-delay-ps = <0>;
                                     reg = <4>;
 
                                     fixed-link {