All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] completely rework mediatek,mt7530 binding
@ 2022-08-13 15:44 ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Hello.

This patch series brings complete rework of the mediatek,mt7530 binding.

The binding is checked with "make dt_binding_check
DT_SCHEMA_FILES=mediatek,mt7530.yaml".

If anyone knows the GIC bit for interrupt for multi-chip module MT7530 in
MT7623AI SoC, let me know. I'll add it to the examples.

If anyone got a Unielec U7623 or another MT7623AI board, please reach out.

v2:
- Change the way of adding descriptions for each compatible string.
- Split the patch for updating the json-schema.
- Make slight changes on the patch for the binding description.

Arınç ÜNAL (7):
  dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
  dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
  dt-bindings: net: dsa: mediatek,mt7530: update examples
  dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
  dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
  dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
  dt-bindings: net: dsa: mediatek,mt7530: update binding description

 .../bindings/net/dsa/mediatek,mt7530.yaml       | 1017 +++++++++++++-----
 1 file changed, 767 insertions(+), 250 deletions(-)



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

* [PATCH v2 0/7] completely rework mediatek,mt7530 binding
@ 2022-08-13 15:44 ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Hello.

This patch series brings complete rework of the mediatek,mt7530 binding.

The binding is checked with "make dt_binding_check
DT_SCHEMA_FILES=mediatek,mt7530.yaml".

If anyone knows the GIC bit for interrupt for multi-chip module MT7530 in
MT7623AI SoC, let me know. I'll add it to the examples.

If anyone got a Unielec U7623 or another MT7623AI board, please reach out.

v2:
- Change the way of adding descriptions for each compatible string.
- Split the patch for updating the json-schema.
- Make slight changes on the patch for the binding description.

Arınç ÜNAL (7):
  dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
  dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
  dt-bindings: net: dsa: mediatek,mt7530: update examples
  dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
  dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
  dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
  dt-bindings: net: dsa: mediatek,mt7530: update binding description

 .../bindings/net/dsa/mediatek,mt7530.yaml       | 1017 +++++++++++++-----
 1 file changed, 767 insertions(+), 250 deletions(-)



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 1/7] dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
  2022-08-13 15:44 ` Arınç ÜNAL
@ 2022-08-13 15:44   ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Make trivial changes on the binding.

- Update title to include MT7531 switch.
- Add me as a maintainer. List maintainers in alphabetical order by first
name.
- Add description to compatible strings.
- Stretch descriptions up to the 80 character limit.
- Remove quotes from $ref: "dsa.yaml#".

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 36 ++++++++++++-------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 17ab6c69ecc7..edf48e917173 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -4,12 +4,13 @@
 $id: http://devicetree.org/schemas/net/dsa/mediatek,mt7530.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Mediatek MT7530 Ethernet switch
+title: Mediatek MT7530 and MT7531 Ethernet Switches
 
 maintainers:
-  - Sean Wang <sean.wang@mediatek.com>
+  - Arınç ÜNAL <arinc.unal@arinc9.com>
   - Landen Chao <Landen.Chao@mediatek.com>
   - DENG Qingfang <dqfext@gmail.com>
+  - Sean Wang <sean.wang@mediatek.com>
 
 description: |
   Port 5 of mt7530 and mt7621 switch is muxed between:
@@ -61,10 +62,21 @@ description: |
 
 properties:
   compatible:
-    enum:
-      - mediatek,mt7530
-      - mediatek,mt7531
-      - mediatek,mt7621
+    oneOf:
+      - description:
+          Standalone MT7530 and multi-chip module MT7530 in MT7623AI SoC
+        items:
+          - const: mediatek,mt7530
+
+      - description:
+          Standalone MT7531
+        items:
+          - const: mediatek,mt7531
+
+      - description:
+          Multi-chip module MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
+        items:
+          - const: mediatek,mt7621
 
   reg:
     maxItems: 1
@@ -79,7 +91,7 @@ properties:
   gpio-controller:
     type: boolean
     description:
-      if defined, MT7530's LED controller will run on GPIO mode.
+      If defined, MT7530's LED controller will run on GPIO mode.
 
   "#interrupt-cells":
     const: 1
@@ -92,8 +104,8 @@ properties:
   io-supply:
     description:
       Phandle to the regulator node necessary for the I/O power.
-      See Documentation/devicetree/bindings/regulator/mt6323-regulator.txt
-      for details for the regulator setup on these boards.
+      See Documentation/devicetree/bindings/regulator/mt6323-regulator.txt for
+      details for the regulator setup on these boards.
 
   mediatek,mcm:
     type: boolean
@@ -110,8 +122,8 @@ properties:
 
   resets:
     description:
-      Phandle pointing to the system reset controller with line index for
-      the ethsys.
+      Phandle pointing to the system reset controller with line index for the
+      ethsys.
     maxItems: 1
 
 patternProperties:
@@ -148,7 +160,7 @@ required:
   - reg
 
 allOf:
-  - $ref: "dsa.yaml#"
+  - $ref: dsa.yaml#
   - if:
       required:
         - mediatek,mcm
-- 
2.34.1


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

* [PATCH v2 1/7] dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
@ 2022-08-13 15:44   ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Make trivial changes on the binding.

- Update title to include MT7531 switch.
- Add me as a maintainer. List maintainers in alphabetical order by first
name.
- Add description to compatible strings.
- Stretch descriptions up to the 80 character limit.
- Remove quotes from $ref: "dsa.yaml#".

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 36 ++++++++++++-------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 17ab6c69ecc7..edf48e917173 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -4,12 +4,13 @@
 $id: http://devicetree.org/schemas/net/dsa/mediatek,mt7530.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Mediatek MT7530 Ethernet switch
+title: Mediatek MT7530 and MT7531 Ethernet Switches
 
 maintainers:
-  - Sean Wang <sean.wang@mediatek.com>
+  - Arınç ÜNAL <arinc.unal@arinc9.com>
   - Landen Chao <Landen.Chao@mediatek.com>
   - DENG Qingfang <dqfext@gmail.com>
+  - Sean Wang <sean.wang@mediatek.com>
 
 description: |
   Port 5 of mt7530 and mt7621 switch is muxed between:
@@ -61,10 +62,21 @@ description: |
 
 properties:
   compatible:
-    enum:
-      - mediatek,mt7530
-      - mediatek,mt7531
-      - mediatek,mt7621
+    oneOf:
+      - description:
+          Standalone MT7530 and multi-chip module MT7530 in MT7623AI SoC
+        items:
+          - const: mediatek,mt7530
+
+      - description:
+          Standalone MT7531
+        items:
+          - const: mediatek,mt7531
+
+      - description:
+          Multi-chip module MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
+        items:
+          - const: mediatek,mt7621
 
   reg:
     maxItems: 1
@@ -79,7 +91,7 @@ properties:
   gpio-controller:
     type: boolean
     description:
-      if defined, MT7530's LED controller will run on GPIO mode.
+      If defined, MT7530's LED controller will run on GPIO mode.
 
   "#interrupt-cells":
     const: 1
@@ -92,8 +104,8 @@ properties:
   io-supply:
     description:
       Phandle to the regulator node necessary for the I/O power.
-      See Documentation/devicetree/bindings/regulator/mt6323-regulator.txt
-      for details for the regulator setup on these boards.
+      See Documentation/devicetree/bindings/regulator/mt6323-regulator.txt for
+      details for the regulator setup on these boards.
 
   mediatek,mcm:
     type: boolean
@@ -110,8 +122,8 @@ properties:
 
   resets:
     description:
-      Phandle pointing to the system reset controller with line index for
-      the ethsys.
+      Phandle pointing to the system reset controller with line index for the
+      ethsys.
     maxItems: 1
 
 patternProperties:
@@ -148,7 +160,7 @@ required:
   - reg
 
 allOf:
-  - $ref: "dsa.yaml#"
+  - $ref: dsa.yaml#
   - if:
       required:
         - mediatek,mcm
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 2/7] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
  2022-08-13 15:44 ` Arınç ÜNAL
@ 2022-08-13 15:44   ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

- Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
- Add description for reset-gpios.
- Invalidate reset-gpios if mediatek,mcm is used.
- Invalidate mediatek,mcm if the compatible device is mediatek,mt7531.
- Require mediatek,mcm for the described MT7621 SoCs as the compatible
string is only used for MT7530 which is a part of the multi-chip module.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 31 +++++++++++++++++--
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index edf48e917173..4c99266ce82a 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -110,11 +110,15 @@ properties:
   mediatek,mcm:
     type: boolean
     description:
-      if defined, indicates that either MT7530 is the part on multi-chip
-      module belong to MT7623A has or the remotely standalone chip as the
-      function MT7623N reference board provided for.
+      Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530
+      switch is a part of the multi-chip module.
 
   reset-gpios:
+    description:
+      GPIO to reset the switch. Use this if mediatek,mcm is not used.
+      This property is optional because some boards share the reset line with
+      other components which makes it impossible to probe the switch if the
+      reset line is used.
     maxItems: 1
 
   reset-names:
@@ -165,6 +169,9 @@ allOf:
       required:
         - mediatek,mcm
     then:
+      properties:
+        reset-gpios: false
+
       required:
         - resets
         - reset-names
@@ -182,6 +189,24 @@ allOf:
         - core-supply
         - io-supply
 
+  - if:
+      properties:
+        compatible:
+          items:
+            - const: mediatek,mt7531
+    then:
+      properties:
+        mediatek,mcm: false
+
+  - if:
+      properties:
+        compatible:
+          items:
+            - const: mediatek,mt7621
+    then:
+      required:
+        - mediatek,mcm
+
 unevaluatedProperties: false
 
 examples:
-- 
2.34.1


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

* [PATCH v2 2/7] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
@ 2022-08-13 15:44   ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

- Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
- Add description for reset-gpios.
- Invalidate reset-gpios if mediatek,mcm is used.
- Invalidate mediatek,mcm if the compatible device is mediatek,mt7531.
- Require mediatek,mcm for the described MT7621 SoCs as the compatible
string is only used for MT7530 which is a part of the multi-chip module.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 31 +++++++++++++++++--
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index edf48e917173..4c99266ce82a 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -110,11 +110,15 @@ properties:
   mediatek,mcm:
     type: boolean
     description:
-      if defined, indicates that either MT7530 is the part on multi-chip
-      module belong to MT7623A has or the remotely standalone chip as the
-      function MT7623N reference board provided for.
+      Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530
+      switch is a part of the multi-chip module.
 
   reset-gpios:
+    description:
+      GPIO to reset the switch. Use this if mediatek,mcm is not used.
+      This property is optional because some boards share the reset line with
+      other components which makes it impossible to probe the switch if the
+      reset line is used.
     maxItems: 1
 
   reset-names:
@@ -165,6 +169,9 @@ allOf:
       required:
         - mediatek,mcm
     then:
+      properties:
+        reset-gpios: false
+
       required:
         - resets
         - reset-names
@@ -182,6 +189,24 @@ allOf:
         - core-supply
         - io-supply
 
+  - if:
+      properties:
+        compatible:
+          items:
+            - const: mediatek,mt7531
+    then:
+      properties:
+        mediatek,mcm: false
+
+  - if:
+      properties:
+        compatible:
+          items:
+            - const: mediatek,mt7621
+    then:
+      required:
+        - mediatek,mcm
+
 unevaluatedProperties: false
 
 examples:
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 3/7] dt-bindings: net: dsa: mediatek,mt7530: update examples
  2022-08-13 15:44 ` Arınç ÜNAL
@ 2022-08-13 15:44   ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Update the examples on the binding.

- Add examples which include a wide variation of configurations.
- Make example comments YAML comment instead of DT binding comment.
- Define examples from platform to make the bindings clearer.
- Add interrupt controller to the examples. Include header file for
interrupt.
- Change reset line for MT7621 examples.
- Pretty formatting for the examples.
- Change switch reg to 0.
- Change port labels to fit the example, change port 4 label to wan.
- Change ethernet-ports to ports.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 663 +++++++++++++-----
 1 file changed, 502 insertions(+), 161 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 4c99266ce82a..cc87f48d4d07 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -210,144 +210,374 @@ allOf:
 unevaluatedProperties: false
 
 examples:
+  # Example 1: Standalone MT7530
   - |
     #include <dt-bindings/gpio/gpio.h>
-    mdio {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        switch@0 {
-            compatible = "mediatek,mt7530";
-            reg = <0>;
-
-            core-supply = <&mt6323_vpa_reg>;
-            io-supply = <&mt6323_vemc3v3_reg>;
-            reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
-
-            ethernet-ports {
+
+    platform {
+        ethernet {
+            mdio {
                 #address-cells = <1>;
                 #size-cells = <0>;
-                port@0 {
+
+                switch@0 {
+                    compatible = "mediatek,mt7530";
                     reg = <0>;
-                    label = "lan0";
-                };
 
-                port@1 {
-                    reg = <1>;
-                    label = "lan1";
-                };
+                    reset-gpios = <&pio 33 0>;
 
-                port@2 {
-                    reg = <2>;
-                    label = "lan2";
-                };
+                    core-supply = <&mt6323_vpa_reg>;
+                    io-supply = <&mt6323_vemc3v3_reg>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
 
-                port@3 {
-                    reg = <3>;
-                    label = "lan3";
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "rgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
+                    };
                 };
+            };
+        };
+    };
 
-                port@4 {
-                    reg = <4>;
-                    label = "wan";
+  # Example 2: MT7530 in MT7623AI SoC
+  - |
+    #include <dt-bindings/reset/mt2701-resets.h>
+
+    platform {
+        ethernet {
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                switch@0 {
+                    compatible = "mediatek,mt7530";
+                    reg = <0>;
+
+                    mediatek,mcm;
+                    resets = <&ethsys MT2701_ETHSYS_MCM_RST>;
+                    reset-names = "mcm";
+
+                    core-supply = <&mt6323_vpa_reg>;
+                    io-supply = <&mt6323_vemc3v3_reg>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
+                    };
                 };
+            };
+        };
+    };
+
+  # Example 3: Standalone MT7531
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    platform {
+        ethernet {
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                switch@0 {
+                    compatible = "mediatek,mt7531";
+                    reg = <0>;
+
+                    reset-gpios = <&pio 54 0>;
+
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&pio>;
+                    interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
 
-                port@6 {
-                    reg = <6>;
-                    label = "cpu";
-                    ethernet = <&gmac0>;
-                    phy-mode = "trgmii";
-                    fixed-link {
-                        speed = <1000>;
-                        full-duplex;
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "2500base-x";
+
+                            fixed-link {
+                                speed = <2500>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
                     };
                 };
             };
         };
     };
 
+  # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
   - |
-    //Example 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4.
-
-    ethernet {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        gmac0: mac@0 {
-            compatible = "mediatek,eth-mac";
-            reg = <0>;
-            phy-mode = "rgmii";
-
-            fixed-link {
-                speed = <1000>;
-                full-duplex;
-                pause;
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+    #include <dt-bindings/reset/mt7621-reset.h>
+
+    platform {
+        ethernet {
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                switch@0 {
+                    compatible = "mediatek,mt7621";
+                    reg = <0>;
+
+                    mediatek,mcm;
+                    resets = <&sysc MT7621_RST_MCM>;
+                    reset-names = "mcm";
+
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&gic>;
+                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
+                    };
+                };
             };
         };
+    };
 
-        gmac1: mac@1 {
-            compatible = "mediatek,eth-mac";
-            reg = <1>;
-            phy-mode = "rgmii-txid";
-            phy-handle = <&phy4>;
+  # Example 5: MT7621: mux MT7530's phy4 to SoC's gmac1
+  - |
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+    #include <dt-bindings/reset/mt7621-reset.h>
+
+    platform {
+        pinctrl {
+            example5_rgmii2_pins: rgmii2-pins {
+                pinmux {
+                    groups = "rgmii2";
+                    function = "rgmii2";
+                };
+            };
         };
 
-        mdio: mdio-bus {
+        ethernet {
             #address-cells = <1>;
             #size-cells = <0>;
 
-            /* Internal phy */
-            phy4: ethernet-phy@4 {
-                reg = <4>;
+            pinctrl-names = "default";
+            pinctrl-0 = <&example5_rgmii2_pins>;
+
+            mac@1 {
+                compatible = "mediatek,eth-mac";
+                reg = <1>;
+
+                phy-mode = "rgmii";
+                phy-handle = <&example5_ethphy4>;
             };
 
-            mt7530: switch@1f {
-                compatible = "mediatek,mt7621";
-                reg = <0x1f>;
-                mediatek,mcm;
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
 
-                resets = <&rstctrl 2>;
-                reset-names = "mcm";
+                /* MT7530's phy4 */
+                example5_ethphy4: ethernet-phy@4 {
+                    reg = <4>;
+                };
 
-                ethernet-ports {
-                    #address-cells = <1>;
-                    #size-cells = <0>;
+                switch@0 {
+                    compatible = "mediatek,mt7621";
+                    reg = <0>;
 
-                    port@0 {
-                        reg = <0>;
-                        label = "lan0";
-                    };
+                    mediatek,mcm;
+                    resets = <&sysc MT7621_RST_MCM>;
+                    reset-names = "mcm";
 
-                    port@1 {
-                        reg = <1>;
-                        label = "lan1";
-                    };
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&gic>;
+                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
 
-                    port@2 {
-                        reg = <2>;
-                        label = "lan2";
-                    };
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
 
-                    port@3 {
-                        reg = <3>;
-                        label = "lan3";
-                    };
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
 
-                    /* Commented out. Port 4 is handled by 2nd GMAC.
-                    port@4 {
-                        reg = <4>;
-                        label = "lan4";
-                    };
-                    */
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
 
-                    port@6 {
-                        reg = <6>;
-                        label = "cpu";
-                        ethernet = <&gmac0>;
-                        phy-mode = "rgmii";
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
 
-                        fixed-link {
-                            speed = <1000>;
-                            full-duplex;
-                            pause;
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        /* Commented out, phy4 is muxed to gmac1.
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+                        */
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
                         };
                     };
                 };
@@ -355,87 +585,198 @@ examples:
         };
     };
 
+  # Example 6: MT7621: mux external phy to SoC's gmac1
   - |
-    //Example 3: MT7621: Port 5 is connected to external PHY: Port 5 -> external PHY.
-
-    ethernet {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        gmac_0: mac@0 {
-            compatible = "mediatek,eth-mac";
-            reg = <0>;
-            phy-mode = "rgmii";
-
-            fixed-link {
-                speed = <1000>;
-                full-duplex;
-                pause;
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+    #include <dt-bindings/reset/mt7621-reset.h>
+
+    platform {
+        pinctrl {
+            example6_rgmii2_pins: rgmii2-pins {
+                pinmux {
+                    groups = "rgmii2";
+                    function = "rgmii2";
+                };
             };
         };
 
-        mdio0: mdio-bus {
+        ethernet {
             #address-cells = <1>;
             #size-cells = <0>;
 
-            /* External phy */
-            ephy5: ethernet-phy@7 {
-                reg = <7>;
+            pinctrl-names = "default";
+            pinctrl-0 = <&example6_rgmii2_pins>;
+
+            mac@1 {
+                compatible = "mediatek,eth-mac";
+                reg = <1>;
+
+                phy-mode = "rgmii";
+                phy-handle = <&example6_ethphy7>;
             };
 
-            switch@1f {
-                compatible = "mediatek,mt7621";
-                reg = <0x1f>;
-                mediatek,mcm;
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
 
-                resets = <&rstctrl 2>;
-                reset-names = "mcm";
+                /* External PHY */
+                example6_ethphy7: ethernet-phy@7 {
+                    reg = <7>;
+                    phy-mode = "rgmii";
+                };
 
-                ethernet-ports {
-                    #address-cells = <1>;
-                    #size-cells = <0>;
+                switch@0 {
+                    compatible = "mediatek,mt7621";
+                    reg = <0>;
 
-                    port@0 {
-                        reg = <0>;
-                        label = "lan0";
-                    };
+                    mediatek,mcm;
+                    resets = <&sysc MT7621_RST_MCM>;
+                    reset-names = "mcm";
 
-                    port@1 {
-                        reg = <1>;
-                        label = "lan1";
-                    };
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&gic>;
+                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
 
-                    port@2 {
-                        reg = <2>;
-                        label = "lan2";
-                    };
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
 
-                    port@3 {
-                        reg = <3>;
-                        label = "lan3";
-                    };
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
 
-                    port@4 {
-                        reg = <4>;
-                        label = "lan4";
-                    };
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
 
-                    port@5 {
-                        reg = <5>;
-                        label = "lan5";
-                        phy-mode = "rgmii";
-                        phy-handle = <&ephy5>;
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
                     };
+                };
+            };
+        };
+    };
+
+  # Example 7: MT7621: mux external phy to MT7530's port 5
+  - |
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+    #include <dt-bindings/reset/mt7621-reset.h>
+
+    platform {
+        pinctrl {
+            example7_rgmii2_pins: rgmii2-pins {
+                pinmux {
+                    groups = "rgmii2";
+                    function = "gpio";
+                };
+            };
+        };
+
+        ethernet {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            pinctrl-names = "default";
+            pinctrl-0 = <&example7_rgmii2_pins>;
 
-                    cpu_port0: port@6 {
-                        reg = <6>;
-                        label = "cpu";
-                        ethernet = <&gmac_0>;
-                        phy-mode = "rgmii";
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                /* External PHY */
+                example7_ethphy7: ethernet-phy@7 {
+                    reg = <7>;
+                    phy-mode = "rgmii";
+                };
+
+                switch@0 {
+                    compatible = "mediatek,mt7621";
+                    reg = <0>;
+
+                    mediatek,mcm;
+                    resets = <&sysc MT7621_RST_MCM>;
+                    reset-names = "mcm";
+
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&gic>;
+                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@5 {
+                            reg = <5>;
+                            label = "extphy";
+                            phy-mode = "rgmii-txid";
+                            phy-handle = <&example7_ethphy7>;
+                        };
 
-                        fixed-link {
-                            speed = <1000>;
-                            full-duplex;
-                            pause;
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
                         };
                     };
                 };
-- 
2.34.1


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

* [PATCH v2 3/7] dt-bindings: net: dsa: mediatek,mt7530: update examples
@ 2022-08-13 15:44   ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Update the examples on the binding.

- Add examples which include a wide variation of configurations.
- Make example comments YAML comment instead of DT binding comment.
- Define examples from platform to make the bindings clearer.
- Add interrupt controller to the examples. Include header file for
interrupt.
- Change reset line for MT7621 examples.
- Pretty formatting for the examples.
- Change switch reg to 0.
- Change port labels to fit the example, change port 4 label to wan.
- Change ethernet-ports to ports.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 663 +++++++++++++-----
 1 file changed, 502 insertions(+), 161 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 4c99266ce82a..cc87f48d4d07 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -210,144 +210,374 @@ allOf:
 unevaluatedProperties: false
 
 examples:
+  # Example 1: Standalone MT7530
   - |
     #include <dt-bindings/gpio/gpio.h>
-    mdio {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        switch@0 {
-            compatible = "mediatek,mt7530";
-            reg = <0>;
-
-            core-supply = <&mt6323_vpa_reg>;
-            io-supply = <&mt6323_vemc3v3_reg>;
-            reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
-
-            ethernet-ports {
+
+    platform {
+        ethernet {
+            mdio {
                 #address-cells = <1>;
                 #size-cells = <0>;
-                port@0 {
+
+                switch@0 {
+                    compatible = "mediatek,mt7530";
                     reg = <0>;
-                    label = "lan0";
-                };
 
-                port@1 {
-                    reg = <1>;
-                    label = "lan1";
-                };
+                    reset-gpios = <&pio 33 0>;
 
-                port@2 {
-                    reg = <2>;
-                    label = "lan2";
-                };
+                    core-supply = <&mt6323_vpa_reg>;
+                    io-supply = <&mt6323_vemc3v3_reg>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
 
-                port@3 {
-                    reg = <3>;
-                    label = "lan3";
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "rgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
+                    };
                 };
+            };
+        };
+    };
 
-                port@4 {
-                    reg = <4>;
-                    label = "wan";
+  # Example 2: MT7530 in MT7623AI SoC
+  - |
+    #include <dt-bindings/reset/mt2701-resets.h>
+
+    platform {
+        ethernet {
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                switch@0 {
+                    compatible = "mediatek,mt7530";
+                    reg = <0>;
+
+                    mediatek,mcm;
+                    resets = <&ethsys MT2701_ETHSYS_MCM_RST>;
+                    reset-names = "mcm";
+
+                    core-supply = <&mt6323_vpa_reg>;
+                    io-supply = <&mt6323_vemc3v3_reg>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
+                    };
                 };
+            };
+        };
+    };
+
+  # Example 3: Standalone MT7531
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    platform {
+        ethernet {
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                switch@0 {
+                    compatible = "mediatek,mt7531";
+                    reg = <0>;
+
+                    reset-gpios = <&pio 54 0>;
+
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&pio>;
+                    interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
 
-                port@6 {
-                    reg = <6>;
-                    label = "cpu";
-                    ethernet = <&gmac0>;
-                    phy-mode = "trgmii";
-                    fixed-link {
-                        speed = <1000>;
-                        full-duplex;
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "2500base-x";
+
+                            fixed-link {
+                                speed = <2500>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
                     };
                 };
             };
         };
     };
 
+  # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
   - |
-    //Example 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4.
-
-    ethernet {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        gmac0: mac@0 {
-            compatible = "mediatek,eth-mac";
-            reg = <0>;
-            phy-mode = "rgmii";
-
-            fixed-link {
-                speed = <1000>;
-                full-duplex;
-                pause;
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+    #include <dt-bindings/reset/mt7621-reset.h>
+
+    platform {
+        ethernet {
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                switch@0 {
+                    compatible = "mediatek,mt7621";
+                    reg = <0>;
+
+                    mediatek,mcm;
+                    resets = <&sysc MT7621_RST_MCM>;
+                    reset-names = "mcm";
+
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&gic>;
+                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
+                    };
+                };
             };
         };
+    };
 
-        gmac1: mac@1 {
-            compatible = "mediatek,eth-mac";
-            reg = <1>;
-            phy-mode = "rgmii-txid";
-            phy-handle = <&phy4>;
+  # Example 5: MT7621: mux MT7530's phy4 to SoC's gmac1
+  - |
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+    #include <dt-bindings/reset/mt7621-reset.h>
+
+    platform {
+        pinctrl {
+            example5_rgmii2_pins: rgmii2-pins {
+                pinmux {
+                    groups = "rgmii2";
+                    function = "rgmii2";
+                };
+            };
         };
 
-        mdio: mdio-bus {
+        ethernet {
             #address-cells = <1>;
             #size-cells = <0>;
 
-            /* Internal phy */
-            phy4: ethernet-phy@4 {
-                reg = <4>;
+            pinctrl-names = "default";
+            pinctrl-0 = <&example5_rgmii2_pins>;
+
+            mac@1 {
+                compatible = "mediatek,eth-mac";
+                reg = <1>;
+
+                phy-mode = "rgmii";
+                phy-handle = <&example5_ethphy4>;
             };
 
-            mt7530: switch@1f {
-                compatible = "mediatek,mt7621";
-                reg = <0x1f>;
-                mediatek,mcm;
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
 
-                resets = <&rstctrl 2>;
-                reset-names = "mcm";
+                /* MT7530's phy4 */
+                example5_ethphy4: ethernet-phy@4 {
+                    reg = <4>;
+                };
 
-                ethernet-ports {
-                    #address-cells = <1>;
-                    #size-cells = <0>;
+                switch@0 {
+                    compatible = "mediatek,mt7621";
+                    reg = <0>;
 
-                    port@0 {
-                        reg = <0>;
-                        label = "lan0";
-                    };
+                    mediatek,mcm;
+                    resets = <&sysc MT7621_RST_MCM>;
+                    reset-names = "mcm";
 
-                    port@1 {
-                        reg = <1>;
-                        label = "lan1";
-                    };
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&gic>;
+                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
 
-                    port@2 {
-                        reg = <2>;
-                        label = "lan2";
-                    };
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
 
-                    port@3 {
-                        reg = <3>;
-                        label = "lan3";
-                    };
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
 
-                    /* Commented out. Port 4 is handled by 2nd GMAC.
-                    port@4 {
-                        reg = <4>;
-                        label = "lan4";
-                    };
-                    */
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
 
-                    port@6 {
-                        reg = <6>;
-                        label = "cpu";
-                        ethernet = <&gmac0>;
-                        phy-mode = "rgmii";
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
 
-                        fixed-link {
-                            speed = <1000>;
-                            full-duplex;
-                            pause;
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        /* Commented out, phy4 is muxed to gmac1.
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+                        */
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
                         };
                     };
                 };
@@ -355,87 +585,198 @@ examples:
         };
     };
 
+  # Example 6: MT7621: mux external phy to SoC's gmac1
   - |
-    //Example 3: MT7621: Port 5 is connected to external PHY: Port 5 -> external PHY.
-
-    ethernet {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        gmac_0: mac@0 {
-            compatible = "mediatek,eth-mac";
-            reg = <0>;
-            phy-mode = "rgmii";
-
-            fixed-link {
-                speed = <1000>;
-                full-duplex;
-                pause;
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+    #include <dt-bindings/reset/mt7621-reset.h>
+
+    platform {
+        pinctrl {
+            example6_rgmii2_pins: rgmii2-pins {
+                pinmux {
+                    groups = "rgmii2";
+                    function = "rgmii2";
+                };
             };
         };
 
-        mdio0: mdio-bus {
+        ethernet {
             #address-cells = <1>;
             #size-cells = <0>;
 
-            /* External phy */
-            ephy5: ethernet-phy@7 {
-                reg = <7>;
+            pinctrl-names = "default";
+            pinctrl-0 = <&example6_rgmii2_pins>;
+
+            mac@1 {
+                compatible = "mediatek,eth-mac";
+                reg = <1>;
+
+                phy-mode = "rgmii";
+                phy-handle = <&example6_ethphy7>;
             };
 
-            switch@1f {
-                compatible = "mediatek,mt7621";
-                reg = <0x1f>;
-                mediatek,mcm;
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
 
-                resets = <&rstctrl 2>;
-                reset-names = "mcm";
+                /* External PHY */
+                example6_ethphy7: ethernet-phy@7 {
+                    reg = <7>;
+                    phy-mode = "rgmii";
+                };
 
-                ethernet-ports {
-                    #address-cells = <1>;
-                    #size-cells = <0>;
+                switch@0 {
+                    compatible = "mediatek,mt7621";
+                    reg = <0>;
 
-                    port@0 {
-                        reg = <0>;
-                        label = "lan0";
-                    };
+                    mediatek,mcm;
+                    resets = <&sysc MT7621_RST_MCM>;
+                    reset-names = "mcm";
 
-                    port@1 {
-                        reg = <1>;
-                        label = "lan1";
-                    };
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&gic>;
+                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
 
-                    port@2 {
-                        reg = <2>;
-                        label = "lan2";
-                    };
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
 
-                    port@3 {
-                        reg = <3>;
-                        label = "lan3";
-                    };
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
 
-                    port@4 {
-                        reg = <4>;
-                        label = "lan4";
-                    };
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
 
-                    port@5 {
-                        reg = <5>;
-                        label = "lan5";
-                        phy-mode = "rgmii";
-                        phy-handle = <&ephy5>;
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
+                        };
                     };
+                };
+            };
+        };
+    };
+
+  # Example 7: MT7621: mux external phy to MT7530's port 5
+  - |
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+    #include <dt-bindings/reset/mt7621-reset.h>
+
+    platform {
+        pinctrl {
+            example7_rgmii2_pins: rgmii2-pins {
+                pinmux {
+                    groups = "rgmii2";
+                    function = "gpio";
+                };
+            };
+        };
+
+        ethernet {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            pinctrl-names = "default";
+            pinctrl-0 = <&example7_rgmii2_pins>;
 
-                    cpu_port0: port@6 {
-                        reg = <6>;
-                        label = "cpu";
-                        ethernet = <&gmac_0>;
-                        phy-mode = "rgmii";
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                /* External PHY */
+                example7_ethphy7: ethernet-phy@7 {
+                    reg = <7>;
+                    phy-mode = "rgmii";
+                };
+
+                switch@0 {
+                    compatible = "mediatek,mt7621";
+                    reg = <0>;
+
+                    mediatek,mcm;
+                    resets = <&sysc MT7621_RST_MCM>;
+                    reset-names = "mcm";
+
+                    interrupt-controller;
+                    #interrupt-cells = <1>;
+                    interrupt-parent = <&gic>;
+                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
+
+                    ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+
+                        port@0 {
+                            reg = <0>;
+                            label = "lan1";
+                        };
+
+                        port@1 {
+                            reg = <1>;
+                            label = "lan2";
+                        };
+
+                        port@2 {
+                            reg = <2>;
+                            label = "lan3";
+                        };
+
+                        port@3 {
+                            reg = <3>;
+                            label = "lan4";
+                        };
+
+                        port@4 {
+                            reg = <4>;
+                            label = "wan";
+                        };
+
+                        port@5 {
+                            reg = <5>;
+                            label = "extphy";
+                            phy-mode = "rgmii-txid";
+                            phy-handle = <&example7_ethphy7>;
+                        };
 
-                        fixed-link {
-                            speed = <1000>;
-                            full-duplex;
-                            pause;
+                        port@6 {
+                            reg = <6>;
+                            label = "cpu";
+                            ethernet = <&gmac0>;
+                            phy-mode = "trgmii";
+
+                            fixed-link {
+                                speed = <1000>;
+                                full-duplex;
+                                pause;
+                            };
                         };
                     };
                 };
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 4/7] dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
  2022-08-13 15:44 ` Arınç ÜNAL
