Skip to contentSkip to conversation

dt-bindings: net: Convert mdio-gpio to yaml

PATCH Superseded Corentin Labbe 3 participants 4 messages Apr 30, 2021 – May 3, 2021

Subsystems (4)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 dt-bindings: net: Convert mdio-gpio to yaml

Converts net/mdio-gpio.txt to yaml

---
Changes since v1:
- fixes yamllint warning about indent
- added maxItems 3

Changes since v2:
- fixed example (gpios need 2 entries)

 .../devicetree/bindings/net/mdio-gpio.txt     | 27 ---------
 .../devicetree/bindings/net/mdio-gpio.yaml    | 57 +++++++++++++++++++
 2 files changed, 57 insertions(+), 27 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/mdio-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/net/mdio-gpio.yaml
Documentation/devicetree/bindings/net/mdio-gpio.txt deleted +0 -27
deleted file mode 100644
index 4d91a36c5cf5..000000000000
@@ -1,27 +0,0 @@
-MDIO on GPIOs
-
-Currently defined compatibles:
-- virtual,gpio-mdio
-- microchip,mdio-smi0
-
-MDC and MDIO lines connected to GPIO controllers are listed in the
-gpios property as described in section VIII.1 in the following order:
-
-MDC, MDIO.
-
-Note: Each gpio-mdio bus should have an alias correctly numbered in "aliases"
-node.
-
-Example:
-
-aliases {
-	mdio-gpio0 = &mdio0;
-};
-
-mdio0: mdio {
-	compatible = "virtual,mdio-gpio";
-	#address-cells = <1>;
-	#size-cells = <0>;
-	gpios = <&qe_pio_a 11
-		 &qe_pio_c 6>;
-};
Documentation/devicetree/bindings/net/mdio-gpio.yaml new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.26.3
maintainer
#1 lore raw
Quoted 82 lines · Corentin Labbe

Converts net/mdio-gpio.txt to yaml

---
Changes since v1:
- fixes yamllint warning about indent
- added maxItems 3

Changes since v2:
- fixed example (gpios need 2 entries)

 .../devicetree/bindings/net/mdio-gpio.txt     | 27 ---------
 .../devicetree/bindings/net/mdio-gpio.yaml    | 57 +++++++++++++++++++
 2 files changed, 57 insertions(+), 27 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/mdio-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/net/mdio-gpio.yaml
Documentation/devicetree/bindings/net/mdio-gpio.txt deleted +0 -27
deleted file mode 100644
index 4d91a36c5cf5..000000000000
@@ -1,27 +0,0 @@
-MDIO on GPIOs
-
-Currently defined compatibles:
-- virtual,gpio-mdio
-- microchip,mdio-smi0
-
-MDC and MDIO lines connected to GPIO controllers are listed in the
-gpios property as described in section VIII.1 in the following order:
-
-MDC, MDIO.
-
-Note: Each gpio-mdio bus should have an alias correctly numbered in "aliases"
-node.
-
-Example:
-
-aliases {
-	mdio-gpio0 = &mdio0;
-};
-
-mdio0: mdio {
-	compatible = "virtual,mdio-gpio";
-	#address-cells = <1>;
-	#size-cells = <0>;
-	gpios = <&qe_pio_a 11
-		 &qe_pio_c 6>;
-};
Documentation/devicetree/bindings/net/mdio-gpio.yaml new file +25 -0
new file mode 100644
index 000000000000..183cf248d597
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/mdio-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MDIO on GPIOs
+
+maintainers:
+  - Andrew Lunn <[email protected]>
+  - Florian Fainelli <[email protected]>
+  - Heiner Kallweit <[email protected]>
+
+allOf:
+  - $ref: "mdio.yaml#"
+
+properties:
+  compatible:
+    enum:
+      - virtual,mdio-gpio
+      - microchip,mdio-smi0
+
+  "#address-cells":
+    const: 1
+

Documentation/devicetree/bindings/net/mdio-gpio.yaml line 35

Quoted 10 lines
Documentation/devicetree/bindings/net/mdio-gpio.yaml new file +10 -0
+  "#size-cells":
+    const: 0
+
+  gpios:
+    minItems: 2
+    maxItems: 3
+    description: |
+      MDC and MDIO lines connected to GPIO controllers are listed in
+      the gpios property as described in section VIII.1 in the
+      following order: MDC, MDIO.

section VIII.1 of what? Might be in DT spec, but if so the section is different for sure.

What's the order with 3 lines? In any case, define the order with schema:

minItems:
items:
- description: MDC signal
- description: MDIO or ?? signal
- description: ?? signal

Documentation/devicetree/bindings/net/mdio-gpio.yaml line 39

Quoted 4 lines
Documentation/devicetree/bindings/net/mdio-gpio.yaml new file +4 -0
+
+#Note: Each gpio-mdio bus should have an alias correctly numbered in "aliases"
+#node.
+unevaluatedProperties: false

