Commit 9549c74e authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-dsa-yt921x-add-support-for-motorcomm-yt921x'

David Yang says:

====================
net: dsa: yt921x: Add support for Motorcomm YT921x

Motorcomm YT921x is a series of ethernet switches developed by Shanghai
Motorcomm Electronic Technology, including:

  - YT9215S / YT9215RB / YT9215SC: 5 GbE phys
  - YT9213NB / YT9214NB: 2 GbE phys
  - YT9218N / YT9218MB: 8 GbE phys

and up to 2 serdes interfaces.

This patch adds basic support for a working DSA switch.
====================

Link: https://patch.msgid.link/20251017060859.326450-1-mmyangfl@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 21e45ec8 0c5480ac
Loading
Loading
Loading
Loading
+167 −0
Original line number Diff line number Diff line
# 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:

    - YT9215S / YT9215RB / YT9215SC: 5 GbE PHYs (Port 0-4) + 2 GMACs (Port 8-9)
    - YT9213NB: 2 GbE PHYs (Port 1/3) + 1 GMAC (Port 9)
    - YT9214NB: 2 GbE PHYs (Port 1/3) + 2 GMACs (Port 8-9)
    - YT9218N: 8 GbE PHYs (Port 0-7)
    - YT9218MB: 8 GbE PHYs (Port 0-7) + 2 GMACs (Port 8-9)

  Any port can be used as the CPU port.

properties:
  compatible:
    const: motorcomm,yt9215

  reg:
    enum: [0x0, 0x1d]

  reset-gpios:
    maxItems: 1

  mdio:
    $ref: /schemas/net/mdio.yaml#
    unevaluatedProperties: false
    description:
      Internal MDIO bus for the internal GbE PHYs. PHY 0-7 are used for Port
      0-7 respectively.

  mdio-external:
    $ref: /schemas/net/mdio.yaml#
    unevaluatedProperties: false
    description:
      External MDIO bus to access external components. External PHYs for GMACs
      (Port 8-9) are expected to be connected to the external MDIO bus in
      vendor's reference design, but that is not a hard limitation from the
      chip.

required:
  - compatible
  - reg

allOf:
  - $ref: dsa.yaml#/$defs/ethernet-ports

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>

    mdio {
        #address-cells = <1>;
        #size-cells = <0>;

        switch@1d {
            compatible = "motorcomm,yt9215";
            /* default 0x1d, alternate 0x0 */
            reg = <0x1d>;
            reset-gpios = <&tlmm 39 GPIO_ACTIVE_LOW>;

            mdio {
                #address-cells = <1>;
                #size-cells = <0>;

                sw_phy0: phy@0 {
                    reg = <0x0>;
                };

                sw_phy1: phy@1 {
                    reg = <0x1>;
                };

                sw_phy2: phy@2 {
                    reg = <0x2>;
                };

                sw_phy3: phy@3 {
                    reg = <0x3>;
                };

                sw_phy4: phy@4 {
                    reg = <0x4>;
                };
            };

            mdio-external {
                #address-cells = <1>;
                #size-cells = <0>;

                phy1: phy@b {
                    reg = <0xb>;
                };
            };

            ethernet-ports {
                #address-cells = <1>;
                #size-cells = <0>;

                ethernet-port@0 {
                    reg = <0>;
                    label = "lan1";
                    phy-mode = "internal";
                    phy-handle = <&sw_phy0>;
                };

                ethernet-port@1 {
                    reg = <1>;
                    label = "lan2";
                    phy-mode = "internal";
                    phy-handle = <&sw_phy1>;
                };

                ethernet-port@2 {
                    reg = <2>;
                    label = "lan3";
                    phy-mode = "internal";
                    phy-handle = <&sw_phy2>;
                };

                ethernet-port@3 {
                    reg = <3>;
                    label = "lan4";
                    phy-mode = "internal";
                    phy-handle = <&sw_phy3>;
                };

                ethernet-port@4 {
                    reg = <4>;
                    label = "lan5";
                    phy-mode = "internal";
                    phy-handle = <&sw_phy4>;
                };

                /* CPU port */
                ethernet-port@8 {
                    reg = <8>;
                    phy-mode = "2500base-x";
                    ethernet = <&eth0>;

                    fixed-link {
                        speed = <2500>;
                        full-duplex;
                    };
                };

                /* if external phy is connected to a MAC */
                ethernet-port@9 {
                    reg = <9>;
                    label = "wan";
                    phy-mode = "rgmii-id";
                    phy-handle = <&phy1>;
                };
            };
        };
    };
+8 −0
Original line number Diff line number Diff line
@@ -17435,6 +17435,14 @@ S: Maintained
F:	Documentation/devicetree/bindings/net/motorcomm,yt8xxx.yaml
F:	drivers/net/phy/motorcomm.c
MOTORCOMM YT921X ETHERNET SWITCH DRIVER
M:	David Yang <mmyangfl@gmail.com>
L:	netdev@vger.kernel.org
S:	Maintained
F:	Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
F:	drivers/net/dsa/yt921x.*
F:	net/dsa/tag_yt921x.c
MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD
M:	Jiri Slaby <jirislaby@kernel.org>
S:	Maintained
+7 −0
Original line number Diff line number Diff line
@@ -154,4 +154,11 @@ config NET_DSA_VITESSE_VSC73XX_PLATFORM
	  This enables support for the Vitesse VSC7385, VSC7388, VSC7395
	  and VSC7398 SparX integrated ethernet switches, connected over
	  a CPU-attached address bus and work in memory-mapped I/O mode.

config NET_DSA_YT921X
	tristate "Motorcomm YT9215 ethernet switch chip support"
	select NET_DSA_TAG_YT921X
	help
	  This enables support for the Motorcomm YT9215 ethernet switch
	  chip.
endmenu
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ obj-$(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) += lan9303_mdio.o
obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX) += vitesse-vsc73xx-core.o
obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM) += vitesse-vsc73xx-platform.o
obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_SPI) += vitesse-vsc73xx-spi.o
obj-$(CONFIG_NET_DSA_YT921X) += yt921x.o
obj-y				+= b53/
obj-y				+= hirschmann/
obj-y				+= lantiq/
+2891 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading