Skip to content

Commit 4af2950

Browse files
sipragadavem330
authored andcommitted
net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC
This patch adds a realtek-smi subdriver for the RTL8365MB-VC 4+1 port 10/100/1000M switch controller. The driver has been developed based on a GPL-licensed OS-agnostic Realtek vendor driver known as rtl8367c found in the OpenWrt source tree. Despite the name, the RTL8365MB-VC has an entirely different register layout to the already-supported RTL8366RB ASIC. Notwithstanding this, the structure of the rtl8365mb subdriver is loosely based on the rtl8366rb subdriver. Like the 'rb, it establishes its own irqchip to handle cascaded PHY link status interrupts. The RTL8365MB-VC switch is capable of offloading a large number of features from the software, but this patch introduces only the most basic DSA driver functionality. The ports always function as standalone ports, with bridging handled in software. One more thing. Realtek's nomenclature for switches makes it hard to know exactly what other ASICs might be supported by this driver. The vendor driver goes by the name rtl8367c, but as far as I can tell, no chip actually exists under this name. As such, the subdriver is named rtl8365mb to emphasize the potentially limited support. But it is clear from the vendor sources that a number of other more advanced switches share a similar register layout, and further support should not be too hard to add given access to the relevant hardware. With this in mind, the subdriver has been written with as few assumptions about the particular chip as is reasonable. But the RTL8365MB-VC is the only hardware I have available, so some further work is surely needed. Co-developed-by: Michael Rasmussen <[email protected]> Signed-off-by: Michael Rasmussen <[email protected]> Signed-off-by: Alvin Šipraga <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Tested-by: Arınç ÜNAL <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1521d5a commit 4af2950

File tree

5 files changed

+1989
-1
lines changed

5 files changed

+1989
-1
lines changed

drivers/net/dsa/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ config NET_DSA_QCA8K
7070
config NET_DSA_REALTEK_SMI
7171
tristate "Realtek SMI Ethernet switch family support"
7272
select NET_DSA_TAG_RTL4_A
73+
select NET_DSA_TAG_RTL8_4
7374
select FIXED_PHY
7475
select IRQ_DOMAIN
7576
select REALTEK_PHY

drivers/net/dsa/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o
1010
obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
1111
obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o
1212
obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o
13-
realtek-smi-objs := realtek-smi-core.o rtl8366.o rtl8366rb.o
13+
realtek-smi-objs := realtek-smi-core.o rtl8366.o rtl8366rb.o rtl8365mb.o
1414
obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o
1515
obj-$(CONFIG_NET_DSA_SMSC_LAN9303_I2C) += lan9303_i2c.o
1616
obj-$(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) += lan9303_mdio.o

drivers/net/dsa/realtek-smi-core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,10 @@ static const struct of_device_id realtek_smi_of_match[] = {
501501
.compatible = "realtek,rtl8366s",
502502
.data = NULL,
503503
},
504+
{
505+
.compatible = "realtek,rtl8365mb",
506+
.data = &rtl8365mb_variant,
507+
},
504508
{ /* sentinel */ },
505509
};
506510
MODULE_DEVICE_TABLE(of, realtek_smi_of_match);

drivers/net/dsa/realtek-smi-core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,6 @@ int rtl8366_get_sset_count(struct dsa_switch *ds, int port, int sset);
140140
void rtl8366_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
141141

142142
extern const struct realtek_smi_variant rtl8366rb_variant;
143+
extern const struct realtek_smi_variant rtl8365mb_variant;
143144

144145
#endif /* _REALTEK_SMI_H */

0 commit comments

Comments
 (0)