@ 2022-08-13 15:44   ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Define DSA port binding under each compatible device as each device
requires different values for certain properties.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 116 +++++++++++++-----
 1 file changed, 87 insertions(+), 29 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index cc87f48d4d07..ff51a2f6875f 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -130,35 +130,6 @@ properties:
       ethsys.
     maxItems: 1
 
-patternProperties:
-  "^(ethernet-)?ports$":
-    type: object
-
-    patternProperties:
-      "^(ethernet-)?port@[0-9]+$":
-        type: object
-        description: Ethernet switch ports
-
-        unevaluatedProperties: false
-
-        properties:
-          reg:
-            description:
-              Port address described must be 5 or 6 for CPU port and from 0
-              to 5 for user ports.
-
-        allOf:
-          - $ref: dsa-port.yaml#
-          - if:
-              properties:
-                label:
-                  items:
-                    - const: cpu
-            then:
-              required:
-                - reg
-                - phy-mode
-
 required:
   - compatible
   - reg
@@ -189,6 +160,35 @@ allOf:
         - core-supply
         - io-supply
 
+      patternProperties:
+        "^(ethernet-)?ports$":
+          type: object
+
+          patternProperties:
+            "^(ethernet-)?port@[0-9]+$":
+              type: object
+              description: Ethernet switch ports
+
+              unevaluatedProperties: false
+
+              properties:
+                reg:
+                  description:
+                    Port address described must be 5 or 6 for CPU port and from
+                    0 to 5 for user ports.
+
+              allOf:
+                - $ref: dsa-port.yaml#
+                - if:
+                    properties:
+                      label:
+                        items:
+                          - const: cpu
+                  then:
+                    required:
+                      - reg
+                      - phy-mode
+
   - if:
       properties:
         compatible:
@@ -198,6 +198,35 @@ allOf:
       properties:
         mediatek,mcm: false
 
+      patternProperties:
+        "^(ethernet-)?ports$":
+          type: object
+
+          patternProperties:
+            "^(ethernet-)?port@[0-9]+$":
+              type: object
+              description: Ethernet switch ports
+
+              unevaluatedProperties: false
+
+              properties:
+                reg:
+                  description:
+                    Port address described must be 5 or 6 for CPU port and from
+                    0 to 5 for user ports.
+
+              allOf:
+                - $ref: dsa-port.yaml#
+                - if:
+                    properties:
+                      label:
+                        items:
+                          - const: cpu
+                  then:
+                    required:
+                      - reg
+                      - phy-mode
+
   - if:
       properties:
         compatible:
@@ -207,6 +236,35 @@ allOf:
       required:
         - mediatek,mcm
 
+      patternProperties:
+        "^(ethernet-)?ports$":
+          type: object
+
+          patternProperties:
+            "^(ethernet-)?port@[0-9]+$":
+              type: object
+              description: Ethernet switch ports
+
+              unevaluatedProperties: false
+
+              properties:
+                reg:
+                  description:
+                    Port address described must be 5 or 6 for CPU port and from
+                    0 to 5 for user ports.
+
+              allOf:
+                - $ref: dsa-port.yaml#
+                - if:
+                    properties:
+                      label:
+                        items:
+                          - const: cpu
+                  then:
+                    required:
+                      - reg
+                      - phy-mode
+
 unevaluatedProperties: false
 
 examples:
-- 
2.34.1


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

* [PATCH v2 4/7] dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
@ 2022-08-13 15:44   ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Define DSA port binding under each compatible device as each device
requires different values for certain properties.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 116 +++++++++++++-----
 1 file changed, 87 insertions(+), 29 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index cc87f48d4d07..ff51a2f6875f 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -130,35 +130,6 @@ properties:
       ethsys.
     maxItems: 1
 
-patternProperties:
-  "^(ethernet-)?ports$":
-    type: object
-
-    patternProperties:
-      "^(ethernet-)?port@[0-9]+$":
-        type: object
-        description: Ethernet switch ports
-
-        unevaluatedProperties: false
-
-        properties:
-          reg:
-            description:
-              Port address described must be 5 or 6 for CPU port and from 0
-              to 5 for user ports.
-
-        allOf:
-          - $ref: dsa-port.yaml#
-          - if:
-              properties:
-                label:
-                  items:
-                    - const: cpu
-            then:
-              required:
-                - reg
-                - phy-mode
-
 required:
   - compatible
   - reg
@@ -189,6 +160,35 @@ allOf:
         - core-supply
         - io-supply
 
+      patternProperties:
+        "^(ethernet-)?ports$":
+          type: object
+
+          patternProperties:
+            "^(ethernet-)?port@[0-9]+$":
+              type: object
+              description: Ethernet switch ports
+
+              unevaluatedProperties: false
+
+              properties:
+                reg:
+                  description:
+                    Port address described must be 5 or 6 for CPU port and from
+                    0 to 5 for user ports.
+
+              allOf:
+                - $ref: dsa-port.yaml#
+                - if:
+                    properties:
+                      label:
+                        items:
+                          - const: cpu
+                  then:
+                    required:
+                      - reg
+                      - phy-mode
+
   - if:
       properties:
         compatible:
@@ -198,6 +198,35 @@ allOf:
       properties:
         mediatek,mcm: false
 
+      patternProperties:
+        "^(ethernet-)?ports$":
+          type: object
+
+          patternProperties:
+            "^(ethernet-)?port@[0-9]+$":
+              type: object
+              description: Ethernet switch ports
+
+              unevaluatedProperties: false
+
+              properties:
+                reg:
+                  description:
+                    Port address described must be 5 or 6 for CPU port and from
+                    0 to 5 for user ports.
+
+              allOf:
+                - $ref: dsa-port.yaml#
+                - if:
+                    properties:
+                      label:
+                        items:
+                          - const: cpu
+                  then:
+                    required:
+                      - reg
+                      - phy-mode
+
   - if:
       properties:
         compatible:
@@ -207,6 +236,35 @@ allOf:
       required:
         - mediatek,mcm
 
+      patternProperties:
+        "^(ethernet-)?ports$":
+          type: object
+
+          patternProperties:
+            "^(ethernet-)?port@[0-9]+$":
+              type: object
+              description: Ethernet switch ports
+
+              unevaluatedProperties: false
+
+              properties:
+                reg:
+                  description:
+                    Port address described must be 5 or 6 for CPU port and from
+                    0 to 5 for user ports.
+
+              allOf:
+                - $ref: dsa-port.yaml#
+                - if:
+                    properties:
+                      label:
+                        items:
+                          - const: cpu
+                  then:
+                    required:
+                      - reg
+                      - phy-mode
+
 unevaluatedProperties: false
 
 examples:
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 5/7] dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
  2022-08-13 15:44 ` Arınç ÜNAL
@ 2022-08-13 15:44   ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Remove unnecessary lines as they are already included from the referred
dsa.yaml.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 27 -------------------
 1 file changed, 27 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index ff51a2f6875f..a27cb4fa490f 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -162,15 +162,8 @@ allOf:
 
       patternProperties:
         "^(ethernet-)?ports$":
-          type: object
-
           patternProperties:
             "^(ethernet-)?port@[0-9]+$":
-              type: object
-              description: Ethernet switch ports
-
-              unevaluatedProperties: false
-
               properties:
                 reg:
                   description:
@@ -178,7 +171,6 @@ allOf:
                     0 to 5 for user ports.
 
               allOf:
-                - $ref: dsa-port.yaml#
                 - if:
                     properties:
                       label:
@@ -186,7 +178,6 @@ allOf:
                           - const: cpu
                   then:
                     required:
-                      - reg
                       - phy-mode
 
   - if:
@@ -200,15 +191,8 @@ allOf:
 
       patternProperties:
         "^(ethernet-)?ports$":
-          type: object
-
           patternProperties:
             "^(ethernet-)?port@[0-9]+$":
-              type: object
-              description: Ethernet switch ports
-
-              unevaluatedProperties: false
-
               properties:
                 reg:
                   description:
@@ -216,7 +200,6 @@ allOf:
                     0 to 5 for user ports.
 
               allOf:
-                - $ref: dsa-port.yaml#
                 - if:
                     properties:
                       label:
@@ -224,7 +207,6 @@ allOf:
                           - const: cpu
                   then:
                     required:
-                      - reg
                       - phy-mode
 
   - if:
@@ -238,15 +220,8 @@ allOf:
 
       patternProperties:
         "^(ethernet-)?ports$":
-          type: object
-
           patternProperties:
             "^(ethernet-)?port@[0-9]+$":
-              type: object
-              description: Ethernet switch ports
-
-              unevaluatedProperties: false
-
               properties:
                 reg:
                   description:
@@ -254,7 +229,6 @@ allOf:
                     0 to 5 for user ports.
 
               allOf:
-                - $ref: dsa-port.yaml#
                 - if:
                     properties:
                       label:
@@ -262,7 +236,6 @@ allOf:
                           - const: cpu
                   then:
                     required:
-                      - reg
                       - phy-mode
 
 unevaluatedProperties: false
-- 
2.34.1


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

* [PATCH v2 5/7] dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
@ 2022-08-13 15:44   ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Remove unnecessary lines as they are already included from the referred
dsa.yaml.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 27 -------------------
 1 file changed, 27 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index ff51a2f6875f..a27cb4fa490f 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -162,15 +162,8 @@ allOf:
 
       patternProperties:
         "^(ethernet-)?ports$":
-          type: object
-
           patternProperties:
             "^(ethernet-)?port@[0-9]+$":
-              type: object
-              description: Ethernet switch ports
-
-              unevaluatedProperties: false
-
               properties:
                 reg:
                   description:
@@ -178,7 +171,6 @@ allOf:
                     0 to 5 for user ports.
 
               allOf:
-                - $ref: dsa-port.yaml#
                 - if:
                     properties:
                       label:
@@ -186,7 +178,6 @@ allOf:
                           - const: cpu
                   then:
                     required:
-                      - reg
                       - phy-mode
 
   - if:
@@ -200,15 +191,8 @@ allOf:
 
       patternProperties:
         "^(ethernet-)?ports$":
-          type: object
-
           patternProperties:
             "^(ethernet-)?port@[0-9]+$":
-              type: object
-              description: Ethernet switch ports
-
-              unevaluatedProperties: false
-
               properties:
                 reg:
                   description:
@@ -216,7 +200,6 @@ allOf:
                     0 to 5 for user ports.
 
               allOf:
-                - $ref: dsa-port.yaml#
                 - if:
                     properties:
                       label:
@@ -224,7 +207,6 @@ allOf:
                           - const: cpu
                   then:
                     required:
-                      - reg
                       - phy-mode
 
   - if:
@@ -238,15 +220,8 @@ allOf:
 
       patternProperties:
         "^(ethernet-)?ports$":
-          type: object
-
           patternProperties:
             "^(ethernet-)?port@[0-9]+$":
-              type: object
-              description: Ethernet switch ports
-
-              unevaluatedProperties: false
-
               properties:
                 reg:
                   description:
@@ -254,7 +229,6 @@ allOf:
                     0 to 5 for user ports.
 
               allOf:
-                - $ref: dsa-port.yaml#
                 - if:
                     properties:
                       label:
@@ -262,7 +236,6 @@ allOf:
                           - const: cpu
                   then:
                     required:
-                      - reg
                       - phy-mode
 
 unevaluatedProperties: false
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 6/7] dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
  2022-08-13 15:44 ` Arınç ÜNAL
@ 2022-08-13 15:44   ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Define acceptable phy-mode values for CPU port of each compatible device.
Remove relevant information from the description of the binding.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 103 ++++++++++++++++--
 1 file changed, 92 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index a27cb4fa490f..530ef5a75a2f 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -49,17 +49,6 @@ description: |
   * mt7621: phy-mode = "rgmii-txid";
   * mt7623: phy-mode = "rgmii";
 
-  CPU-Ports need a phy-mode property:
-    Allowed values on mt7530 and mt7621:
-      - "rgmii"
-      - "trgmii"
-    On mt7531:
-      - "1000base-x"
-      - "2500base-x"
-      - "rgmii"
-      - "sgmii"
-
-
 properties:
   compatible:
     oneOf:
@@ -177,6 +166,36 @@ allOf:
                         items:
                           - const: cpu
                   then:
+                    allOf:
+                      - if:
+                          properties:
+                            reg:
+                              const: 5
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - gmii
+                                - mii
+                                - rgmii
+
+                      - if:
+                          properties:
+                            reg:
+                              const: 6
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - rgmii
+                                - trgmii
+
+                    properties:
+                      reg:
+                        enum:
+                          - 5
+                          - 6
+
                     required:
                       - phy-mode
 
@@ -206,6 +225,38 @@ allOf:
                         items:
                           - const: cpu
                   then:
+                    allOf:
+                      - if:
+                          properties:
+                            reg:
+                              const: 5
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - 1000base-x
+                                - 2500base-x
+                                - rgmii
+                                - sgmii
+
+                      - if:
+                          properties:
+                            reg:
+                              const: 6
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - 1000base-x
+                                - 2500base-x
+                                - sgmii
+
+                    properties:
+                      reg:
+                        enum:
+                          - 5
+                          - 6
+
                     required:
                       - phy-mode
 
@@ -235,6 +286,36 @@ allOf:
                         items:
                           - const: cpu
                   then:
+                    allOf:
+                      - if:
+                          properties:
+                            reg:
+                              const: 5
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - gmii
+                                - mii
+                                - rgmii
+
+                      - if:
+                          properties:
+                            reg:
+                              const: 6
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - rgmii
+                                - trgmii
+
+                    properties:
+                      reg:
+                        enum:
+                          - 5
+                          - 6
+
                     required:
                       - phy-mode
 
-- 
2.34.1


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

* [PATCH v2 6/7] dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
@ 2022-08-13 15:44   ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Define acceptable phy-mode values for CPU port of each compatible device.
Remove relevant information from the description of the binding.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 103 ++++++++++++++++--
 1 file changed, 92 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index a27cb4fa490f..530ef5a75a2f 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -49,17 +49,6 @@ description: |
   * mt7621: phy-mode = "rgmii-txid";
   * mt7623: phy-mode = "rgmii";
 
-  CPU-Ports need a phy-mode property:
-    Allowed values on mt7530 and mt7621:
-      - "rgmii"
-      - "trgmii"
-    On mt7531:
-      - "1000base-x"
-      - "2500base-x"
-      - "rgmii"
-      - "sgmii"
-
-
 properties:
   compatible:
     oneOf:
@@ -177,6 +166,36 @@ allOf:
                         items:
                           - const: cpu
                   then:
+                    allOf:
+                      - if:
+                          properties:
+                            reg:
+                              const: 5
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - gmii
+                                - mii
+                                - rgmii
+
+                      - if:
+                          properties:
+                            reg:
+                              const: 6
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - rgmii
+                                - trgmii
+
+                    properties:
+                      reg:
+                        enum:
+                          - 5
+                          - 6
+
                     required:
                       - phy-mode
 
@@ -206,6 +225,38 @@ allOf:
                         items:
                           - const: cpu
                   then:
+                    allOf:
+                      - if:
+                          properties:
+                            reg:
+                              const: 5
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - 1000base-x
+                                - 2500base-x
+                                - rgmii
+                                - sgmii
+
+                      - if:
+                          properties:
+                            reg:
+                              const: 6
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - 1000base-x
+                                - 2500base-x
+                                - sgmii
+
+                    properties:
+                      reg:
+                        enum:
+                          - 5
+                          - 6
+
                     required:
                       - phy-mode
 
@@ -235,6 +286,36 @@ allOf:
                         items:
                           - const: cpu
                   then:
