Skip to contentSkip to conversation

net: dsa: mt7530: split-off MDIO driver

RFC PATCH Superseded Daniel Golle 1 participant 1 message Mar 27, 2023

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Daniel Golle

author maintainer
#0 lore raw

RFC PATCH 1/2 net: dsa: mt7530: split-off MDIO driver

In order to support the built-in switch of some MediaTek SoCs we need to use MMIO instead of MDIO to access the switch.
Prepare this be splitting-off the part of the driver registering an MDIO driver, so we can add another module acting as MMIO/platform driver.

---
 drivers/net/dsa/Kconfig       |   8 +-
 drivers/net/dsa/Makefile      |   3 +-
 drivers/net/dsa/mt7530-mdio.c | 165 ++++++++++++++++++++++++++++++++
 drivers/net/dsa/mt7530.c      | 174 +++++-----------------------------
 drivers/net/dsa/mt7530.h      |  23 +----
 5 files changed, 203 insertions(+), 170 deletions(-)
 create mode 100644 drivers/net/dsa/mt7530-mdio.c
drivers/net/dsa/Kconfig +7 -1
index 6b45fa8b69078..5a67a74166a3d 100644
@@ -35,10 +35,16 @@ config NET_DSA_LANTIQ_GSWIP
 	  the xrx200 / VR9 SoC.
 
 config NET_DSA_MT7530
-	tristate "MediaTek MT7530 and MT7531 Ethernet switch support"
+	tristate "MediaTek Ethernet switch support"
 	select NET_DSA_TAG_MTK
 	select MEDIATEK_GE_PHY
 	select PCS_MTK_LYNXI
+	help
+	  This enables support for the MediaTek Ethernet switch chips.
+
+config NET_DSA_MT7530_MDIO
+	tristate "MediaTek MT7530 and MT7531 Ethernet switch support"
+	select NET_DSA_MT7530
 	help
 	  This enables support for the MediaTek MT7530 and MT7531 Ethernet
 	  switch chips. Multi-chip module MT7530 in MT7621AT, MT7621DAT,
drivers/net/dsa/Makefile +2 -1
index 16eb879e0cb4d..2b072d574ed02 100644
@@ -6,7 +6,8 @@ ifdef CONFIG_NET_DSA_LOOP
 obj-$(CONFIG_FIXED_PHY)		+= dsa_loop_bdinfo.o
 endif
 obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o
-obj-$(CONFIG_NET_DSA_MT7530)	+= mt7530.o
+obj-$(CONFIG_NET_DSA_MT7530)		+= mt7530.o
+obj-$(CONFIG_NET_DSA_MT7530_MDIO)	+= mt7530-mdio.o
 obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
 obj-$(CONFIG_NET_DSA_RZN1_A5PSW) += rzn1_a5psw.o
 obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o
drivers/net/dsa/mt7530-mdio.c new file +165 -0

165 lines not on this page · raw message

drivers/net/dsa/mt7530.c +24 -150

210 lines not on this page · raw message

drivers/net/dsa/mt7530.h +5 -18
index c5d29f3fc1d80..e78ae5c8955ee 100644
@@ -682,24 +682,6 @@ enum p5_interface_select {
 	P5_INTF_SEL_GMAC5_SGMII,
 };
 
-static const char *p5_intf_modes(unsigned int p5_interface)
-{
-	switch (p5_interface) {
-	case P5_DISABLED:
-		return "DISABLED";
-	case P5_INTF_SEL_PHY_P0:
-		return "PHY P0";
-	case P5_INTF_SEL_PHY_P4:
-		return "PHY P4";
-	case P5_INTF_SEL_GMAC5:
-		return "GMAC5";
-	case P5_INTF_SEL_GMAC5_SGMII:
-		return "GMAC5_SGMII";
-	default:
-		return "unknown";
-	}
-}
-
 struct mt7530_priv;
 
 struct mt753x_pcs {
@@ -830,4 +812,9 @@ static inline void INIT_MT7530_DUMMY_POLL(struct mt7530_dummy_poll *p,
 	p->reg = reg;
 }
 
+void mt7530_free_irq(struct mt7530_priv *priv);
+
+extern const struct dsa_switch_ops mt7530_switch_ops;
+extern const struct mt753x_info mt753x_table[];
+
 #endif /* __MT7530_H */
Signature · 1 line
2.39.2