additionalProperties:
type: object

To say anything else has to be a child node.

Quoted 21 lines
Documentation/devicetree/bindings/net/mdio-gpio.yaml new file +18 -0
+
+examples:
+  - |
+    aliases {
+        mdio-gpio0 = &mdio0;
+    };
+
+    mdio0: mdio {
+      compatible = "virtual,mdio-gpio";
+      #address-cells = <1>;
+      #size-cells = <0>;
+      gpios = <&qe_pio_a 11>,
+              <&qe_pio_c 6>;
+      ethphy0: ethernet-phy@0 {
+        reg = <0>;
+      };
+    };
+...
Signature · 1 line
2.26.3
#2 lore raw
Quoted 88 lines · Rob Herring
Quoted 87 lines · Corentin Labbe

Converts net/mdio-gpio.txt to yaml

---
Changes since v1:
- fixes yamllint warning about indent
- added maxItems 3

Changes since v2:
- fixed example (gpios need 2 entries)

 .../devicetree/bindings/net/mdio-gpio.txt     | 27 ---------
 .../devicetree/bindings/net/mdio-gpio.yaml    | 57 +++++++++++++++++++
 2 files changed, 57 insertions(+), 27 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/mdio-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/net/mdio-gpio.yaml
Documentation/devicetree/bindings/net/mdio-gpio.txt deleted +0 -27
deleted file mode 100644
index 4d91a36c5cf5..000000000000
@@ -1,27 +0,0 @@
-MDIO on GPIOs
-
-Currently defined compatibles:
-- virtual,gpio-mdio
-- microchip,mdio-smi0
-
-MDC and MDIO lines connected to GPIO controllers are listed in the
-gpios property as described in section VIII.1 in the following order:
-
-MDC, MDIO.
-
-Note: Each gpio-mdio bus should have an alias correctly numbered in "aliases"
-node.
-
-Example:
-
-aliases {
-	mdio-gpio0 = &mdio0;
-};
-
-mdio0: mdio {
-	compatible = "virtual,mdio-gpio";
-	#address-cells = <1>;
-	#size-cells = <0>;
-	gpios = <&qe_pio_a 11
-		 &qe_pio_c 6>;
-};
Documentation/devicetree/bindings/net/mdio-gpio.yaml new file +30 -0
new file mode 100644
index 000000000000..183cf248d597
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/mdio-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MDIO on GPIOs
+
+maintainers:
+  - Andrew Lunn <[email protected]>
+  - Florian Fainelli <[email protected]>
+  - Heiner Kallweit <[email protected]>
+
+allOf:
+  - $ref: "mdio.yaml#"
+
+properties:
+  compatible:
+    enum:
+      - virtual,mdio-gpio
+      - microchip,mdio-smi0
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  gpios:
+    minItems: 2
Quoted 9 lines

Documentation/devicetree/bindings/net/mdio-gpio.yaml line 35

Quoted 5 lines
Documentation/devicetree/bindings/net/mdio-gpio.yaml new file +5 -0
+    maxItems: 3
+    description: |
+      MDC and MDIO lines connected to GPIO controllers are listed in
+      the gpios property as described in section VIII.1 in the
+      following order: MDC, MDIO.

section VIII.1 of what? Might be in DT spec, but if so the section is different for sure.

It cames from Documentation/powerpc/booting-without-of.txt and was removed more than 10 years ago. So the reference could be removed.

Quoted 9 lines

What's the order with 3 lines? In any case, define the order with schema:

minItems:
items:
- description: MDC signal
- description: MDIO or ?? signal
- description: ?? signal

I dont know what to write in the third line, I added the "maxItems: 3" by request of Andrew Lunn. But I have no example at hand.

Andrew could you give me an example of: "You often find with x86 machines you don't have GPIOs, just GPI
and GPO, and you need to combine two to form the MDIO line of the MDIO bus." Or could I drop the "maxItems: 3" until a board need it.

Regards

maintainer
#3 lore raw
Quoted 10 lines
Quoted 9 lines

What's the order with 3 lines? In any case, define the order with schema:

minItems:
items:
- description: MDC signal
- description: MDIO or ?? signal
- description: ?? signal

Quoted 6 lines

I dont know what to write in the third line, I added the "maxItems: 3" by request of Andrew Lunn. But I have no example at hand.

Andrew could you give me an example of: "You often find with x86 machines you don't have GPIOs, just GPI
and GPO, and you need to combine two to form the MDIO line of the MDIO bus." Or could I drop the "maxItems: 3" until a board need it.

The code gets the GPIOs via index. The index are defined in include/linux/gpio-mdio.h as:

#define MDIO_GPIO_MDC 0
#define MDIO_GPIO_MDIO 1
#define MDIO_GPIO_MDO 2

So you can describe them MDC, MDIO, MDO.

Andrew