Skip to contentSkip to conversation

dt-bindings: net: Cleanup MDIO node schemas

PATCH In review Rob Herring 2 participants 2 messages Jan 5, 2022 – Jan 10, 2022

Subsystems (13)
lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: net: Cleanup MDIO node schemas

The schemas for MDIO bus nodes range from missing to duplicating everything in mdio.yaml. The MDIO bus node schemas only need to reference mdio.yaml, define any binding specific properties, and define 'unevaluatedProperties: false'. This ensures that MDIO nodes only contain defined properties. With this, any duplicated properties can be removed.

Cc "David S. Miller" <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Vivien Didelot <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Vladimir Oltean <[email protected]>
Cc Joakim Zhang <[email protected]>
Cc Heiner Kallweit <[email protected]>
Cc Russell King <[email protected]>
Cc Kunihiko Hayashi <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Cristian Ciocaltea <[email protected]>
Cc "Fernández Rojas" <[email protected]>
Cc John Crispin <[email protected]>
Cc "G. Jaya Kumaran" <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Joel Stanley <[email protected]>
Cc Bartosz Golaszewski <[email protected]>
Cc Oleksij Rempel <[email protected]>
Cc Alexandre Torgue <[email protected]>
Cc Giuseppe Cavallaro <[email protected]>
Cc Jose Abreu <[email protected]>

---
I can take this via the DT tree.

 .../bindings/net/actions,owl-emac.yaml        |  4 +++
 .../net/allwinner,sun8i-a83t-emac.yaml        | 25 ++++++++----------
 .../bindings/net/brcm,bcm6368-mdio-mux.yaml   | 26 +------------------
 .../bindings/net/dsa/nxp,sja1105.yaml         |  6 ++---
 .../devicetree/bindings/net/dsa/qca8k.yaml    | 23 ++--------------
 .../devicetree/bindings/net/fsl,fec.yaml      |  3 ++-
 .../bindings/net/intel,dwmac-plat.yaml        |  2 +-
 .../bindings/net/intel,ixp4xx-ethernet.yaml   |  4 +--
 .../bindings/net/litex,liteeth.yaml           |  1 +
 .../devicetree/bindings/net/mdio-mux.yaml     |  7 ++---
 .../bindings/net/mediatek,star-emac.yaml      |  5 ++--
 .../devicetree/bindings/net/qca,ar71xx.yaml   |  4 +++
 .../devicetree/bindings/net/snps,dwmac.yaml   |  3 ++-
 .../bindings/net/socionext,uniphier-ave4.yaml |  1 +
 .../bindings/net/toshiba,visconti-dwmac.yaml  |  2 +-
 15 files changed, 38 insertions(+), 78 deletions(-)
Documentation/devicetree/bindings/net/actions,owl-emac.yaml +4 -0
index 1626e0a821b0..d30fada2ac39 100644
@@ -51,6 +51,10 @@ properties:
     description:
       Phandle to the device containing custom config.
 
+  mdio:
+    $ref: mdio.yaml#
+    unevaluatedProperties: false
+
 required:
   - compatible
   - reg
Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml +11 -14
index 407586bc366b..6a4831fd3616 100644
@@ -122,6 +122,7 @@ allOf:
 
         mdio-mux:
           type: object
+          unevaluatedProperties: false
 
           properties:
             compatible:
@@ -132,17 +133,18 @@ allOf:
               description:
                 Phandle to EMAC MDIO.
 
+            "#address-cells":
+              const: 1
+
+            "#size-cells":
+              const: 0
+
             mdio@1:
-              type: object
+              $ref: mdio.yaml#
+              unevaluatedProperties: false
               description: Internal MDIO Bus
 
               properties:
-                "#address-cells":
-                  const: 1
-
-                "#size-cells":
-                  const: 0
-
                 compatible:
                   const: allwinner,sun8i-h3-mdio-internal
 
