diff mbox series

[net-next,1/8] dt-bindings: net: dsa: dt bindings for microchip lan937x

Message ID 20210128064112.372883-2-prasanna.vengateshan@microchip.com
State New
Headers show
Series net: dsa: microchip: DSA driver support for LAN937x switch | expand

Commit Message

Prasanna Vengateshan Jan. 28, 2021, 6:41 a.m. UTC
Documentation in .yaml format and updates to the MAINTAINERS
Also 'make dt_binding_check' is passed

Signed-off-by: Prasanna Vengateshan <prasanna.vengateshan@microchip.com>
---
 .../bindings/net/dsa/microchip,lan937x.yaml   | 115 ++++++++++++++++++
 MAINTAINERS                                   |   1 +
 2 files changed, 116 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml

Comments

Vladimir Oltean Jan. 30, 2021, 2:02 a.m. UTC | #1
On Thu, Jan 28, 2021 at 12:11:05PM +0530, Prasanna Vengateshan wrote:
> +  spi-max-frequency:

> +    maximum: 50000000


And it actually works at 50 MHz? Cool.

> +

> +  reset-gpios:

> +    description: Optional gpio specifier for a reset line

> +    maxItems: 1

> +

> +required:

> +  - compatible

> +  - reg

> +

> +unevaluatedProperties: false

> +

> +examples:

> +  - |

> +    #include <dt-bindings/gpio/gpio.h>

> +

> +    //Ethernet switch connected via spi to the host, CPU port wired to eth1

> +    eth1 {


So if you do bother to add the DSA master in the example, can this be
&eth1 so that we could associate with the phandle below?

> +      #address-cells = <1>;

> +      #size-cells = <0>;

> +

> +      fixed-link {

> +        speed = <1000>;

> +        full-duplex;

> +      };

> +    };

> +

> +    spi1 {


Is this a label or a node name? spi1 or spi@1?

> +      #address-cells = <1>;

> +      #size-cells = <0>;

> +      pinctrl-0 = <&pinctrl_spi_ksz>;

> +      cs-gpios = <0>, <0>, <0>, <&pioC 28 0>;

> +      id = <1>;


I know this is the SPI controller and thus mostly irrelevant, but what
is "id = <1>"?

> +

> +      lan9374: switch@0 {

> +        compatible = "microchip,lan9374";

> +        reg = <0>;

> +

> +        spi-max-frequency = <44000000>;

> +

> +        ethernet-ports {

> +          #address-cells = <1>;

> +          #size-cells = <0>;

> +          port@0 {

> +            reg = <0>;

> +            label = "lan1";

> +          };

> +          port@1 {

> +            reg = <1>;

> +            label = "lan2";

> +          };

> +          port@2 {

> +            reg = <7>;


reg should match node index (port@2), here and everywhere below. As for
the net device labels, I'm not sure if the mismatch is deliberate there.

> +            label = "lan3";

> +          };

> +          port@3 {

> +            reg = <2>;

> +            label = "lan4";

> +          };

> +          port@4 {

> +            reg = <6>;

> +            label = "lan5";

> +          };

> +          port@5 {

> +            reg = <3>;

> +            label = "lan6";

> +          };

> +          port@6 {

> +            reg = <4>;

> +            label = "cpu";


label for CPU port is not needed/used.

> +            ethernet = <&eth1>;

> +            fixed-link {

> +              speed = <1000>;

> +              full-duplex;

> +            };

> +          };

> +          port@7 {

> +            reg = <5>;

> +            label = "lan7";

> +            fixed-link {

> +              speed = <1000>;

> +              full-duplex;

> +            };

> +          };

> +        };

> +      };

> +    };
Rob Herring (Arm) Feb. 9, 2021, 7:35 p.m. UTC | #2
On Thu, Jan 28, 2021 at 12:11:05PM +0530, Prasanna Vengateshan wrote:
> Documentation in .yaml format and updates to the MAINTAINERS

