Skip to contentSkip to conversation

dt-bindings: dsa: lan9303: Add lan9303 yaml

PATCH Superseded Jerry Ray 2 participants 2 messages Sep 28, 2022

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jerry Ray

author
#0 lore raw

PATCH v3 1/1 dt-bindings: dsa: lan9303: Add lan9303 yaml

Adding the dt binding yaml for the lan9303 3-port ethernet switch. The microchip lan9354 3-port ethernet switch will also use the same binding.

---
v2->v3:
- removed cpu labels
- now patching against latest net-next
v1->v2:
- fixed dt_binding_check warning
- added max-speed setting on the switches 10/100 ports.

---
 .../devicetree/bindings/net/dsa/lan9303.txt   |  99 +-------------
 .../bindings/net/dsa/microchip,lan9303.yaml   | 129 ++++++++++++++++++
 MAINTAINERS                                   |   8 ++
 3 files changed, 139 insertions(+), 97 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml
Documentation/devicetree/bindings/net/dsa/lan9303.txt +2 -97
index 46a732087f5c..8c8fedd1f00e 100644
@@ -1,100 +1,5 @@
 SMSC/MicroChip LAN9303 three port ethernet switch
 -------------------------------------------------
 
-Required properties:
-
-- compatible: should be
-  - "smsc,lan9303-i2c" for I2C managed mode
-    or
-  - "smsc,lan9303-mdio" for mdio managed mode
-
-Optional properties:
-
-- reset-gpios: GPIO to be used to reset the whole device
-- reset-duration: reset duration in milliseconds, defaults to 200 ms
-
-Subnodes:
-
-The integrated switch subnode should be specified according to the binding
-described in dsa/dsa.txt. The CPU port of this switch is always port 0.
-
-Note: always use 'reg = <0/1/2>;' for the three DSA ports, even if the device is
-configured to use 1/2/3 instead. This hardware configuration will be
-auto-detected and mapped accordingly.
-
-Example:
-
-I2C managed mode:
-
-	master: masterdevice@X {
-
-		fixed-link { /* RMII fixed link to LAN9303 */
-			speed = <100>;
-			full-duplex;
-		};
-	};
-
-	switch: switch@a {
-		compatible = "smsc,lan9303-i2c";
-		reg = <0xa>;
-		reset-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
-		reset-duration = <200>;
-
-		ports {
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			port@0 { /* RMII fixed link to master */
-				reg = <0>;
-				ethernet = <&master>;
-			};
-
-			port@1 { /* external port 1 */
-				reg = <1>;
-				label = "lan1";
-			};
-
-			port@2 { /* external port 2 */
-				reg = <2>;
-				label = "lan2";
-			};
-		};
-	};
-
-MDIO managed mode:
-
-	master: masterdevice@X {
-		phy-handle = <&switch>;
-
-		mdio {
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			switch: switch-phy@0 {
-				compatible = "smsc,lan9303-mdio";
-				reg = <0>;
-				reset-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
-				reset-duration = <100>;
-
-				ports {
-					#address-cells = <1>;
-					#size-cells = <0>;
-
-					port@0 {
-						reg = <0>;
-						ethernet = <&master>;
-					};
-
-					port@1 { /* external port 1 */
-						reg = <1>;
-						label = "lan1";
-					};
-
-					port@2 { /* external port 2 */
-						reg = <2>;
-						label = "lan2";
-					};
-				};
-			};
-		};
-	};
+See Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml for the
+device tree documentation covering the LAN9303 and LAN9354 devices.
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +129 -0

129 lines not on this page · raw message

MAINTAINERS +8 -0
index 5d58b55c5ae5..89055ff2838a 100644
@@ -13386,6 +13386,14 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/microchip/lan743x_*
 
+MICROCHIP LAN9303/LAN9354 ETHERNET SWITCH DRIVER
+M:	Jerry Ray <[email protected]>
+M:	[email protected]
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml
+F:	drivers/net/dsa/lan9303*
+
 MICROCHIP LAN966X ETHERNET DRIVER
 M:	Horatiu Vultur <[email protected]>
 M:	[email protected]
Signature · 1 line
2.25.1
#1 lore raw
Quoted 24 lines · Jerry Ray

Adding the dt binding yaml for the lan9303 3-port ethernet switch. The microchip lan9354 3-port ethernet switch will also use the same binding.

---
v2->v3:
- removed cpu labels
- now patching against latest net-next
v1->v2:
- fixed dt_binding_check warning
- added max-speed setting on the switches 10/100 ports.

---
 .../devicetree/bindings/net/dsa/lan9303.txt   |  99 +-------------
 .../bindings/net/dsa/microchip,lan9303.yaml   | 129 ++++++++++++++++++
 MAINTAINERS                                   |   8 ++
 3 files changed, 139 insertions(+), 97 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml
Documentation/devicetree/bindings/net/dsa/lan9303.txt +0 -0
index 46a732087f5c..8c8fedd1f00e 100644

Documentation/devicetree/bindings/net/dsa/lan9303.txt line 2

Quoted 2 lines
Documentation/devicetree/bindings/net/dsa/lan9303.txt +0 -0
@@ -1,100 +1,5 @@
 SMSC/MicroChip LAN9303 three port ethernet switch
 -------------------------------------------------