@@ -168,16 +170,11 @@ allOf:
 
 
             mdio@2:
-              type: object
+              $ref: mdio.yaml#
+              unevaluatedProperties: false
               description: External MDIO Bus (H3 only)
 
               properties:
-                "#address-cells":
-                  const: 1
-
-                "#size-cells":
-                  const: 0
-
                 reg:
                   const: 2
 
Documentation/devicetree/bindings/net/brcm,bcm6368-mdio-mux.yaml +1 -25
index 2f34fda55fd0..9ef28c2a0afc 100644
@@ -15,18 +15,12 @@ description:
   properties as well to generate desired MDIO transaction on appropriate bus.
 
 allOf:
-  - $ref: "mdio.yaml#"
+  - $ref: mdio-mux.yaml#
 
 properties:
   compatible:
     const: brcm,bcm6368-mdio-mux
 
-  "#address-cells":
-    const: 1
-
-  "#size-cells":
-    const: 0
-
   reg:
     maxItems: 1
 
@@ -34,24 +28,6 @@ required:
   - compatible
   - reg
 
-patternProperties:
-  '^mdio@[0-1]$':
-    type: object
-    properties:
-      reg:
-        maxItems: 1
-
-      "#address-cells":
-        const: 1
-
-      "#size-cells":
-        const: 0
-
-    required:
-      - reg
-      - "#address-cells"
-      - "#size-cells"
-
 unevaluatedProperties: false
 
 examples:
Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml +2 -4
index 24cd733c11d1..1ea0bd490473 100644
@@ -52,10 +52,8 @@ properties:
 
     patternProperties:
       "^mdio@[0-1]$":
-        type: object
-
-        allOf:
-          - $ref: "http://devicetree.org/schemas/net/mdio.yaml#"
+        $ref: /schemas/net/mdio.yaml#
+        unevaluatedProperties: false
 
         properties:
           compatible:
Documentation/devicetree/bindings/net/dsa/qca8k.yaml +2 -21
index 48de0ace265d..907b2ae6442d 100644
@@ -58,33 +58,14 @@ properties:
       B68 on the QCA832x and B49 on the QCA833x.
 
   mdio:
-    type: object
+    $ref: /schemas/net/mdio.yaml#
+    unevaluatedProperties: false
     description: Qca8k switch have an internal mdio to access switch port.
                  If this is not present, the legacy mapping is used and the
                  internal mdio access is used.
                  With the legacy mapping the reg corresponding to the internal
                  mdio is the switch reg with an offset of -1.
 
-    properties:
-      '#address-cells':
-        const: 1
-      '#size-cells':
-        const: 0
-
-    patternProperties:
-      "^(ethernet-)?phy@[0-4]$":
-        type: object
-
-        allOf:
-          - $ref: "http://devicetree.org/schemas/net/mdio.yaml#"
-
-        properties:
-          reg:
-            maxItems: 1
-
-        required:
-          - reg
-
 patternProperties:
   "^(ethernet-)?ports$":
     type: object
Documentation/devicetree/bindings/net/fsl,fec.yaml +2 -1
index eca41443fcce..fd8371e31867 100644
@@ -165,7 +165,8 @@ properties:
       req_bit is the gpr bit offset for ENET stop request.
 
   mdio:
-    type: object
+    $ref: mdio.yaml#
+    unevaluatedProperties: false
     description:
       Specifies the mdio bus in the FEC, used as a container for phy nodes.
 
Documentation/devicetree/bindings/net/intel,dwmac-plat.yaml +1 -1
index 08a3f1f6aea2..52a7fa4f49a4 100644
@@ -117,7 +117,7 @@ examples:
         snps,mtl-tx-config = <&mtl_tx_setup>;
         snps,tso;
 
