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
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.
@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.
[ 75.393056] CPU 0 Unable to handle kernel paging request at virtual address 702e1534, epc == 702e1534, ra == 80001db0
[ 75.403958] Oops[#1]:
[ 75.406288] CPU: 0 UID: 0 PID: 2298 Comm: modprobe Tainted: G O 6.12.40 #0
[ 75.414735] Tainted: [O]=OOT_MODULE
[ 75.418291] Hardware name: TP-Link EC220-G5 v2 (DSA)
[ 75.423621] $ 0 : 00000000 00000001 819d0560 809d3cdc
[ 75.428984] $ 4 : 00000cc0 00000001 00018654 83091280
[ 75.434342] $ 8 : 00018655 00000cc0 00000000 77e0efff
[ 75.439700] $12 : 81ccd1e5 00000001 00000000 7fd2ffff
[ 75.445058] $16 : 000013a0 77e06000 7fd50284 00400dc1
[ 75.450417] $20 : 8383fbf8 77e0e3d0 00000000 7fd50120
[ 75.455775] $24 : 00000003 807cbe88
[ 75.461133] $28 : 83056000 83057f28 00000000 80001db0
[ 75.466492] Hi : 00000000
[ 75.469427] Lo : 00000000
[ 75.472364] epc : 702e1534 0x702e1534
[ 75.476287] ra : 80001db0 work_notifysig+0x10/0x18
[ 75.481457] Status: 1100b403KERNEL EXL IE
[ 75.485742] Cause : 50800008 (ExcCode 02)
[ 75.489832] BadVA : 702e1534
[ 75.492769] PrId : 00019650 (MIPS 24KEc)
[ 75.496859] Modules linked in: rt2800soc(O) rt2800mmio(O) rt2800lib(O) pppoe ppp_async nft_fib_inet nf_flow_table_inet rt2x00soc(O) rt2x00mmio(O) rt2x00lib(O) pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_numgen nft_nat nft_masq nft_log nft_limit nft_hash nft_flow_offload nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_ct nft_chain_nat nf_tables nf_nat_tftp nf_nat_snmp_basic nf_nat_sip nf_nat_pptp nf_nat_irc nf_nat_h323 nf_nat_amanda nf_nat nf_flow_table nf_conntrack_tftp nf_conntrack_snmp nf_conntrack_sip nf_conntrack_sane nf_conntrack_pptp nf_conntrack_netbios_ns nf_conntrack_irc nf_conntrack_h323 nf_conntrack_broadcast nf_conntrack_amanda nf_conntrack mt76x2e(O) mt76x2_common(O) mt76x02_lib(O) mt76(O) mac80211(O) cfg80211(O) ts_kmp ts_fsm ts_bm slhc nfnetlink nf_reject_ipv6 nf_reject_ipv4 nf_log_syslog nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c crc_ccitt compat(O) asn1_decoder i2c_dev sit tunnel4 ip_tunnel sha512_generic seqiv sha3_generic jitterentropy_rng drbg hmac geniv
[ 75.497429] rng cmac leds_gpio tag_rtl8_4 rtl8365mb realtek_dsa dsa_core gpio_button_hotplug(O) realtek hwmon i2c_core phylink crc32c_generic
[ 75.602410] Process modprobe (pid: 2298, threadinfo=e1783efc, task=7b3eaece, tls=77e16dfc)
[ 75.610858] Stack : 00000000 00000000 00000000 00000000 77e15290 77e0bb21 77e15290 77e0bad0
[ 75.619433] 00000000 00000001 00000000 77d9d644 77e06000 000013a0 00000000 00000000
[ 75.628007] 00000000 81ba8b74 77e0bfff 77e0efff 81ccd1e5 00000001 83097e10 7fd2ffff
[ 75.636583] 000013a0 77e06000 7fd50284 00400dc1 8383fbf8 77e0e3d0 00000000 7fd50120
[ 75.645159] 00000000 77dd36d0 00000001 00000000 77e15290 7fd4ffe0 00000000 77d9d674
[ 75.653733] ...
[ 75.656236] Call Trace:
[ 75.656242]
[ 75.660321]
[ 75.661840] Code: (Bad address in epc)
[ 75.661840]
[ 75.667172]
[ 75.668796] ---[ end trace 0000000000000000 ]---
[ 75.673536] Kernel panic - not syncing: Fatal exception
[ 75.678878] Rebooting in 3 seconds..```
Any ideas?
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.
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.
Added support for rtl8367s-vb (rtl8367d family chip).