+                    allOf:
+                      - if:
+                          properties:
+                            reg:
+                              const: 5
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - gmii
+                                - mii
+                                - rgmii
+
+                      - if:
+                          properties:
+                            reg:
+                              const: 6
+                        then:
+                          properties:
+                            phy-mode:
+                              enum:
+                                - rgmii
+                                - trgmii
+
+                    properties:
+                      reg:
+                        enum:
+                          - 5
+                          - 6
+
                     required:
                       - phy-mode
 
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 7/7] dt-bindings: net: dsa: mediatek,mt7530: update binding description
  2022-08-13 15:44 ` Arınç ÜNAL
@ 2022-08-13 15:44   ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Update the description of the binding.

- Describe the switches, which SoCs they are in, or if they are standalone.
- Explain the various ways of configuring MT7530's port 5.
- Remove phy-mode = "rgmii-txid" from description. Same code path is
followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 97 ++++++++++++-------
 1 file changed, 62 insertions(+), 35 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 530ef5a75a2f..cf6340d072df 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -13,41 +13,68 @@ maintainers:
   - Sean Wang <sean.wang@mediatek.com>
 
 description: |
-  Port 5 of mt7530 and mt7621 switch is muxed between:
-  1. GMAC5: GMAC5 can interface with another external MAC or PHY.
-  2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC
-     of the SOC. Used in many setups where port 0/4 becomes the WAN port.
-     Note: On a MT7621 SOC with integrated switch: 2nd GMAC can only connected to
-       GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not
-       connected to external component!
-
-  Port 5 modes/configurations:
-  1. Port 5 is disabled and isolated: An external phy can interface to the 2nd
-     GMAC of the SOC.
-     In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd
-     GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC!
-  2. Port 5 is muxed to PHY of port 0/4: Port 0/4 interfaces with 2nd GMAC.
-     It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode
-     and RGMII delay.
-  3. Port 5 is muxed to GMAC5 and can interface to an external phy.
-     Port 5 becomes an extra switch port.
-     Only works on platform where external phy TX<->RX lines are swapped.
-     Like in the Ubiquiti ER-X-SFP.
-  4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port.
-     Currently a 2nd CPU port is not supported by DSA code.
-
-  Depending on how the external PHY is wired:
-  1. normal: The PHY can only connect to 2nd GMAC but not to the switch
-  2. swapped: RGMII TX, RX are swapped; external phy interface with the switch as
-     a ethernet port. But can't interface to the 2nd GMAC.
-
-    Based on the DT the port 5 mode is configured.
-
-  Driver tries to lookup the phy-handle of the 2nd GMAC of the master device.
-  When phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2.
-  phy-mode must be set, see also example 2 below!
-  * mt7621: phy-mode = "rgmii-txid";
-  * mt7623: phy-mode = "rgmii";
+  There are two versions of MT7530, standalone and in a multi-chip module.
+
+  MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN,
+  MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs.
+
+  MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs
+  and the switch registers are directly mapped into SoC's memory map rather than
+  using MDIO. There is currently no support for this.
+
+  There is only the standalone version of MT7531.
+
+  Port 5 on MT7530 has got various ways of configuration.
+
+  For standalone MT7530:
+
+    - Port 5 can be used as a CPU port.
+
+    - PHY 0 or 4 of the switch can be muxed to connect to the gmac of the SoC
+      which port 5 is wired to. Usually used for connecting the wan port
+      directly to the CPU to achieve 2 Gbps routing in total.
+
+      The driver looks up the reg on the ethernet-phy node which the phy-handle
+      property refers to on the gmac node to mux the specified phy.
+
+      The driver requires the gmac of the SoC to have "mediatek,eth-mac" as the
+      compatible string and the reg must be 1. So, for now, only gmac1 of an
+      MediaTek SoC can benefit this. Banana Pi BPI-R2 suits this.
+      Check out example 5 for a similar configuration.
+
+    - Port 5 can be wired to an external phy. Port 5 becomes a DSA slave.
+      Check out example 7 for a similar configuration.
+
+  For multi-chip module MT7530:
+
+    - Port 5 can be used as a CPU port.
+
+    - PHY 0 or 4 of the switch can be muxed to connect to gmac1 of the SoC.
+      Usually used for connecting the wan port directly to the CPU to achieve 2
+      Gbps routing in total.
+
+      The driver looks up the reg on the ethernet-phy node which the phy-handle
+      property refers to on the gmac node to mux the specified phy.
+
+      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
+      Check out example 5.
+
+    - In case of an external phy wired to gmac1 of the SoC, port 5 must not be
+      enabled.
+
+      In case of muxing PHY 0 or 4, the external phy must not be enabled.
+
+      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
+      Check out example 6.
+
+    - Port 5 can be muxed to an external phy. Port 5 becomes a DSA slave.
+      The external phy must be wired TX to TX to gmac1 of the SoC for this to
+      work. Ubiquiti EdgeRouter X SFP is wired this way.
+
+      Muxing PHY 0 or 4 won't work when the external phy is connected TX to TX.
+
+      For the MT7621 SoCs, rgmii2 group must be claimed with gpio function.
+      Check out example 7.
 
 properties:
   compatible:
-- 
2.34.1


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

* [PATCH v2 7/7] dt-bindings: net: dsa: mediatek,mt7530: update binding description
@ 2022-08-13 15:44   ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-13 15:44 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger, Sean Wang,
	Landen Chao, DENG Qingfang, Frank Wunderlich,
	Luiz Angelo Daros de Luca, Sander Vanheule, René van Dorst,
	Daniel Golle, erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Arınç ÜNAL

Update the description of the binding.

- Describe the switches, which SoCs they are in, or if they are standalone.
- Explain the various ways of configuring MT7530's port 5.
- Remove phy-mode = "rgmii-txid" from description. Same code path is
followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 97 ++++++++++++-------
 1 file changed, 62 insertions(+), 35 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 530ef5a75a2f..cf6340d072df 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -13,41 +13,68 @@ maintainers:
   - Sean Wang <sean.wang@mediatek.com>
 
 description: |
-  Port 5 of mt7530 and mt7621 switch is muxed between:
-  1. GMAC5: GMAC5 can interface with another external MAC or PHY.
-  2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC
-     of the SOC. Used in many setups where port 0/4 becomes the WAN port.
-     Note: On a MT7621 SOC with integrated switch: 2nd GMAC can only connected to
-       GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not
-       connected to external component!
-
-  Port 5 modes/configurations:
-  1. Port 5 is disabled and isolated: An external phy can interface to the 2nd
-     GMAC of the SOC.
-     In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd
-     GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC!
-  2. Port 5 is muxed to PHY of port 0/4: Port 0/4 interfaces with 2nd GMAC.
-     It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode
-     and RGMII delay.
-  3. Port 5 is muxed to GMAC5 and can interface to an external phy.
-     Port 5 becomes an extra switch port.
-     Only works on platform where external phy TX<->RX lines are swapped.
-     Like in the Ubiquiti ER-X-SFP.
-  4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port.
-     Currently a 2nd CPU port is not supported by DSA code.
-
-  Depending on how the external PHY is wired:
-  1. normal: The PHY can only connect to 2nd GMAC but not to the switch
-  2. swapped: RGMII TX, RX are swapped; external phy interface with the switch as
-     a ethernet port. But can't interface to the 2nd GMAC.
-
-    Based on the DT the port 5 mode is configured.
-
-  Driver tries to lookup the phy-handle of the 2nd GMAC of the master device.
-  When phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2.
-  phy-mode must be set, see also example 2 below!
-  * mt7621: phy-mode = "rgmii-txid";
-  * mt7623: phy-mode = "rgmii";
+  There are two versions of MT7530, standalone and in a multi-chip module.
+
+  MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN,
+  MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs.
+
+  MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs
+  and the switch registers are directly mapped into SoC's memory map rather than
+  using MDIO. There is currently no support for this.
+
+  There is only the standalone version of MT7531.
+
+  Port 5 on MT7530 has got various ways of configuration.
+
+  For standalone MT7530:
+
+    - Port 5 can be used as a CPU port.
+
+    - PHY 0 or 4 of the switch can be muxed to connect to the gmac of the SoC
+      which port 5 is wired to. Usually used for connecting the wan port
+      directly to the CPU to achieve 2 Gbps routing in total.
+
+      The driver looks up the reg on the ethernet-phy node which the phy-handle
+      property refers to on the gmac node to mux the specified phy.
+
+      The driver requires the gmac of the SoC to have "mediatek,eth-mac" as the
+      compatible string and the reg must be 1. So, for now, only gmac1 of an
+      MediaTek SoC can benefit this. Banana Pi BPI-R2 suits this.
+      Check out example 5 for a similar configuration.
+
+    - Port 5 can be wired to an external phy. Port 5 becomes a DSA slave.
+      Check out example 7 for a similar configuration.
+
+  For multi-chip module MT7530:
+
+    - Port 5 can be used as a CPU port.
+
+    - PHY 0 or 4 of the switch can be muxed to connect to gmac1 of the SoC.
+      Usually used for connecting the wan port directly to the CPU to achieve 2
+      Gbps routing in total.
+
+      The driver looks up the reg on the ethernet-phy node which the phy-handle
+      property refers to on the gmac node to mux the specified phy.
+
+      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
+      Check out example 5.
+
+    - In case of an external phy wired to gmac1 of the SoC, port 5 must not be
+      enabled.
+
+      In case of muxing PHY 0 or 4, the external phy must not be enabled.
+
+      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
+      Check out example 6.
+
+    - Port 5 can be muxed to an external phy. Port 5 becomes a DSA slave.
+      The external phy must be wired TX to TX to gmac1 of the SoC for this to
+      work. Ubiquiti EdgeRouter X SFP is wired this way.
+
+      Muxing PHY 0 or 4 won't work when the external phy is connected TX to TX.
+
+      For the MT7621 SoCs, rgmii2 group must be claimed with gpio function.
+      Check out example 7.
 
 properties:
   compatible:
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 1/7] dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
  2022-08-13 15:44   ` Arınç ÜNAL
  (?)
@ 2022-08-16 20:49     ` Rob Herring
  -1 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 20:49 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: netdev, David S . Miller, Krzysztof Kozlowski, Florian Fainelli,
	Daniel Golle, Matthias Brugger, Landen Chao, linux-arm-kernel,
	Rob Herring, Luiz Angelo Daros de Luca, linux-kernel,
	Vivien Didelot, Jakub Kicinski, René van Dorst,
	linux-mediatek, Andrew Lunn, Vladimir Oltean, Paolo Abeni,
	Sander Vanheule, Frank Wunderlich, Sean Wang, Sergio Paracuellos,
	devicetree, erkin.bozoglu, Eric Dumazet, DENG Qingfang

On Sat, 13 Aug 2022 18:44:09 +0300, Arınç ÜNAL wrote:
> Make trivial changes on the binding.
> 
> - Update title to include MT7531 switch.
> - Add me as a maintainer. List maintainers in alphabetical order by first
> name.
> - Add description to compatible strings.
> - Stretch descriptions up to the 80 character limit.
> - Remove quotes from $ref: "dsa.yaml#".
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 36 ++++++++++++-------
>  1 file changed, 24 insertions(+), 12 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v2 1/7] dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
@ 2022-08-16 20:49     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 20:49 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, Rob Herring,
	linux-mediatek, Matthias Brugger, linux-arm-kernel, netdev,
	Daniel Golle, Vladimir Oltean, David S . Miller

On Sat, 13 Aug 2022 18:44:09 +0300, Arınç ÜNAL wrote:
> Make trivial changes on the binding.
> 
> - Update title to include MT7531 switch.
> - Add me as a maintainer. List maintainers in alphabetical order by first
> name.
> - Add description to compatible strings.
> - Stretch descriptions up to the 80 character limit.
> - Remove quotes from $ref: "dsa.yaml#".
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 36 ++++++++++++-------
>  1 file changed, 24 insertions(+), 12 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>


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

* Re: [PATCH v2 1/7] dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
@ 2022-08-16 20:49     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 20:49 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: netdev, David S . Miller, Krzysztof Kozlowski, Florian Fainelli,
	Daniel Golle, Matthias Brugger, Landen Chao, linux-arm-kernel,
	Rob Herring, Luiz Angelo Daros de Luca, linux-kernel,
	Vivien Didelot, Jakub Kicinski, René van Dorst,
	linux-mediatek, Andrew Lunn, Vladimir Oltean, Paolo Abeni,
	Sander Vanheule, Frank Wunderlich, Sean Wang, Sergio Paracuellos,
	devicetree, erkin.bozoglu, Eric Dumazet, DENG Qingfang

On Sat, 13 Aug 2022 18:44:09 +0300, Arınç ÜNAL wrote:
> Make trivial changes on the binding.
> 
> - Update title to include MT7531 switch.
> - Add me as a maintainer. List maintainers in alphabetical order by first
> name.
> - Add description to compatible strings.
> - Stretch descriptions up to the 80 character limit.
> - Remove quotes from $ref: "dsa.yaml#".
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 36 ++++++++++++-------
>  1 file changed, 24 insertions(+), 12 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/7] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
  2022-08-13 15:44   ` Arınç ÜNAL
  (?)
@ 2022-08-16 20:52     ` Rob Herring
  -1 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 20:52 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:10PM +0300, Arınç ÜNAL wrote:
> - Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
> - Add description for reset-gpios.
> - Invalidate reset-gpios if mediatek,mcm is used.
> - Invalidate mediatek,mcm if the compatible device is mediatek,mt7531.
> - Require mediatek,mcm for the described MT7621 SoCs as the compatible
> string is only used for MT7530 which is a part of the multi-chip module.

The commit message should answer 'why is this change needed/wanted?' not 
'what changed'. I can read the diff to see what changed.

d> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 31 +++++++++++++++++--
>  1 file changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index edf48e917173..4c99266ce82a 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -110,11 +110,15 @@ properties:
>    mediatek,mcm:
>      type: boolean
>      description:
> -      if defined, indicates that either MT7530 is the part on multi-chip
> -      module belong to MT7623A has or the remotely standalone chip as the
> -      function MT7623N reference board provided for.
> +      Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530
> +      switch is a part of the multi-chip module.
>  
>    reset-gpios:
> +    description:
> +      GPIO to reset the switch. Use this if mediatek,mcm is not used.
> +      This property is optional because some boards share the reset line with
> +      other components which makes it impossible to probe the switch if the
> +      reset line is used.
>      maxItems: 1
>  
>    reset-names:
> @@ -165,6 +169,9 @@ allOf:
>        required:
>          - mediatek,mcm
>      then:
> +      properties:
> +        reset-gpios: false
> +
>        required:
>          - resets
>          - reset-names
> @@ -182,6 +189,24 @@ allOf:
>          - core-supply
>          - io-supply
>  
> +  - if:
> +      properties:
> +        compatible:
> +          items:
> +            - const: mediatek,mt7531
> +    then:
> +      properties:
> +        mediatek,mcm: false
> +
> +  - if:
> +      properties:
> +        compatible:
> +          items:
> +            - const: mediatek,mt7621
> +    then:
> +      required:
> +        - mediatek,mcm
> +
>  unevaluatedProperties: false
>  
>  examples:
> -- 
> 2.34.1
> 
> 

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

* Re: [PATCH v2 2/7] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
@ 2022-08-16 20:52     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 20:52 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On Sat, Aug 13, 2022 at 06:44:10PM +0300, Arınç ÜNAL wrote:
> - Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
> - Add description for reset-gpios.
> - Invalidate reset-gpios if mediatek,mcm is used.
> - Invalidate mediatek,mcm if the compatible device is mediatek,mt7531.
> - Require mediatek,mcm for the described MT7621 SoCs as the compatible
> string is only used for MT7530 which is a part of the multi-chip module.

The commit message should answer 'why is this change needed/wanted?' not 
'what changed'. I can read the diff to see what changed.

d> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 31 +++++++++++++++++--
>  1 file changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index edf48e917173..4c99266ce82a 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -110,11 +110,15 @@ properties:
>    mediatek,mcm:
>      type: boolean
>      description:
> -      if defined, indicates that either MT7530 is the part on multi-chip
> -      module belong to MT7623A has or the remotely standalone chip as the
> -      function MT7623N reference board provided for.
> +      Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530
> +      switch is a part of the multi-chip module.
>  
>    reset-gpios:
> +    description:
> +      GPIO to reset the switch. Use this if mediatek,mcm is not used.
> +      This property is optional because some boards share the reset line with
> +      other components which makes it impossible to probe the switch if the
> +      reset line is used.
>      maxItems: 1
>  
>    reset-names:
> @@ -165,6 +169,9 @@ allOf:
>        required:
>          - mediatek,mcm
>      then:
> +      properties:
> +        reset-gpios: false
> +
>        required:
>          - resets
>          - reset-names
> @@ -182,6 +189,24 @@ allOf:
>          - core-supply
>          - io-supply
>  
> +  - if:
> +      properties:
> +        compatible:
> +          items:
> +            - const: mediatek,mt7531
> +    then:
> +      properties:
> +        mediatek,mcm: false
> +
> +  - if:
> +      properties:
> +        compatible:
> +          items:
> +            - const: mediatek,mt7621
> +    then:
> +      required:
> +        - mediatek,mcm
> +
>  unevaluatedProperties: false
>  
>  examples:
> -- 
> 2.34.1
> 
> 


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

* Re: [PATCH v2 2/7] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
@ 2022-08-16 20:52     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 20:52 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:10PM +0300, Arınç ÜNAL wrote:
> - Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
> - Add description for reset-gpios.
> - Invalidate reset-gpios if mediatek,mcm is used.
> - Invalidate mediatek,mcm if the compatible device is mediatek,mt7531.
> - Require mediatek,mcm for the described MT7621 SoCs as the compatible
> string is only used for MT7530 which is a part of the multi-chip module.

The commit message should answer 'why is this change needed/wanted?' not 
'what changed'. I can read the diff to see what changed.

d> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 31 +++++++++++++++++--
>  1 file changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index edf48e917173..4c99266ce82a 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -110,11 +110,15 @@ properties:
>    mediatek,mcm:
>      type: boolean
>      description:
> -      if defined, indicates that either MT7530 is the part on multi-chip
> -      module belong to MT7623A has or the remotely standalone chip as the
> -      function MT7623N reference board provided for.
> +      Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530
> +      switch is a part of the multi-chip module.
>  
>    reset-gpios:
> +    description:
> +      GPIO to reset the switch. Use this if mediatek,mcm is not used.
> +      This property is optional because some boards share the reset line with
> +      other components which makes it impossible to probe the switch if the
> +      reset line is used.
>      maxItems: 1
>  
>    reset-names:
> @@ -165,6 +169,9 @@ allOf:
>        required:
>          - mediatek,mcm
>      then:
> +      properties:
> +        reset-gpios: false
> +
>        required:
>          - resets
>          - reset-names
> @@ -182,6 +189,24 @@ allOf:
>          - core-supply
>          - io-supply
>  
> +  - if:
> +      properties:
> +        compatible:
> +          items:
> +            - const: mediatek,mt7531
> +    then:
> +      properties:
> +        mediatek,mcm: false
> +
> +  - if:
> +      properties:
> +        compatible:
> +          items:
> +            - const: mediatek,mt7621
> +    then:
> +      required:
> +        - mediatek,mcm
> +
>  unevaluatedProperties: false
>  
>  examples:
> -- 
> 2.34.1
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 3/7] dt-bindings: net: dsa: mediatek,mt7530: update examples
  2022-08-13 15:44   ` Arınç ÜNAL
  (?)
