[RFC PATCH net-next 0/5] net: dsa: add support for RTL8365MB-VC

From: Alvin Šipraga
Date: Sun Aug 22 2021 - 15:32:44 EST


From: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>

This series adds support for Realtek's RTL8365MB-VC, a 4+1 port
10/100/1000M Ethernet switch. The driver - rtl8365mb - was developed by
Michael Ramussen and myself.

Summary of patches:

- The first patch in the series is a bugfix in realtek-smi which I
found when writing the new rtl8365mb subdriver and building
realtek-smi as a module. If desired, I can spin it off into a
separate patch and target it for net (not net-next).

- The second patch updates the dt-bindings for the new compatible
string.

- The third patch adds the 8 byte tag protocol driver.

- The fourth patch adds the rtl8365mb subdriver - the main feature of
this patch series.

- The fifth patch adds a PHY driver for the internal PHYs found in the
RTL8365MB-VC. This is not strictly necessary for the rtl8365mb
driver to work, but it avoids using the poll-only Generic PHY driver
directly by hooking into the IRQs made available by the switch
driver.

This is my first time in the DSA subsystem, so I am submitting this as
an RFC patch series for now. Apologies if I have made some terrible
mistakes along the way. All feedback - no matter how minor - is thus
very welcome.

There is a lot more work that can be done on this driver, particularly
when it comes to offloading certain DSA features to the hardware. I
intend to revisit this later when I have more time. In the mean time,
the driver seems to be in a good enough state for upstream submission.

Finally, there is an outstanding issue in probing the PHY driver when
fw_devlink=on. This seems to be a generic problem with DSA drivers which
create a dependency between an internal interrupt-controller and child
PHY nodes, realtek-smi being one of them. See [1] for an ongoing
discussion about that. Since this seems to be an existing problem and
not unique to this new driver, I hope that it will not impede the
upstreaming of this patch series.

[1] https://lore.kernel.org/netdev/cd0d9c40-d07b-e2ab-b068-d0bcb4685d09@xxxxxxxxxxxxxxx/

Alvin Šipraga (5):
net: dsa: realtek-smi: fix mdio_free bug on module unload
dt-bindings: net: dsa: realtek-smi: document new compatible rtl8365mb
net: dsa: tag_rtl8_4: add realtek 8 byte protocol 4 tag
net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC
net: phy: realtek: add support for RTL8365MB-VC internal PHYs

.../bindings/net/dsa/realtek-smi.txt | 1 +
drivers/net/dsa/Kconfig | 1 +
drivers/net/dsa/Makefile | 2 +-
drivers/net/dsa/realtek-smi-core.c | 10 +
drivers/net/dsa/realtek-smi-core.h | 2 +
drivers/net/dsa/rtl8365mb.c | 2124 +++++++++++++++++
drivers/net/dsa/rtl8366rb.c | 8 +
drivers/net/phy/realtek.c | 8 +
include/net/dsa.h | 2 +
net/dsa/Kconfig | 6 +
net/dsa/Makefile | 1 +
net/dsa/tag_rtl8_4.c | 178 ++
12 files changed, 2342 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/dsa/rtl8365mb.c
create mode 100644 net/dsa/tag_rtl8_4.c

--
2.32.0