lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230317113427.302162-2-noltari@gmail.com>
Date:   Fri, 17 Mar 2023 12:34:25 +0100
From:   Álvaro Fernández Rojas 
        <noltari@...il.com>
To:     davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, f.fainelli@...il.com,
        jonas.gorski@...il.com, andrew@...n.ch, olteanv@...il.com,
        hkallweit1@...il.com, linux@...linux.org.uk,
        netdev@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Álvaro Fernández Rojas 
        <noltari@...il.com>
Subject: [PATCH 1/3] dt-bindings: net: move bcm6368-mdio-mux bindings to b53

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

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@...il.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@...000b0 {
-      #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@...00000 {
+      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;
+          };
+        };
+      };
+    };
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