net: dsa: yt921x: Add support for Motorcomm YT921x
Subsystems (5)
David Yang
maintainerv14 cover 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.
v13: https://lore.kernel.org/r/[email protected]
- add MAINTAINERS entry
- remove wrong memory barrier
- suggested code style changes
v12: https://lore.kernel.org/r/[email protected]
- do not introduce PHY_INTERFACE_MODE_REVSGMII for the moment
v11: https://lore.kernel.org/r/[email protected]
- make MIB_DESC cleaner
- use disable_delayed_work at teardown
v10: https://lore.kernel.org/r/[email protected]
- fix warnings related to PHY_INTERFACE_MODE_REVSGMII
v9: https://lore.kernel.org/r/[email protected]
- add PHY_INTERFACE_MODE_REVSGMII
- remove mdio_verify()
- remove uncessary fdb flush opeartions
- rework mib reading
- set port pvid by port_set_pvid()
v8: https://lore.kernel.org/r/[email protected]
- rework register polling
- rework mib reading
- other suggested code style changes
v7: https://lore.kernel.org/r/[email protected]
- simplify locking scheme
v6: https://lore.kernel.org/r/[email protected]
- handle unforwarded packets in tag driver
- move register and struct definitions to header file
- rework register abstraction and implement a driver lock
- implement *_stats and use a periodic work to fetch MIB
- remove EEPROM dump
- remove sysfs attr and other debug leftovers
- remove ds->user_mii_bus assignment
- run selftests and fix any errors found
v5: https://lore.kernel.org/r/[email protected]
- use enum for reg in dt binding
- fix phylink_mac_ops in the driver
- fix coding style
v4: https://lore.kernel.org/r/[email protected]
- remove switchid from dt binding
- remove hsr from tag driver
- use ratelimited log in tag driver
v3: https://lore.kernel.org/r/[email protected]
- fix words and warnings in dt binding
- remove unnecessary dev_warn_ratelimited and u64_from_u32
- remove lag and mst
- check for mdio results and fix a unlocked write in conduit_state_change
v2: https://lore.kernel.org/r/[email protected]
- fix words in dt binding
- add support for lag and mst
v1: https://lore.kernel.org/r/[email protected]
- fix coding style
- add dt binding
- add support for fdb, vlan and bridge
David Yang (4):
dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support
net: dsa: tag_yt921x: add support for Motorcomm YT921x tags
net: dsa: yt921x: Add support for Motorcomm YT921x
MAINTAINERS: add entry for Motorcomm YT921x ethernet switch driver
.../bindings/net/dsa/motorcomm,yt921x.yaml | 167 + MAINTAINERS | 8 + drivers/net/dsa/Kconfig | 7 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/yt921x.c | 2891 +++++++++++++++++ drivers/net/dsa/yt921x.h | 504 +++ include/net/dsa.h | 2 + include/uapi/linux/if_ether.h | 1 + net/dsa/Kconfig | 6 + net/dsa/Makefile | 1 + net/dsa/tag_yt921x.c | 141 + 11 files changed, 3729 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml create mode 100644 drivers/net/dsa/yt921x.c create mode 100644 drivers/net/dsa/yt921x.h create mode 100644 net/dsa/tag_yt921x.c
--
2.51.0
David Yang
maintainerPATCH v14 1/4 dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support
The Motorcomm YT921x series is a family of Ethernet switches with up to 8 internal GbE PHYs and up to 2 GMACs.
--- .../bindings/net/dsa/motorcomm,yt921x.yaml | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml new file +167 -0
@@ -0,0 +1,167 @@ +# 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 <[email protected]> + +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 = <ð0>; + + 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>; + }; + }; + }; + };
Signature · 1 line
2.51.0
David Yang
maintainerPATCH v14 2/4 net: dsa: tag_yt921x: add support for Motorcomm YT921x tags
In reply to David YangAdd support for Motorcomm YT921x tags, which includes a proper configurable ethertype field (default to 0x9988).
--- include/net/dsa.h | 2 + include/uapi/linux/if_ether.h | 1 + net/dsa/Kconfig | 6 ++ net/dsa/Makefile | 1 + net/dsa/tag_yt921x.c | 141 ++++++++++++++++++++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 net/dsa/tag_yt921x.c
include/net/dsa.h +2 -0
@@ -55,6 +55,7 @@ struct tc_action;#define DSA_TAG_PROTO_LAN937X_VALUE 27#define DSA_TAG_PROTO_VSC73XX_8021Q_VALUE 28#define DSA_TAG_PROTO_BRCM_LEGACY_FCS_VALUE 29 +#define DSA_TAG_PROTO_YT921X_VALUE 30enum dsa_tag_protocol {DSA_TAG_PROTO_NONE =DSA_TAG_PROTO_NONE_VALUE ,
@@ -87,6 +88,7 @@ enum dsa_tag_protocol {DSA_TAG_PROTO_RZN1_A5PSW =DSA_TAG_PROTO_RZN1_A5PSW_VALUE ,DSA_TAG_PROTO_LAN937X =DSA_TAG_PROTO_LAN937X_VALUE ,DSA_TAG_PROTO_VSC73XX_8021Q =DSA_TAG_PROTO_VSC73XX_8021Q_VALUE , + DSA_TAG_PROTO_YT921X = DSA_TAG_PROTO_YT921X_VALUE, };struct dsa_switch ;
include/uapi/linux/if_ether.h +1 -0
@@ -114,6 +114,7 @@#define ETH_P_QINQ1 0x9100/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_QINQ2 0x9200/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_QINQ3 0x9300/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ +#define ETH_P_YT921X 0x9988/* Motorcomm YT921x DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_EDSA 0xDADA/* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_DSA_8021Q 0xDADB/* Fake VLAN Header for DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_DSA_A5PSW 0xE001/* A5PSW Tag Value [ NOT AN OFFICIALLY REGISTERED ID ] */
net/dsa/Kconfig +6 -0
@@ -190,4 +190,10 @@ config NET_DSA_TAG_XRS700X Say Y or M if you want to enable support for tagging frames for Arrow SpeedChips XRS700x switches that use a single byte tag trailer. +config NET_DSA_TAG_YT921X + tristate "Tag driver for Motorcomm YT921x switches" + help + Say Y or M if you want to enable support for tagging frames for + Motorcomm YT921x switches. + endif
net/dsa/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_NET_DSA_TAG_SJA1105) += tag_sja1105.o obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o obj-$(CONFIG_NET_DSA_TAG_VSC73XX_8021Q) += tag_vsc73xx_8021q.o obj-$(CONFIG_NET_DSA_TAG_XRS700X) += tag_xrs700x.o +obj-$(CONFIG_NET_DSA_TAG_YT921X) += tag_yt921x.o # for tracing framework to find trace.h CFLAGS_trace.o := -I$(src)
net/dsa/tag_yt921x.c new file +141 -0
141 lines not on this page · raw message
Signature · 1 line
2.51.0
David Yang
maintainerPATCH v14 3/4 net: dsa: yt921x: Add support for Motorcomm YT921x
In reply to David YangMotorcomm 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 GMACs.
Driver verified on a stock wireless router with IPQ5018 + YT9215S.
--- drivers/net/dsa/Kconfig | 7 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/yt921x.c | 2891 ++++++++++++++++++++++++++++++++++++++ drivers/net/dsa/yt921x.h | 504 +++++++ 4 files changed, 3403 insertions(+) create mode 100644 drivers/net/dsa/yt921x.c create mode 100644 drivers/net/dsa/yt921x.h
drivers/net/dsa/Kconfig +7 -0
@@ -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
drivers/net/dsa/Makefile +1 -0
@@ -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/
drivers/net/dsa/yt921x.c new file +2891 -0
2,891 lines not on this page · raw message
drivers/net/dsa/yt921x.h new file +504 -0
91 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.51.0
Part of the diff is not shown here. View the raw message.
Hi David Yang,
I am testing your YT9215 driver on a CIG device (ODM for a carrier) which uses the Qualcomm IPQ5018 SoC paired with the Motorcomm YT9215S switch.
The switch itself is detected correctly via MDIO bitbang, but I am facing issues with the internal PHYs. They are detected with a specific ID |0x01e04281| which falls back to the "Generic PHY" driver, and the ports remain in |NO-CARRIER| state even when cables are plugged in. I tried the existing Motorcomm PHY driver but it does not seem to cover this specific ID.
Here is my setup details:
DTS Configuration: I am using phy-mode = "internal" for the ports. (Full DTS available here: https://github.com/michioxd/openwrt-wf810df/blob/1b37e3adee7ab6651430511af259687a5a57edc5/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-ax3000cv2.dts)
&mdio_bitbang {
/* ... */
yt9215: switch@1d {
compatible = "motorcomm,yt9215";
reg = <29>;
/* ... */
ethernet-ports {
ethernet-port@0 {
reg = <0>;
phy-mode = "internal";
phy-handle = <&sw_phy0>;
};
/* ... */
};
};
};
dmesg Output: The chip ID is detected as 0x90020002, but PHYs are generic:
[ 13.405614] yt921x gpio-1:1d: Motorcomm YT9215S ethernet switch, chipid: 0x90020002, chipmode: 0x2 0x0 [ 14.004664] yt921x gpio-1:1d: configuring for fixed/2500base-x link mode
[ 14.018058] yt921x gpio-1:1d: Link is Up - 2.5Gbps/Full - flow control off
[ 14.097426] yt921x gpio-1:1d lan1 (uninitialized): PHY [gpio-1:1d:00] driver [Generic PHY] (irq=POLL) [ 14.160182] yt921x gpio-1:1d lan2 (uninitialized): PHY [gpio-1:1d:01] driver [Generic PHY] (irq=POLL) [ 14.226811] yt921x gpio-1:1d lan3 (uninitialized): PHY [gpio-1:1d:02] driver [Generic PHY] (irq=POLL)
ip link Output:
3: lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1508 qdisc fq_codel state UP qlen 1000
link/ether ... brd ff:ff:ff:ff:ff:ff
4: lan1@lan: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000 link/ether ... brd ff:ff:ff:ff:ff:ff
5: lan2@lan: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000 link/ether ... brd ff:ff:ff:ff:ff:ff
6: lan3@lan: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000 link/ether ... brd ff:ff:ff:ff:ff:ff
Have you encountered this PHY ID (0x01e04281) before? If this ID requires a driver patch, do you know if it shares the same register layout or behavior with any existing supported YT8xxx PHYs (like YT8511 or YT8521)? Knowing its closest relative would help me attempt to add support for it in drivers/net/phy/motorcomm.c.
Any advice on how to bring up these ports would be appreciated.
Best regards, Michio
Signature · 2 lines
michio da neko https://michioxd.ch
yangfl
maintainerQuoted 77 lines · michio da neko
Hi David Yang,
I am testing your YT9215 driver on a CIG device (ODM for a carrier) which uses the Qualcomm IPQ5018 SoC paired with the Motorcomm YT9215S switch.
The switch itself is detected correctly via MDIO bitbang, but I am facing issues with the internal PHYs. They are detected with a specific ID |0x01e04281| which falls back to the "Generic PHY" driver, and the ports remain in |NO-CARRIER| state even when cables are plugged in. I tried the existing Motorcomm PHY driver but it does not seem to cover this specific ID.
Here is my setup details:
DTS Configuration: I am using phy-mode = "internal" for the ports. (Full DTS available here:
https://github.com/michioxd/openwrt-wf810df/blob/1b37e3adee7ab6651430511af259687a5a57edc5/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-ax3000cv2.dts)
&mdio_bitbang{
/* ... */
yt9215: switch@1d {
compatible = "motorcomm,yt9215";
reg = <29>;
/* ... */
ethernet-ports {
ethernet-port@0 {
reg = <0>;
phy-mode = "internal";
phy-handle = <&sw_phy0>;
};
/* ... */
};
};
};dmesg Output: The chip ID is detected as
0x90020002, but PHYs are generic:[ 13.405614] yt921x gpio-1:1d: Motorcomm YT9215S ethernet switch,
chipid:0x90020002, chipmode:0x20x0
[ 14.004664] yt921x gpio-1:1d: configuring for fixed/2500base-x link mode [ 14.018058] yt921x gpio-1:1d: Link is Up - 2.5Gbps/Full - flow control off
[ 14.097426] yt921x gpio-1:1d lan1 (uninitialized): PHY [gpio-1:1d:00] driver [Generic PHY] (irq=POLL)
[ 14.160182] yt921x gpio-1:1d lan2 (uninitialized): PHY [gpio-1:1d:01] driver [Generic PHY] (irq=POLL)
[ 14.226811] yt921x gpio-1:1d lan3 (uninitialized): PHY [gpio-1:1d:02] driver [Generic PHY] (irq=POLL)ip link Output:
3: lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1508 qdisc
fq_codelstate UP qlen 1000
link/ether ... brd ff:ff:ff:ff:ff:ff
4: lan1@lan: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000
link/ether ... brd ff:ff:ff:ff:ff:ff
5: lan2@lan: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000
link/ether ... brd ff:ff:ff:ff:ff:ff
6: lan3@lan: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000
link/ether ... brd ff:ff:ff:ff:ff:ffHave you encountered this PHY ID (
0x01e04281) before? If this ID requires a driver patch, do you know if it shares the same register layout or behavior with any existing supported YT8xxx PHYs (like YT8511 or YT8521)? Knowing its closest relative would help me attempt to add support for it indrivers/net/phy/motorcomm.c.
Quoted 8 lines
Any advice on how to bring up these ports would be appreciated.
Best regards, Michio
--
michio da neko
https://michioxd.ch
Hi,
Please do not use PATCH thread for technical support, as it CCs to tons of unrelated people.
If you are looking closer you might find the thread about the chip on the OpenWRT forum.
As for your question, the internal PHYs are standard and do not need a separate driver for basic support.
David Yang
maintainerPATCH v14 4/4 MAINTAINERS: add entry for Motorcomm YT921x ethernet switch driver
In reply to David YangAdd a MAINTAINERS entry for the Motorcomm YT921x ethernet switch driver and its DT binding.
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -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 <[email protected]> +L: [email protected] +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 <[email protected]> S: Maintained
Signature · 1 line
2.51.0
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Fri, 17 Oct 2025 14:08:52 +0800 you wrote:
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[...]
Here is the summary with links:
- [net-next,v14,1/4] dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support
https://git.kernel.org/netdev/net-next/c/a9dff2b5f72b - [net-next,v14,2/4] net: dsa: tag_yt921x: add support for Motorcomm YT921x tags https://git.kernel.org/netdev/net-next/c/ca4709843b7e - [net-next,v14,3/4] net: dsa: yt921x: Add support for Motorcomm YT921x https://git.kernel.org/netdev/net-next/c/186623f4aa72 - [net-next,v14,4/4] MAINTAINERS: add entry for Motorcomm YT921x ethernet switch driver https://git.kernel.org/netdev/net-next/c/0c5480ac96a4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html