> Also 'make dt_binding_check' is passed

> 

> Signed-off-by: Prasanna Vengateshan <prasanna.vengateshan@microchip.com>

> ---

>  .../bindings/net/dsa/microchip,lan937x.yaml   | 115 ++++++++++++++++++

>  MAINTAINERS                                   |   1 +

>  2 files changed, 116 insertions(+)

>  create mode 100644 Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml

> 

> diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml

> new file mode 100644

> index 000000000000..8531ca603f13

> --- /dev/null

> +++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml

> @@ -0,0 +1,115 @@

> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

> +%YAML 1.2

> +---

> +$id: http://devicetree.org/schemas/net/dsa/microchip,lan937x.yaml#

> +$schema: http://devicetree.org/meta-schemas/core.yaml#

> +

> +title: LAN937x Ethernet Switch Series Tree Bindings

> +

> +maintainers:

> +  - woojung.huh@microchip.com

> +  - prasanna.vengateshan@microchip.com

> +

> +allOf:

> +  - $ref: dsa.yaml#

> +

> +properties:

> +  compatible:

> +    enum:

> +      - microchip,lan9370

> +      - microchip,lan9371

> +      - microchip,lan9372

> +      - microchip,lan9373

> +      - microchip,lan9374

> +

> +  reg:

> +    maxItems: 1

> +

> +  spi-max-frequency:

> +    maximum: 50000000

> +

> +  reset-gpios:

> +    description: Optional gpio specifier for a reset line

> +    maxItems: 1

> +

> +required:

> +  - compatible

> +  - reg

> +

> +unevaluatedProperties: false

> +

> +examples:

> +  - |

> +    #include <dt-bindings/gpio/gpio.h>

> +

> +    //Ethernet switch connected via spi to the host, CPU port wired to eth1

