Convert TP-Link Archer C5 v4 and EC220-G5 v2 to DSA

Convert TP-Link Archer C5 v4 and EC220-G5 v2 to DSA.
This supports only the rtl8367s and not the variant with the rtl8367s-vb switch, which is still not supported in the upstream Realtek DSA driver.
The code for testing is available at: https://github.com/openwrt/openwrt/pull/19397

2 Likes

Since routers comes with two switch versions, either RTL8367S or RTL8367S-VB, a new DTS was created. Next to tplink,archer-c5-v4 (RTL8367S or RTL8367S-VB) is tplink,archer-c5-v4-dsa with DSA support, but only for the RTL8367S.Similarly for TP-Link EC220-G5 v2.

All tests and comments are welcome.

Kernel log of the Archer C5 v4 router: https://github.com/user-attachments/files/21414901/log-dsa_old-6.12.39.log

How do you tell them apart externally?

Just look at the kernel log:

[    3.439173] rtl8367b rtl8367s: using MDIO bus 'mdio'
[    3.445179] rtl8367b rtl8367s: RTL8367S chip found (num:6367 ver:00a0, mode:00a0)
[    3.574950] rtl8367b rtl8367s: cpu_port:7, assigned to extif2

I dont have the device, just thinking if first time user does not brick it.

Fortunately, this router has recovery via TFTP.

1 Like

@123serge123 Would you be able to adapt the realtek,rtl8365mb driver to support RTL8367S-VB?

Ping @ricardovitor
Can you test EC220-G5 v2?

I'm not familiar emough with dsa and don't have test device.

The new DSA configuration for TP-Link EC220-G5 v2 should be tested on real hardware. I also do not have confirmed switch_intc interrupt settings.
Similarly for Archer C5 v4 I have not found confirmation of this interrupt anywhere. TP-Link's GPL code for this router does not contain any information about the GPIO11 interrupt for the RTL8367S.

I partially ported your fixes to rtl8365mb (https://github.com/namiltd/rtl8367d/pull/3) but I still have to do vlan mc emulation. I don't have such a device either, so I'm doing it blindly. So I'll leave that to do later.

Edit: Added support for rtl8367s-vb (rtl8367d family chip).

Additionally, I created an LED trigger module to support multiple interfaces simultaneously in LAN/WAN/WLAN groups. The type is automatically recognized based on the LED name. Patch available at: https://github.com/openwrt/openwrt/pull/19903 Tests and any comments are welcome.

1 Like

There are no volunteers to help, so the only option left is to move support for only RTL8367S to DSA. Routers with the RTL8367S-VB version will have to be unsupported.

Unfortunately, it is the best approach. Until a driver dev (me or @mietekn ) have access to a RTL8367S-VB, blindly changing the driver is too risky.