Skip to contentSkip to conversation

dt-bindings: net: davinci_emac: Convert to yaml version from txt

PATCH In review Adam Ford 2 participants 4 messages Jun 23, 2024 – Jun 24, 2024

Subsystems (3)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 dt-bindings: net: davinci_emac: Convert to yaml version from txt

The davinci_emac is used by several devices which are still maintained, but to make some improvements, it's necessary to convert from txt to yaml.

Documentation/devicetree/bindings/net/davinci_emac.txt deleted +0 -44
deleted file mode 100644
index 5e3579e72e2d..000000000000
@@ -1,44 +0,0 @@
-* Texas Instruments Davinci EMAC
-
-This file provides information, what the device node
-for the davinci_emac interface contains.
-
-Required properties:
-- compatible: "ti,davinci-dm6467-emac", "ti,am3517-emac" or
-  "ti,dm816-emac"
-- reg: Offset and length of the register set for the device
-- ti,davinci-ctrl-reg-offset: offset to control register
-- ti,davinci-ctrl-mod-reg-offset: offset to control module register
-- ti,davinci-ctrl-ram-offset: offset to control module ram
-- ti,davinci-ctrl-ram-size: size of control module ram
-- interrupts: interrupt mapping for the davinci emac interrupts sources:
-              4 sources: <Receive Threshold Interrupt
-			  Receive Interrupt
-			  Transmit Interrupt
-			  Miscellaneous Interrupt>
-
-Optional properties:
-- phy-handle: See ethernet.txt file in the same directory.
-              If absent, davinci_emac driver defaults to 100/FULL.
-- ti,davinci-rmii-en: 1 byte, 1 means use RMII
-- ti,davinci-no-bd-ram: boolean, does EMAC have BD RAM?
-
-The MAC address will be determined using the optional properties
-defined in ethernet.txt.
-
-Example (enbw_cmc board):
-	eth0: emac@1e20000 {
-		compatible = "ti,davinci-dm6467-emac";
-		reg = <0x220000 0x4000>;
-		ti,davinci-ctrl-reg-offset = <0x3000>;
-		ti,davinci-ctrl-mod-reg-offset = <0x2000>;
-		ti,davinci-ctrl-ram-offset = <0>;
-		ti,davinci-ctrl-ram-size = <0x2000>;
-		local-mac-address = [ 00 00 00 00 00 00 ];
-		interrupts = <33
-				34
-				35
-				36
-				>;
-		interrupt-parent = <&intc>;
-	};
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +111 -0

111 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw

Documentation/devicetree/bindings/net/davinci_emac.yaml

Quoted 60 lines · Adam Ford

The davinci_emac is used by several devices which are still maintained, but to make some improvements, it's necessary to convert from txt to yaml.

Documentation/devicetree/bindings/net/davinci_emac.txt deleted +0 -44
deleted file mode 100644
index 5e3579e72e2d..000000000000
@@ -1,44 +0,0 @@
-* Texas Instruments Davinci EMAC
-
-This file provides information, what the device node
-for the davinci_emac interface contains.
-
-Required properties:
-- compatible: "ti,davinci-dm6467-emac", "ti,am3517-emac" or
-  "ti,dm816-emac"
-- reg: Offset and length of the register set for the device
-- ti,davinci-ctrl-reg-offset: offset to control register
-- ti,davinci-ctrl-mod-reg-offset: offset to control module register
-- ti,davinci-ctrl-ram-offset: offset to control module ram
-- ti,davinci-ctrl-ram-size: size of control module ram
-- interrupts: interrupt mapping for the davinci emac interrupts sources:
-              4 sources: <Receive Threshold Interrupt
-			  Receive Interrupt
-			  Transmit Interrupt
-			  Miscellaneous Interrupt>
-
-Optional properties:
-- phy-handle: See ethernet.txt file in the same directory.
-              If absent, davinci_emac driver defaults to 100/FULL.
-- ti,davinci-rmii-en: 1 byte, 1 means use RMII
-- ti,davinci-no-bd-ram: boolean, does EMAC have BD RAM?
-
-The MAC address will be determined using the optional properties
-defined in ethernet.txt.
-
-Example (enbw_cmc board):
-	eth0: emac@1e20000 {
-		compatible = "ti,davinci-dm6467-emac";
-		reg = <0x220000 0x4000>;
-		ti,davinci-ctrl-reg-offset = <0x3000>;
-		ti,davinci-ctrl-mod-reg-offset = <0x2000>;
-		ti,davinci-ctrl-ram-offset = <0>;
-		ti,davinci-ctrl-ram-size = <0x2000>;
-		local-mac-address = [ 00 00 00 00 00 00 ];
-		interrupts = <33
-				34
-				35
-				36
-				>;
-		interrupt-parent = <&intc>;
-	};
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +0 -0
new file mode 100644
index 000000000000..4c2640aef8a1