@ 2022-08-16 21:02     ` Rob Herring
  -1 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:02 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:11PM +0300, Arınç ÜNAL wrote:
> Update the examples on the binding.
> 
> - Add examples which include a wide variation of configurations.
> - Make example comments YAML comment instead of DT binding comment.
> - Define examples from platform to make the bindings clearer.
> - Add interrupt controller to the examples. Include header file for
> interrupt.
> - Change reset line for MT7621 examples.
> - Pretty formatting for the examples.
> - Change switch reg to 0.
> - Change port labels to fit the example, change port 4 label to wan.
> - Change ethernet-ports to ports.

Again, why?

> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 663 +++++++++++++-----
>  1 file changed, 502 insertions(+), 161 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 4c99266ce82a..cc87f48d4d07 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -210,144 +210,374 @@ allOf:
>  unevaluatedProperties: false
>  
>  examples:
> +  # Example 1: Standalone MT7530
>    - |
>      #include <dt-bindings/gpio/gpio.h>
> -    mdio {
> -        #address-cells = <1>;
> -        #size-cells = <0>;
> -        switch@0 {
> -            compatible = "mediatek,mt7530";
> -            reg = <0>;
> -
> -            core-supply = <&mt6323_vpa_reg>;
> -            io-supply = <&mt6323_vemc3v3_reg>;
> -            reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
> -
> -            ethernet-ports {
> +
> +    platform {
> +        ethernet {

Don't need these nodes.

> +            mdio {
>                  #address-cells = <1>;
>                  #size-cells = <0>;
> -                port@0 {
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7530";
>                      reg = <0>;
> -                    label = "lan0";
> -                };
>  
> -                port@1 {
> -                    reg = <1>;
> -                    label = "lan1";
> -                };
> +                    reset-gpios = <&pio 33 0>;
>  
> -                port@2 {
> -                    reg = <2>;
> -                    label = "lan2";
> -                };
> +                    core-supply = <&mt6323_vpa_reg>;
> +                    io-supply = <&mt6323_vemc3v3_reg>;
> +
> +                    ports {

'ports' is for the DT graph binding. 'ethernet-ports' is for DSA 
binding. The former is allowed due to existing users. Don't add more.

> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
>  
> -                port@3 {
> -                    reg = <3>;
> -                    label = "lan3";
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "rgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
>                  };
> +            };
> +        };
> +    };
>  
> -                port@4 {
> -                    reg = <4>;
> -                    label = "wan";
> +  # Example 2: MT7530 in MT7623AI SoC

Looks almost the same as example 1. Examples are not an enumeration of 
every possible DT. Limit them to cases which are significantly 
different.

> +  - |
> +    #include <dt-bindings/reset/mt2701-resets.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7530";
> +                    reg = <0>;
> +
> +                    mediatek,mcm;
> +                    resets = <&ethsys MT2701_ETHSYS_MCM_RST>;
> +                    reset-names = "mcm";
> +
> +                    core-supply = <&mt6323_vpa_reg>;
> +                    io-supply = <&mt6323_vemc3v3_reg>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "trgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
>                  };
> +            };
> +        };
> +    };
> +
> +  # Example 3: Standalone MT7531
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7531";
> +                    reg = <0>;
> +
> +                    reset-gpios = <&pio 54 0>;
> +
> +                    interrupt-controller;
> +                    #interrupt-cells = <1>;
> +                    interrupt-parent = <&pio>;
> +                    interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
>  
> -                port@6 {
> -                    reg = <6>;
> -                    label = "cpu";
> -                    ethernet = <&gmac0>;
> -                    phy-mode = "trgmii";
> -                    fixed-link {
> -                        speed = <1000>;
> -                        full-duplex;
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "2500base-x";
> +
> +                            fixed-link {
> +                                speed = <2500>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
>                      };
>                  };
>              };
>          };
>      };
>  
> +  # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
>    - |
> -    //Example 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4.
> -
> -    ethernet {
> -        #address-cells = <1>;
> -        #size-cells = <0>;
> -        gmac0: mac@0 {
> -            compatible = "mediatek,eth-mac";
> -            reg = <0>;
> -            phy-mode = "rgmii";
> -
> -            fixed-link {
> -                speed = <1000>;
> -                full-duplex;
> -                pause;
> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
> +    #include <dt-bindings/reset/mt7621-reset.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7621";
> +                    reg = <0>;
> +
> +                    mediatek,mcm;
> +                    resets = <&sysc MT7621_RST_MCM>;
> +                    reset-names = "mcm";
> +
> +                    interrupt-controller;
> +                    #interrupt-cells = <1>;
> +                    interrupt-parent = <&gic>;
> +                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "trgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
> +                };
>              };
>          };
> +    };
>  
> -        gmac1: mac@1 {
> -            compatible = "mediatek,eth-mac";
> -            reg = <1>;
> -            phy-mode = "rgmii-txid";
> -            phy-handle = <&phy4>;
> +  # Example 5: MT7621: mux MT7530's phy4 to SoC's gmac1
> +  - |
> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
> +    #include <dt-bindings/reset/mt7621-reset.h>
> +
> +    platform {
> +        pinctrl {
> +            example5_rgmii2_pins: rgmii2-pins {
> +                pinmux {
> +                    groups = "rgmii2";
> +                    function = "rgmii2";
> +                };
> +            };

No need to put this in the example. We don't put provide nodes in 
the examples of the consumers. It's also incomplete and can't be 
validated. 

>          };
>  
> -        mdio: mdio-bus {
> +        ethernet {
>              #address-cells = <1>;
>              #size-cells = <0>;

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

* Re: [PATCH v2 3/7] dt-bindings: net: dsa: mediatek,mt7530: update examples
@ 2022-08-16 21:02     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:02 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On Sat, Aug 13, 2022 at 06:44:11PM +0300, Arınç ÜNAL wrote:
> Update the examples on the binding.
> 
> - Add examples which include a wide variation of configurations.
> - Make example comments YAML comment instead of DT binding comment.
> - Define examples from platform to make the bindings clearer.
> - Add interrupt controller to the examples. Include header file for
> interrupt.
> - Change reset line for MT7621 examples.
> - Pretty formatting for the examples.
> - Change switch reg to 0.
> - Change port labels to fit the example, change port 4 label to wan.
> - Change ethernet-ports to ports.

Again, why?

> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 663 +++++++++++++-----
>  1 file changed, 502 insertions(+), 161 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 4c99266ce82a..cc87f48d4d07 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -210,144 +210,374 @@ allOf:
>  unevaluatedProperties: false
>  
>  examples:
> +  # Example 1: Standalone MT7530
>    - |
>      #include <dt-bindings/gpio/gpio.h>
> -    mdio {
> -        #address-cells = <1>;
> -        #size-cells = <0>;
> -        switch@0 {
> -            compatible = "mediatek,mt7530";
> -            reg = <0>;
> -
> -            core-supply = <&mt6323_vpa_reg>;
> -            io-supply = <&mt6323_vemc3v3_reg>;
> -            reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
> -
> -            ethernet-ports {
> +
> +    platform {
> +        ethernet {

Don't need these nodes.

> +            mdio {
>                  #address-cells = <1>;
>                  #size-cells = <0>;
> -                port@0 {
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7530";
>                      reg = <0>;
> -                    label = "lan0";
> -                };
>  
> -                port@1 {
> -                    reg = <1>;
> -                    label = "lan1";
> -                };
> +                    reset-gpios = <&pio 33 0>;
>  
> -                port@2 {
> -                    reg = <2>;
> -                    label = "lan2";
> -                };
> +                    core-supply = <&mt6323_vpa_reg>;
> +                    io-supply = <&mt6323_vemc3v3_reg>;
> +
> +                    ports {

'ports' is for the DT graph binding. 'ethernet-ports' is for DSA 
binding. The former is allowed due to existing users. Don't add more.

> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
>  
> -                port@3 {
> -                    reg = <3>;
> -                    label = "lan3";
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "rgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
>                  };
> +            };
> +        };
> +    };
>  
> -                port@4 {
> -                    reg = <4>;
> -                    label = "wan";
> +  # Example 2: MT7530 in MT7623AI SoC

Looks almost the same as example 1. Examples are not an enumeration of 
every possible DT. Limit them to cases which are significantly 
different.

> +  - |
> +    #include <dt-bindings/reset/mt2701-resets.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7530";
> +                    reg = <0>;
> +
> +                    mediatek,mcm;
> +                    resets = <&ethsys MT2701_ETHSYS_MCM_RST>;
> +                    reset-names = "mcm";
> +
> +                    core-supply = <&mt6323_vpa_reg>;
> +                    io-supply = <&mt6323_vemc3v3_reg>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "trgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
>                  };
> +            };
> +        };
> +    };
> +
> +  # Example 3: Standalone MT7531
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7531";
> +                    reg = <0>;
> +
> +                    reset-gpios = <&pio 54 0>;
> +
> +                    interrupt-controller;
> +                    #interrupt-cells = <1>;
> +                    interrupt-parent = <&pio>;
> +                    interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
>  
> -                port@6 {
> -                    reg = <6>;
> -                    label = "cpu";
> -                    ethernet = <&gmac0>;
> -                    phy-mode = "trgmii";
> -                    fixed-link {
> -                        speed = <1000>;
> -                        full-duplex;
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "2500base-x";
> +
> +                            fixed-link {
> +                                speed = <2500>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
>                      };
>                  };
>              };
>          };
>      };
>  
> +  # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
>    - |
> -    //Example 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4.
> -
> -    ethernet {
> -        #address-cells = <1>;
> -        #size-cells = <0>;
> -        gmac0: mac@0 {
> -            compatible = "mediatek,eth-mac";
> -            reg = <0>;
> -            phy-mode = "rgmii";
> -
> -            fixed-link {
> -                speed = <1000>;
> -                full-duplex;
> -                pause;
> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
> +    #include <dt-bindings/reset/mt7621-reset.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7621";
> +                    reg = <0>;
> +
> +                    mediatek,mcm;
> +                    resets = <&sysc MT7621_RST_MCM>;
> +                    reset-names = "mcm";
> +
> +                    interrupt-controller;
> +                    #interrupt-cells = <1>;
> +                    interrupt-parent = <&gic>;
> +                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "trgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
> +                };
>              };
>          };
> +    };
>  
> -        gmac1: mac@1 {
> -            compatible = "mediatek,eth-mac";
> -            reg = <1>;
> -            phy-mode = "rgmii-txid";
> -            phy-handle = <&phy4>;
> +  # Example 5: MT7621: mux MT7530's phy4 to SoC's gmac1
> +  - |
> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
> +    #include <dt-bindings/reset/mt7621-reset.h>
> +
> +    platform {
> +        pinctrl {
> +            example5_rgmii2_pins: rgmii2-pins {
> +                pinmux {
> +                    groups = "rgmii2";
> +                    function = "rgmii2";
> +                };
> +            };

No need to put this in the example. We don't put provide nodes in 
the examples of the consumers. It's also incomplete and can't be 
validated. 

>          };
>  
> -        mdio: mdio-bus {
> +        ethernet {
>              #address-cells = <1>;
>              #size-cells = <0>;


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

* Re: [PATCH v2 3/7] dt-bindings: net: dsa: mediatek,mt7530: update examples
@ 2022-08-16 21:02     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:02 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:11PM +0300, Arınç ÜNAL wrote:
> Update the examples on the binding.
> 
> - Add examples which include a wide variation of configurations.
> - Make example comments YAML comment instead of DT binding comment.
> - Define examples from platform to make the bindings clearer.
> - Add interrupt controller to the examples. Include header file for
> interrupt.
> - Change reset line for MT7621 examples.
> - Pretty formatting for the examples.
> - Change switch reg to 0.
> - Change port labels to fit the example, change port 4 label to wan.
> - Change ethernet-ports to ports.

Again, why?

> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 663 +++++++++++++-----
>  1 file changed, 502 insertions(+), 161 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 4c99266ce82a..cc87f48d4d07 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -210,144 +210,374 @@ allOf:
>  unevaluatedProperties: false
>  
>  examples:
> +  # Example 1: Standalone MT7530
>    - |
>      #include <dt-bindings/gpio/gpio.h>
> -    mdio {
> -        #address-cells = <1>;
> -        #size-cells = <0>;
> -        switch@0 {
> -            compatible = "mediatek,mt7530";
> -            reg = <0>;
> -
> -            core-supply = <&mt6323_vpa_reg>;
> -            io-supply = <&mt6323_vemc3v3_reg>;
> -            reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
> -
> -            ethernet-ports {
> +
> +    platform {
> +        ethernet {

Don't need these nodes.

> +            mdio {
>                  #address-cells = <1>;
>                  #size-cells = <0>;
> -                port@0 {
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7530";
>                      reg = <0>;
> -                    label = "lan0";
> -                };
>  
> -                port@1 {
> -                    reg = <1>;
> -                    label = "lan1";
> -                };
> +                    reset-gpios = <&pio 33 0>;
>  
> -                port@2 {
> -                    reg = <2>;
> -                    label = "lan2";
> -                };
> +                    core-supply = <&mt6323_vpa_reg>;
> +                    io-supply = <&mt6323_vemc3v3_reg>;
> +
> +                    ports {

'ports' is for the DT graph binding. 'ethernet-ports' is for DSA 
binding. The former is allowed due to existing users. Don't add more.

> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
>  
> -                port@3 {
> -                    reg = <3>;
> -                    label = "lan3";
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "rgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
>                  };
> +            };
> +        };
> +    };
>  
> -                port@4 {
> -                    reg = <4>;
> -                    label = "wan";
> +  # Example 2: MT7530 in MT7623AI SoC

Looks almost the same as example 1. Examples are not an enumeration of 
every possible DT. Limit them to cases which are significantly 
different.

> +  - |
> +    #include <dt-bindings/reset/mt2701-resets.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7530";
> +                    reg = <0>;
> +
> +                    mediatek,mcm;
> +                    resets = <&ethsys MT2701_ETHSYS_MCM_RST>;
> +                    reset-names = "mcm";
> +
> +                    core-supply = <&mt6323_vpa_reg>;
> +                    io-supply = <&mt6323_vemc3v3_reg>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "trgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
>                  };
> +            };
> +        };
> +    };
> +
> +  # Example 3: Standalone MT7531
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7531";
> +                    reg = <0>;
> +
> +                    reset-gpios = <&pio 54 0>;
> +
> +                    interrupt-controller;
> +                    #interrupt-cells = <1>;
> +                    interrupt-parent = <&pio>;
> +                    interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
>  
> -                port@6 {
> -                    reg = <6>;
> -                    label = "cpu";
> -                    ethernet = <&gmac0>;
> -                    phy-mode = "trgmii";
> -                    fixed-link {
> -                        speed = <1000>;
> -                        full-duplex;
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "2500base-x";
> +
> +                            fixed-link {
> +                                speed = <2500>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
>                      };
>                  };
>              };
>          };
>      };
>  
> +  # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
>    - |
> -    //Example 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4.
> -
> -    ethernet {
> -        #address-cells = <1>;
> -        #size-cells = <0>;
> -        gmac0: mac@0 {
> -            compatible = "mediatek,eth-mac";
> -            reg = <0>;
> -            phy-mode = "rgmii";
> -
> -            fixed-link {
> -                speed = <1000>;
> -                full-duplex;
> -                pause;
> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
> +    #include <dt-bindings/reset/mt7621-reset.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch@0 {
> +                    compatible = "mediatek,mt7621";
> +                    reg = <0>;
> +
> +                    mediatek,mcm;
> +                    resets = <&sysc MT7621_RST_MCM>;
> +                    reset-names = "mcm";
> +
> +                    interrupt-controller;
> +                    #interrupt-cells = <1>;
> +                    interrupt-parent = <&gic>;
> +                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port@1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port@2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port@3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port@4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port@6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "trgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
> +                };
>              };
>          };
> +    };
>  
> -        gmac1: mac@1 {
> -            compatible = "mediatek,eth-mac";
> -            reg = <1>;
> -            phy-mode = "rgmii-txid";
> -            phy-handle = <&phy4>;
> +  # Example 5: MT7621: mux MT7530's phy4 to SoC's gmac1
> +  - |
> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
> +    #include <dt-bindings/reset/mt7621-reset.h>
> +
> +    platform {
> +        pinctrl {
> +            example5_rgmii2_pins: rgmii2-pins {
> +                pinmux {
> +                    groups = "rgmii2";
> +                    function = "rgmii2";
> +                };
> +            };

No need to put this in the example. We don't put provide nodes in 
the examples of the consumers. It's also incomplete and can't be 
validated. 

>          };
>  
> -        mdio: mdio-bus {
> +        ethernet {
>              #address-cells = <1>;
>              #size-cells = <0>;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 5/7] dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
  2022-08-13 15:44   ` Arınç ÜNAL
  (?)
@ 2022-08-16 21:14     ` Rob Herring
  -1 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:14 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:13PM +0300, Arınç ÜNAL wrote:
> Remove unnecessary lines as they are already included from the referred
> dsa.yaml.

You are duplicating the schema and then removing parts twice. I would 
combine patches 4 and 5 or reverse the order.

> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 27 -------------------
>  1 file changed, 27 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index ff51a2f6875f..a27cb4fa490f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -162,15 +162,8 @@ allOf:
>  
>        patternProperties:
>          "^(ethernet-)?ports$":
> -          type: object
> -
>            patternProperties:
>              "^(ethernet-)?port@[0-9]+$":
> -              type: object
> -              description: Ethernet switch ports
> -
> -              unevaluatedProperties: false
> -
>                properties:
>                  reg:
>                    description:
> @@ -178,7 +171,6 @@ allOf:
>                      0 to 5 for user ports.
>  
>                allOf:
> -                - $ref: dsa-port.yaml#
>                  - if:

This 'if' schema is the only part you need actually (though you have to 
create the node structure).

>                      properties:
>                        label:
> @@ -186,7 +178,6 @@ allOf:
>                            - const: cpu
>                    then:
>                      required:
> -                      - reg
>                        - phy-mode
>  
>    - if:
> @@ -200,15 +191,8 @@ allOf:
>  
>        patternProperties:
>          "^(ethernet-)?ports$":
> -          type: object
> -
>            patternProperties:
>              "^(ethernet-)?port@[0-9]+$":
> -              type: object
> -              description: Ethernet switch ports
> -
> -              unevaluatedProperties: false
> -
>                properties:
>                  reg:
>                    description:
> @@ -216,7 +200,6 @@ allOf:
>                      0 to 5 for user ports.
>  
>                allOf:
> -                - $ref: dsa-port.yaml#
>                  - if:
>                      properties:
>                        label:
> @@ -224,7 +207,6 @@ allOf:
>                            - const: cpu
>                    then:
>                      required:
> -                      - reg
>                        - phy-mode
>  
>    - if:
> @@ -238,15 +220,8 @@ allOf:
>  
>        patternProperties:
>          "^(ethernet-)?ports$":
> -          type: object
> -
>            patternProperties:
>              "^(ethernet-)?port@[0-9]+$":
> -              type: object
> -              description: Ethernet switch ports
> -
> -              unevaluatedProperties: false
> -
>                properties:
>                  reg:
>                    description:
> @@ -254,7 +229,6 @@ allOf:
>                      0 to 5 for user ports.
>  
>                allOf:
> -                - $ref: dsa-port.yaml#
>                  - if:
>                      properties:
>                        label:
> @@ -262,7 +236,6 @@ allOf:
>                            - const: cpu
>                    then:
>                      required:
> -                      - reg
>                        - phy-mode
>  
>  unevaluatedProperties: false
> -- 
> 2.34.1
> 
> 

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

* Re: [PATCH v2 5/7] dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
@ 2022-08-16 21:14     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:14 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On Sat, Aug 13, 2022 at 06:44:13PM +0300, Arınç ÜNAL wrote:
> Remove unnecessary lines as they are already included from the referred
> dsa.yaml.

You are duplicating the schema and then removing parts twice. I would 
combine patches 4 and 5 or reverse the order.

> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 27 -------------------
>  1 file changed, 27 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index ff51a2f6875f..a27cb4fa490f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -162,15 +162,8 @@ allOf:
>  
>        patternProperties:
>          "^(ethernet-)?ports$":
> -          type: object
> -
>            patternProperties:
>              "^(ethernet-)?port@[0-9]+$":
> -              type: object
> -              description: Ethernet switch ports
> -
> -              unevaluatedProperties: false
> -
>                properties:
>                  reg:
>                    description:
> @@ -178,7 +171,6 @@ allOf:
>                      0 to 5 for user ports.
>  
>                allOf:
> -                - $ref: dsa-port.yaml#
>                  - if:

This 'if' schema is the only part you need actually (though you have to 
create the node structure).

>                      properties:
>                        label:
> @@ -186,7 +178,6 @@ allOf:
>                            - const: cpu
>                    then:
>                      required:
> -                      - reg
>                        - phy-mode
>  
>    - if:
> @@ -200,15 +191,8 @@ allOf:
>  
>        patternProperties:
>          "^(ethernet-)?ports$":
> -          type: object
> -
>            patternProperties:
>              "^(ethernet-)?port@[0-9]+$":
> -              type: object
> -              description: Ethernet switch ports
> -
> -              unevaluatedProperties: false
> -
>                properties:
>                  reg:
>                    description:
> @@ -216,7 +200,6 @@ allOf:
>                      0 to 5 for user ports.
>  
>                allOf:
> -                - $ref: dsa-port.yaml#
>                  - if:
>                      properties:
>                        label:
> @@ -224,7 +207,6 @@ allOf:
>                            - const: cpu
>                    then:
>                      required:
> -                      - reg
>                        - phy-mode
>  
>    - if:
> @@ -238,15 +220,8 @@ allOf:
>  
>        patternProperties:
>          "^(ethernet-)?ports$":
> -          type: object
> -
>            patternProperties:
>              "^(ethernet-)?port@[0-9]+$":
> -              type: object
> -              description: Ethernet switch ports
> -
> -              unevaluatedProperties: false
> -
>                properties:
>                  reg:
>                    description:
> @@ -254,7 +229,6 @@ allOf:
>                      0 to 5 for user ports.
>  
>                allOf:
> -                - $ref: dsa-port.yaml#
>                  - if:
>                      properties:
>                        label:
> @@ -262,7 +236,6 @@ allOf:
>                            - const: cpu
>                    then:
>                      required:
> -                      - reg
>                        - phy-mode
>  
>  unevaluatedProperties: false
> -- 
> 2.34.1
> 
> 


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

* Re: [PATCH v2 5/7] dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
@ 2022-08-16 21:14     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:14 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:13PM +0300, Arınç ÜNAL wrote:
> Remove unnecessary lines as they are already included from the referred
> dsa.yaml.

You are duplicating the schema and then removing parts twice. I would 
combine patches 4 and 5 or reverse the order.

> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 27 -------------------
>  1 file changed, 27 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index ff51a2f6875f..a27cb4fa490f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -162,15 +162,8 @@ allOf:
>  
>        patternProperties:
>          "^(ethernet-)?ports$":
> -          type: object
> -
>            patternProperties:
>              "^(ethernet-)?port@[0-9]+$":
> -              type: object
> -              description: Ethernet switch ports
> -
> -              unevaluatedProperties: false
> -
>                properties:
>                  reg:
>                    description:
> @@ -178,7 +171,6 @@ allOf:
>                      0 to 5 for user ports.
>  
>                allOf:
> -                - $ref: dsa-port.yaml#
>                  - if:

This 'if' schema is the only part you need actually (though you have to 
create the node structure).

>                      properties:
>                        label:
> @@ -186,7 +178,6 @@ allOf:
>                            - const: cpu
>                    then:
>                      required:
> -                      - reg
>                        - phy-mode
>  
>    - if:
> @@ -200,15 +191,8 @@ allOf:
>  
>        patternProperties:
>          "^(ethernet-)?ports$":
> -          type: object
> -
>            patternProperties:
>              "^(ethernet-)?port@[0-9]+$":
> -              type: object
> -              description: Ethernet switch ports
> -
> -              unevaluatedProperties: false
> -
>                properties:
>                  reg:
>                    description:
> @@ -216,7 +200,6 @@ allOf:
>                      0 to 5 for user ports.
>  
>                allOf:
> -                - $ref: dsa-port.yaml#
>                  - if:
>                      properties:
>                        label:
> @@ -224,7 +207,6 @@ allOf:
>                            - const: cpu
>                    then:
>                      required:
> -                      - reg
>                        - phy-mode
>  
>    - if:
> @@ -238,15 +220,8 @@ allOf:
>  
>        patternProperties:
>          "^(ethernet-)?ports$":
> -          type: object
> -
>            patternProperties:
>              "^(ethernet-)?port@[0-9]+$":
> -              type: object
> -              description: Ethernet switch ports
> -
> -              unevaluatedProperties: false
> -
>                properties:
>                  reg:
>                    description:
> @@ -254,7 +229,6 @@ allOf:
>                      0 to 5 for user ports.
>  
>                allOf:
> -                - $ref: dsa-port.yaml#
>                  - if:
>                      properties:
>                        label:
> @@ -262,7 +236,6 @@ allOf:
>                            - const: cpu
>                    then:
>                      required:
> -                      - reg
>                        - phy-mode
>  
>  unevaluatedProperties: false
> -- 
> 2.34.1
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 6/7] dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
  2022-08-13 15:44   ` Arınç ÜNAL
  (?)
@ 2022-08-16 21:21     ` Rob Herring
  -1 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:21 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:14PM +0300, Arınç ÜNAL wrote:
> Define acceptable phy-mode values for CPU port of each compatible device.
> Remove relevant information from the description of the binding.

I'm not really sure this is worth the complexity just to check 
'phy-mode'...

> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 103 ++++++++++++++++--
>  1 file changed, 92 insertions(+), 11 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index a27cb4fa490f..530ef5a75a2f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -49,17 +49,6 @@ description: |
>    * mt7621: phy-mode = "rgmii-txid";
>    * mt7623: phy-mode = "rgmii";
>  
> -  CPU-Ports need a phy-mode property:
> -    Allowed values on mt7530 and mt7621:
> -      - "rgmii"
> -      - "trgmii"
> -    On mt7531:
> -      - "1000base-x"
> -      - "2500base-x"
> -      - "rgmii"
> -      - "sgmii"
> -
> -
>  properties:
>    compatible:
>      oneOf:
> @@ -177,6 +166,36 @@ allOf:
>                          items:
>                            - const: cpu
>                    then:
> +                    allOf:
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 5
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - gmii
> +                                - mii
> +                                - rgmii
> +
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 6
> +                        then:

You've restricted this to ports 5 or 6 already, so you just need an 
'else' here. And you can then drop the 'allOf'.

> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - rgmii
> +                                - trgmii
> +
> +                    properties:
> +                      reg:
> +                        enum:
> +                          - 5
> +                          - 6
> +
>                      required:
>                        - phy-mode
>  
> @@ -206,6 +225,38 @@ allOf:
>                          items:
>                            - const: cpu
>                    then:
> +                    allOf:
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 5
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - 1000base-x
> +                                - 2500base-x
> +                                - rgmii
> +                                - sgmii
> +
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 6
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - 1000base-x
> +                                - 2500base-x
> +                                - sgmii
> +
> +                    properties:
> +                      reg:
> +                        enum:
> +                          - 5
> +                          - 6
> +
>                      required:
>                        - phy-mode
>  
> @@ -235,6 +286,36 @@ allOf:
>                          items:
>                            - const: cpu
>                    then:
> +                    allOf:
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 5
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - gmii
> +                                - mii
> +                                - rgmii
> +
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 6
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - rgmii
> +                                - trgmii
> +
> +                    properties:
> +                      reg:
> +                        enum:
> +                          - 5
> +                          - 6
> +

Looks like the same schema duplicated. You can put it under a '$defs' 
and reference it twice.

>                      required:
>                        - phy-mode
>  
> -- 
> 2.34.1
> 
> 

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

* Re: [PATCH v2 6/7] dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
@ 2022-08-16 21:21     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:21 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On Sat, Aug 13, 2022 at 06:44:14PM +0300, Arınç ÜNAL wrote:
> Define acceptable phy-mode values for CPU port of each compatible device.
> Remove relevant information from the description of the binding.

I'm not really sure this is worth the complexity just to check 
'phy-mode'...

> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 103 ++++++++++++++++--
>  1 file changed, 92 insertions(+), 11 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index a27cb4fa490f..530ef5a75a2f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -49,17 +49,6 @@ description: |
>    * mt7621: phy-mode = "rgmii-txid";
>    * mt7623: phy-mode = "rgmii";
>  
> -  CPU-Ports need a phy-mode property:
> -    Allowed values on mt7530 and mt7621:
> -      - "rgmii"
> -      - "trgmii"
> -    On mt7531:
> -      - "1000base-x"
> -      - "2500base-x"
> -      - "rgmii"
> -      - "sgmii"
> -
> -
>  properties:
>    compatible:
>      oneOf:
> @@ -177,6 +166,36 @@ allOf:
>                          items:
>                            - const: cpu
>                    then:
> +                    allOf:
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 5
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - gmii
> +                                - mii
> +                                - rgmii
> +
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 6
> +                        then:

You've restricted this to ports 5 or 6 already, so you just need an 
'else' here. And you can then drop the 'allOf'.

> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - rgmii
> +                                - trgmii
> +
> +                    properties:
> +                      reg:
> +                        enum:
> +                          - 5
> +                          - 6
> +
>                      required:
>                        - phy-mode
>  
> @@ -206,6 +225,38 @@ allOf:
>                          items:
>                            - const: cpu
>                    then:
> +                    allOf:
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 5
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - 1000base-x
> +                                - 2500base-x
> +                                - rgmii
> +                                - sgmii
> +
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 6
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - 1000base-x
> +                                - 2500base-x
> +                                - sgmii
> +
> +                    properties:
> +                      reg:
> +                        enum:
> +                          - 5
> +                          - 6
> +
>                      required:
>                        - phy-mode
>  
> @@ -235,6 +286,36 @@ allOf:
>                          items:
>                            - const: cpu
>                    then:
> +                    allOf:
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 5
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - gmii
> +                                - mii
> +                                - rgmii
> +
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 6
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - rgmii
> +                                - trgmii
> +
> +                    properties:
> +                      reg:
> +                        enum:
> +                          - 5
> +                          - 6
> +

Looks like the same schema duplicated. You can put it under a '$defs' 
and reference it twice.

>                      required:
>                        - phy-mode
>  
> -- 
> 2.34.1
> 
> 


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

* Re: [PATCH v2 6/7] dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
@ 2022-08-16 21:21     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:21 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:14PM +0300, Arınç ÜNAL wrote:
> Define acceptable phy-mode values for CPU port of each compatible device.
> Remove relevant information from the description of the binding.

I'm not really sure this is worth the complexity just to check 
'phy-mode'...

> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 103 ++++++++++++++++--
>  1 file changed, 92 insertions(+), 11 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index a27cb4fa490f..530ef5a75a2f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -49,17 +49,6 @@ description: |
>    * mt7621: phy-mode = "rgmii-txid";
>    * mt7623: phy-mode = "rgmii";
>  
> -  CPU-Ports need a phy-mode property:
> -    Allowed values on mt7530 and mt7621:
> -      - "rgmii"
> -      - "trgmii"
> -    On mt7531:
> -      - "1000base-x"
> -      - "2500base-x"
> -      - "rgmii"
> -      - "sgmii"
> -
> -
>  properties:
>    compatible:
>      oneOf:
> @@ -177,6 +166,36 @@ allOf:
>                          items:
>                            - const: cpu
>                    then:
> +                    allOf:
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 5
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - gmii
> +                                - mii
> +                                - rgmii
> +
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 6
> +                        then:

You've restricted this to ports 5 or 6 already, so you just need an 
'else' here. And you can then drop the 'allOf'.

> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - rgmii
> +                                - trgmii
> +
> +                    properties:
> +                      reg:
> +                        enum:
> +                          - 5
> +                          - 6
> +
>                      required:
>                        - phy-mode
>  
> @@ -206,6 +225,38 @@ allOf:
>                          items:
>                            - const: cpu
>                    then:
> +                    allOf:
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 5
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - 1000base-x
> +                                - 2500base-x
> +                                - rgmii
> +                                - sgmii
> +
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 6
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - 1000base-x
> +                                - 2500base-x
> +                                - sgmii
> +
> +                    properties:
> +                      reg:
> +                        enum:
> +                          - 5
> +                          - 6
> +
>                      required:
>                        - phy-mode
>  
> @@ -235,6 +286,36 @@ allOf:
>                          items:
>                            - const: cpu
>                    then:
> +                    allOf:
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 5
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - gmii
> +                                - mii
> +                                - rgmii
> +
> +                      - if:
> +                          properties:
> +                            reg:
> +                              const: 6
> +                        then:
> +                          properties:
> +                            phy-mode:
> +                              enum:
> +                                - rgmii
> +                                - trgmii
> +
> +                    properties:
> +                      reg:
> +                        enum:
> +                          - 5
> +                          - 6
> +

Looks like the same schema duplicated. You can put it under a '$defs' 
and reference it twice.

>                      required:
>                        - phy-mode
>  
> -- 
> 2.34.1
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 7/7] dt-bindings: net: dsa: mediatek,mt7530: update binding description
  2022-08-13 15:44   ` Arınç ÜNAL
  (?)
