diff mbox series

[1/3] dt-bindings: net: move bcm6368-mdio-mux bindings to b53

Message ID 20230317113427.302162-2-noltari@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: b53: mmap: add MDIO Mux bus controller | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch warning WARNING: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Álvaro Fernández Rojas March 17, 2023, 11:34 a.m. UTC
b53 MMAP devices have a MDIO Mux bus controller that must be registered after
properly initializing the switch. If the MDIO Mux controller is registered
from a separate driver and the device has an external switch present, it will
cause a race condition which will hang the device.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 .../bindings/net/brcm,bcm6368-mdio-mux.yaml   |  52 -------
 .../devicetree/bindings/net/dsa/brcm,b53.yaml | 131 ++++++++++++++++++
 2 files changed, 131 insertions(+), 52 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/brcm,bcm6368-mdio-mux.yaml

Comments

Krzysztof Kozlowski March 19, 2023, 11:35 a.m. UTC | #1
On 17/03/2023 12:34, Álvaro Fernández Rojas wrote:
> b53 MMAP devices have a MDIO Mux bus controller that must be registered after
> properly initializing the switch. If the MDIO Mux controller is registered
> from a separate driver and the device has an external switch present, it will
> cause a race condition which will hang the device.

Are you sure it is wrapped according to Linux coding style?
https://elixir.bootlin.com/linux/v5.18-rc4/source/Documentation/process/submitting-patches.rst#L586

Your rationale does not justify incompatible binding change, especially
that it could be probably solved by including the child in the parent.

Anyway, Linux driver boot order is not a reason to change bindings really.


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/brcm,bcm6368-mdio-mux.yaml b/Documentation/devicetree/bindings/net/brcm,bcm6368-mdio-mux.yaml
deleted file mode 100644
index 9ef28c2a0afc..000000000000
--- a/Documentation/devicetree/bindings/net/brcm,bcm6368-mdio-mux.yaml
+++ /dev/null
@@ -1,52 +0,0 @@ 
-# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
-%YAML 1.2
----
-$id: http://devicetree.org/schemas/net/brcm,bcm6368-mdio-mux.yaml#
-$schema: http://devicetree.org/meta-schemas/core.yaml#
-
-title: Broadcom BCM6368 MDIO bus multiplexer
-
-maintainers:
-  - Álvaro Fernández Rojas <noltari@gmail.com>
-
-description:
-  This MDIO bus multiplexer defines buses that could be internal as well as
-  external to SoCs. When child bus is selected, one needs to select these two
-  properties as well to generate desired MDIO transaction on appropriate bus.
-
-allOf:
-  - $ref: mdio-mux.yaml#
-
-properties:
-  compatible:
-    const: brcm,bcm6368-mdio-mux
-
-  reg:
-    maxItems: 1
-
-required:
-  - compatible
-  - reg
-
-unevaluatedProperties: false
-
-examples:
-  - |
-    mdio0: mdio@10e000b0 {
-      #address-cells = <1>;
-      #size-cells = <0>;
-      compatible = "brcm,bcm6368-mdio-mux";
-      reg = <0x10e000b0 0x6>;
-
-      mdio_int: mdio@0 {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        reg = <0>;
-      };
-
-      mdio_ext: mdio@1 {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        reg = <1>;
-      };
-    };
diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
index 5bef4128d175..b1a894899306 100644
--- a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
@@ -61,6 +61,17 @@  properties:
               - brcm,bcm6368-switch
           - const: brcm,bcm63xx-switch
 
+  big-endian:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Set this flag for switches with big endian registers.
+
+  mdio-mux:
+    $ref: /schemas/net/mdio-mux.yaml
+    description:
+      MDIO bus multiplexer defines buses that could be internal as well as
+      external to SoCs.
+
 required:
   - compatible
   - reg
@@ -131,6 +142,22 @@  allOf:
         reg:
           maxItems: 1
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - brcm,bcm3384-switch
+              - brcm,bcm6328-switch
+              - brcm,bcm6368-switch
+    then:
+      properties:
+        reg:
+          minItems: 1
+          maxItems: 1
+      required:
+        - mdio-mux
+
 unevaluatedProperties: false
 
 examples:
@@ -262,3 +289,107 @@  examples:
             };
         };
     };
+  - |
+    switch0: switch@10f00000 {
+      compatible = "brcm,bcm6368-switch", "brcm,bcm63xx-switch";
+      reg = <0x10f00000 0x8000>;
+      big-endian;
+
+      dsa,member = <0 0>;
+
+      mdio-mux {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mdio@0 {
+          #address-cells = <1>;
+          #size-cells = <0>;
+          reg = <0>;
+        };
+
+        mdio@1 {
+          #address-cells = <1>;
+          #size-cells = <0>;
+          reg = <1>;
+
+          switch@1e {
+            compatible = "brcm,bcm53125";
+            reg = <30>;
+
+            dsa,member = <1 0>;
+
+            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@8 {
+                reg = <8>;
+                label = "cpu";
+
+                phy-mode = "rgmii";
+                ethernet = <&switch0port4>;
+
+                fixed-link {
+                  speed = <1000>;
+                  full-duplex;
+                };
+              };
+            };
+          };
+        };
+      };
+
+      ports {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        switch0port4: port@4 {
+          reg = <4>;
+          label = "extsw";
+
+          phy-mode = "rgmii";
+
+          fixed-link {
+            speed = <1000>;
+            full-duplex;
+          };
+        };
+
+        port@8 {
+          reg = <8>;
+
+          phy-mode = "internal";
+          ethernet = <&ethernet>;
+
+          fixed-link {
+            speed = <1000>;
+            full-duplex;
+          };
+        };
+      };
+    };