[RFC net-next 1/3] dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support

David Yang posted 3 patches 1 month, 3 weeks ago
There is a newer version of this series
[RFC net-next 1/3] dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support
Posted by David Yang 1 month, 3 weeks ago
The Motorcomm YT921x series is a family of Ethernet switches with up to
8 internal GbE PHYs and up to 2 GMACs.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 .../bindings/net/dsa/motorcomm,yt921x.yaml    | 121 ++++++++++++++++++
 1 file changed, 121 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml

diff --git a/Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml b/Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
new file mode 100644
index 000000000000..2f0e4532e73e
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
@@ -0,0 +1,121 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/dsa/motorcomm,yt921x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Motorcomm YT921x Ethernet switch family
+
+maintainers:
+  - David Yang <mmyangfl@gmail.com>
+
+description: |
+  The Motorcomm YT921x series is a family of Ethernet switches with up to 8
+  internal GbE PHYs and up to 2 GMACs, including YT9213NB, YT9214NB, YT9215RB,
+  YT9215S, YT9215SC, YT9218N, YT9218MB.
+
+  For now, only YT9215 is supported.
+
+properties:
+  compatible:
+    const: motorcomm,yt9215
+
+  reg:
+    maxItems: 1
+
+  reset-gpios:
+    description: Optional gpio specifier for a reset line
+    maxItems: 1
+
+  motorcomm,switch-id:
+    description: |
+      When managed via mdio, hard-configured switch id to distinguish between
+      multiple devices.
+    enum: [0, 1, 2, 3]
+    default: 0
+
+  mdio:
+    $ref: /schemas/net/mdio.yaml#
+    unevaluatedProperties: false
+    description: MDIO bus for the internal GbE PHYs.
+
+  mdio-external:
+    $ref: /schemas/net/mdio.yaml#
+    unevaluatedProperties: false
+    description: External MDIO bus.
+
+    properties:
+      compatible:
+        const: motorcomm,yt921x-mdio-external
+
+    required:
+      - compatible
+
+allOf:
+  - $ref: dsa.yaml#/$defs/ethernet-ports
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        switch@1d {
+            compatible = "motorcomm,yt9215";
+            reg = <0x1d>;
+
+            ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@0 {
+                    reg = <0>;
+                    label = "lan1";
+                    phy-mode = "internal";
+                };
+
+                port@1 {
+                    reg = <1>;
+                    label = "lan2";
+                    phy-mode = "internal";
+                };
+
+                port@2 {
+                    reg = <2>;
+                    label = "lan3";
+                    phy-mode = "internal";
+                };
+
+                port@3 {
+                    reg = <3>;
+                    label = "lan4";
+                    phy-mode = "internal";
+                };
+
+                port@4 {
+                    reg = <4>;
+                    label = "wan";
+                    phy-mode = "internal";
+                };
+
+                port@8 {
+                    reg = <8>;
+                    phy-mode = "sgmii";
+                    ethernet = <&eth0>;
+
+                    fixed-link {
+                        speed = <1000>;
+                        full-duplex;
+                        pause;
+                        asym-pause;
+                    };
+                };
+            };
+        };
+    };
-- 
2.47.2
Re: [RFC net-next 1/3] dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support
Posted by Rob Herring (Arm) 1 month, 3 weeks ago
On Thu, 14 Aug 2025 14:50:20 +0800, David Yang wrote:
> The Motorcomm YT921x series is a family of Ethernet switches with up to
> 8 internal GbE PHYs and up to 2 GMACs.
> 
> Signed-off-by: David Yang <mmyangfl@gmail.com>
> ---
>  .../bindings/net/dsa/motorcomm,yt921x.yaml    | 121 ++++++++++++++++++
>  1 file changed, 121 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml: motorcomm,switch-id: missing type definition

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250814065032.3766988-2-mmyangfl@gmail.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Re: [RFC net-next 1/3] dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support
Posted by Krzysztof Kozlowski 1 month, 3 weeks ago
On 14/08/2025 08:50, David Yang wrote:
> The Motorcomm YT921x series is a family of Ethernet switches with up to
> 8 internal GbE PHYs and up to 2 GMACs.
> 
> Signed-off-by: David Yang <mmyangfl@gmail.com>
> ---
>  .../bindings/net/dsa/motorcomm,yt921x.yaml    | 121 ++++++++++++++++++
>  1 file changed, 121 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml b/Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
> new file mode 100644
> index 000000000000..2f0e4532e73e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
> @@ -0,0 +1,121 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/dsa/motorcomm,yt921x.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Motorcomm YT921x Ethernet switch family
> +
> +maintainers:
> +  - David Yang <mmyangfl@gmail.com>
> +
> +description: |
> +  The Motorcomm YT921x series is a family of Ethernet switches with up to 8
> +  internal GbE PHYs and up to 2 GMACs, including YT9213NB, YT9214NB, YT9215RB,
> +  YT9215S, YT9215SC, YT9218N, YT9218MB.
> +
> +  For now, only YT9215 is supported.