Filename matching compatible format. Missing vendor prefix. Underscores are not used in names or compatibles.

Quoted 12 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +11 -0
@@ -0,0 +1,111 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/davinci_emac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments Davici EMAC
+
+maintainers:
+  - Adam Ford <[email protected]>
+

Documentation/devicetree/bindings/net/davinci_emac.yaml line 21

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+description:
+  Ethernet based on the Programmable Real-Time Unit and Industrial
+  Communication Subsystem.
+
+allOf:
+  - $ref: ethernet-controller.yaml#
+
+properties:
+  compatible:
+    items:

That's just enum, no need for items here.

Documentation/devicetree/bindings/net/davinci_emac.yaml line 31

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+      - enum:
+          - ti,davinci-dm6467-emac # da850
+          - ti,dm816-emac
+          - ti,am3517-emac
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    minItems: 4

You need to list and describe the items.

Quoted 5 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +5 -0
+
+  clocks:
+    maxItems: 1
+
+  clock-names:

Documentation/devicetree/bindings/net/davinci_emac.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+    items:
+      - const: ick
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  local-mac-address: true

Drop

Documentation/devicetree/bindings/net/davinci_emac.yaml line 47

Quoted 1 line
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +1 -0
+  mac-address: true

Drop

You miss top-level $ref to appropriate schema.

Documentation/devicetree/bindings/net/davinci_emac.yaml line 52

Quoted 5 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +5 -0
+
+  syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: a phandle to the global system controller on
+      to enable/disable interrupts

Drop entire property. There was no such property in old binding and nothing explains why it was added.

Quoted 22 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +22 -0
+
+  ti,davinci-ctrl-reg-offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset to control register
+
+  ti,davinci-ctrl-mod-reg-offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset to control module register
+
+  ti,davinci-ctrl-ram-offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset to control module ram
+
+  ti,davinci-ctrl-ram-size:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Size of control module ram
+
+  ti,davinci-rmii-en:

Documentation/devicetree/bindings/net/davinci_emac.yaml line 84

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+    $ref: /schemas/types.yaml#/definitions/uint8
+    description:
+      RMII enable means use RMII
+
+  ti,davinci-no-bd-ram:
+    type: boolean
+    description:
+      Enable if EMAC have BD RAM
+
+additionalProperties: false

Look at example-schema. This goes after required, although anyway should be unevaluatedProperties after adding proper $ref.

Quoted 4 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +4 -0
+
+required:
+  - compatible
+  - reg

