Skip to contentSkip to conversation

Orion MDIO DT binding fixes

PATCH Superseded Michał Grzelak 2 participants 7 messages Dec 27, 2022 – Dec 29, 2022

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Orion MDIO DT binding fixes

Hi all,

This patchset fixes two small bugs in orion-mdio
binding. I would be thankful for your review.

Best regards,
Michał Grzelak

Michał Grzelak (2):
dt-bindings: net: marvell,orion-mdio: Fix error
dt-bindings: net: marvell,orion-mdio: Fix examples

 .../bindings/net/marvell,orion-mdio.yaml         | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 dt-bindings: net: marvell,orion-mdio: Fix error

Fix 'unevaluated properties error' during 'make dtbs_check' appearing on arm device trees by defining generic 'ethernet-phy' subnode in marvell,orion-mdio.yaml.

Fixes 0781434af811f ("dt-bindings: net: orion-mdio: Convert to JSON

schema")

---
 Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +4 -0
index d2906b4a0f59..2b2b3f8709fc 100644
@@ -35,6 +35,10 @@ properties:
     minItems: 1
     maxItems: 4
 
+patternProperties:
+  '^ethernet-phy':
+    type: object
+
 required:
   - compatible
   - reg
Signature · 1 line
2.34.1
#2 lore raw

Re: [net PATCH 1/2] dt-bindings: net: marvell,orion-mdio: Fix error

Quoted 3 lines · Michał Grzelak

Fix 'unevaluated properties error' during 'make dtbs_check' appearing on arm device trees by defining generic 'ethernet-phy' subnode in marvell,orion-mdio.yaml.

Instead of long test just paste a bit of warning message. Much easier to read.

Quoted 3 lines
Fixes 0781434af811f ("dt-bindings: net: orion-mdio: Convert to JSON

schema")

Don't wrap tags.

Quoted 10 lines
---
 Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +0 -0
index d2906b4a0f59..2b2b3f8709fc 100644

Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml properties: · line 39

Quoted 5 lines
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +2 -0
@@ -35,6 +35,10 @@ properties:
     minItems: 1
     maxItems: 4
 
+patternProperties:
+  '^ethernet-phy':

ethernet-phy@ is already accepted via mdio, so this looks wrong. You need to rather fix the DTS.

Best regards,
Krzysztof

#3 lore raw

PATCH 2/2 dt-bindings: net: marvell,orion-mdio: Fix examples

In reply to Michał Grzelak

As stated in marvell-orion-mdio.txt deleted in 'commit 0781434af811f ("dt-bindings: net: orion-mdio: Convert to JSON schema")' if 'interrupts' property is present, width of 'reg' should be 0x84. Otherwise, width of 'reg' should be 0x4. Fix 'examples:' and extend it by second example from marvell-orion-mdio.txt.

---
 .../devicetree/bindings/net/marvell,orion-mdio.yaml  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +11 -1
index 2b2b3f8709fc..d260794e92c5 100644
@@ -47,9 +47,10 @@ unevaluatedProperties: false
 
 examples:
   - |
+    // MDIO binding with interrupt
     mdio@d0072004 {
       compatible = "marvell,orion-mdio";
-      reg = <0xd0072004 0x4>;
+      reg = <0xd0072004 0x84>;
       #address-cells = <1>;
       #size-cells = <0>;
       interrupts = <30>;
@@ -62,3 +63,12 @@ examples:
         reg = <1>;
       };
     };
+
+  - |
+    // MDIO binding without interrupt
+    mdio@d0072004 {
+      compatible = "marvell,orion-mdio";
+      reg = <0xd0072004 0x4>;
+      #address-cells = <1>;
+      #size-cells = <0>;
+    };
Signature · 1 line
2.34.1
#4 lore raw

Re: [net PATCH 2/2] dt-bindings: net: marvell,orion-mdio: Fix examples

Quoted 2 lines · Michał Grzelak

As stated in marvell-orion-mdio.txt deleted in 'commit 0781434af811f ("dt-bindings: net: orion-mdio: Convert to JSON schema")' if

Drop '' quotes.

BTW, read the original binding to find the answer for your first patch.

Quoted 3 lines

'interrupts' property is present, width of 'reg' should be 0x84. Otherwise, width of 'reg' should be 0x4. Fix 'examples:' and extend it by second example from marvell-orion-mdio.txt.

The original binding did not say that, unless you mean giving different examples? Examples are not a binding.

Quoted 25 lines
---
 .../devicetree/bindings/net/marvell,orion-mdio.yaml  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +2 -1
index 2b2b3f8709fc..d260794e92c5 100644
@@ -47,9 +47,10 @@ unevaluatedProperties: false
 
 examples:
   - |
+    // MDIO binding with interrupt
     mdio@d0072004 {
       compatible = "marvell,orion-mdio";
-      reg = <0xd0072004 0x4>;
+      reg = <0xd0072004 0x84>;
       #address-cells = <1>;
       #size-cells = <0>;
       interrupts = <30>;
@@ -62,3 +63,12 @@ examples:
         reg = <1>;
       };

Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml examples: · line 74

Quoted 10 lines
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +9 -0
     };