Please describe complete hardware. Drivers are not relevant here and
binding cannot support anything, thus this feels like comment about drivers.

> +
> +properties:
> +  compatible:
> +    const: motorcomm,yt9215
> +
> +  reg:
> +    maxItems: 1
> +
> +  reset-gpios:
> +    description: Optional gpio specifier for a reset line

Drop comment, 100% redundant.

> +    maxItems: 1
> +
> +  motorcomm,switch-id:
> +    description: |
> +      When managed via mdio, hard-configured switch id to distinguish between
> +      multiple devices.

IDs are not allowed.

> +    enum: [0, 1, 2, 3]
> +    default: 0
> +
> +  mdio:
> +    $ref: /schemas/net/mdio.yaml#
> +    unevaluatedProperties: false
> +    description: MDIO bus for the internal GbE PHYs.
> +
> +  mdio-external:
> +    $ref: /schemas/net/mdio.yaml#
> +    unevaluatedProperties: false
> +    description: External MDIO bus.
> +
> +    properties:
> +      compatible:
> +        const: motorcomm,yt921x-mdio-external

Incomplete compatible... but also not needed in the first place.

> +
> +    required:
> +      - compatible
> +
> +allOf:
> +  - $ref: dsa.yaml#/$defs/ethernet-ports
> +
> +required:
> +  - compatible
> +  - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    mdio {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        switch@1d {
> +            compatible = "motorcomm,yt9215";
> +            reg = <0x1d>;
> +

Incomplete example. Where are all other properties?



Best regards,
Krzysztof
Re: [RFC net-next 1/3] dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support
Posted by Andrew Lunn 1 month, 2 weeks ago
> > +  motorcomm,switch-id:
> > +    description: |
> > +      When managed via mdio, hard-configured switch id to distinguish between
> > +      multiple devices.
> 
> IDs are not allowed.

Please describe in more detail what this is used for.

When the switch is hanging off an MDIO bus, there is a reg
property. Maybe that is what you mean here? Take a look at mv88e6xxx,
and other DSA devices which are on MDIO busses.

> > +    enum: [0, 1, 2, 3]
> > +    default: 0
> > +
> > +  mdio:
> > +    $ref: /schemas/net/mdio.yaml#
> > +    unevaluatedProperties: false
> > +    description: MDIO bus for the internal GbE PHYs.
> > +
> > +  mdio-external:
> > +    $ref: /schemas/net/mdio.yaml#
> > +    unevaluatedProperties: false
> > +    description: External MDIO bus.
> > +
> > +    properties:
> > +      compatible:
> > +        const: motorcomm,yt921x-mdio-external
> 
> Incomplete compatible... but also not needed in the first place.

So this device has two MDIO busses. You need to somehow describe each
in DT, so you can PHYs off them. And you need to know which is
which. For mv88e6xxx, which i know is maybe not the best example
because a lot of best practices have changed since then, some variants
also have two MDIO busses, and we give the second one a compatible so
we can tell it part from the other which is common to all mv88e6xxx
devices.

	Andrew