@ 2022-08-16 21:25     ` Rob Herring
  -1 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:25 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:15PM +0300, Arınç ÜNAL wrote:
> Update the description of the binding.
> 
> - Describe the switches, which SoCs they are in, or if they are standalone.
> - Explain the various ways of configuring MT7530's port 5.
> - Remove phy-mode = "rgmii-txid" from description. Same code path is
> followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 97 ++++++++++++-------
>  1 file changed, 62 insertions(+), 35 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 530ef5a75a2f..cf6340d072df 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -13,41 +13,68 @@ maintainers:
>    - Sean Wang <sean.wang@mediatek.com>
>  
>  description: |
> -  Port 5 of mt7530 and mt7621 switch is muxed between:
> -  1. GMAC5: GMAC5 can interface with another external MAC or PHY.
> -  2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC
> -     of the SOC. Used in many setups where port 0/4 becomes the WAN port.
> -     Note: On a MT7621 SOC with integrated switch: 2nd GMAC can only connected to
> -       GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not
> -       connected to external component!
> -
> -  Port 5 modes/configurations:
> -  1. Port 5 is disabled and isolated: An external phy can interface to the 2nd
> -     GMAC of the SOC.
> -     In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd
> -     GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC!
> -  2. Port 5 is muxed to PHY of port 0/4: Port 0/4 interfaces with 2nd GMAC.
> -     It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode
> -     and RGMII delay.
> -  3. Port 5 is muxed to GMAC5 and can interface to an external phy.
> -     Port 5 becomes an extra switch port.
> -     Only works on platform where external phy TX<->RX lines are swapped.
> -     Like in the Ubiquiti ER-X-SFP.
> -  4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port.
> -     Currently a 2nd CPU port is not supported by DSA code.
> -
> -  Depending on how the external PHY is wired:
> -  1. normal: The PHY can only connect to 2nd GMAC but not to the switch
> -  2. swapped: RGMII TX, RX are swapped; external phy interface with the switch as
> -     a ethernet port. But can't interface to the 2nd GMAC.
> -
> -    Based on the DT the port 5 mode is configured.
> -
> -  Driver tries to lookup the phy-handle of the 2nd GMAC of the master device.
> -  When phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2.
> -  phy-mode must be set, see also example 2 below!
> -  * mt7621: phy-mode = "rgmii-txid";
> -  * mt7623: phy-mode = "rgmii";
> +  There are two versions of MT7530, standalone and in a multi-chip module.
> +
> +  MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN,
> +  MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs.
> +
> +  MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs

s/got //

> +  and the switch registers are directly mapped into SoC's memory map rather than
> +  using MDIO. There is currently no support for this.

No support in the binding or driver? Driver capabilities are relevant to 
the binding.

> +
> +  There is only the standalone version of MT7531.
> +
> +  Port 5 on MT7530 has got various ways of configuration.

s/got //

> +
> +  For standalone MT7530:
> +
> +    - Port 5 can be used as a CPU port.
> +
> +    - PHY 0 or 4 of the switch can be muxed to connect to the gmac of the SoC
> +      which port 5 is wired to. Usually used for connecting the wan port
> +      directly to the CPU to achieve 2 Gbps routing in total.
> +
> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
> +      property refers to on the gmac node to mux the specified phy.
> +
> +      The driver requires the gmac of the SoC to have "mediatek,eth-mac" as the
> +      compatible string and the reg must be 1. So, for now, only gmac1 of an
> +      MediaTek SoC can benefit this. Banana Pi BPI-R2 suits this.
> +      Check out example 5 for a similar configuration.
> +
> +    - Port 5 can be wired to an external phy. Port 5 becomes a DSA slave.
> +      Check out example 7 for a similar configuration.
> +
> +  For multi-chip module MT7530:
> +
> +    - Port 5 can be used as a CPU port.
> +
> +    - PHY 0 or 4 of the switch can be muxed to connect to gmac1 of the SoC.
> +      Usually used for connecting the wan port directly to the CPU to achieve 2
> +      Gbps routing in total.
> +
> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
> +      property refers to on the gmac node to mux the specified phy.
> +
> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
> +      Check out example 5.
> +
> +    - In case of an external phy wired to gmac1 of the SoC, port 5 must not be
> +      enabled.
> +
> +      In case of muxing PHY 0 or 4, the external phy must not be enabled.
> +
> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
> +      Check out example 6.
> +
> +    - Port 5 can be muxed to an external phy. Port 5 becomes a DSA slave.
> +      The external phy must be wired TX to TX to gmac1 of the SoC for this to
> +      work. Ubiquiti EdgeRouter X SFP is wired this way.
> +
> +      Muxing PHY 0 or 4 won't work when the external phy is connected TX to TX.
> +
> +      For the MT7621 SoCs, rgmii2 group must be claimed with gpio function.
> +      Check out example 7.
>  
>  properties:
>    compatible:
> -- 
> 2.34.1
> 
> 

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

* Re: [PATCH v2 7/7] dt-bindings: net: dsa: mediatek,mt7530: update binding description
@ 2022-08-16 21:25     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:25 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On Sat, Aug 13, 2022 at 06:44:15PM +0300, Arınç ÜNAL wrote:
> Update the description of the binding.
> 
> - Describe the switches, which SoCs they are in, or if they are standalone.
> - Explain the various ways of configuring MT7530's port 5.
> - Remove phy-mode = "rgmii-txid" from description. Same code path is
> followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 97 ++++++++++++-------
>  1 file changed, 62 insertions(+), 35 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 530ef5a75a2f..cf6340d072df 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -13,41 +13,68 @@ maintainers:
>    - Sean Wang <sean.wang@mediatek.com>
>  
>  description: |
> -  Port 5 of mt7530 and mt7621 switch is muxed between:
> -  1. GMAC5: GMAC5 can interface with another external MAC or PHY.
> -  2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC
> -     of the SOC. Used in many setups where port 0/4 becomes the WAN port.
> -     Note: On a MT7621 SOC with integrated switch: 2nd GMAC can only connected to
> -       GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not
> -       connected to external component!
> -
> -  Port 5 modes/configurations:
> -  1. Port 5 is disabled and isolated: An external phy can interface to the 2nd
> -     GMAC of the SOC.
> -     In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd
> -     GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC!
> -  2. Port 5 is muxed to PHY of port 0/4: Port 0/4 interfaces with 2nd GMAC.
> -     It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode
> -     and RGMII delay.
> -  3. Port 5 is muxed to GMAC5 and can interface to an external phy.
> -     Port 5 becomes an extra switch port.
> -     Only works on platform where external phy TX<->RX lines are swapped.
> -     Like in the Ubiquiti ER-X-SFP.
> -  4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port.
> -     Currently a 2nd CPU port is not supported by DSA code.
> -
> -  Depending on how the external PHY is wired:
> -  1. normal: The PHY can only connect to 2nd GMAC but not to the switch
> -  2. swapped: RGMII TX, RX are swapped; external phy interface with the switch as
> -     a ethernet port. But can't interface to the 2nd GMAC.
> -
> -    Based on the DT the port 5 mode is configured.
> -
> -  Driver tries to lookup the phy-handle of the 2nd GMAC of the master device.
> -  When phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2.
> -  phy-mode must be set, see also example 2 below!
> -  * mt7621: phy-mode = "rgmii-txid";
> -  * mt7623: phy-mode = "rgmii";
> +  There are two versions of MT7530, standalone and in a multi-chip module.
> +
> +  MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN,
> +  MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs.
> +
> +  MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs

s/got //

> +  and the switch registers are directly mapped into SoC's memory map rather than
> +  using MDIO. There is currently no support for this.

No support in the binding or driver? Driver capabilities are relevant to 
the binding.

> +
> +  There is only the standalone version of MT7531.
> +
> +  Port 5 on MT7530 has got various ways of configuration.

s/got //

> +
> +  For standalone MT7530:
> +
> +    - Port 5 can be used as a CPU port.
> +
> +    - PHY 0 or 4 of the switch can be muxed to connect to the gmac of the SoC
> +      which port 5 is wired to. Usually used for connecting the wan port
> +      directly to the CPU to achieve 2 Gbps routing in total.
> +
> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
> +      property refers to on the gmac node to mux the specified phy.
> +
> +      The driver requires the gmac of the SoC to have "mediatek,eth-mac" as the
> +      compatible string and the reg must be 1. So, for now, only gmac1 of an
> +      MediaTek SoC can benefit this. Banana Pi BPI-R2 suits this.
> +      Check out example 5 for a similar configuration.
> +
> +    - Port 5 can be wired to an external phy. Port 5 becomes a DSA slave.
> +      Check out example 7 for a similar configuration.
> +
> +  For multi-chip module MT7530:
> +
> +    - Port 5 can be used as a CPU port.
> +
> +    - PHY 0 or 4 of the switch can be muxed to connect to gmac1 of the SoC.
> +      Usually used for connecting the wan port directly to the CPU to achieve 2
> +      Gbps routing in total.
> +
> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
> +      property refers to on the gmac node to mux the specified phy.
> +
> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
> +      Check out example 5.
> +
> +    - In case of an external phy wired to gmac1 of the SoC, port 5 must not be
> +      enabled.
> +
> +      In case of muxing PHY 0 or 4, the external phy must not be enabled.
> +
> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
> +      Check out example 6.
> +
> +    - Port 5 can be muxed to an external phy. Port 5 becomes a DSA slave.
> +      The external phy must be wired TX to TX to gmac1 of the SoC for this to
> +      work. Ubiquiti EdgeRouter X SFP is wired this way.
> +
> +      Muxing PHY 0 or 4 won't work when the external phy is connected TX to TX.
> +
> +      For the MT7621 SoCs, rgmii2 group must be claimed with gpio function.
> +      Check out example 7.
>  
>  properties:
>    compatible:
> -- 
> 2.34.1
> 
> 


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

* Re: [PATCH v2 7/7] dt-bindings: net: dsa: mediatek,mt7530: update binding description
@ 2022-08-16 21:25     ` Rob Herring
  0 siblings, 0 replies; 55+ messages in thread
From: Rob Herring @ 2022-08-16 21:25 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On Sat, Aug 13, 2022 at 06:44:15PM +0300, Arınç ÜNAL wrote:
> Update the description of the binding.
> 
> - Describe the switches, which SoCs they are in, or if they are standalone.
> - Explain the various ways of configuring MT7530's port 5.
> - Remove phy-mode = "rgmii-txid" from description. Same code path is
> followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 97 ++++++++++++-------
>  1 file changed, 62 insertions(+), 35 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 530ef5a75a2f..cf6340d072df 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -13,41 +13,68 @@ maintainers:
>    - Sean Wang <sean.wang@mediatek.com>
>  
>  description: |
> -  Port 5 of mt7530 and mt7621 switch is muxed between:
> -  1. GMAC5: GMAC5 can interface with another external MAC or PHY.
> -  2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC
> -     of the SOC. Used in many setups where port 0/4 becomes the WAN port.
> -     Note: On a MT7621 SOC with integrated switch: 2nd GMAC can only connected to
> -       GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not
> -       connected to external component!
> -
> -  Port 5 modes/configurations:
> -  1. Port 5 is disabled and isolated: An external phy can interface to the 2nd
> -     GMAC of the SOC.
> -     In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd
> -     GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC!
> -  2. Port 5 is muxed to PHY of port 0/4: Port 0/4 interfaces with 2nd GMAC.
> -     It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode
> -     and RGMII delay.
> -  3. Port 5 is muxed to GMAC5 and can interface to an external phy.
> -     Port 5 becomes an extra switch port.
> -     Only works on platform where external phy TX<->RX lines are swapped.
> -     Like in the Ubiquiti ER-X-SFP.
> -  4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port.
> -     Currently a 2nd CPU port is not supported by DSA code.
> -
> -  Depending on how the external PHY is wired:
> -  1. normal: The PHY can only connect to 2nd GMAC but not to the switch
> -  2. swapped: RGMII TX, RX are swapped; external phy interface with the switch as
> -     a ethernet port. But can't interface to the 2nd GMAC.
> -
> -    Based on the DT the port 5 mode is configured.
> -
> -  Driver tries to lookup the phy-handle of the 2nd GMAC of the master device.
> -  When phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2.
> -  phy-mode must be set, see also example 2 below!
> -  * mt7621: phy-mode = "rgmii-txid";
> -  * mt7623: phy-mode = "rgmii";
> +  There are two versions of MT7530, standalone and in a multi-chip module.
> +
> +  MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN,
> +  MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs.
> +
> +  MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs

s/got //

> +  and the switch registers are directly mapped into SoC's memory map rather than
> +  using MDIO. There is currently no support for this.

No support in the binding or driver? Driver capabilities are relevant to 
the binding.

> +
> +  There is only the standalone version of MT7531.
> +
> +  Port 5 on MT7530 has got various ways of configuration.

s/got //

