net: dsa: yt921x: Add support for Motorcomm YT921x
Subsystems (7)
David Yang
maintainerv12 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.
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 (5):
dt-bindings: ethernet-phy: add reverse SGMII phy interface type
net: phy: introduce PHY_INTERFACE_MODE_REVSGMII
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
.../bindings/net/dsa/motorcomm,yt921x.yaml | 169 + .../bindings/net/ethernet-controller.yaml | 1 + drivers/net/dsa/Kconfig | 7 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/yt921x.c | 2901 +++++++++++++++++ drivers/net/dsa/yt921x.h | 505 +++ drivers/net/phy/phy-core.c | 1 + drivers/net/phy/phy_caps.c | 1 + drivers/net/phy/phylink.c | 1 + include/linux/phy.h | 4 + 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 + 15 files changed, 3742 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
Signature · 1 line
2.51.0
David Yang
maintainerPATCH v12 1/5 dt-bindings: ethernet-phy: add reverse SGMII phy interface type
The "reverse SGMII" protocol name is an invention derived from "reverse MII" and "reverse RMII", this means: "behave like an SGMII PHY".
--- Documentation/devicetree/bindings/net/ethernet-controller.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/ethernet-controller.yaml +1 -0
@@ -42,6 +42,7 @@ properties: - mii-lite - gmii - sgmii + - rev-sgmii - psgmii - qsgmii - qusgmii
Signature · 1 line
2.51.0
David Yang
maintainerPATCH v12 2/5 net: phy: introduce PHY_INTERFACE_MODE_REVSGMII
In reply to David YangThe "reverse SGMII" protocol name is an invention derived from "reverse MII" and "reverse RMII", this means: "behave like an SGMII PHY".
--- drivers/net/phy/phy-core.c | 1 + drivers/net/phy/phy_caps.c | 1 + drivers/net/phy/phylink.c | 1 + include/linux/phy.h | 4 ++++ 4 files changed, 7 insertions(+)
drivers/net/phy/phy-core.c +1 -0
@@ -132,6 +132,7 @@ int phy_interface_num_ports(phy_interface_t interface)case PHY_INTERFACE_MODE_TRGMII :case PHY_INTERFACE_MODE_USXGMII :case PHY_INTERFACE_MODE_SGMII : +case PHY_INTERFACE_MODE_REVSGMII :case PHY_INTERFACE_MODE_SMII :case PHY_INTERFACE_MODE_1000BASEX :case PHY_INTERFACE_MODE_2500BASEX :
drivers/net/phy/phy_caps.c +1 -0
@@ -299,6 +299,7 @@ unsigned long phy_caps_from_interface(phy_interface_t interface)case PHY_INTERFACE_MODE_PSGMII :case PHY_INTERFACE_MODE_QSGMII :case PHY_INTERFACE_MODE_QUSGMII : +case PHY_INTERFACE_MODE_REVSGMII :case PHY_INTERFACE_MODE_SGMII :case PHY_INTERFACE_MODE_GMII : link_caps |=BIT (LINK_CAPA_1000HD ) |BIT (LINK_CAPA_1000FD );
drivers/net/phy/phylink.c +1 -0
@@ -255,6 +255,7 @@ static int phylink_interface_max_speed(phy_interface_t interface)case PHY_INTERFACE_MODE_PSGMII :case PHY_INTERFACE_MODE_QSGMII :case PHY_INTERFACE_MODE_QUSGMII : +case PHY_INTERFACE_MODE_REVSGMII :case PHY_INTERFACE_MODE_SGMII :case PHY_INTERFACE_MODE_GMII :return SPEED_1000 ;
include/linux/phy.h +4 -0
@@ -107,6 +107,7 @@ extern const int phy_basic_ports_array[3];* @PHY_INTERFACE_MODE_LAUI: 50 Gigabit Attachment Unit Interface * @PHY_INTERFACE_MODE_100GBASEP: 100GBase-P - with Clause 134 FEC * @PHY_INTERFACE_MODE_MIILITE: MII-Lite - MII without RXER TXER CRS COL +* @PHY_INTERFACE_MODE_REVSGMII: Serial gigabit media-independent interface in PHY role * @PHY_INTERFACE_MODE_MAX: Book keeping * * Describes the interface between the MAC and PHY.
@@ -152,6 +153,7 @@ typedef enum {PHY_INTERFACE_MODE_LAUI ,PHY_INTERFACE_MODE_100GBASEP ,PHY_INTERFACE_MODE_MIILITE , +PHY_INTERFACE_MODE_REVSGMII ,PHY_INTERFACE_MODE_MAX , } phy_interface_t;
@@ -286,6 +288,8 @@ static inline const char *phy_modes(phy_interface_t interface)return "100gbase-p" ;case PHY_INTERFACE_MODE_MIILITE :return "mii-lite" ; +case PHY_INTERFACE_MODE_REVSGMII : +return "rev-sgmii" ;default :return "unknown" ; }
Signature · 1 line
2.51.0
Paolo Abeni
maintainerRe: [PATCH net-next v12 2/5] net: phy: introduce PHY_INTERFACE_MODE_REVSGMII
Quoted 6 lines · David Yang
The "reverse SGMII" protocol name is an invention derived from "reverse MII" and "reverse RMII", this means: "behave like an SGMII PHY".
Signed-off-by David Yang <[email protected]>Reviewed-by Maxime Chevallier <[email protected]>
My understanding is that Russell question on v11 is still pending:
https://lore.kernel.org/netdev/[email protected]/
and the net-next PR for 6.18 is upcoming. Deferring to next cycle.
Cheers,
Paolo
David Yang
maintainerPATCH v12 3/5 dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support
In reply to David YangThe 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 | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml new file +169 -0
@@ -0,0 +1,169 @@ +# 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 = "rev-sgmii"; + ethernet = <ð0>; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + asym-pause; + }; + }; + + /* 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 v12 4/5 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 v12 5/5 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 | 2901 ++++++++++++++++++++++++++++++++++++++ drivers/net/dsa/yt921x.h | 505 +++++++ 4 files changed, 3414 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 +2901 -0
2,901 lines not on this page · raw message
drivers/net/dsa/yt921x.h new file +505 -0
81 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.