linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] dt-bindings: net: Convert mdio-gpio to yaml
@ 2021-04-30 18:29 Corentin Labbe
  2021-04-30 21:53 ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Corentin Labbe @ 2021-04-30 18:29 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, robh+dt
  Cc: devicetree, linux-kernel, netdev, Corentin Labbe

Converts net/mdio-gpio.txt to yaml

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
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

diff --git a/Documentation/devicetree/bindings/net/mdio-gpio.txt b/Documentation/devicetree/bindings/net/mdio-gpio.txt
deleted file mode 100644
index 4d91a36c5cf5..000000000000
--- a/Documentation/devicetree/bindings/net/mdio-gpio.txt
+++ /dev/null
@@ -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>;
-};
diff --git a/Documentation/devicetree/bindings/net/mdio-gpio.yaml b/Documentation/devicetree/bindings/net/mdio-gpio.yaml
new file mode 100644
index 000000000000..183cf248d597
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/mdio-gpio.yaml
@@ -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 <andrew@lunn.ch>
+  - Florian Fainelli <f.fainelli@gmail.com>
+  - Heiner Kallweit <hkallweit1@gmail.com>
+
+allOf:
+  - $ref: "mdio.yaml#"
+
+properties:
+  compatible:
+    enum:
+      - virtual,mdio-gpio
+      - microchip,mdio-smi0
+
+  "#address-cells":
+    const: 1
+
+  "#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.
+
+#Note: Each gpio-mdio bus should have an alias correctly numbered in "aliases"
+#node.
+unevaluatedProperties: false
+
+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>;
+      };
+    };
+...
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] dt-bindings: net: Convert mdio-gpio to yaml
  2021-04-30 18:29 [PATCH v3] dt-bindings: net: Convert mdio-gpio to yaml Corentin Labbe
@ 2021-04-30 21:53 ` Rob Herring
  2021-05-03  6:20   ` LABBE Corentin
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring @ 2021-04-30 21:53 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: andrew, hkallweit1, linux, devicetree, linux-kernel, netdev

On Fri, Apr 30, 2021 at 06:29:41PM +0000, Corentin Labbe wrote:
> Converts net/mdio-gpio.txt to yaml
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
> 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
> 
> diff --git a/Documentation/devicetree/bindings/net/mdio-gpio.txt b/Documentation/devicetree/bindings/net/mdio-gpio.txt
> deleted file mode 100644
> index 4d91a36c5cf5..000000000000
> --- a/Documentation/devicetree/bindings/net/mdio-gpio.txt
> +++ /dev/null
> @@ -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>;
> -};
> diff --git a/Documentation/devicetree/bindings/net/mdio-gpio.yaml b/Documentation/devicetree/bindings/net/mdio-gpio.yaml
> new file mode 100644
> index 000000000000..183cf248d597
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/mdio-gpio.yaml
> @@ -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 <andrew@lunn.ch>
> +  - Florian Fainelli <f.fainelli@gmail.com>
> +  - Heiner Kallweit <hkallweit1@gmail.com>
> +
> +allOf:
> +  - $ref: "mdio.yaml#"
> +
> +properties:
> +  compatible:
> +    enum:
> +      - virtual,mdio-gpio
> +      - microchip,mdio-smi0
> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#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

> +
> +#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.

> +
> +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>;
> +      };
> +    };
> +...
> -- 
> 2.26.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] dt-bindings: net: Convert mdio-gpio to yaml
  2021-04-30 21:53 ` Rob Herring
@ 2021-05-03  6:20   ` LABBE Corentin
  2021-05-03 12:14     ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: LABBE Corentin @ 2021-05-03  6:20 UTC (permalink / raw)
  To: Rob Herring, andrew; +Cc: hkallweit1, linux, devicetree, linux-kernel, netdev

Le Fri, Apr 30, 2021 at 04:53:25PM -0500, Rob Herring a écrit :
> On Fri, Apr 30, 2021 at 06:29:41PM +0000, Corentin Labbe wrote:
> > Converts net/mdio-gpio.txt to yaml
> > 
> > Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> > Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> > ---
> > 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
> > 
> > diff --git a/Documentation/devicetree/bindings/net/mdio-gpio.txt b/Documentation/devicetree/bindings/net/mdio-gpio.txt
> > deleted file mode 100644
> > index 4d91a36c5cf5..000000000000
> > --- a/Documentation/devicetree/bindings/net/mdio-gpio.txt
> > +++ /dev/null
> > @@ -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>;
> > -};
> > diff --git a/Documentation/devicetree/bindings/net/mdio-gpio.yaml b/Documentation/devicetree/bindings/net/mdio-gpio.yaml
> > new file mode 100644
> > index 000000000000..183cf248d597
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/mdio-gpio.yaml
> > @@ -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 <andrew@lunn.ch>
> > +  - Florian Fainelli <f.fainelli@gmail.com>
> > +  - Heiner Kallweit <hkallweit1@gmail.com>
> > +
> > +allOf:
> > +  - $ref: "mdio.yaml#"
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - virtual,mdio-gpio
> > +      - microchip,mdio-smi0
> > +
> > +  "#address-cells":
> > +    const: 1
> > +
> > +  "#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.
> 

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


> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] dt-bindings: net: Convert mdio-gpio to yaml
  2021-05-03  6:20   ` LABBE Corentin
@ 2021-05-03 12:14     ` Andrew Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2021-05-03 12:14 UTC (permalink / raw)
  To: LABBE Corentin
  Cc: Rob Herring, hkallweit1, linux, devicetree, linux-kernel, netdev

> > 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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-03 12:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 18:29 [PATCH v3] dt-bindings: net: Convert mdio-gpio to yaml Corentin Labbe
2021-04-30 21:53 ` Rob Herring
2021-05-03  6:20   ` LABBE Corentin
2021-05-03 12:14     ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).