> +
> +  For standalone MT7530:
> +
> +    - Port 5 can be used as a CPU port.
> +
> +    - PHY 0 or 4 of the switch can be muxed to connect to the gmac of the SoC
> +      which port 5 is wired to. Usually used for connecting the wan port
> +      directly to the CPU to achieve 2 Gbps routing in total.
> +
> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
> +      property refers to on the gmac node to mux the specified phy.
> +
> +      The driver requires the gmac of the SoC to have "mediatek,eth-mac" as the
> +      compatible string and the reg must be 1. So, for now, only gmac1 of an
> +      MediaTek SoC can benefit this. Banana Pi BPI-R2 suits this.
> +      Check out example 5 for a similar configuration.
> +
> +    - Port 5 can be wired to an external phy. Port 5 becomes a DSA slave.
> +      Check out example 7 for a similar configuration.
> +
> +  For multi-chip module MT7530:
> +
> +    - Port 5 can be used as a CPU port.
> +
> +    - PHY 0 or 4 of the switch can be muxed to connect to gmac1 of the SoC.
> +      Usually used for connecting the wan port directly to the CPU to achieve 2
> +      Gbps routing in total.
> +
> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
> +      property refers to on the gmac node to mux the specified phy.
> +
> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
> +      Check out example 5.
> +
> +    - In case of an external phy wired to gmac1 of the SoC, port 5 must not be
> +      enabled.
> +
> +      In case of muxing PHY 0 or 4, the external phy must not be enabled.
> +
> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
> +      Check out example 6.
> +
> +    - Port 5 can be muxed to an external phy. Port 5 becomes a DSA slave.
> +      The external phy must be wired TX to TX to gmac1 of the SoC for this to
> +      work. Ubiquiti EdgeRouter X SFP is wired this way.
> +
> +      Muxing PHY 0 or 4 won't work when the external phy is connected TX to TX.
> +
> +      For the MT7621 SoCs, rgmii2 group must be claimed with gpio function.
> +      Check out example 7.
>  
>  properties:
>    compatible:
> -- 
> 2.34.1
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 7/7] dt-bindings: net: dsa: mediatek,mt7530: update binding description
  2022-08-16 21:25     ` Rob Herring
  (?)
@ 2022-08-16 21:53       ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 21:53 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 17.08.2022 00:25, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:15PM +0300, Arınç ÜNAL wrote:
>> Update the description of the binding.
>>
>> - Describe the switches, which SoCs they are in, or if they are standalone.
>> - Explain the various ways of configuring MT7530's port 5.
>> - Remove phy-mode = "rgmii-txid" from description. Same code path is
>> followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 97 ++++++++++++-------
>>   1 file changed, 62 insertions(+), 35 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index 530ef5a75a2f..cf6340d072df 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -13,41 +13,68 @@ maintainers:
>>     - Sean Wang <sean.wang@mediatek.com>
>>   
>>   description: |
>> -  Port 5 of mt7530 and mt7621 switch is muxed between:
>> -  1. GMAC5: GMAC5 can interface with another external MAC or PHY.
>> -  2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC
>> -     of the SOC. Used in many setups where port 0/4 becomes the WAN port.
>> -     Note: On a MT7621 SOC with integrated switch: 2nd GMAC can only connected to
>> -       GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not
>> -       connected to external component!
>> -
>> -  Port 5 modes/configurations:
>> -  1. Port 5 is disabled and isolated: An external phy can interface to the 2nd
>> -     GMAC of the SOC.
>> -     In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd
>> -     GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC!
>> -  2. Port 5 is muxed to PHY of port 0/4: Port 0/4 interfaces with 2nd GMAC.
>> -     It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode
>> -     and RGMII delay.
>> -  3. Port 5 is muxed to GMAC5 and can interface to an external phy.
>> -     Port 5 becomes an extra switch port.
>> -     Only works on platform where external phy TX<->RX lines are swapped.
>> -     Like in the Ubiquiti ER-X-SFP.
>> -  4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port.
>> -     Currently a 2nd CPU port is not supported by DSA code.
>> -
>> -  Depending on how the external PHY is wired:
>> -  1. normal: The PHY can only connect to 2nd GMAC but not to the switch
>> -  2. swapped: RGMII TX, RX are swapped; external phy interface with the switch as
>> -     a ethernet port. But can't interface to the 2nd GMAC.
>> -
>> -    Based on the DT the port 5 mode is configured.
>> -
>> -  Driver tries to lookup the phy-handle of the 2nd GMAC of the master device.
>> -  When phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2.
>> -  phy-mode must be set, see also example 2 below!
>> -  * mt7621: phy-mode = "rgmii-txid";
>> -  * mt7623: phy-mode = "rgmii";
>> +  There are two versions of MT7530, standalone and in a multi-chip module.
>> +
>> +  MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN,
>> +  MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs.
>> +
>> +  MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs
> 
> s/got //

Can't use British English on bindings? :)

> 
>> +  and the switch registers are directly mapped into SoC's memory map rather than
>> +  using MDIO. There is currently no support for this.
> 
> No support in the binding or driver? Driver capabilities are relevant to
> the binding.

In the driver. Also, did you mean irrelevant? Should I remove this part 
from the binding?

> 
>> +
>> +  There is only the standalone version of MT7531.
>> +
>> +  Port 5 on MT7530 has got various ways of configuration.
> 
> s/got //
> 
>> +
>> +  For standalone MT7530:
>> +
>> +    - Port 5 can be used as a CPU port.
>> +
>> +    - PHY 0 or 4 of the switch can be muxed to connect to the gmac of the SoC
>> +      which port 5 is wired to. Usually used for connecting the wan port
>> +      directly to the CPU to achieve 2 Gbps routing in total.
>> +
>> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
>> +      property refers to on the gmac node to mux the specified phy.
>> +
>> +      The driver requires the gmac of the SoC to have "mediatek,eth-mac" as the
>> +      compatible string and the reg must be 1. So, for now, only gmac1 of an
>> +      MediaTek SoC can benefit this. Banana Pi BPI-R2 suits this.
>> +      Check out example 5 for a similar configuration.
>> +
>> +    - Port 5 can be wired to an external phy. Port 5 becomes a DSA slave.
>> +      Check out example 7 for a similar configuration.
>> +
>> +  For multi-chip module MT7530:
>> +
>> +    - Port 5 can be used as a CPU port.
>> +
>> +    - PHY 0 or 4 of the switch can be muxed to connect to gmac1 of the SoC.
>> +      Usually used for connecting the wan port directly to the CPU to achieve 2
>> +      Gbps routing in total.
>> +
>> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
>> +      property refers to on the gmac node to mux the specified phy.
>> +
>> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
>> +      Check out example 5.
>> +
>> +    - In case of an external phy wired to gmac1 of the SoC, port 5 must not be
>> +      enabled.
>> +
>> +      In case of muxing PHY 0 or 4, the external phy must not be enabled.
>> +
>> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
>> +      Check out example 6.
>> +
>> +    - Port 5 can be muxed to an external phy. Port 5 becomes a DSA slave.
>> +      The external phy must be wired TX to TX to gmac1 of the SoC for this to
>> +      work. Ubiquiti EdgeRouter X SFP is wired this way.
>> +
>> +      Muxing PHY 0 or 4 won't work when the external phy is connected TX to TX.
>> +
>> +      For the MT7621 SoCs, rgmii2 group must be claimed with gpio function.
>> +      Check out example 7.
>>   
>>   properties:
>>     compatible:
>> -- 
>> 2.34.1
>>
>>

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

* Re: [PATCH v2 7/7] dt-bindings: net: dsa: mediatek,mt7530: update binding description
@ 2022-08-16 21:53       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 21:53 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On 17.08.2022 00:25, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:15PM +0300, Arınç ÜNAL wrote:
>> Update the description of the binding.
>>
>> - Describe the switches, which SoCs they are in, or if they are standalone.
>> - Explain the various ways of configuring MT7530's port 5.
>> - Remove phy-mode = "rgmii-txid" from description. Same code path is
>> followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 97 ++++++++++++-------
>>   1 file changed, 62 insertions(+), 35 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index 530ef5a75a2f..cf6340d072df 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -13,41 +13,68 @@ maintainers:
>>     - Sean Wang <sean.wang@mediatek.com>
>>   
>>   description: |
>> -  Port 5 of mt7530 and mt7621 switch is muxed between:
>> -  1. GMAC5: GMAC5 can interface with another external MAC or PHY.
>> -  2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC
>> -     of the SOC. Used in many setups where port 0/4 becomes the WAN port.
>> -     Note: On a MT7621 SOC with integrated switch: 2nd GMAC can only connected to
>> -       GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not
>> -       connected to external component!
>> -
>> -  Port 5 modes/configurations:
>> -  1. Port 5 is disabled and isolated: An external phy can interface to the 2nd
>> -     GMAC of the SOC.
>> -     In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd
>> -     GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC!
>> -  2. Port 5 is muxed to PHY of port 0/4: Port 0/4 interfaces with 2nd GMAC.
>> -     It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode
>> -     and RGMII delay.
>> -  3. Port 5 is muxed to GMAC5 and can interface to an external phy.
>> -     Port 5 becomes an extra switch port.
>> -     Only works on platform where external phy TX<->RX lines are swapped.
>> -     Like in the Ubiquiti ER-X-SFP.
>> -  4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port.
>> -     Currently a 2nd CPU port is not supported by DSA code.
>> -
>> -  Depending on how the external PHY is wired:
>> -  1. normal: The PHY can only connect to 2nd GMAC but not to the switch
>> -  2. swapped: RGMII TX, RX are swapped; external phy interface with the switch as
>> -     a ethernet port. But can't interface to the 2nd GMAC.
>> -
>> -    Based on the DT the port 5 mode is configured.
>> -
>> -  Driver tries to lookup the phy-handle of the 2nd GMAC of the master device.
>> -  When phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2.
>> -  phy-mode must be set, see also example 2 below!
>> -  * mt7621: phy-mode = "rgmii-txid";
>> -  * mt7623: phy-mode = "rgmii";
>> +  There are two versions of MT7530, standalone and in a multi-chip module.
>> +
>> +  MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN,
>> +  MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs.
>> +
>> +  MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs
> 
> s/got //

Can't use British English on bindings? :)

> 
>> +  and the switch registers are directly mapped into SoC's memory map rather than
>> +  using MDIO. There is currently no support for this.
> 
> No support in the binding or driver? Driver capabilities are relevant to
> the binding.

In the driver. Also, did you mean irrelevant? Should I remove this part 
from the binding?

> 
>> +
>> +  There is only the standalone version of MT7531.
>> +
>> +  Port 5 on MT7530 has got various ways of configuration.
> 
> s/got //
> 
>> +
>> +  For standalone MT7530:
>> +
>> +    - Port 5 can be used as a CPU port.
>> +
>> +    - PHY 0 or 4 of the switch can be muxed to connect to the gmac of the SoC
>> +      which port 5 is wired to. Usually used for connecting the wan port
>> +      directly to the CPU to achieve 2 Gbps routing in total.
>> +
>> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
>> +      property refers to on the gmac node to mux the specified phy.
>> +
>> +      The driver requires the gmac of the SoC to have "mediatek,eth-mac" as the
>> +      compatible string and the reg must be 1. So, for now, only gmac1 of an
>> +      MediaTek SoC can benefit this. Banana Pi BPI-R2 suits this.
>> +      Check out example 5 for a similar configuration.
>> +
>> +    - Port 5 can be wired to an external phy. Port 5 becomes a DSA slave.
>> +      Check out example 7 for a similar configuration.
>> +
>> +  For multi-chip module MT7530:
>> +
>> +    - Port 5 can be used as a CPU port.
>> +
>> +    - PHY 0 or 4 of the switch can be muxed to connect to gmac1 of the SoC.
>> +      Usually used for connecting the wan port directly to the CPU to achieve 2
>> +      Gbps routing in total.
>> +
>> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
>> +      property refers to on the gmac node to mux the specified phy.
>> +
>> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
>> +      Check out example 5.
>> +
>> +    - In case of an external phy wired to gmac1 of the SoC, port 5 must not be
>> +      enabled.
>> +
>> +      In case of muxing PHY 0 or 4, the external phy must not be enabled.
>> +
>> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
>> +      Check out example 6.
>> +
>> +    - Port 5 can be muxed to an external phy. Port 5 becomes a DSA slave.
>> +      The external phy must be wired TX to TX to gmac1 of the SoC for this to
>> +      work. Ubiquiti EdgeRouter X SFP is wired this way.
>> +
>> +      Muxing PHY 0 or 4 won't work when the external phy is connected TX to TX.
>> +
>> +      For the MT7621 SoCs, rgmii2 group must be claimed with gpio function.
>> +      Check out example 7.
>>   
>>   properties:
>>     compatible:
>> -- 
>> 2.34.1
>>
>>


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

* Re: [PATCH v2 7/7] dt-bindings: net: dsa: mediatek,mt7530: update binding description
@ 2022-08-16 21:53       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 21:53 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 17.08.2022 00:25, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:15PM +0300, Arınç ÜNAL wrote:
>> Update the description of the binding.
>>
>> - Describe the switches, which SoCs they are in, or if they are standalone.
>> - Explain the various ways of configuring MT7530's port 5.
>> - Remove phy-mode = "rgmii-txid" from description. Same code path is
>> followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 97 ++++++++++++-------
>>   1 file changed, 62 insertions(+), 35 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index 530ef5a75a2f..cf6340d072df 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -13,41 +13,68 @@ maintainers:
>>     - Sean Wang <sean.wang@mediatek.com>
>>   
>>   description: |
>> -  Port 5 of mt7530 and mt7621 switch is muxed between:
>> -  1. GMAC5: GMAC5 can interface with another external MAC or PHY.
>> -  2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC
>> -     of the SOC. Used in many setups where port 0/4 becomes the WAN port.
>> -     Note: On a MT7621 SOC with integrated switch: 2nd GMAC can only connected to
>> -       GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not
>> -       connected to external component!
>> -
>> -  Port 5 modes/configurations:
>> -  1. Port 5 is disabled and isolated: An external phy can interface to the 2nd
>> -     GMAC of the SOC.
>> -     In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd
>> -     GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC!
>> -  2. Port 5 is muxed to PHY of port 0/4: Port 0/4 interfaces with 2nd GMAC.
>> -     It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode
>> -     and RGMII delay.
>> -  3. Port 5 is muxed to GMAC5 and can interface to an external phy.
>> -     Port 5 becomes an extra switch port.
>> -     Only works on platform where external phy TX<->RX lines are swapped.
>> -     Like in the Ubiquiti ER-X-SFP.
>> -  4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port.
>> -     Currently a 2nd CPU port is not supported by DSA code.
>> -
>> -  Depending on how the external PHY is wired:
>> -  1. normal: The PHY can only connect to 2nd GMAC but not to the switch
>> -  2. swapped: RGMII TX, RX are swapped; external phy interface with the switch as
>> -     a ethernet port. But can't interface to the 2nd GMAC.
>> -
>> -    Based on the DT the port 5 mode is configured.
>> -
>> -  Driver tries to lookup the phy-handle of the 2nd GMAC of the master device.
>> -  When phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2.
>> -  phy-mode must be set, see also example 2 below!
>> -  * mt7621: phy-mode = "rgmii-txid";
>> -  * mt7623: phy-mode = "rgmii";
>> +  There are two versions of MT7530, standalone and in a multi-chip module.
>> +
>> +  MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN,
>> +  MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs.
>> +
>> +  MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs
> 
> s/got //

Can't use British English on bindings? :)

> 
>> +  and the switch registers are directly mapped into SoC's memory map rather than
>> +  using MDIO. There is currently no support for this.
> 
> No support in the binding or driver? Driver capabilities are relevant to
> the binding.

In the driver. Also, did you mean irrelevant? Should I remove this part 
from the binding?

> 
>> +
>> +  There is only the standalone version of MT7531.
>> +
>> +  Port 5 on MT7530 has got various ways of configuration.
> 
> s/got //
> 
>> +
>> +  For standalone MT7530:
>> +
>> +    - Port 5 can be used as a CPU port.
>> +
>> +    - PHY 0 or 4 of the switch can be muxed to connect to the gmac of the SoC
>> +      which port 5 is wired to. Usually used for connecting the wan port
>> +      directly to the CPU to achieve 2 Gbps routing in total.
>> +
>> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
>> +      property refers to on the gmac node to mux the specified phy.
>> +
>> +      The driver requires the gmac of the SoC to have "mediatek,eth-mac" as the
>> +      compatible string and the reg must be 1. So, for now, only gmac1 of an
>> +      MediaTek SoC can benefit this. Banana Pi BPI-R2 suits this.
>> +      Check out example 5 for a similar configuration.
>> +
>> +    - Port 5 can be wired to an external phy. Port 5 becomes a DSA slave.
>> +      Check out example 7 for a similar configuration.
>> +
>> +  For multi-chip module MT7530:
>> +
>> +    - Port 5 can be used as a CPU port.
>> +
>> +    - PHY 0 or 4 of the switch can be muxed to connect to gmac1 of the SoC.
>> +      Usually used for connecting the wan port directly to the CPU to achieve 2
>> +      Gbps routing in total.
>> +
>> +      The driver looks up the reg on the ethernet-phy node which the phy-handle
>> +      property refers to on the gmac node to mux the specified phy.
>> +
>> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
>> +      Check out example 5.
>> +
>> +    - In case of an external phy wired to gmac1 of the SoC, port 5 must not be
>> +      enabled.
>> +
>> +      In case of muxing PHY 0 or 4, the external phy must not be enabled.
>> +
>> +      For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.
>> +      Check out example 6.
>> +
>> +    - Port 5 can be muxed to an external phy. Port 5 becomes a DSA slave.
>> +      The external phy must be wired TX to TX to gmac1 of the SoC for this to
>> +      work. Ubiquiti EdgeRouter X SFP is wired this way.
>> +
>> +      Muxing PHY 0 or 4 won't work when the external phy is connected TX to TX.
>> +
>> +      For the MT7621 SoCs, rgmii2 group must be claimed with gpio function.
>> +      Check out example 7.
>>   
>>   properties:
>>     compatible:
>> -- 
>> 2.34.1
>>
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 6/7] dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
  2022-08-16 21:21     ` Rob Herring
  (?)
@ 2022-08-16 22:09       ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:09 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 17.08.2022 00:21, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:14PM +0300, Arınç ÜNAL wrote:
>> Define acceptable phy-mode values for CPU port of each compatible device.
>> Remove relevant information from the description of the binding.
> 
> I'm not really sure this is worth the complexity just to check
> 'phy-mode'...

I can describe it on the binding description but it won't be checked on 
DT bindings. phy-mode values are significantly different between mt7530 
and mt7531 so I think it's useful to have it.

> 
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 103 ++++++++++++++++--
>>   1 file changed, 92 insertions(+), 11 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index a27cb4fa490f..530ef5a75a2f 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -49,17 +49,6 @@ description: |
>>     * mt7621: phy-mode = "rgmii-txid";
>>     * mt7623: phy-mode = "rgmii";
>>   
>> -  CPU-Ports need a phy-mode property:
>> -    Allowed values on mt7530 and mt7621:
>> -      - "rgmii"
>> -      - "trgmii"
>> -    On mt7531:
>> -      - "1000base-x"
>> -      - "2500base-x"
>> -      - "rgmii"
>> -      - "sgmii"
>> -
>> -
>>   properties:
>>     compatible:
>>       oneOf:
>> @@ -177,6 +166,36 @@ allOf:
>>                           items:
>>                             - const: cpu
>>                     then:
>> +                    allOf:
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 5
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - gmii
>> +                                - mii
>> +                                - rgmii
>> +
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 6
>> +                        then:
> 
> You've restricted this to ports 5 or 6 already, so you just need an
> 'else' here. And you can then drop the 'allOf'.

Good thinking, will do.

> 
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - rgmii
>> +                                - trgmii
>> +
>> +                    properties:
>> +                      reg:
>> +                        enum:
>> +                          - 5
>> +                          - 6
>> +
>>                       required:
>>                         - phy-mode
>>   
>> @@ -206,6 +225,38 @@ allOf:
>>                           items:
>>                             - const: cpu
>>                     then:
>> +                    allOf:
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 5
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - 1000base-x
>> +                                - 2500base-x
>> +                                - rgmii
>> +                                - sgmii
>> +
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 6
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - 1000base-x
>> +                                - 2500base-x
>> +                                - sgmii
>> +
>> +                    properties:
>> +                      reg:
>> +                        enum:
>> +                          - 5
>> +                          - 6
>> +
>>                       required:
>>                         - phy-mode
>>   
>> @@ -235,6 +286,36 @@ allOf:
>>                           items:
>>                             - const: cpu
>>                     then:
>> +                    allOf:
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 5
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - gmii
>> +                                - mii
>> +                                - rgmii
>> +
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 6
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - rgmii
>> +                                - trgmii
>> +
>> +                    properties:
>> +                      reg:
>> +                        enum:
>> +                          - 5
>> +                          - 6
>> +
> 
> Looks like the same schema duplicated. You can put it under a '$defs'
> and reference it twice.

Great!

> 
>>                       required:
>>                         - phy-mode
>>   
>> -- 
>> 2.34.1
>>
>>

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

* Re: [PATCH v2 6/7] dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
@ 2022-08-16 22:09       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:09 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On 17.08.2022 00:21, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:14PM +0300, Arınç ÜNAL wrote:
>> Define acceptable phy-mode values for CPU port of each compatible device.
>> Remove relevant information from the description of the binding.
> 
> I'm not really sure this is worth the complexity just to check
> 'phy-mode'...

I can describe it on the binding description but it won't be checked on 
DT bindings. phy-mode values are significantly different between mt7530 
and mt7531 so I think it's useful to have it.

> 
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 103 ++++++++++++++++--
>>   1 file changed, 92 insertions(+), 11 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index a27cb4fa490f..530ef5a75a2f 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -49,17 +49,6 @@ description: |
>>     * mt7621: phy-mode = "rgmii-txid";
>>     * mt7623: phy-mode = "rgmii";
>>   
>> -  CPU-Ports need a phy-mode property:
>> -    Allowed values on mt7530 and mt7621:
>> -      - "rgmii"
>> -      - "trgmii"
>> -    On mt7531:
>> -      - "1000base-x"
>> -      - "2500base-x"
>> -      - "rgmii"
>> -      - "sgmii"
>> -
>> -
>>   properties:
>>     compatible:
>>       oneOf:
>> @@ -177,6 +166,36 @@ allOf:
>>                           items:
>>                             - const: cpu
>>                     then:
>> +                    allOf:
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 5
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - gmii
>> +                                - mii
>> +                                - rgmii
>> +
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 6
>> +                        then:
> 
> You've restricted this to ports 5 or 6 already, so you just need an
> 'else' here. And you can then drop the 'allOf'.

Good thinking, will do.

> 
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - rgmii
>> +                                - trgmii
>> +
>> +                    properties:
>> +                      reg:
>> +                        enum:
>> +                          - 5
>> +                          - 6
>> +
>>                       required:
>>                         - phy-mode
>>   
>> @@ -206,6 +225,38 @@ allOf:
>>                           items:
>>                             - const: cpu
>>                     then:
>> +                    allOf:
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 5
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - 1000base-x
>> +                                - 2500base-x
>> +                                - rgmii
>> +                                - sgmii
>> +
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 6
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - 1000base-x
>> +                                - 2500base-x
>> +                                - sgmii
>> +
>> +                    properties:
>> +                      reg:
>> +                        enum:
>> +                          - 5
>> +                          - 6
>> +
>>                       required:
>>                         - phy-mode
>>   
>> @@ -235,6 +286,36 @@ allOf:
>>                           items:
>>                             - const: cpu
>>                     then:
>> +                    allOf:
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 5
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - gmii
>> +                                - mii
>> +                                - rgmii
>> +
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 6
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - rgmii
>> +                                - trgmii
>> +
>> +                    properties:
>> +                      reg:
>> +                        enum:
>> +                          - 5
>> +                          - 6
>> +
> 
> Looks like the same schema duplicated. You can put it under a '$defs'
> and reference it twice.

Great!

> 
>>                       required:
>>                         - phy-mode
>>   
>> -- 
>> 2.34.1
>>
>>


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

* Re: [PATCH v2 6/7] dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible
@ 2022-08-16 22:09       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:09 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 17.08.2022 00:21, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:14PM +0300, Arınç ÜNAL wrote:
>> Define acceptable phy-mode values for CPU port of each compatible device.
>> Remove relevant information from the description of the binding.
> 
> I'm not really sure this is worth the complexity just to check
> 'phy-mode'...

I can describe it on the binding description but it won't be checked on 
DT bindings. phy-mode values are significantly different between mt7530 
and mt7531 so I think it's useful to have it.

> 
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 103 ++++++++++++++++--
>>   1 file changed, 92 insertions(+), 11 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index a27cb4fa490f..530ef5a75a2f 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -49,17 +49,6 @@ description: |
>>     * mt7621: phy-mode = "rgmii-txid";
>>     * mt7623: phy-mode = "rgmii";
>>   
>> -  CPU-Ports need a phy-mode property:
>> -    Allowed values on mt7530 and mt7621:
>> -      - "rgmii"
>> -      - "trgmii"
>> -    On mt7531:
>> -      - "1000base-x"
>> -      - "2500base-x"
>> -      - "rgmii"
>> -      - "sgmii"
>> -
>> -
>>   properties:
>>     compatible:
>>       oneOf:
>> @@ -177,6 +166,36 @@ allOf:
>>                           items:
>>                             - const: cpu
>>                     then:
>> +                    allOf:
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 5
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - gmii
>> +                                - mii
>> +                                - rgmii
>> +
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 6
>> +                        then:
> 
> You've restricted this to ports 5 or 6 already, so you just need an
> 'else' here. And you can then drop the 'allOf'.

Good thinking, will do.

> 
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - rgmii
>> +                                - trgmii
>> +
>> +                    properties:
>> +                      reg:
>> +                        enum:
>> +                          - 5
>> +                          - 6
>> +
>>                       required:
>>                         - phy-mode
>>   
>> @@ -206,6 +225,38 @@ allOf:
>>                           items:
>>                             - const: cpu
>>                     then:
>> +                    allOf:
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 5
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - 1000base-x
>> +                                - 2500base-x
>> +                                - rgmii
>> +                                - sgmii
>> +
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 6
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - 1000base-x
>> +                                - 2500base-x
>> +                                - sgmii
>> +
>> +                    properties:
>> +                      reg:
>> +                        enum:
>> +                          - 5
>> +                          - 6
>> +
>>                       required:
>>                         - phy-mode
>>   
>> @@ -235,6 +286,36 @@ allOf:
>>                           items:
>>                             - const: cpu
>>                     then:
>> +                    allOf:
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 5
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - gmii
>> +                                - mii
>> +                                - rgmii
>> +
>> +                      - if:
>> +                          properties:
>> +                            reg:
>> +                              const: 6
>> +                        then:
>> +                          properties:
>> +                            phy-mode:
>> +                              enum:
>> +                                - rgmii
>> +                                - trgmii
>> +
>> +                    properties:
>> +                      reg:
>> +                        enum:
>> +                          - 5
>> +                          - 6
>> +
> 
> Looks like the same schema duplicated. You can put it under a '$defs'
> and reference it twice.

Great!