Old file should be entirely removed.

Quoted 90 lines
Documentation/devicetree/bindings/net/dsa/lan9303.txt +0 -89
-Required properties:
-
-- compatible: should be
-  - "smsc,lan9303-i2c" for I2C managed mode
-    or
-  - "smsc,lan9303-mdio" for mdio managed mode
-
-Optional properties:
-
-- reset-gpios: GPIO to be used to reset the whole device
-- reset-duration: reset duration in milliseconds, defaults to 200 ms
-
-Subnodes:
-
-The integrated switch subnode should be specified according to the binding
-described in dsa/dsa.txt. The CPU port of this switch is always port 0.
-
-Note: always use 'reg = <0/1/2>;' for the three DSA ports, even if the device is
-configured to use 1/2/3 instead. This hardware configuration will be
-auto-detected and mapped accordingly.
-
-Example:
-
-I2C managed mode:
-
-	master: masterdevice@X {
-
-		fixed-link { /* RMII fixed link to LAN9303 */
-			speed = <100>;
-			full-duplex;
-		};
-	};
-
-	switch: switch@a {
-		compatible = "smsc,lan9303-i2c";
-		reg = <0xa>;
-		reset-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
-		reset-duration = <200>;
-
-		ports {
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			port@0 { /* RMII fixed link to master */
-				reg = <0>;
-				ethernet = <&master>;
-			};
-
-			port@1 { /* external port 1 */
-				reg = <1>;
-				label = "lan1";
-			};
-
-			port@2 { /* external port 2 */
-				reg = <2>;
-				label = "lan2";
-			};
-		};
-	};
-
-MDIO managed mode:
-
-	master: masterdevice@X {
-		phy-handle = <&switch>;
-
-		mdio {
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			switch: switch-phy@0 {
-				compatible = "smsc,lan9303-mdio";
-				reg = <0>;
-				reset-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
-				reset-duration = <100>;
-
-				ports {
-					#address-cells = <1>;
-					#size-cells = <0>;
-
-					port@0 {
-						reg = <0>;
-						ethernet = <&master>;
-					};
-
-					port@1 { /* external port 1 */
-						reg = <1>;
-						label = "lan1";
-					};
-

Documentation/devicetree/bindings/net/dsa/lan9303.txt line 5

Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/lan9303.txt +2 -8
-					port@2 { /* external port 2 */
-						reg = <2>;
-						label = "lan2";
-					};
-				};
-			};
-		};
-	};
+See Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml for the
+device tree documentation covering the LAN9303 and LAN9354 devices.

No, just remove it.

Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml line 7

Quoted 13 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +7 -0
new file mode 100644
index 000000000000..818770092a2c
@@ -0,0 +1,129 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/dsa/microchip,lan9303.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LAN9303 Ethernet Switch Series Tree Bindings

Drop "Tree Bindings"

Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml line 10

Quoted 3 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +3 -0
+
+allOf:
+  - $ref: "dsa.yaml#"

Drop quotes.

Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml line 22

Quoted 12 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +12 -0
+
+maintainers:
+  - [email protected]
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - smsc,lan9303-mdio
+          - microchip,lan9354-mdio
+      - enum:
+          - smsc,lan9303-i2c

oneOf does not make sense. It's just one enum.

Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml line 28

Quoted 6 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +6 -0
+
+  reg:
+    maxItems: 1
+
+  reset-gpios:
+    description: Optional gpio specifier for a reset line

Drop "gpio specifier for a"

Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml line 32

Quoted 4 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +4 -0
+    maxItems: 1
+
+  reset-duration:
+    description: Reset duration in milliseconds, defaults to 200 ms

This does not look like standard type or unit suffix, so you need here type. Don't you have warnings for this?

default: 200

Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml line 44

Quoted 12 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +12 -0
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    //Ethernet switch connected via mdio to the host

Missing space before comments. Use Linux style comments, not your own.

Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml line 45

Quoted 1 line
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +1 -0
+    ethernet0 {

Drop "0".

Quoted 5 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +5 -0
+        #address-cells = <1>;
+        #size-cells = <0>;
+        phy-handle = <&lan9303switch>;
+        phy-mode = "rmii";
+        fixed-link {

Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml line 60

Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +10 -0
+            speed = <100>;
+            full-duplex;
+        };
+        mdio {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            lan9303switch: switch@0 {
+                compatible = "smsc,lan9303-mdio";
+                dsa,member = <0 0>;
+                reg = <0>;

reg goes after compatible.

Quoted 19 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +19 -0
+                ethernet-ports {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+                        port@0 {
+                            reg = <0>;
+                            phy-mode = "rmii";
+                            ethernet = <&ethernet>;
+                            fixed-link {
+                                speed = <100>;
+                                full-duplex;
+                            };
+                        };
+                        port@1 {
+                            reg = <1>;
+                            max-speed = <100>;
+                            label = "lan1";
+                        };
+                        port@2 {
+                            reg = <2>;

Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml line 89

Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/microchip,lan9303.yaml new file +10 -0
+                            max-speed = <100>;
+                            label = "lan2";
+                        };
+                    };
+                };
+            };
+        };
+
+    //Ethernet switch connected via i2c to the host
+    ethernet1 {

Just ethernet (and make it a second example)

Best regards,
Krzysztof