Skip to contentSkip to conversation

dt-bindings: net: davinci-mdio: convert bindings to json-schema

RFC PATCH In review Grygorii Strashko 2 participants 2 messages Oct 24, 2019 – Oct 29, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 dt-bindings: net: davinci-mdio: convert bindings to json-schema

Now that we have the DT validation in place, let's convert the device tree bindings for the TI SoC Davinci/OMAP/Keystone2 MDIO Controllerr over to a YAML schemas.

---
This my first attempt to work with YAML schemas, hence RFC.

 .../bindings/net/ti,davinci-mdio.yaml         | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/ti,davinci-mdio.yaml
Documentation/devicetree/bindings/net/ti,davinci-mdio.yaml new file +64 -0
new file mode 100644
index 000000000000..e51054d2e0fa
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/ti,davinci-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI SoC Davinci/Keystone2 MDIO Controller
+
+maintainers:
+  - Grygorii Strashko <[email protected]>
+
+description:
+  TI SoC Davinci/Keystone2 MDIO Controller Device Tree Bindings
+
+allOf:
+  - $ref: "mdio.yaml#"
+
+properties:
+  compatible:
+    oneOf:
+       - const: ti,davinci_mdio
+       - items:
+         - const: ti,keystone_mdio
+         - const: ti,davinci_mdio
+       - items:
+         - const: ti,cpsw-mdio
+         - const: ti,davinci_mdio
+       - items:
+         - const: ti,am4372-mdio
+         - const: ti,cpsw-mdio
+         - const: ti,davinci_mdio
+
+  reg:
+    maxItems: 1
+
+  bus_freq:
+      maximum: 2500000
+      description:
+        Mdio Bus frequency
+
+  ti,hwmods:
+    description: TI hwmod name
+    deprecated: true
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/string-array
+      - items:
+          const: davinci_mdio
+
+required:
+  - compatible
+  - reg
+  - bus_freq
+  - "#address-cells"
+  - "#size-cells"
+
+examples:
+  - |
+    davinci_mdio: mdio@4a101000 {
+         compatible = "ti,davinci_mdio";
+         #address-cells = <1>;
+         #size-cells = <0>;
+         reg = <0x4A101000 0x1000>;
+         bus_freq = <1000000>;
+    };
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 7 lines · Grygorii Strashko

Now that we have the DT validation in place, let's convert the device tree bindings for the TI SoC Davinci/OMAP/Keystone2 MDIO Controllerr over to a YAML schemas.

---
This my first attempt to work with YAML schemas, hence RFC.

No problems validating this schema, but the example in mdio.yaml isn't happy:

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/mdio.example.dt.yaml:
mdio@5c030000: 'bus_freq' is a required property

Quoted 4 lines
 .../bindings/net/ti,davinci-mdio.yaml         | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/ti,davinci-mdio.yaml

Convert implies deleting the old binding...

Quoted 59 lines
Documentation/devicetree/bindings/net/ti,davinci-mdio.yaml new file +52 -0
new file mode 100644
index 000000000000..e51054d2e0fa
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/ti,davinci-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI SoC Davinci/Keystone2 MDIO Controller
+
+maintainers:
+  - Grygorii Strashko <[email protected]>
+
+description:
+  TI SoC Davinci/Keystone2 MDIO Controller Device Tree Bindings
+
+allOf:
+  - $ref: "mdio.yaml#"
+
+properties:
+  compatible:
+    oneOf:
+       - const: ti,davinci_mdio
+       - items:
+         - const: ti,keystone_mdio
+         - const: ti,davinci_mdio
+       - items:
+         - const: ti,cpsw-mdio
+         - const: ti,davinci_mdio
+       - items:
+         - const: ti,am4372-mdio
+         - const: ti,cpsw-mdio
+         - const: ti,davinci_mdio
+
+  reg:
+    maxItems: 1
+
+  bus_freq:
+      maximum: 2500000
+      description:
+        Mdio Bus frequency
+
+  ti,hwmods:
+    description: TI hwmod name
+    deprecated: true
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/string-array
+      - items:
+          const: davinci_mdio
+
+required:
+  - compatible
+  - reg
+  - bus_freq

Documentation/devicetree/bindings/net/ti,davinci-mdio.yaml line 62

Quoted 10 lines
Documentation/devicetree/bindings/net/ti,davinci-mdio.yaml new file +10 -0
+  - "#address-cells"
+  - "#size-cells"
+
+examples:
+  - |
+    davinci_mdio: mdio@4a101000 {
+         compatible = "ti,davinci_mdio";
+         #address-cells = <1>;
+         #size-cells = <0>;
+         reg = <0x4A101000 0x1000>;

Lowercase hex please.

Quoted 5 lines
Documentation/devicetree/bindings/net/ti,davinci-mdio.yaml new file +2 -0
+         bus_freq = <1000000>;
+    };
Signature · 1 line
2.17.1