> 
>>                       required:
>>                         - phy-mode
>>   
>> -- 
>> 2.34.1
>>
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 3/7] dt-bindings: net: dsa: mediatek,mt7530: update examples
  2022-08-16 21:02     ` Rob Herring
  (?)
@ 2022-08-16 22:15       ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:15 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On 17.08.2022 00:02, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:11PM +0300, Arınç ÜNAL wrote:
>> Update the examples on the binding.
>>
>> - Add examples which include a wide variation of configurations.
>> - Make example comments YAML comment instead of DT binding comment.
>> - Define examples from platform to make the bindings clearer.
>> - Add interrupt controller to the examples. Include header file for
>> interrupt.
>> - Change reset line for MT7621 examples.
>> - Pretty formatting for the examples.
>> - Change switch reg to 0.
>> - Change port labels to fit the example, change port 4 label to wan.
>> - Change ethernet-ports to ports.
> 
> Again, why?

For wrong reasons as it seems. Will revert that one.

> 
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 663 +++++++++++++-----
>>   1 file changed, 502 insertions(+), 161 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index 4c99266ce82a..cc87f48d4d07 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -210,144 +210,374 @@ allOf:
>>   unevaluatedProperties: false
>>   
>>   examples:
>> +  # Example 1: Standalone MT7530
>>     - |
>>       #include <dt-bindings/gpio/gpio.h>
>> -    mdio {
>> -        #address-cells = <1>;
>> -        #size-cells = <0>;
>> -        switch@0 {
>> -            compatible = "mediatek,mt7530";
>> -            reg = <0>;
>> -
>> -            core-supply = <&mt6323_vpa_reg>;
>> -            io-supply = <&mt6323_vemc3v3_reg>;
>> -            reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
>> -
>> -            ethernet-ports {
>> +
>> +    platform {
>> +        ethernet {
> 
> Don't need these nodes.

Will remove.

> 
>> +            mdio {
>>                   #address-cells = <1>;
>>                   #size-cells = <0>;
>> -                port@0 {
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7530";
>>                       reg = <0>;
>> -                    label = "lan0";
>> -                };
>>   
>> -                port@1 {
>> -                    reg = <1>;
>> -                    label = "lan1";
>> -                };
>> +                    reset-gpios = <&pio 33 0>;
>>   
>> -                port@2 {
>> -                    reg = <2>;
>> -                    label = "lan2";
>> -                };
>> +                    core-supply = <&mt6323_vpa_reg>;
>> +                    io-supply = <&mt6323_vemc3v3_reg>;
>> +
>> +                    ports {
> 
> 'ports' is for the DT graph binding. 'ethernet-ports' is for DSA
> binding. The former is allowed due to existing users. Don't add more.

Will fix.

> 
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>>   
>> -                port@3 {
>> -                    reg = <3>;
>> -                    label = "lan3";
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>> +
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "rgmii";
>> +
>> +                            fixed-link {
>> +                                speed = <1000>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>> +                    };
>>                   };
>> +            };
>> +        };
>> +    };
>>   
>> -                port@4 {
>> -                    reg = <4>;
>> -                    label = "wan";
>> +  # Example 2: MT7530 in MT7623AI SoC
> 
> Looks almost the same as example 1. Examples are not an enumeration of
> every possible DT. Limit them to cases which are significantly
> different.

It seemed to me it would be useful to reference the reset line for the 
MT7623AI SoC. Using mediatek,mcm and especially MT2701_ETHSYS_MCM_RST in 
dt-bindings/reset/mt2701-resets.h.

Should I remove anyway?

> 
>> +  - |
>> +    #include <dt-bindings/reset/mt2701-resets.h>
>> +
>> +    platform {
>> +        ethernet {
>> +            mdio {
>> +                #address-cells = <1>;
>> +                #size-cells = <0>;
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7530";
>> +                    reg = <0>;
>> +
>> +                    mediatek,mcm;
>> +                    resets = <&ethsys MT2701_ETHSYS_MCM_RST>;
>> +                    reset-names = "mcm";
>> +
>> +                    core-supply = <&mt6323_vpa_reg>;
>> +                    io-supply = <&mt6323_vemc3v3_reg>;
>> +
>> +                    ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>> +
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "trgmii";
>> +
>> +                            fixed-link {
>> +                                speed = <1000>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>> +                    };
>>                   };
>> +            };
>> +        };
>> +    };
>> +
>> +  # Example 3: Standalone MT7531
>> +  - |
>> +    #include <dt-bindings/gpio/gpio.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +
>> +    platform {
>> +        ethernet {
>> +            mdio {
>> +                #address-cells = <1>;
>> +                #size-cells = <0>;
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7531";
>> +                    reg = <0>;
>> +
>> +                    reset-gpios = <&pio 54 0>;
>> +
>> +                    interrupt-controller;
>> +                    #interrupt-cells = <1>;
>> +                    interrupt-parent = <&pio>;
>> +                    interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
>> +
>> +                    ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>>   
>> -                port@6 {
>> -                    reg = <6>;
>> -                    label = "cpu";
>> -                    ethernet = <&gmac0>;
>> -                    phy-mode = "trgmii";
>> -                    fixed-link {
>> -                        speed = <1000>;
>> -                        full-duplex;
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "2500base-x";
>> +
>> +                            fixed-link {
>> +                                speed = <2500>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>>                       };
>>                   };
>>               };
>>           };
>>       };
>>   
>> +  # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
>>     - |
>> -    //Example 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4.
>> -
>> -    ethernet {
>> -        #address-cells = <1>;
>> -        #size-cells = <0>;
>> -        gmac0: mac@0 {
>> -            compatible = "mediatek,eth-mac";
>> -            reg = <0>;
>> -            phy-mode = "rgmii";
>> -
>> -            fixed-link {
>> -                speed = <1000>;
>> -                full-duplex;
>> -                pause;
>> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
>> +    #include <dt-bindings/reset/mt7621-reset.h>
>> +
>> +    platform {
>> +        ethernet {
>> +            mdio {
>> +                #address-cells = <1>;
>> +                #size-cells = <0>;
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7621";
>> +                    reg = <0>;
>> +
>> +                    mediatek,mcm;
>> +                    resets = <&sysc MT7621_RST_MCM>;
>> +                    reset-names = "mcm";
>> +
>> +                    interrupt-controller;
>> +                    #interrupt-cells = <1>;
>> +                    interrupt-parent = <&gic>;
>> +                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
>> +
>> +                    ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>> +
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "trgmii";
>> +
>> +                            fixed-link {
>> +                                speed = <1000>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>> +                    };
>> +                };
>>               };
>>           };
>> +    };
>>   
>> -        gmac1: mac@1 {
>> -            compatible = "mediatek,eth-mac";
>> -            reg = <1>;
>> -            phy-mode = "rgmii-txid";
>> -            phy-handle = <&phy4>;
>> +  # Example 5: MT7621: mux MT7530's phy4 to SoC's gmac1
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
>> +    #include <dt-bindings/reset/mt7621-reset.h>
>> +
>> +    platform {
>> +        pinctrl {
>> +            example5_rgmii2_pins: rgmii2-pins {
>> +                pinmux {
>> +                    groups = "rgmii2";
>> +                    function = "rgmii2";
>> +                };
>> +            };
> 
> No need to put this in the example. We don't put provide nodes in
> the examples of the consumers. It's also incomplete and can't be
> validated.

Will remove.

> 
>>           };
>>   
>> -        mdio: mdio-bus {
>> +        ethernet {
>>               #address-cells = <1>;
>>               #size-cells = <0>;


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

* Re: [PATCH v2 3/7] dt-bindings: net: dsa: mediatek,mt7530: update examples
@ 2022-08-16 22:15       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:15 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 17.08.2022 00:02, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:11PM +0300, Arınç ÜNAL wrote:
>> Update the examples on the binding.
>>
>> - Add examples which include a wide variation of configurations.
>> - Make example comments YAML comment instead of DT binding comment.
>> - Define examples from platform to make the bindings clearer.
>> - Add interrupt controller to the examples. Include header file for
>> interrupt.
>> - Change reset line for MT7621 examples.
>> - Pretty formatting for the examples.
>> - Change switch reg to 0.
>> - Change port labels to fit the example, change port 4 label to wan.
>> - Change ethernet-ports to ports.
> 
> Again, why?

For wrong reasons as it seems. Will revert that one.

> 
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 663 +++++++++++++-----
>>   1 file changed, 502 insertions(+), 161 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index 4c99266ce82a..cc87f48d4d07 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -210,144 +210,374 @@ allOf:
>>   unevaluatedProperties: false
>>   
>>   examples:
>> +  # Example 1: Standalone MT7530
>>     - |
>>       #include <dt-bindings/gpio/gpio.h>
>> -    mdio {
>> -        #address-cells = <1>;
>> -        #size-cells = <0>;
>> -        switch@0 {
>> -            compatible = "mediatek,mt7530";
>> -            reg = <0>;
>> -
>> -            core-supply = <&mt6323_vpa_reg>;
>> -            io-supply = <&mt6323_vemc3v3_reg>;
>> -            reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
>> -
>> -            ethernet-ports {
>> +
>> +    platform {
>> +        ethernet {
> 
> Don't need these nodes.

Will remove.

> 
>> +            mdio {
>>                   #address-cells = <1>;
>>                   #size-cells = <0>;
>> -                port@0 {
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7530";
>>                       reg = <0>;
>> -                    label = "lan0";
>> -                };
>>   
>> -                port@1 {
>> -                    reg = <1>;
>> -                    label = "lan1";
>> -                };
>> +                    reset-gpios = <&pio 33 0>;
>>   
>> -                port@2 {
>> -                    reg = <2>;
>> -                    label = "lan2";
>> -                };
>> +                    core-supply = <&mt6323_vpa_reg>;
>> +                    io-supply = <&mt6323_vemc3v3_reg>;
>> +
>> +                    ports {
> 
> 'ports' is for the DT graph binding. 'ethernet-ports' is for DSA
> binding. The former is allowed due to existing users. Don't add more.

Will fix.

> 
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>>   
>> -                port@3 {
>> -                    reg = <3>;
>> -                    label = "lan3";
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>> +
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "rgmii";
>> +
>> +                            fixed-link {
>> +                                speed = <1000>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>> +                    };
>>                   };
>> +            };
>> +        };
>> +    };
>>   
>> -                port@4 {
>> -                    reg = <4>;
>> -                    label = "wan";
>> +  # Example 2: MT7530 in MT7623AI SoC
> 
> Looks almost the same as example 1. Examples are not an enumeration of
> every possible DT. Limit them to cases which are significantly
> different.

It seemed to me it would be useful to reference the reset line for the 
MT7623AI SoC. Using mediatek,mcm and especially MT2701_ETHSYS_MCM_RST in 
dt-bindings/reset/mt2701-resets.h.

Should I remove anyway?

> 
>> +  - |
>> +    #include <dt-bindings/reset/mt2701-resets.h>
>> +
>> +    platform {
>> +        ethernet {
>> +            mdio {
>> +                #address-cells = <1>;
>> +                #size-cells = <0>;
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7530";
>> +                    reg = <0>;
>> +
>> +                    mediatek,mcm;
>> +                    resets = <&ethsys MT2701_ETHSYS_MCM_RST>;
>> +                    reset-names = "mcm";
>> +
>> +                    core-supply = <&mt6323_vpa_reg>;
>> +                    io-supply = <&mt6323_vemc3v3_reg>;
>> +
>> +                    ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>> +
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "trgmii";
>> +
>> +                            fixed-link {
>> +                                speed = <1000>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>> +                    };
>>                   };
>> +            };
>> +        };
>> +    };
>> +
>> +  # Example 3: Standalone MT7531
>> +  - |
>> +    #include <dt-bindings/gpio/gpio.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +
>> +    platform {
>> +        ethernet {
>> +            mdio {
>> +                #address-cells = <1>;
>> +                #size-cells = <0>;
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7531";
>> +                    reg = <0>;
>> +
>> +                    reset-gpios = <&pio 54 0>;
>> +
>> +                    interrupt-controller;
>> +                    #interrupt-cells = <1>;
>> +                    interrupt-parent = <&pio>;
>> +                    interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
>> +
>> +                    ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>>   
>> -                port@6 {
>> -                    reg = <6>;
>> -                    label = "cpu";
>> -                    ethernet = <&gmac0>;
>> -                    phy-mode = "trgmii";
>> -                    fixed-link {
>> -                        speed = <1000>;
>> -                        full-duplex;
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "2500base-x";
>> +
>> +                            fixed-link {
>> +                                speed = <2500>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>>                       };
>>                   };
>>               };
>>           };
>>       };
>>   
>> +  # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
>>     - |
>> -    //Example 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4.
>> -
>> -    ethernet {
>> -        #address-cells = <1>;
>> -        #size-cells = <0>;
>> -        gmac0: mac@0 {
>> -            compatible = "mediatek,eth-mac";
>> -            reg = <0>;
>> -            phy-mode = "rgmii";
>> -
>> -            fixed-link {
>> -                speed = <1000>;
>> -                full-duplex;
>> -                pause;
>> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
>> +    #include <dt-bindings/reset/mt7621-reset.h>
>> +
>> +    platform {
>> +        ethernet {
>> +            mdio {
>> +                #address-cells = <1>;
>> +                #size-cells = <0>;
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7621";
>> +                    reg = <0>;
>> +
>> +                    mediatek,mcm;
>> +                    resets = <&sysc MT7621_RST_MCM>;
>> +                    reset-names = "mcm";
>> +
>> +                    interrupt-controller;
>> +                    #interrupt-cells = <1>;
>> +                    interrupt-parent = <&gic>;
>> +                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
>> +
>> +                    ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>> +
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "trgmii";
>> +
>> +                            fixed-link {
>> +                                speed = <1000>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>> +                    };
>> +                };
>>               };
>>           };
>> +    };
>>   
>> -        gmac1: mac@1 {
>> -            compatible = "mediatek,eth-mac";
>> -            reg = <1>;
>> -            phy-mode = "rgmii-txid";
>> -            phy-handle = <&phy4>;
>> +  # Example 5: MT7621: mux MT7530's phy4 to SoC's gmac1
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
>> +    #include <dt-bindings/reset/mt7621-reset.h>
>> +
>> +    platform {
>> +        pinctrl {
>> +            example5_rgmii2_pins: rgmii2-pins {
>> +                pinmux {
>> +                    groups = "rgmii2";
>> +                    function = "rgmii2";
>> +                };
>> +            };
> 
> No need to put this in the example. We don't put provide nodes in
> the examples of the consumers. It's also incomplete and can't be
> validated.

Will remove.

> 
>>           };
>>   
>> -        mdio: mdio-bus {
>> +        ethernet {
>>               #address-cells = <1>;
>>               #size-cells = <0>;

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

* Re: [PATCH v2 3/7] dt-bindings: net: dsa: mediatek,mt7530: update examples
@ 2022-08-16 22:15       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:15 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 17.08.2022 00:02, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:11PM +0300, Arınç ÜNAL wrote:
>> Update the examples on the binding.
>>
>> - Add examples which include a wide variation of configurations.
>> - Make example comments YAML comment instead of DT binding comment.
>> - Define examples from platform to make the bindings clearer.
>> - Add interrupt controller to the examples. Include header file for
>> interrupt.
>> - Change reset line for MT7621 examples.
>> - Pretty formatting for the examples.
>> - Change switch reg to 0.
>> - Change port labels to fit the example, change port 4 label to wan.
>> - Change ethernet-ports to ports.
> 
> Again, why?

For wrong reasons as it seems. Will revert that one.

> 
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 663 +++++++++++++-----
>>   1 file changed, 502 insertions(+), 161 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index 4c99266ce82a..cc87f48d4d07 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -210,144 +210,374 @@ allOf:
>>   unevaluatedProperties: false
>>   
>>   examples:
>> +  # Example 1: Standalone MT7530
>>     - |
>>       #include <dt-bindings/gpio/gpio.h>
>> -    mdio {
>> -        #address-cells = <1>;
>> -        #size-cells = <0>;
>> -        switch@0 {
>> -            compatible = "mediatek,mt7530";
>> -            reg = <0>;
>> -
>> -            core-supply = <&mt6323_vpa_reg>;
>> -            io-supply = <&mt6323_vemc3v3_reg>;
>> -            reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
>> -
>> -            ethernet-ports {
>> +
>> +    platform {
>> +        ethernet {
> 
> Don't need these nodes.

Will remove.

> 
>> +            mdio {
>>                   #address-cells = <1>;
>>                   #size-cells = <0>;
>> -                port@0 {
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7530";
>>                       reg = <0>;
>> -                    label = "lan0";
>> -                };
>>   
>> -                port@1 {
>> -                    reg = <1>;
>> -                    label = "lan1";
>> -                };
>> +                    reset-gpios = <&pio 33 0>;
>>   
>> -                port@2 {
>> -                    reg = <2>;
>> -                    label = "lan2";
>> -                };
>> +                    core-supply = <&mt6323_vpa_reg>;
>> +                    io-supply = <&mt6323_vemc3v3_reg>;
>> +
>> +                    ports {
> 
> 'ports' is for the DT graph binding. 'ethernet-ports' is for DSA
> binding. The former is allowed due to existing users. Don't add more.

Will fix.

> 
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>>   
>> -                port@3 {
>> -                    reg = <3>;
>> -                    label = "lan3";
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>> +
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "rgmii";
>> +
>> +                            fixed-link {
>> +                                speed = <1000>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>> +                    };
>>                   };
>> +            };
>> +        };
>> +    };
>>   
>> -                port@4 {
>> -                    reg = <4>;
>> -                    label = "wan";
>> +  # Example 2: MT7530 in MT7623AI SoC
> 
> Looks almost the same as example 1. Examples are not an enumeration of
> every possible DT. Limit them to cases which are significantly
> different.

It seemed to me it would be useful to reference the reset line for the 
MT7623AI SoC. Using mediatek,mcm and especially MT2701_ETHSYS_MCM_RST in 
dt-bindings/reset/mt2701-resets.h.

Should I remove anyway?

> 
>> +  - |
>> +    #include <dt-bindings/reset/mt2701-resets.h>
>> +
>> +    platform {
>> +        ethernet {
>> +            mdio {
>> +                #address-cells = <1>;
>> +                #size-cells = <0>;
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7530";
>> +                    reg = <0>;
>> +
>> +                    mediatek,mcm;
>> +                    resets = <&ethsys MT2701_ETHSYS_MCM_RST>;
>> +                    reset-names = "mcm";
>> +
>> +                    core-supply = <&mt6323_vpa_reg>;
>> +                    io-supply = <&mt6323_vemc3v3_reg>;
>> +
>> +                    ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>> +
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "trgmii";
>> +
>> +                            fixed-link {
>> +                                speed = <1000>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>> +                    };
>>                   };
>> +            };
>> +        };
>> +    };
>> +
>> +  # Example 3: Standalone MT7531
>> +  - |
>> +    #include <dt-bindings/gpio/gpio.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +
>> +    platform {
>> +        ethernet {
>> +            mdio {
>> +                #address-cells = <1>;
>> +                #size-cells = <0>;
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7531";
>> +                    reg = <0>;
>> +
>> +                    reset-gpios = <&pio 54 0>;
>> +
>> +                    interrupt-controller;
>> +                    #interrupt-cells = <1>;
>> +                    interrupt-parent = <&pio>;
>> +                    interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
>> +
>> +                    ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>>   
>> -                port@6 {
>> -                    reg = <6>;
>> -                    label = "cpu";
>> -                    ethernet = <&gmac0>;
>> -                    phy-mode = "trgmii";
>> -                    fixed-link {
>> -                        speed = <1000>;
>> -                        full-duplex;
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "2500base-x";
>> +
>> +                            fixed-link {
>> +                                speed = <2500>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>>                       };
>>                   };
>>               };
>>           };
>>       };
>>   
>> +  # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs
>>     - |
>> -    //Example 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4.
>> -
>> -    ethernet {
>> -        #address-cells = <1>;
>> -        #size-cells = <0>;
>> -        gmac0: mac@0 {
>> -            compatible = "mediatek,eth-mac";
>> -            reg = <0>;
>> -            phy-mode = "rgmii";
>> -
>> -            fixed-link {
>> -                speed = <1000>;
>> -                full-duplex;
>> -                pause;
>> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
>> +    #include <dt-bindings/reset/mt7621-reset.h>
>> +
>> +    platform {
>> +        ethernet {
>> +            mdio {
>> +                #address-cells = <1>;
>> +                #size-cells = <0>;
>> +
>> +                switch@0 {
>> +                    compatible = "mediatek,mt7621";
>> +                    reg = <0>;
>> +
>> +                    mediatek,mcm;
>> +                    resets = <&sysc MT7621_RST_MCM>;
>> +                    reset-names = "mcm";
>> +
>> +                    interrupt-controller;
>> +                    #interrupt-cells = <1>;
>> +                    interrupt-parent = <&gic>;
>> +                    interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
>> +
>> +                    ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                            reg = <0>;
>> +                            label = "lan1";
>> +                        };
>> +
>> +                        port@1 {
>> +                            reg = <1>;
>> +                            label = "lan2";
>> +                        };
>> +
>> +                        port@2 {
>> +                            reg = <2>;
>> +                            label = "lan3";
>> +                        };
>> +
>> +                        port@3 {
>> +                            reg = <3>;
>> +                            label = "lan4";
>> +                        };
>> +
>> +                        port@4 {
>> +                            reg = <4>;
>> +                            label = "wan";
>> +                        };
>> +
>> +                        port@6 {
>> +                            reg = <6>;
>> +                            label = "cpu";
>> +                            ethernet = <&gmac0>;
>> +                            phy-mode = "trgmii";
>> +
>> +                            fixed-link {
>> +                                speed = <1000>;
>> +                                full-duplex;
>> +                                pause;
>> +                            };
>> +                        };
>> +                    };
>> +                };
>>               };
>>           };
>> +    };
>>   
>> -        gmac1: mac@1 {
>> -            compatible = "mediatek,eth-mac";
>> -            reg = <1>;
>> -            phy-mode = "rgmii-txid";
>> -            phy-handle = <&phy4>;
>> +  # Example 5: MT7621: mux MT7530's phy4 to SoC's gmac1
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/mips-gic.h>
>> +    #include <dt-bindings/reset/mt7621-reset.h>
>> +
>> +    platform {
>> +        pinctrl {
>> +            example5_rgmii2_pins: rgmii2-pins {
>> +                pinmux {
>> +                    groups = "rgmii2";
>> +                    function = "rgmii2";
>> +                };
>> +            };
> 
> No need to put this in the example. We don't put provide nodes in
> the examples of the consumers. It's also incomplete and can't be
> validated.

Will remove.

> 
>>           };
>>   
>> -        mdio: mdio-bus {
>> +        ethernet {
>>               #address-cells = <1>;
>>               #size-cells = <0>;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 5/7] dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
  2022-08-16 21:14     ` Rob Herring
  (?)
@ 2022-08-16 22:21       ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:21 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 17.08.2022 00:14, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:13PM +0300, Arınç ÜNAL wrote:
>> Remove unnecessary lines as they are already included from the referred
>> dsa.yaml.
> 
> You are duplicating the schema and then removing parts twice. I would
> combine patches 4 and 5 or reverse the order.

Will combine.

> 
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 27 -------------------
>>   1 file changed, 27 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index ff51a2f6875f..a27cb4fa490f 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -162,15 +162,8 @@ allOf:
>>   
>>         patternProperties:
>>           "^(ethernet-)?ports$":
>> -          type: object
>> -
>>             patternProperties:
>>               "^(ethernet-)?port@[0-9]+$":
>> -              type: object
>> -              description: Ethernet switch ports
>> -
>> -              unevaluatedProperties: false
>> -
>>                 properties:
>>                   reg:
>>                     description:
>> @@ -178,7 +171,6 @@ allOf:
>>                       0 to 5 for user ports.
>>   
>>                 allOf:
>> -                - $ref: dsa-port.yaml#
>>                   - if:
> 
> This 'if' schema is the only part you need actually (though you have to
> create the node structure).

Do you mean that I should take "if:" out of allOf?

> 
>>                       properties:
>>                         label:
>> @@ -186,7 +178,6 @@ allOf:
>>                             - const: cpu
>>                     then:
>>                       required:
>> -                      - reg
>>                         - phy-mode
>>   
>>     - if:
>> @@ -200,15 +191,8 @@ allOf:
>>   
>>         patternProperties:
>>           "^(ethernet-)?ports$":
>> -          type: object
>> -
>>             patternProperties:
>>               "^(ethernet-)?port@[0-9]+$":
>> -              type: object
>> -              description: Ethernet switch ports
>> -
>> -              unevaluatedProperties: false
>> -
>>                 properties:
>>                   reg:
>>                     description:
>> @@ -216,7 +200,6 @@ allOf:
>>                       0 to 5 for user ports.
>>   
>>                 allOf:
>> -                - $ref: dsa-port.yaml#
>>                   - if:
>>                       properties:
>>                         label:
>> @@ -224,7 +207,6 @@ allOf:
>>                             - const: cpu
>>                     then:
>>                       required:
>> -                      - reg
>>                         - phy-mode
>>   
>>     - if:
>> @@ -238,15 +220,8 @@ allOf:
>>   
>>         patternProperties:
>>           "^(ethernet-)?ports$":
>> -          type: object
>> -
>>             patternProperties:
>>               "^(ethernet-)?port@[0-9]+$":
>> -              type: object
>> -              description: Ethernet switch ports
>> -
>> -              unevaluatedProperties: false
>> -
>>                 properties:
>>                   reg:
>>                     description:
>> @@ -254,7 +229,6 @@ allOf:
>>                       0 to 5 for user ports.
>>   
>>                 allOf:
>> -                - $ref: dsa-port.yaml#
>>                   - if:
>>                       properties:
>>                         label:
>> @@ -262,7 +236,6 @@ allOf:
>>                             - const: cpu
>>                     then:
>>                       required:
>> -                      - reg
>>                         - phy-mode
>>   
>>   unevaluatedProperties: false
>> -- 
>> 2.34.1
>>
>>

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

* Re: [PATCH v2 5/7] dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
@ 2022-08-16 22:21       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:21 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On 17.08.2022 00:14, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:13PM +0300, Arınç ÜNAL wrote:
>> Remove unnecessary lines as they are already included from the referred
>> dsa.yaml.
> 
> You are duplicating the schema and then removing parts twice. I would
> combine patches 4 and 5 or reverse the order.

Will combine.

> 
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 27 -------------------
>>   1 file changed, 27 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index ff51a2f6875f..a27cb4fa490f 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -162,15 +162,8 @@ allOf:
>>   
>>         patternProperties:
>>           "^(ethernet-)?ports$":
>> -          type: object
>> -
>>             patternProperties:
>>               "^(ethernet-)?port@[0-9]+$":
>> -              type: object
>> -              description: Ethernet switch ports
>> -
>> -              unevaluatedProperties: false
>> -
>>                 properties:
>>                   reg:
>>                     description:
>> @@ -178,7 +171,6 @@ allOf:
>>                       0 to 5 for user ports.
>>   
>>                 allOf:
>> -                - $ref: dsa-port.yaml#
>>                   - if:
> 
> This 'if' schema is the only part you need actually (though you have to
> create the node structure).

Do you mean that I should take "if:" out of allOf?

> 
>>                       properties:
>>                         label:
>> @@ -186,7 +178,6 @@ allOf:
>>                             - const: cpu
>>                     then:
>>                       required:
>> -                      - reg
>>                         - phy-mode
>>   
>>     - if:
>> @@ -200,15 +191,8 @@ allOf:
>>   
>>         patternProperties:
>>           "^(ethernet-)?ports$":
>> -          type: object
>> -
>>             patternProperties:
>>               "^(ethernet-)?port@[0-9]+$":
>> -              type: object
>> -              description: Ethernet switch ports
>> -
>> -              unevaluatedProperties: false
>> -
>>                 properties:
>>                   reg:
>>                     description:
>> @@ -216,7 +200,6 @@ allOf:
>>                       0 to 5 for user ports.
>>   
>>                 allOf:
>> -                - $ref: dsa-port.yaml#
>>                   - if:
>>                       properties:
>>                         label:
>> @@ -224,7 +207,6 @@ allOf:
>>                             - const: cpu
>>                     then:
>>                       required:
>> -                      - reg
>>                         - phy-mode
>>   
>>     - if:
>> @@ -238,15 +220,8 @@ allOf:
>>   
>>         patternProperties:
>>           "^(ethernet-)?ports$":
>> -          type: object
>> -
>>             patternProperties:
>>               "^(ethernet-)?port@[0-9]+$":
>> -              type: object
>> -              description: Ethernet switch ports
>> -
>> -              unevaluatedProperties: false
>> -
>>                 properties:
>>                   reg:
>>                     description:
>> @@ -254,7 +229,6 @@ allOf:
>>                       0 to 5 for user ports.
>>   
>>                 allOf:
>> -                - $ref: dsa-port.yaml#
>>                   - if:
>>                       properties:
>>                         label:
>> @@ -262,7 +236,6 @@ allOf:
>>                             - const: cpu
>>                     then:
>>                       required:
>> -                      - reg
>>                         - phy-mode
>>   
>>   unevaluatedProperties: false
>> -- 
>> 2.34.1
>>
>>


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

* Re: [PATCH v2 5/7] dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines
@ 2022-08-16 22:21       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:21 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 17.08.2022 00:14, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:13PM +0300, Arınç ÜNAL wrote:
>> Remove unnecessary lines as they are already included from the referred
>> dsa.yaml.
> 
> You are duplicating the schema and then removing parts twice. I would
> combine patches 4 and 5 or reverse the order.

Will combine.

> 
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 27 -------------------
>>   1 file changed, 27 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index ff51a2f6875f..a27cb4fa490f 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -162,15 +162,8 @@ allOf:
>>   
>>         patternProperties:
>>           "^(ethernet-)?ports$":
>> -          type: object
>> -
>>             patternProperties:
>>               "^(ethernet-)?port@[0-9]+$":
>> -              type: object
>> -              description: Ethernet switch ports
>> -
>> -              unevaluatedProperties: false
>> -
>>                 properties:
>>                   reg:
>>                     description:
>> @@ -178,7 +171,6 @@ allOf:
>>                       0 to 5 for user ports.
>>   
>>                 allOf:
>> -                - $ref: dsa-port.yaml#
>>                   - if:
> 
> This 'if' schema is the only part you need actually (though you have to
> create the node structure).

Do you mean that I should take "if:" out of allOf?