> +    eth1 {


ethernet {

> +      #address-cells = <1>;

> +      #size-cells = <0>;

> +

> +      fixed-link {

> +        speed = <1000>;

> +        full-duplex;

> +      };

> +    };

> +

> +    spi1 {


spi {

> +      #address-cells = <1>;

> +      #size-cells = <0>;


> +      pinctrl-0 = <&pinctrl_spi_ksz>;

> +      cs-gpios = <0>, <0>, <0>, <&pioC 28 0>;

> +      id = <1>;


These 3 are relevant to the example, drop

> +

> +      lan9374: switch@0 {

> +        compatible = "microchip,lan9374";

> +        reg = <0>;

> +

> +        spi-max-frequency = <44000000>;

> +

> +        ethernet-ports {

> +          #address-cells = <1>;

> +          #size-cells = <0>;

> +          port@0 {

> +            reg = <0>;

> +            label = "lan1";

> +          };

> +          port@1 {

> +            reg = <1>;

> +            label = "lan2";

> +          };

> +          port@2 {

> +            reg = <7>;

> +            label = "lan3";

> +          };

> +          port@3 {

> +            reg = <2>;

> +            label = "lan4";

> +          };

> +          port@4 {

> +            reg = <6>;

> +            label = "lan5";

> +          };

> +          port@5 {

> +            reg = <3>;

> +            label = "lan6";

> +          };

> +          port@6 {

> +            reg = <4>;

> +            label = "cpu";

> +            ethernet = <&eth1>;

> +            fixed-link {

> +              speed = <1000>;

> +              full-duplex;

> +            };

> +          };

> +          port@7 {

> +            reg = <5>;

> +            label = "lan7";

> +            fixed-link {

> +              speed = <1000>;

> +              full-duplex;

> +            };

> +          };

> +        };

> +      };

> +    };

> diff --git a/MAINTAINERS b/MAINTAINERS

> index 650deb973913..455670f37231 100644

> --- a/MAINTAINERS

> +++ b/MAINTAINERS

> @@ -11688,6 +11688,7 @@ M:	UNGLinuxDriver@microchip.com

>  L:	netdev@vger.kernel.org

>  S:	Maintained

>  F:	Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml

> +F:	Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml

>  F:	drivers/net/dsa/microchip/*

>  F:	include/linux/platform_data/microchip-ksz.h

>  F:	net/dsa/tag_ksz.c

> -- 

> 2.25.1

>
Prasanna Vengateshan Feb. 10, 2021, 11:46 a.m. UTC | #3
On Sat, 2021-01-30 at 04:02 +0200, Vladimir Oltean wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you

> know the content is safe

> 

Thanks for your time on reviewing the patch series.

> On Thu, Jan 28, 2021 at 12:11:05PM +0530, Prasanna Vengateshan wrote:

> > +  spi-max-frequency:

> > +    maximum: 50000000

> 

> And it actually works at 50 MHz? Cool.

Yes.

> 

> > +

> > +  reset-gpios:

> > +    description: Optional gpio specifier for a reset line

> > +    maxItems: 1

> > +

> > +required:

> > +  - compatible

> > +  - reg

> > +

> > +unevaluatedProperties: false

> > +

> > +examples:

> > +  - |

> > +    #include <dt-bindings/gpio/gpio.h>

> > +

> > +    //Ethernet switch connected via spi to the host, CPU port

> > wired to eth1

> > +    eth1 {

> 

> So if you do bother to add the DSA master in the example, can this be

> &eth1 so that we could associate with the phandle below?

Sure.

> 

> > +      #address-cells = <1>;

> > +      #size-cells = <0>;

> > +

> > +      fixed-link {

> > +        speed = <1000>;

> > +        full-duplex;

> > +      };

> > +    };

> > +

> > +    spi1 {

> 

> Is this a label or a node name? spi1 or spi@1?

This is a label.

> 

> > +      #address-cells = <1>;

> > +      #size-cells = <0>;

> > +      pinctrl-0 = <&pinctrl_spi_ksz>;

> > +      cs-gpios = <0>, <0>, <0>, <&pioC 28 0>;

> > +      id = <1>;

> 

> I know this is the SPI controller and thus mostly irrelevant, but

> what

> is "id = <1>"?

id is not needed, i will remove it.

> 

> > +

> > +      lan9374: switch@0 {

> > +        compatible = "microchip,lan9374";

> > +        reg = <0>;

> > +

> > +        spi-max-frequency = <44000000>;

> > +

> > +        ethernet-ports {

> > +          #address-cells = <1>;

> > +          #size-cells = <0>;

> > +          port@0 {

> > +            reg = <0>;

> > +            label = "lan1";

> > +          };

> > +          port@1 {

> > +            reg = <1>;

> > +            label = "lan2";

> > +          };

> > +          port@2 {

> > +            reg = <7>;

> 

> reg should match node index (port@2), here and everywhere below. As

> for

> the net device labels, I'm not sure if the mismatch is deliberate

> there.

reg & port node indexes are different here because to match with the
 physical to logical port mapping done in the LAN9374. I realized that
the description is missing and that is to be added. However, should reg
& port node index match for the net dev? 
If it should be the same, then the same can be acheived by renaming a
label (lanx) as well.

> 

> > +            label = "lan3";

> > +          };

> > +          port@3 {

> > +            reg = <2>;

> > +            label = "lan4";

> > +          };

> > +          port@4 {

> > +            reg = <6>;

> > +            label = "lan5";

> > +          };

> > +          port@5 {

> > +            reg = <3>;

> > +            label = "lan6";

> > +          };

> > +          port@6 {

> > +            reg = <4>;

> > +            label = "cpu";

> 

> label for CPU port is not needed/used.

Sure, will remove it.

> 

> > +            ethernet = <&eth1>;

> > +            fixed-link {

> > +              speed = <1000>;

> > +              full-duplex;

> > +            };

> > +          };

> > +          port@7 {

> > +            reg = <5>;

> > +            label = "lan7";

> > +            fixed-link {

> > +              speed = <1000>;

> > +              full-duplex;

> > +            };

> > +          };

> > +        };

> > +      };

> > +    };
Andrew Lunn Feb. 10, 2021, 6:57 p.m. UTC | #4
> > > +        ethernet-ports {

> > > +          #address-cells = <1>;

> > > +          #size-cells = <0>;

> > > +          port@0 {

> > > +            reg = <0>;

> > > +            label = "lan1";

> > > +          };

> > > +          port@1 {

> > > +            reg = <1>;

> > > +            label = "lan2";

> > > +          };

> > > +          port@2 {

> > > +            reg = <7>;

> > 

> > reg should match node index (port@2), here and everywhere below. As

> > for

> > the net device labels, I'm not sure if the mismatch is deliberate

> > there.

> reg & port node indexes are different here because to match with the

>  physical to logical port mapping done in the LAN9374. I realized that

> the description is missing and that is to be added. However, should reg

> & port node index match for the net dev? 

> If it should be the same, then the same can be acheived by renaming a

> label (lanx) as well.


The label should match whatever the text on the device case says. So
it is fine if port 2 says lan3 on the front panel. However, port@2
should have reg=<2>. Please change it to port@7. This is a generic DT
requirement, not specific to DSA.

       Andrew
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
new file mode 100644
index 000000000000..8531ca603f13
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
@@ -0,0 +1,115 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/dsa/microchip,lan937x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LAN937x Ethernet Switch Series Tree Bindings
+
+maintainers:
+  - woojung.huh@microchip.com
+  - prasanna.vengateshan@microchip.com
+
+allOf:
+  - $ref: dsa.yaml#
+
+properties:
+  compatible:
+    enum:
+      - microchip,lan9370
+      - microchip,lan9371
+      - microchip,lan9372
+      - microchip,lan9373
+      - microchip,lan9374
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 50000000
+
+  reset-gpios:
+    description: Optional gpio specifier for a reset line
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    //Ethernet switch connected via spi to the host, CPU port wired to eth1
+    eth1 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      fixed-link {
+        speed = <1000>;
+        full-duplex;
+      };
+    };
+
+    spi1 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      pinctrl-0 = <&pinctrl_spi_ksz>;
+      cs-gpios = <0>, <0>, <0>, <&pioC 28 0>;
+      id = <1>;
+
+      lan9374: switch@0 {
+        compatible = "microchip,lan9374";
+        reg = <0>;
+
+        spi-max-frequency = <44000000>;
+
+        ethernet-ports {
+          #address-cells = <1>;
+          #size-cells = <0>;
+          port@0 {
+            reg = <0>;
+            label = "lan1";
+          };
+          port@1 {
+            reg = <1>;
+            label = "lan2";
+          };
+          port@2 {
+            reg = <7>;
+            label = "lan3";
+          };
+          port@3 {
+            reg = <2>;
+            label = "lan4";
+          };
+          port@4 {
+            reg = <6>;
+            label = "lan5";
+          };
+          port@5 {
+            reg = <3>;
+            label = "lan6";
+          };
+          port@6 {
+            reg = <4>;
+            label = "cpu";
+            ethernet = <&eth1>;
+            fixed-link {
+              speed = <1000>;
+              full-duplex;
+            };
+          };
+          port@7 {
+            reg = <5>;
+            label = "lan7";
+            fixed-link {
+              speed = <1000>;
+              full-duplex;
+            };
+          };
+        };
+      };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 650deb973913..455670f37231 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11688,6 +11688,7 @@  M:	UNGLinuxDriver@microchip.com
 L:	netdev@vger.kernel.org
 S:	Maintained
 F:	Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
+F:	Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
 F:	drivers/net/dsa/microchip/*
 F:	include/linux/platform_data/microchip-ksz.h
 F:	net/dsa/tag_ksz.c