+
+  - |
+    // MDIO binding without interrupt
+    mdio@d0072004 {
+      compatible = "marvell,orion-mdio";
+      reg = <0xd0072004 0x4>;
+      #address-cells = <1>;
+      #size-cells = <0>;
+    };

Why? The same compatible, the same nodes. No differences. Missing pieces is not a big difference justifying new example.

Best regards,
Krzysztof

#5 lore raw

PATCH v2 1/1 dt-bindings: net: marvell,orion-mdio: Fix examples

As stated in marvell-orion-mdio.txt deleted in commit 0781434af811f ("dt-bindings: net: orion-mdio: Convert to JSON schema") if 'interrupts' property is present, width of 'reg' should be 0x84. Otherwise, width of 'reg' should be 0x4. Fix 'examples:' and add constraints checking whether 'interrupts' property is present and validate it against fixed values in reg.

---
Changelog:
v1->v2:
- remove second example
- add 'if:' constraint to 'allOf:'
- move 'allOf:' before 'examples:'

 .../bindings/net/marvell,orion-mdio.yaml      | 31 ++++++++++++++++---
 1 file changed, 27 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +27 -4
index d2906b4a0f59..381cd8edebed 100644
@@ -16,9 +16,6 @@ description: |
   8k has a second unit which provides an interface with the xMDIO bus. This
   driver handles these interfaces.
 
-allOf:
-  - $ref: "mdio.yaml#"
-
 properties:
   compatible:
     enum:
@@ -39,13 +36,39 @@ required:
   - compatible
   - reg
 
+allOf:
+
+  - $ref: "mdio.yaml#"
+
+  - if:
+      required:
+        - interrupts
+
+    then:
+      properties:
+        reg:
+          items:
+            - items:
+                - $ref: /schemas/types.yaml#/definitions/cell
+                - const: 0x84
+
+    else:
+      properties:
+        reg:
+          items:
+            - items:
+                - $ref: /schemas/types.yaml#/definitions/cell
+                - enum:
+                    - 0x4
+                    - 0x10
+
 unevaluatedProperties: false
 
 examples:
   - |
     mdio@d0072004 {
       compatible = "marvell,orion-mdio";
-      reg = <0xd0072004 0x4>;
+      reg = <0xd0072004 0x84>;
       #address-cells = <1>;
       #size-cells = <0>;
       interrupts = <30>;
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#6 lore raw

Re: [PATCH v2] dt-bindings: net: marvell,orion-mdio: Fix examples

Quoted 33 lines · Michał Grzelak

As stated in marvell-orion-mdio.txt deleted in commit 0781434af811f ("dt-bindings: net: orion-mdio: Convert to JSON schema") if 'interrupts' property is present, width of 'reg' should be 0x84. Otherwise, width of 'reg' should be 0x4. Fix 'examples:' and add constraints checking whether 'interrupts' property is present and validate it against fixed values in reg.

---
Changelog:
v1->v2:
- remove second example
- add 'if:' constraint to 'allOf:'
- move 'allOf:' before 'examples:'

 .../bindings/net/marvell,orion-mdio.yaml      | 31 ++++++++++++++++---
 1 file changed, 27 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +0 -3
index d2906b4a0f59..381cd8edebed 100644
@@ -16,9 +16,6 @@ description: |
   8k has a second unit which provides an interface with the xMDIO bus. This
   driver handles these interfaces.
 
-allOf:
-  - $ref: "mdio.yaml#"
-
 properties:
   compatible:
     enum:

Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml required: · line 40

Quoted 5 lines
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +2 -0
@@ -39,13 +36,39 @@ required:
   - compatible
   - reg
 
+allOf:
+

Drop blank line.

Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml required: · line 41

Quoted 1 line
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +1 -0
+  - $ref: "mdio.yaml#"

Drop quotes while moving it.

Quoted 12 lines
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +12 -0
+
+  - if:
+      required:
+        - interrupts
+
+    then:
+      properties:
+        reg:
+          items:
+            - items:
+                - $ref: /schemas/types.yaml#/definitions/cell
+                - const: 0x84

Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml required: · line 63

Quoted 10 lines
Documentation/devicetree/bindings/net/marvell,orion-mdio.yaml +10 -0
+
+    else:
+      properties:
+        reg:
+          items:
+            - items:
+                - $ref: /schemas/types.yaml#/definitions/cell
+                - enum:
+                    - 0x4
+                    - 0x10

Rest looks good.

Best regards,
Krzysztof