-        mdio0 {
+        mdio {
             #address-cells = <1>;
             #size-cells = <0>;
             compatible = "snps,dwmac-mdio";
Documentation/devicetree/bindings/net/intel,ixp4xx-ethernet.yaml +2 -2
index 378ed2d3b003..67eaf02dda80 100644
@@ -48,8 +48,8 @@ properties:
       and the instance to use in the second cell
 
   mdio:
-    type: object
-    $ref: "mdio.yaml#"
+    $ref: mdio.yaml#
+    unevaluatedProperties: false
     description: optional node for embedded MDIO controller
 
 required:
Documentation/devicetree/bindings/net/litex,liteeth.yaml +1 -0
index 76c164a8199a..ebf4e360f8dd 100644
@@ -62,6 +62,7 @@ properties:
 
   mdio:
     $ref: mdio.yaml#
+    unevaluatedProperties: false
 
 required:
   - compatible
Documentation/devicetree/bindings/net/mdio-mux.yaml +2 -5
index d169adf5d9f4..4321c87de86f 100644
@@ -15,9 +15,6 @@ description: |+
   bus multiplexer/switch will have one child node for each child bus.
 
 properties:
-  $nodename:
-    pattern: '^mdio-mux[\-@]?'
-
   mdio-parent-bus:
     $ref: /schemas/types.yaml#/definitions/phandle
     description:
@@ -32,12 +29,12 @@ properties:
 
 patternProperties:
   '^mdio@[0-9a-f]+$':
-    type: object
+    $ref: mdio.yaml#
+    unevaluatedProperties: false
 
     properties:
       reg:
         maxItems: 1
-        description: The sub-bus number.
 
 additionalProperties: true
 
Documentation/devicetree/bindings/net/mediatek,star-emac.yaml +2 -3
index e6a5ff208253..def994c9cbb4 100644
@@ -48,9 +48,8 @@ properties:
       to control the MII mode.
 
   mdio:
-    type: object
-    description:
-      Creates and registers an MDIO bus.
+    $ref: mdio.yaml#
+    unevaluatedProperties: false
 
 required:
   - compatible
Documentation/devicetree/bindings/net/qca,ar71xx.yaml +4 -0
index 72c931288109..b76a1436fb1b 100644
@@ -62,6 +62,10 @@ properties:
       - const: mac
       - const: mdio
 
+  mdio:
+    $ref: mdio.yaml#
+    unevaluatedProperties: false
+
 required:
   - compatible
   - reg
Documentation/devicetree/bindings/net/snps,dwmac.yaml +2 -1
index 1d67ed0cdec1..7eb43707e601 100644
@@ -286,7 +286,8 @@ properties:
       MAC2MAC connection.
 
   mdio:
-    type: object
+    $ref: mdio.yaml#
+    unevaluatedProperties: false
     description:
       Creates and registers an MDIO bus.
 
Documentation/devicetree/bindings/net/socionext,uniphier-ave4.yaml +1 -0
index 6bc61c42418f..aad5a9f3f962 100644
@@ -72,6 +72,7 @@ properties:
 
   mdio:
     $ref: mdio.yaml#
+    unevaluatedProperties: false
 
 required:
   - compatible
Documentation/devicetree/bindings/net/toshiba,visconti-dwmac.yaml +1 -1
index 59724d18e6f3..b12bfe61c67a 100644
@@ -71,7 +71,7 @@ examples:
             phy-mode = "rgmii-id";
             phy-handle = <&phy0>;
 
-            mdio0 {
+            mdio {
                 #address-cells = <0x1>;
                 #size-cells = <0x0>;
                 compatible = "snps,dwmac-mdio";
Signature · 1 line
2.32.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Rob Herring

The schemas for MDIO bus nodes range from missing to duplicating everything in mdio.yaml. The MDIO bus node schemas only need to reference mdio.yaml, define any binding specific properties, and define 'unevaluatedProperties: false'. This ensures that MDIO nodes only contain defined properties. With this, any duplicated properties can be removed.

Andrew