> 
>>                       properties:
>>                         label:
>> @@ -186,7 +178,6 @@ allOf:
>>                             - const: cpu
>>                     then:
>>                       required:
>> -                      - reg
>>                         - phy-mode
>>   
>>     - if:
>> @@ -200,15 +191,8 @@ allOf:
>>   
>>         patternProperties:
>>           "^(ethernet-)?ports$":
>> -          type: object
>> -
>>             patternProperties:
>>               "^(ethernet-)?port@[0-9]+$":
>> -              type: object
>> -              description: Ethernet switch ports
>> -
>> -              unevaluatedProperties: false
>> -
>>                 properties:
>>                   reg:
>>                     description:
>> @@ -216,7 +200,6 @@ allOf:
>>                       0 to 5 for user ports.
>>   
>>                 allOf:
>> -                - $ref: dsa-port.yaml#
>>                   - if:
>>                       properties:
>>                         label:
>> @@ -224,7 +207,6 @@ allOf:
>>                             - const: cpu
>>                     then:
>>                       required:
>> -                      - reg
>>                         - phy-mode
>>   
>>     - if:
>> @@ -238,15 +220,8 @@ allOf:
>>   
>>         patternProperties:
>>           "^(ethernet-)?ports$":
>> -          type: object
>> -
>>             patternProperties:
>>               "^(ethernet-)?port@[0-9]+$":
>> -              type: object
>> -              description: Ethernet switch ports
>> -
>> -              unevaluatedProperties: false
>> -
>>                 properties:
>>                   reg:
>>                     description:
>> @@ -254,7 +229,6 @@ allOf:
>>                       0 to 5 for user ports.
>>   
>>                 allOf:
>> -                - $ref: dsa-port.yaml#
>>                   - if:
>>                       properties:
>>                         label:
>> @@ -262,7 +236,6 @@ allOf:
>>                             - const: cpu
>>                     then:
>>                       required:
>> -                      - reg
>>                         - phy-mode
>>   
>>   unevaluatedProperties: false
>> -- 
>> 2.34.1
>>
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/7] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
  2022-08-16 20:52     ` Rob Herring
  (?)
@ 2022-08-16 22:25       ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:25 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 16.08.2022 23:52, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:10PM +0300, Arınç ÜNAL wrote:
>> - Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
>> - Add description for reset-gpios.
>> - Invalidate reset-gpios if mediatek,mcm is used.
>> - Invalidate mediatek,mcm if the compatible device is mediatek,mt7531.
>> - Require mediatek,mcm for the described MT7621 SoCs as the compatible
>> string is only used for MT7530 which is a part of the multi-chip module.
> 
> The commit message should answer 'why is this change needed/wanted?' not
> 'what changed'. I can read the diff to see what changed.

I'll explain why to invalidating reset-gpios and mediatek,mcm.

> 
> d>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 31 +++++++++++++++++--
>>   1 file changed, 28 insertions(+), 3 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index edf48e917173..4c99266ce82a 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -110,11 +110,15 @@ properties:
>>     mediatek,mcm:
>>       type: boolean
>>       description:
>> -      if defined, indicates that either MT7530 is the part on multi-chip
>> -      module belong to MT7623A has or the remotely standalone chip as the
>> -      function MT7623N reference board provided for.
>> +      Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530
>> +      switch is a part of the multi-chip module.
>>   
>>     reset-gpios:
>> +    description:
>> +      GPIO to reset the switch. Use this if mediatek,mcm is not used.
>> +      This property is optional because some boards share the reset line with
>> +      other components which makes it impossible to probe the switch if the
>> +      reset line is used.
>>       maxItems: 1
>>   
>>     reset-names:
>> @@ -165,6 +169,9 @@ allOf:
>>         required:
>>           - mediatek,mcm
>>       then:
>> +      properties:
>> +        reset-gpios: false
>> +
>>         required:
>>           - resets
>>           - reset-names
>> @@ -182,6 +189,24 @@ allOf:
>>           - core-supply
>>           - io-supply
>>   
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          items:
>> +            - const: mediatek,mt7531
>> +    then:
>> +      properties:
>> +        mediatek,mcm: false
>> +
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          items:
>> +            - const: mediatek,mt7621
>> +    then:
>> +      required:
>> +        - mediatek,mcm
>> +
>>   unevaluatedProperties: false
>>   
>>   examples:
>> -- 
>> 2.34.1
>>
>>

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

* Re: [PATCH v2 2/7] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
@ 2022-08-16 22:25       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:25 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Sander Vanheule, linux-kernel, René van Dorst,
	Eric Dumazet, Krzysztof Kozlowski, erkin.bozoglu,
	Florian Fainelli, Sergio Paracuellos, Jakub Kicinski,
	Paolo Abeni, Vivien Didelot, devicetree, Landen Chao, Sean Wang,
	Luiz Angelo Daros de Luca, DENG Qingfang, linux-mediatek,
	Matthias Brugger, linux-arm-kernel, netdev, Daniel Golle,
	Vladimir Oltean, David S . Miller

On 16.08.2022 23:52, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:10PM +0300, Arınç ÜNAL wrote:
>> - Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
>> - Add description for reset-gpios.
>> - Invalidate reset-gpios if mediatek,mcm is used.
>> - Invalidate mediatek,mcm if the compatible device is mediatek,mt7531.
>> - Require mediatek,mcm for the described MT7621 SoCs as the compatible
>> string is only used for MT7530 which is a part of the multi-chip module.
> 
> The commit message should answer 'why is this change needed/wanted?' not
> 'what changed'. I can read the diff to see what changed.

I'll explain why to invalidating reset-gpios and mediatek,mcm.

> 
> d>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 31 +++++++++++++++++--
>>   1 file changed, 28 insertions(+), 3 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index edf48e917173..4c99266ce82a 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -110,11 +110,15 @@ properties:
>>     mediatek,mcm:
>>       type: boolean
>>       description:
>> -      if defined, indicates that either MT7530 is the part on multi-chip
>> -      module belong to MT7623A has or the remotely standalone chip as the
>> -      function MT7623N reference board provided for.
>> +      Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530
>> +      switch is a part of the multi-chip module.
>>   
>>     reset-gpios:
>> +    description:
>> +      GPIO to reset the switch. Use this if mediatek,mcm is not used.
>> +      This property is optional because some boards share the reset line with
>> +      other components which makes it impossible to probe the switch if the
>> +      reset line is used.
>>       maxItems: 1
>>   
>>     reset-names:
>> @@ -165,6 +169,9 @@ allOf:
>>         required:
>>           - mediatek,mcm
>>       then:
>> +      properties:
>> +        reset-gpios: false
>> +
>>         required:
>>           - resets
>>           - reset-names
>> @@ -182,6 +189,24 @@ allOf:
>>           - core-supply
>>           - io-supply
>>   
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          items:
>> +            - const: mediatek,mt7531
>> +    then:
>> +      properties:
>> +        mediatek,mcm: false
>> +
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          items:
>> +            - const: mediatek,mt7621
>> +    then:
>> +      required:
>> +        - mediatek,mcm
>> +
>>   unevaluatedProperties: false
>>   
>>   examples:
>> -- 
>> 2.34.1
>>
>>


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

* Re: [PATCH v2 2/7] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
@ 2022-08-16 22:25       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-16 22:25 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos, netdev, devicetree,
	linux-arm-kernel, linux-mediatek, linux-kernel

On 16.08.2022 23:52, Rob Herring wrote:
> On Sat, Aug 13, 2022 at 06:44:10PM +0300, Arınç ÜNAL wrote:
>> - Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
>> - Add description for reset-gpios.
>> - Invalidate reset-gpios if mediatek,mcm is used.
>> - Invalidate mediatek,mcm if the compatible device is mediatek,mt7531.
>> - Require mediatek,mcm for the described MT7621 SoCs as the compatible
>> string is only used for MT7530 which is a part of the multi-chip module.
> 
> The commit message should answer 'why is this change needed/wanted?' not
> 'what changed'. I can read the diff to see what changed.

I'll explain why to invalidating reset-gpios and mediatek,mcm.

> 
> d>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 31 +++++++++++++++++--
>>   1 file changed, 28 insertions(+), 3 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index edf48e917173..4c99266ce82a 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -110,11 +110,15 @@ properties:
>>     mediatek,mcm:
>>       type: boolean
>>       description:
>> -      if defined, indicates that either MT7530 is the part on multi-chip
>> -      module belong to MT7623A has or the remotely standalone chip as the
>> -      function MT7623N reference board provided for.
>> +      Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530
>> +      switch is a part of the multi-chip module.
>>   
>>     reset-gpios:
>> +    description:
>> +      GPIO to reset the switch. Use this if mediatek,mcm is not used.
>> +      This property is optional because some boards share the reset line with
>> +      other components which makes it impossible to probe the switch if the
>> +      reset line is used.
>>       maxItems: 1
>>   
>>     reset-names:
>> @@ -165,6 +169,9 @@ allOf:
>>         required:
>>           - mediatek,mcm
>>       then:
>> +      properties:
>> +        reset-gpios: false
>> +
>>         required:
>>           - resets
>>           - reset-names
>> @@ -182,6 +189,24 @@ allOf:
>>           - core-supply
>>           - io-supply
>>   
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          items:
>> +            - const: mediatek,mt7531
>> +    then:
>> +      properties:
>> +        mediatek,mcm: false
>> +
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          items:
>> +            - const: mediatek,mt7621
>> +    then:
>> +      required:
>> +        - mediatek,mcm
>> +
>>   unevaluatedProperties: false
>>   
>>   examples:
>> -- 
>> 2.34.1
>>
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 4/7] dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
  2022-08-13 15:44   ` Arınç ÜNAL
@ 2022-08-19 12:43     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 55+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-19 12:43 UTC (permalink / raw)
  To: Arınç ÜNAL, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel

On 13/08/2022 18:44, Arınç ÜNAL wrote:
> Define DSA port binding under each compatible device as each device
> requires different values for certain properties.
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 116 +++++++++++++-----
>  1 file changed, 87 insertions(+), 29 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index cc87f48d4d07..ff51a2f6875f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -130,35 +130,6 @@ properties:
>        ethsys.
>      maxItems: 1
>  
> -patternProperties:
> -  "^(ethernet-)?ports$":
> -    type: object
> -
> -    patternProperties:
> -      "^(ethernet-)?port@[0-9]+$":
> -        type: object
> -        description: Ethernet switch ports
> -

my comments from v1 apply here

None of the reasons you said force you to define properties in some
allOf:if:then subblock. These force you to constrain the properties in
allOf:if:then, but not define.


> I can split patternProperties to two sections, but I can't directly
> define the reg property like you put above.

Of course you can and original bindings were doing it.

Let me ask specific questions (yes, no):
1. Are ethernet-ports and ethernet-port present in each variant?
2. Is dsa-port.yaml applicable to each variant? (looks like that - three
compatibles, three all:if:then)
3. If reg appearing in each variant?
4. If above is true, if reg is maximum one item in each variant?

Looking at your patch, I think answer is 4x yes, which means you can
define them in one place and constrain in allOf:if:then, just like all
other schemas, because this one is not different.

Best regards,
Krzysztof

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

* Re: [PATCH v2 4/7] dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
@ 2022-08-19 12:43     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 55+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-19 12:43 UTC (permalink / raw)
  To: Arınç ÜNAL, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel

On 13/08/2022 18:44, Arınç ÜNAL wrote:
> Define DSA port binding under each compatible device as each device
> requires different values for certain properties.
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 116 +++++++++++++-----
>  1 file changed, 87 insertions(+), 29 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index cc87f48d4d07..ff51a2f6875f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -130,35 +130,6 @@ properties:
>        ethsys.
>      maxItems: 1
>  
> -patternProperties:
> -  "^(ethernet-)?ports$":
> -    type: object
> -
> -    patternProperties:
> -      "^(ethernet-)?port@[0-9]+$":
> -        type: object
> -        description: Ethernet switch ports
> -

my comments from v1 apply here

None of the reasons you said force you to define properties in some
allOf:if:then subblock. These force you to constrain the properties in
allOf:if:then, but not define.


> I can split patternProperties to two sections, but I can't directly
> define the reg property like you put above.

Of course you can and original bindings were doing it.

Let me ask specific questions (yes, no):
1. Are ethernet-ports and ethernet-port present in each variant?
2. Is dsa-port.yaml applicable to each variant? (looks like that - three
compatibles, three all:if:then)
3. If reg appearing in each variant?
4. If above is true, if reg is maximum one item in each variant?

Looking at your patch, I think answer is 4x yes, which means you can
define them in one place and constrain in allOf:if:then, just like all
other schemas, because this one is not different.

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 4/7] dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
  2022-08-19 12:43     ` Krzysztof Kozlowski
@ 2022-08-20  7:34       ` Arınç ÜNAL
  -1 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-20  7:34 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel

On 19.08.2022 15:43, Krzysztof Kozlowski wrote:
> On 13/08/2022 18:44, Arınç ÜNAL wrote:
>> Define DSA port binding under each compatible device as each device
>> requires different values for certain properties.
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 116 +++++++++++++-----
>>   1 file changed, 87 insertions(+), 29 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index cc87f48d4d07..ff51a2f6875f 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -130,35 +130,6 @@ properties:
>>         ethsys.
>>       maxItems: 1
>>   
>> -patternProperties:
>> -  "^(ethernet-)?ports$":
>> -    type: object
>> -
>> -    patternProperties:
>> -      "^(ethernet-)?port@[0-9]+$":
>> -        type: object
>> -        description: Ethernet switch ports
>> -
> 
> my comments from v1 apply here
> 
> None of the reasons you said force you to define properties in some
> allOf:if:then subblock. These force you to constrain the properties in
> allOf:if:then, but not define.
> 
> 
>> I can split patternProperties to two sections, but I can't directly
>> define the reg property like you put above.
> 
> Of course you can and original bindings were doing it.
> 
> Let me ask specific questions (yes, no):
> 1. Are ethernet-ports and ethernet-port present in each variant?
> 2. Is dsa-port.yaml applicable to each variant? (looks like that - three
> compatibles, three all:if:then)
> 3. If reg appearing in each variant?
> 4. If above is true, if reg is maximum one item in each variant?

All yes.

> 
> Looking at your patch, I think answer is 4x yes, which means you can
> define them in one place and constrain in allOf:if:then, just like all
> other schemas, because this one is not different.

If I understand correctly, I do this already with v3. Properties are 
defined under the constructed node. Accepted values for properties are 
constrained under if:then.

Arınç

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

* Re: [PATCH v2 4/7] dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
@ 2022-08-20  7:34       ` Arınç ÜNAL
  0 siblings, 0 replies; 55+ messages in thread
From: Arınç ÜNAL @ 2022-08-20  7:34 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel

On 19.08.2022 15:43, Krzysztof Kozlowski wrote:
> On 13/08/2022 18:44, Arınç ÜNAL wrote:
>> Define DSA port binding under each compatible device as each device
>> requires different values for certain properties.
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 116 +++++++++++++-----
>>   1 file changed, 87 insertions(+), 29 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> index cc87f48d4d07..ff51a2f6875f 100644
>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>> @@ -130,35 +130,6 @@ properties:
>>         ethsys.
>>       maxItems: 1
>>   
>> -patternProperties:
>> -  "^(ethernet-)?ports$":
>> -    type: object
>> -
>> -    patternProperties:
>> -      "^(ethernet-)?port@[0-9]+$":
>> -        type: object
>> -        description: Ethernet switch ports
>> -
> 
> my comments from v1 apply here
> 
> None of the reasons you said force you to define properties in some
> allOf:if:then subblock. These force you to constrain the properties in
> allOf:if:then, but not define.
> 
> 
>> I can split patternProperties to two sections, but I can't directly
>> define the reg property like you put above.
> 
> Of course you can and original bindings were doing it.
> 
> Let me ask specific questions (yes, no):
> 1. Are ethernet-ports and ethernet-port present in each variant?
> 2. Is dsa-port.yaml applicable to each variant? (looks like that - three
> compatibles, three all:if:then)
> 3. If reg appearing in each variant?
> 4. If above is true, if reg is maximum one item in each variant?

All yes.

> 
> Looking at your patch, I think answer is 4x yes, which means you can
> define them in one place and constrain in allOf:if:then, just like all
> other schemas, because this one is not different.

If I understand correctly, I do this already with v3. Properties are 
defined under the constructed node. Accepted values for properties are 
constrained under if:then.

Arınç

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 4/7] dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
  2022-08-20  7:34       ` Arınç ÜNAL
@ 2022-08-23 10:48         ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 55+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-23 10:48 UTC (permalink / raw)
  To: Arınç ÜNAL, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel

On 20/08/2022 10:34, Arınç ÜNAL wrote:
> On 19.08.2022 15:43, Krzysztof Kozlowski wrote:
>> On 13/08/2022 18:44, Arınç ÜNAL wrote:
>>> Define DSA port binding under each compatible device as each device
>>> requires different values for certain properties.
>>>
>>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>>> ---
>>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 116 +++++++++++++-----
>>>   1 file changed, 87 insertions(+), 29 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> index cc87f48d4d07..ff51a2f6875f 100644
>>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> @@ -130,35 +130,6 @@ properties:
>>>         ethsys.
>>>       maxItems: 1
>>>   
>>> -patternProperties:
>>> -  "^(ethernet-)?ports$":
>>> -    type: object
>>> -
>>> -    patternProperties:
>>> -      "^(ethernet-)?port@[0-9]+$":
>>> -        type: object
>>> -        description: Ethernet switch ports
>>> -
>>
>> my comments from v1 apply here
>>
>> None of the reasons you said force you to define properties in some
>> allOf:if:then subblock. These force you to constrain the properties in
>> allOf:if:then, but not define.
>>
>>
>>> I can split patternProperties to two sections, but I can't directly
>>> define the reg property like you put above.
>>
>> Of course you can and original bindings were doing it.
>>
>> Let me ask specific questions (yes, no):
>> 1. Are ethernet-ports and ethernet-port present in each variant?
>> 2. Is dsa-port.yaml applicable to each variant? (looks like that - three
>> compatibles, three all:if:then)
>> 3. If reg appearing in each variant?
>> 4. If above is true, if reg is maximum one item in each variant?
> 
> All yes.
> 
>>
>> Looking at your patch, I think answer is 4x yes, which means you can
>> define them in one place and constrain in allOf:if:then, just like all
>> other schemas, because this one is not different.
> 
> If I understand correctly, I do this already with v3. Properties are 
> defined under the constructed node. Accepted values for properties are 
> constrained under if:then.

v4 doesn't do it. You removed there patternProperties - again.


Best regards,
Krzysztof

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

* Re: [PATCH v2 4/7] dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible
@ 2022-08-23 10:48         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 55+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-23 10:48 UTC (permalink / raw)
  To: Arınç ÜNAL, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Sean Wang, Landen Chao,
	DENG Qingfang, Frank Wunderlich, Luiz Angelo Daros de Luca,
	Sander Vanheule, René van Dorst, Daniel Golle,
	erkin.bozoglu, Sergio Paracuellos
  Cc: netdev, devicetree, linux-arm-kernel, linux-mediatek, linux-kernel

On 20/08/2022 10:34, Arınç ÜNAL wrote:
> On 19.08.2022 15:43, Krzysztof Kozlowski wrote:
>> On 13/08/2022 18:44, Arınç ÜNAL wrote:
>>> Define DSA port binding under each compatible device as each device
>>> requires different values for certain properties.
>>>
>>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>>> ---
>>>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 116 +++++++++++++-----
>>>   1 file changed, 87 insertions(+), 29 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> index cc87f48d4d07..ff51a2f6875f 100644
>>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> @@ -130,35 +130,6 @@ properties:
>>>         ethsys.
>>>       maxItems: 1
>>>   
>>> -patternProperties:
>>> -  "^(ethernet-)?ports$":
>>> -    type: object
>>> -
>>> -    patternProperties:
>>> -      "^(ethernet-)?port@[0-9]+$":
>>> -        type: object
>>> -        description: Ethernet switch ports
>>> -
>>
>> my comments from v1 apply here
>>
>> None of the reasons you said force you to define properties in some
>> allOf:if:then subblock. These force you to constrain the properties in
>> allOf:if:then, but not define.
>>
>>
>>> I can split patternProperties to two sections, but I can't directly
>>> define the reg property like you put above.
>>
>> Of course you can and original bindings were doing it.
>>
>> Let me ask specific questions (yes, no):
>> 1. Are ethernet-ports and ethernet-port present in each variant?
>> 2. Is dsa-port.yaml applicable to each variant? (looks like that - three
>> compatibles, three all:if:then)
>> 3. If reg appearing in each variant?
>> 4. If above is true, if reg is maximum one item in each variant?
> 
> All yes.
> 
>>
>> Looking at your patch, I think answer is 4x yes, which means you can
>> define them in one place and constrain in allOf:if:then, just like all
>> other schemas, because this one is not different.
> 
> If I understand correctly, I do this already with v3. Properties are 
> defined under the constructed node. Accepted values for properties are 
> constrained under if:then.

v4 doesn't do it. You removed there patternProperties - again.


Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-08-23 13:51 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13 15:44 [PATCH v2 0/7] completely rework mediatek,mt7530 binding Arınç ÜNAL
2022-08-13 15:44 ` Arınç ÜNAL
2022-08-13 15:44 ` [PATCH v2 1/7] dt-bindings: net: dsa: mediatek,mt7530: make trivial changes Arınç ÜNAL
2022-08-13 15:44   ` Arınç ÜNAL
2022-08-16 20:49   ` Rob Herring
2022-08-16 20:49     ` Rob Herring
2022-08-16 20:49     ` Rob Herring
2022-08-13 15:44 ` [PATCH v2 2/7] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines Arınç ÜNAL
2022-08-13 15:44   ` Arınç ÜNAL
2022-08-16 20:52   ` Rob Herring
2022-08-16 20:52     ` Rob Herring
2022-08-16 20:52     ` Rob Herring
2022-08-16 22:25     ` Arınç ÜNAL
2022-08-16 22:25       ` Arınç ÜNAL
2022-08-16 22:25       ` Arınç ÜNAL
2022-08-13 15:44 ` [PATCH v2 3/7] dt-bindings: net: dsa: mediatek,mt7530: update examples Arınç ÜNAL
2022-08-13 15:44   ` Arınç ÜNAL
2022-08-16 21:02   ` Rob Herring
2022-08-16 21:02     ` Rob Herring
2022-08-16 21:02     ` Rob Herring
2022-08-16 22:15     ` Arınç ÜNAL
2022-08-16 22:15       ` Arınç ÜNAL
2022-08-16 22:15       ` Arınç ÜNAL
2022-08-13 15:44 ` [PATCH v2 4/7] dt-bindings: net: dsa: mediatek,mt7530: define port binding per compatible Arınç ÜNAL
2022-08-13 15:44   ` Arınç ÜNAL
2022-08-19 12:43   ` Krzysztof Kozlowski
2022-08-19 12:43     ` Krzysztof Kozlowski
2022-08-20  7:34     ` Arınç ÜNAL
2022-08-20  7:34       ` Arınç ÜNAL
2022-08-23 10:48       ` Krzysztof Kozlowski
2022-08-23 10:48         ` Krzysztof Kozlowski
2022-08-13 15:44 ` [PATCH v2 5/7] dt-bindings: net: dsa: mediatek,mt7530: remove unnecesary lines Arınç ÜNAL
2022-08-13 15:44   ` Arınç ÜNAL
2022-08-16 21:14   ` Rob Herring
2022-08-16 21:14     ` Rob Herring
2022-08-16 21:14     ` Rob Herring
2022-08-16 22:21     ` Arınç ÜNAL
2022-08-16 22:21       ` Arınç ÜNAL
2022-08-16 22:21       ` Arınç ÜNAL
2022-08-13 15:44 ` [PATCH v2 6/7] dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for each compatible Arınç ÜNAL
2022-08-13 15:44   ` Arınç ÜNAL
2022-08-16 21:21   ` Rob Herring
2022-08-16 21:21     ` Rob Herring
2022-08-16 21:21     ` Rob Herring
2022-08-16 22:09     ` Arınç ÜNAL
2022-08-16 22:09       ` Arınç ÜNAL
2022-08-16 22:09       ` Arınç ÜNAL
2022-08-13 15:44 ` [PATCH v2 7/7] dt-bindings: net: dsa: mediatek,mt7530: update binding description Arınç ÜNAL
2022-08-13 15:44   ` Arınç ÜNAL
2022-08-16 21:25   ` Rob Herring
2022-08-16 21:25     ` Rob Herring
2022-08-16 21:25     ` Rob Herring
2022-08-16 21:53     ` Arınç ÜNAL
2022-08-16 21:53       ` Arınç ÜNAL
2022-08-16 21:53       ` Arınç ÜNAL

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.