Documentation/devicetree/bindings/net/davinci_emac.yaml line 98

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+  - interrupts
+  - clocks
+  - ti,davinci-ctrl-reg-offset
+  - ti,davinci-ctrl-mod-reg-offset
+  - ti,davinci-ctrl-ram-offset
+  - ti,davinci-ctrl-ram-size
+
+examples:
+  - |
+    eth0: ethernet@220000 {

Drop label.

Documentation/devicetree/bindings/net/davinci_emac.yaml line 109

Quoted 11 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +11 -0
+      compatible = "ti,davinci-dm6467-emac";
+      reg = <0x220000 0x4000>;
+      ti,davinci-ctrl-reg-offset = <0x3000>;
+      ti,davinci-ctrl-mod-reg-offset = <0x2000>;
+      ti,davinci-ctrl-ram-offset = <0>;
+      ti,davinci-ctrl-ram-size = <0x2000>;
+      local-mac-address = [ 00 00 00 00 00 00 ];
+      interrupts = <33>, <34>, <35>,<36>;
+      clocks = <&psc1 5>;
+      power-domains = <&psc1 5>;
+      status = "disabled";

Drop. It cannot be disabled, otherwise what would be the point of this example?

Best regards,
Krzysztof

author
#2 lore raw
Quoted 57 lines · Krzysztof Kozlowski
Quoted 55 lines · Adam Ford

The davinci_emac is used by several devices which are still maintained, but to make some improvements, it's necessary to convert from txt to yaml.

Documentation/devicetree/bindings/net/davinci_emac.txt deleted +0 -44
deleted file mode 100644
index 5e3579e72e2d..000000000000
@@ -1,44 +0,0 @@
-* Texas Instruments Davinci EMAC
-
-This file provides information, what the device node
-for the davinci_emac interface contains.
-
-Required properties:
-- compatible: "ti,davinci-dm6467-emac", "ti,am3517-emac" or
-  "ti,dm816-emac"
-- reg: Offset and length of the register set for the device
-- ti,davinci-ctrl-reg-offset: offset to control register
-- ti,davinci-ctrl-mod-reg-offset: offset to control module register
-- ti,davinci-ctrl-ram-offset: offset to control module ram
-- ti,davinci-ctrl-ram-size: size of control module ram
-- interrupts: interrupt mapping for the davinci emac interrupts sources:
-              4 sources: <Receive Threshold Interrupt
-                       Receive Interrupt
-                       Transmit Interrupt
-                       Miscellaneous Interrupt>
-
-Optional properties:
-- phy-handle: See ethernet.txt file in the same directory.
-              If absent, davinci_emac driver defaults to 100/FULL.
-- ti,davinci-rmii-en: 1 byte, 1 means use RMII
-- ti,davinci-no-bd-ram: boolean, does EMAC have BD RAM?
-
-The MAC address will be determined using the optional properties
-defined in ethernet.txt.
-
-Example (enbw_cmc board):
-     eth0: emac@1e20000 {
-             compatible = "ti,davinci-dm6467-emac";
-             reg = <0x220000 0x4000>;
-             ti,davinci-ctrl-reg-offset = <0x3000>;
-             ti,davinci-ctrl-mod-reg-offset = <0x2000>;
-             ti,davinci-ctrl-ram-offset = <0>;
-             ti,davinci-ctrl-ram-size = <0x2000>;
-             local-mac-address = [ 00 00 00 00 00 00 ];
-             interrupts = <33
-                             34
-                             35
-                             36
-                             >;
-             interrupt-parent = <&intc>;
-     };
Quoted 8 lines

Documentation/devicetree/bindings/net/davinci_emac.yaml

Quoted 5 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +0 -0
new file mode 100644
index 000000000000..4c2640aef8a1

Filename matching compatible format. Missing vendor prefix. Underscores are not used in names or compatibles.

Thank you for the review.

Would a proper name be ti,davinci-emac.yaml?

Quoted 65 lines
Quoted 14 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +11 -0
@@ -0,0 +1,111 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/davinci_emac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments Davici EMAC
+
+maintainers:
+  - Adam Ford <[email protected]>
+

Documentation/devicetree/bindings/net/davinci_emac.yaml line 21

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+description:
+  Ethernet based on the Programmable Real-Time Unit and Industrial
+  Communication Subsystem.
+
+allOf:
+  - $ref: ethernet-controller.yaml#
+
+properties:
+  compatible:
+    items:

That's just enum, no need for items here.

Documentation/devicetree/bindings/net/davinci_emac.yaml line 31

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+      - enum:
+          - ti,davinci-dm6467-emac # da850
+          - ti,dm816-emac
+          - ti,am3517-emac
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    minItems: 4

You need to list and describe the items.

Quoted 5 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +5 -0
+
+  clocks:
+    maxItems: 1
+
+  clock-names:

Documentation/devicetree/bindings/net/davinci_emac.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+    items:
+      - const: ick
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  local-mac-address: true

Drop

Documentation/devicetree/bindings/net/davinci_emac.yaml line 47

Quoted 1 line
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +1 -0
+  mac-address: true

Drop

You miss top-level $ref to appropriate schema.

Quoted 8 lines

Documentation/devicetree/bindings/net/davinci_emac.yaml line 52

Quoted 5 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +5 -0
+
+  syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: a phandle to the global system controller on
+      to enable/disable interrupts

Drop entire property. There was no such property in old binding and nothing explains why it was added.

The am3517.dtsi emac node has a syscon, so I didn't want to break it. I'll take a look to see what the syscon node on the am3517 does. I struggle with if statements in yaml, but if it's necessary for the am3517, can we keep it if I elaborate on it in the commit message?

Quoted 66 lines
Quoted 23 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +22 -0
+
+  ti,davinci-ctrl-reg-offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset to control register
+
+  ti,davinci-ctrl-mod-reg-offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset to control module register
+
+  ti,davinci-ctrl-ram-offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset to control module ram
+
+  ti,davinci-ctrl-ram-size:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Size of control module ram
+
+  ti,davinci-rmii-en:

Documentation/devicetree/bindings/net/davinci_emac.yaml line 84

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+    $ref: /schemas/types.yaml#/definitions/uint8
+    description:
+      RMII enable means use RMII
+
+  ti,davinci-no-bd-ram:
+    type: boolean
+    description:
+      Enable if EMAC have BD RAM
+
+additionalProperties: false

Look at example-schema. This goes after required, although anyway should be unevaluatedProperties after adding proper $ref.

Quoted 4 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +4 -0
+
+required:
+  - compatible
+  - reg

Documentation/devicetree/bindings/net/davinci_emac.yaml line 98

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+  - interrupts
+  - clocks
+  - ti,davinci-ctrl-reg-offset
+  - ti,davinci-ctrl-mod-reg-offset
+  - ti,davinci-ctrl-ram-offset
+  - ti,davinci-ctrl-ram-size
+
+examples:
+  - |
+    eth0: ethernet@220000 {

Drop label.

Documentation/devicetree/bindings/net/davinci_emac.yaml line 109

Quoted 11 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +11 -0
+      compatible = "ti,davinci-dm6467-emac";
+      reg = <0x220000 0x4000>;
+      ti,davinci-ctrl-reg-offset = <0x3000>;
+      ti,davinci-ctrl-mod-reg-offset = <0x2000>;
+      ti,davinci-ctrl-ram-offset = <0>;
+      ti,davinci-ctrl-ram-size = <0x2000>;
+      local-mac-address = [ 00 00 00 00 00 00 ];
+      interrupts = <33>, <34>, <35>,<36>;
+      clocks = <&psc1 5>;
+      power-domains = <&psc1 5>;
+      status = "disabled";
Quoted 2 lines

Drop. It cannot be disabled, otherwise what would be the point of this example?

Sorry, I copy-pasted this from the da850.dtsi node. I'll remove the label and the status line.

Quoted 5 lines

Best regards,
Krzysztof

#3 lore raw
Quoted 9 lines · Adam Ford
Quoted 8 lines

Documentation/devicetree/bindings/net/davinci_emac.yaml

Quoted 5 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +0 -0
new file mode 100644
index 000000000000..4c2640aef8a1

Filename matching compatible format. Missing vendor prefix. Underscores are not used in names or compatibles.

Quoted 3 lines

Thank you for the review.

Would a proper name be ti,davinci-emac.yaml?

Yes, it's fine.

Quoted 72 lines
Quoted 72 lines
Quoted 15 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +11 -0
@@ -0,0 +1,111 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/davinci_emac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments Davici EMAC
+
+maintainers:
+  - Adam Ford <[email protected]>
+

Documentation/devicetree/bindings/net/davinci_emac.yaml line 21

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+description:
+  Ethernet based on the Programmable Real-Time Unit and Industrial
+  Communication Subsystem.
+
+allOf:
+  - $ref: ethernet-controller.yaml#
+
+properties:
+  compatible:
+    items:

That's just enum, no need for items here.

Documentation/devicetree/bindings/net/davinci_emac.yaml line 31

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+      - enum:
+          - ti,davinci-dm6467-emac # da850
+          - ti,dm816-emac
+          - ti,am3517-emac
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    minItems: 4

You need to list and describe the items.

Quoted 5 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +5 -0
+
+  clocks:
+    maxItems: 1
+
+  clock-names:

Documentation/devicetree/bindings/net/davinci_emac.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +10 -0
+    items:
+      - const: ick
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  local-mac-address: true

Drop

Documentation/devicetree/bindings/net/davinci_emac.yaml line 47

Quoted 1 line
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +1 -0
+  mac-address: true

Drop

You miss top-level $ref to appropriate schema.

Quoted 5 lines
Documentation/devicetree/bindings/net/davinci_emac.yaml new file +5 -0
+
+  syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: a phandle to the global system controller on
+      to enable/disable interrupts
Quoted 7 lines
Quoted 2 lines

Drop entire property. There was no such property in old binding and nothing explains why it was added.

The am3517.dtsi emac node has a syscon, so I didn't want to break it. I'll take a look to see what the syscon node on the am3517 does. I struggle with if statements in yaml, but if it's necessary for the am3517, can we keep it if I elaborate on it in the commit message?

Explain in commit msg changes to the binding done during conversion. With a rationale why these are needed (e.g. existing DTS and Linux drivers use them).

Best regards,
Krzysztof