Support for RTL838x based managed switches

Do you just get no network, but working serial terminal, or does the device hang completely when trying to reboot? The port LEDs aren't supported yet, so it's no surprise those aren't working.

Could you test if you can get it working with these extra patches? (And please reply there with a Tested-by tag if it works)

My soldering equipment and skills are unfortunately not up to adding serial pins where it looks like they could be soldered - I'd just end up shorting them all together. I've never built my own OpenWrt images either (though it's probably past time I learn). I'm sorry I can't be more helpful.

I checked out your master branch and added the image profile to the Makefile, and changed the partition label, compatible and openwrt,ih-magic properties in the existing DTS. Boot hangs:

## Booting kernel from Legacy Image at 84f00000 ...
   Image Name:   MIPS OpenWrt Linux-5.10.64
   Created:      2021-11-28  11:47:55 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    6070427 Bytes = 5.8 MB
   Load Address: 80000000
   Entry Point:  80000400
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Linux version 5.10.64 (MO\edwin@medusa) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r17632+4-ad28d094ff) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 Sun Nov 28 11:47:55 2021
[    0.000000] RTL838X model is ffffffff
[    0.000000] RTL839X model is 83936802
[    0.000000] SoC Type: RTL8393
[    0.000000] Kernel command line:
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019555 (MIPS 34Kc)
[    0.000000] MIPS: machine is Zyxel GS1900-48
[    0.000000] Registering _machine_restart
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Using appended Device Tree.
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000]   Normal zone: 288 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,115200
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 114412K/131072K available (5464K kernel code, 610K rwdata, 1180K rodata, 7840K init, 203K bss, 16660K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] random: get_random_bytes called from start_kernel+0x31c/0x50c with crng_init=0
[    0.000000] timer_probe: no matching timers found
[    0.000000] CPU frequency from device tree: 700MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5460744132 ns
[    0.000008] sched_clock: 32 bits at 350MHz, resolution 2ns, wraps every 6135667710ns
[    0.009215] Calibrating delay loop... 464.48 BogoMIPS (lpj=2322432)
[    0.076473] pid_max: default: 32768 minimum: 301
[    0.082080] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.090664] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.102031] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.115814] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.127406] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.135509] pinctrl core: initialized pinctrl subsystem
[    0.142255] NET: Registered protocol family 16
[    0.204212] clocksource: Switched to clocksource MIPS
[    0.211344] NET: Registered protocol family 2
[    0.216655] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.225780] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.235690] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.244698] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.252984] TCP: Hash tables configured (established 1024 bind 1024)
[    0.260666] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.268382] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.276856] NET: Registered protocol family 1
[    0.428809] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.440948] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.447832] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.462702] pinctrl-single bb001000.pinmux: 32 pins, size 4
[    0.469762] Probing RTL8231 GPIOs
[    0.473597] rtl8231_init called, MDIO bus ID: 3
[    0.519507] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.752950] brd: module loaded
[    0.757851] libphy: Fixed MDIO Bus: probed
[    0.764928] Probing RTL838X eth device pdev: 81499a00, dev: 81499a10
[    0.779666] rtl838x-eth bb00a300.ethernet: cannot obtain IRQ, using default 24
[    0.788142] Found SoC ID: 8393: RTL8393, family 8390
[    0.793988] Using MAC 0000588bf3fe05d5
[    0.799585] libphy: rtl839x-eth-mdio: probed
[    1.558817] rtl8393_serdes_probe: id: 48
[    1.563369] Realtek RTL8393 SERDES mdio-bus:30: Detected internal RTL8390 SERDES
[    1.586289] rtl8393_serdes_probe: id: 49
[    1.590837] Realtek RTL8393 SERDES mdio-bus:31: Detected internal RTL8390 SERDES
[    1.601798] NET: Registered protocol family 10
[    1.612485] Segment Routing with IPv6
[    1.616902] NET: Registered protocol family 17
[    1.622382] 8021q: 802.1Q VLAN Support v1.8
[    1.627916] i2c-gpio i2c-gpio-0: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.637932] i2c-gpio i2c-gpio-0: using lines 184 (SDA) and 185 (SCL)
[    1.645811] i2c-gpio i2c-gpio-1: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.655785] i2c-gpio i2c-gpio-1: using lines 190 (SDA) and 191 (SCL)
[    1.664348] libphy: SFP I2C Bus: probed
[    1.669137] sfp sfp-p9: Host maximum power 1.0W
[    1.678672] libphy: SFP I2C Bus: probed
[    1.683487] sfp sfp-p10: Host maximum power 1.0W
[    2.584201] random: fast init done
[  133.784256] random: crng init done

So I recreated the patch for PHY_MAX_ADDR:

--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -566,7 +566,7 @@ int __mdiobus_register(struct mii_bus *b
                        goto error_reset_gpiod;
        }

-       for (i = 0; i < PHY_MAX_ADDR; i++) {
+       for (i = 0; i < 52; i++) {
                if ((bus->phy_mask & (1 << i)) == 0) {
                        struct phy_device *phydev;

This causes a kernel panic:

## Booting kernel from Legacy Image at 84f00000 ...
   Image Name:   MIPS OpenWrt Linux-5.10.64
   Created:      2021-11-28  11:47:55 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    6070427 Bytes = 5.8 MB
   Load Address: 80000000
   Entry Point:  80000400
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Linux version 5.10.64 (MO\edwin@medusa) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r17632+4-ad28d094ff) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 Sun Nov 28 11:47:55 2021
[    0.000000] RTL838X model is ffffffff
[    0.000000] RTL839X model is 83936802
[    0.000000] SoC Type: RTL8393
[    0.000000] Kernel command line:
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019555 (MIPS 34Kc)
[    0.000000] MIPS: machine is Zyxel GS1900-48
[    0.000000] Registering _machine_restart
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Using appended Device Tree.
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000]   Normal zone: 288 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,115200
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Writing ErrCtl register=00000006
[    0.000000] Readback ErrCtl register=00000006
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 114412K/131072K available (5464K kernel code, 610K rwdata, 1180K rodata, 7840K init, 203K bss, 16660K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] random: get_random_bytes called from start_kernel+0x31c/0x50c with crng_init=0
[    0.000000] timer_probe: no matching timers found
[    0.000000] CPU frequency from device tree: 700MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5460744132 ns
[    0.000008] sched_clock: 32 bits at 350MHz, resolution 2ns, wraps every 6135667710ns
[    0.009215] Calibrating delay loop... 464.48 BogoMIPS (lpj=2322432)
[    0.076473] pid_max: default: 32768 minimum: 301
[    0.082080] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.090663] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.102032] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.115807] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.127396] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.135500] pinctrl core: initialized pinctrl subsystem
[    0.142248] NET: Registered protocol family 16
[    0.204294] clocksource: Switched to clocksource MIPS
[    0.211438] NET: Registered protocol family 2
[    0.216749] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.225873] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.235783] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.244790] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.253077] TCP: Hash tables configured (established 1024 bind 1024)
[    0.260758] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.268476] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.276948] NET: Registered protocol family 1
[    0.428924] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.441061] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.447944] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.462816] pinctrl-single bb001000.pinmux: 32 pins, size 4
[    0.469875] Probing RTL8231 GPIOs
[    0.473709] rtl8231_init called, MDIO bus ID: 3
[    0.519631] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.752457] brd: module loaded
[    0.757342] libphy: Fixed MDIO Bus: probed
[    0.764410] Probing RTL838X eth device pdev: 81499a00, dev: 81499a10
[    0.779150] rtl838x-eth bb00a300.ethernet: cannot obtain IRQ, using default 24
[    0.787627] Found SoC ID: 8393: RTL8393, family 8390
[    0.793473] Using MAC 0000588bf3fe05d5
[    0.799079] libphy: rtl839x-eth-mdio: probed
[    1.559052] rtl8393_serdes_probe: id: 48
[    1.563602] Realtek RTL8393 SERDES mdio-bus:30: Detected internal RTL8390 SERDES
[    1.586516] rtl8393_serdes_probe: id: 49
[    1.591070] Realtek RTL8393 SERDES mdio-bus:31: Detected internal RTL8390 SERDES
[    1.602025] NET: Registered protocol family 10
[    1.612645] Segment Routing with IPv6
[    1.617060] NET: Registered protocol family 17
[    1.622541] 8021q: 802.1Q VLAN Support v1.8
[    1.630519] i2c-gpio i2c-gpio-0: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.640532] i2c-gpio i2c-gpio-0: using lines 184 (SDA) and 185 (SCL)
[    1.648408] i2c-gpio i2c-gpio-1: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.658383] i2c-gpio i2c-gpio-1: using lines 190 (SDA) and 191 (SCL)
[    1.666952] libphy: SFP I2C Bus: probed
[    1.671740] sfp sfp-p9: Host maximum power 1.0W
[    1.677973] libphy: SFP I2C Bus: probed
[    1.682794] sfp sfp-p10: Host maximum power 1.0W
[    2.406319] libphy: rtl838x slave mii: probed
[    2.426203] In rtl83xx_vlan_setup
[    2.430038] UNKNOWN_MC_PMASK: 001fffffffffffff
[    2.435334] VLAN profile 0: L2 learning: 1, UNKN L2MC FLD PMSK 511, 		UNKN IPMC FLD PMSK 511, UNKN IPv6MC FLD PMSK: 511
[    2.435342] VLAN profile 0: raw 000001ff, 003fe3ff
[    2.584282] random: fast init done
[    4.585399] rtl83xx-switch switch@bb000000 lan01 (uninitialized): PHY [mdio-bus:00] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.601408] rtl83xx-switch switch@bb000000 lan02 (uninitialized): PHY [mdio-bus:01] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.617418] rtl83xx-switch switch@bb000000 lan03 (uninitialized): PHY [mdio-bus:02] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.633428] rtl83xx-switch switch@bb000000 lan04 (uninitialized): PHY [mdio-bus:03] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.649437] rtl83xx-switch switch@bb000000 lan05 (uninitialized): PHY [mdio-bus:04] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.665447] rtl83xx-switch switch@bb000000 lan06 (uninitialized): PHY [mdio-bus:05] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.681457] rtl83xx-switch switch@bb000000 lan07 (uninitialized): PHY [mdio-bus:06] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.697466] rtl83xx-switch switch@bb000000 lan08 (uninitialized): PHY [mdio-bus:07] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.713476] rtl83xx-switch switch@bb000000 lan09 (uninitialized): PHY [mdio-bus:08] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.729486] rtl83xx-switch switch@bb000000 lan10 (uninitialized): PHY [mdio-bus:09] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.745495] rtl83xx-switch switch@bb000000 lan11 (uninitialized): PHY [mdio-bus:0a] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.761505] rtl83xx-switch switch@bb000000 lan12 (uninitialized): PHY [mdio-bus:0b] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.777514] rtl83xx-switch switch@bb000000 lan13 (uninitialized): PHY [mdio-bus:0c] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.793525] rtl83xx-switch switch@bb000000 lan14 (uninitialized): PHY [mdio-bus:0d] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.809535] rtl83xx-switch switch@bb000000 lan15 (uninitialized): PHY [mdio-bus:0e] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.825544] rtl83xx-switch switch@bb000000 lan16 (uninitialized): PHY [mdio-bus:0f] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.841554] rtl83xx-switch switch@bb000000 lan17 (uninitialized): PHY [mdio-bus:10] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.857564] rtl83xx-switch switch@bb000000 lan18 (uninitialized): PHY [mdio-bus:11] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.873584] rtl83xx-switch switch@bb000000 lan19 (uninitialized): PHY [mdio-bus:12] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.889583] rtl83xx-switch switch@bb000000 lan20 (uninitialized): PHY [mdio-bus:13] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.905592] rtl83xx-switch switch@bb000000 lan21 (uninitialized): PHY [mdio-bus:14] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.921603] rtl83xx-switch switch@bb000000 lan22 (uninitialized): PHY [mdio-bus:15] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.937613] rtl83xx-switch switch@bb000000 lan23 (uninitialized): PHY [mdio-bus:16] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.953622] rtl83xx-switch switch@bb000000 lan24 (uninitialized): PHY [mdio-bus:17] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.969631] rtl83xx-switch switch@bb000000 lan25 (uninitialized): PHY [mdio-bus:18] driver [Realtek RTL8218B (external)] (irq=POLL)
[    4.985642] rtl83xx-switch switch@bb000000 lan26 (uninitialized): PHY [mdio-bus:19] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.001651] rtl83xx-switch switch@bb000000 lan27 (uninitialized): PHY [mdio-bus:1a] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.017661] rtl83xx-switch switch@bb000000 lan28 (uninitialized): PHY [mdio-bus:1b] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.033670] rtl83xx-switch switch@bb000000 lan29 (uninitialized): PHY [mdio-bus:1c] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.049681] rtl83xx-switch switch@bb000000 lan30 (uninitialized): PHY [mdio-bus:1d] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.065690] rtl83xx-switch switch@bb000000 lan31 (uninitialized): PHY [mdio-bus:1e] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.081700] rtl83xx-switch switch@bb000000 lan32 (uninitialized): PHY [mdio-bus:1f] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.097710] rtl83xx-switch switch@bb000000 lan33 (uninitialized): PHY [mdio-bus:20] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.113720] rtl83xx-switch switch@bb000000 lan34 (uninitialized): PHY [mdio-bus:21] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.129729] rtl83xx-switch switch@bb000000 lan35 (uninitialized): PHY [mdio-bus:22] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.145739] rtl83xx-switch switch@bb000000 lan36 (uninitialized): PHY [mdio-bus:23] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.161748] rtl83xx-switch switch@bb000000 lan37 (uninitialized): PHY [mdio-bus:24] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.177759] rtl83xx-switch switch@bb000000 lan38 (uninitialized): PHY [mdio-bus:25] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.193768] rtl83xx-switch switch@bb000000 lan39 (uninitialized): PHY [mdio-bus:26] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.209778] rtl83xx-switch switch@bb000000 lan40 (uninitialized): PHY [mdio-bus:27] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.225787] rtl83xx-switch switch@bb000000 lan41 (uninitialized): PHY [mdio-bus:28] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.241798] rtl83xx-switch switch@bb000000 lan42 (uninitialized): PHY [mdio-bus:29] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.257807] rtl83xx-switch switch@bb000000 lan43 (uninitialized): PHY [mdio-bus:2a] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.273832] rtl83xx-switch switch@bb000000 lan44 (uninitialized): PHY [mdio-bus:2b] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.289826] rtl83xx-switch switch@bb000000 lan45 (uninitialized): PHY [mdio-bus:2c] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.305836] rtl83xx-switch switch@bb000000 lan46 (uninitialized): PHY [mdio-bus:2d] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.321846] rtl83xx-switch switch@bb000000 lan47 (uninitialized): PHY [mdio-bus:2e] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.337855] rtl83xx-switch switch@bb000000 lan48 (uninitialized): PHY [mdio-bus:2f] driver [Realtek RTL8218B (external)] (irq=POLL)
[    5.355374] rtl83xx-switch switch@bb000000: configuring for fixed/qsgmii link mode
[    5.364737] DSA: tree 0 setup
[    5.368226] LINK state irq: -517
[    5.371956] rtl83xx-switch switch@bb000000: Error setting up switch interrupt.
[    5.380522] In rtl83xx_setup_qos
[    5.384294] Setting up RTL839X QoS
[    5.388286] RTL839X_PRI_SEL_TBL_CTRL(i): 01112111
[    5.393836] Current Intprio2queue setting: 00000000
[    5.399607] QM_PKT2CPU_INTPRI_MAP: 00fac688
[    5.404570] rtl838x_dbgfs_init called
[    5.450179] Kernel bug detected[#1]:
[    5.454323] CPU: 0 PID: 927 Comm: kworker/0:2 Not tainted 5.10.64 #0
[    5.461831] Workqueue: events deferred_probe_work_func
[    5.467877] $ 0   : 00000000 00000001 00000001 8034f6e0
[    5.474043] $ 4   : 814bd000 00000001 00000001 824dcc00
[    5.480209] $ 8   : 00000def 80f54614 00090020 00000001
[    5.486376] $12   : 00080020 00000001 00000001 00000000
[    5.492542] $16   : 82658e00 82658d00 8274fd78 81499c10
[    5.498708] $20   : 00000037 80ef0000 00000005 fffffffe
[    5.504875] $24   : 8182e720 00000004
[    5.511041] $28   : 8274e000 8274fd68 80690000 8031630c
[    5.517207] Hi    : 002889b6
[    5.520599] Lo    : 1a803a30
[    5.524012] epc   : 8035c944 mdiobus_free+0x14/0x30
[    5.529766] ra    : 8031630c release_nodes+0x78/0xb0
[    5.535604] Status: 11008003	KERNEL EXL IE
[    5.540538] Cause : 10800034 (ExcCode 0d)
[    5.545265] PrId  : 00019555 (MIPS 34Kc)
[    5.549888] Modules linked in:
[    5.553491] Process kworker/0:2 (pid: 927, threadinfo=(ptrval), task=(ptrval), tls=00000000)
[    5.563455] Stack : 8070fe68 80ef0000 00000005 8030e624 814be000 816a2a00 81499c10 00000000
[    5.573320]         ffffffea 80ef0000 8070fe68 80311bf8 8070fe68 8274fe08 8070fe68 80312344
[    5.583186]         807153ec 00000000 8274fe08 803122c4 8070aa00 80710000 00000000 80700000
[    5.593052]         fffffffe 8030f6f4 8142b730 00000009 8068c660 8004f778 8141555c 824c3bb4
[    5.602918]         81499c10 00000001 81499c54 803120cc 81499c10 8030bd6c 8142b730 8142b730
[    5.612784]         ...
[    5.615663] Call Trace:
[    5.618547] [<8035c944>] mdiobus_free+0x14/0x30
[    5.623890]
[    5.625631] Code: 10450007  38420003  0002102b <00020336> 24020004  ac820868  080c29e7  24840870  08051194
[    5.637140]
[    5.638977] ---[ end trace 6cb1ce6561e2e97c ]---
[    5.644355] Kernel panic - not syncing: Fatal exception
[    5.650508] Rebooting in 1 seconds..
[    6.650096] System restart.II: Copied Preloader data from 0x9fc00000(15804B) to 0x9f000000.

Could you try this branch out:

if you select 8390 as the sub-architecture, you can directly build an image for the GS1900-48. Careful, the images will end up at a slightly different sub-directory for the 8390. Also SMP is enabled on the 8390 with a second processor available. It is the latest and greatest I worked on for the 8390 with the GS-1900-48 as the test device for the work we did on the 9300 and 9310. If the fix for the VLAN is not in there, then it probably did not exist. Sorry to send you around on this chase, I really would like to be more helpful but I am already stuck at sub-sub-task: I wanted to work on the SerDes code of the 10G SFP phys of the USW switch and currently I am adding SMBus support for SFP-modules :worried:

1 Like

I built BrainSlayer/pie#pie-5.10-rtl9313 with TESTING_KERNEL=y:
Boot hangs with CPU stalling:

## Booting kernel from Legacy Image at 84f00000 ...
   Image Name:   MIPS OpenWrt Linux-5.10.72
   Created:      2021-10-29  11:49:48 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    6240684 Bytes = 6 MB
   Load Address: 80000000
   Entry Point:  80000400
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Linux version 5.10.72 (MO\edwin@medusa) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r17747+248-9d994f35b4) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP Fri Oct 29 11:49:48 2021
[    0.000000] RTL838X model is ffffffff
[    0.000000] RTL839X model is 83936802
[    0.000000] SoC Type: RTL8393
[    0.000000] Kernel command line:
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019555 (MIPS 34Kc)
[    0.000000] plat_mem_setup
[    0.000000] MIPS: machine is Zyxel GS1900-48
[    0.000000] Registering _machine_restart
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Using appended Device Tree.
[    0.000000] Detected 1 available secondary CPU(s)
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000]   Normal zone: 288 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] percpu: Embedded 14 pages/cpu s26416 r8192 d22736 u57344
[    0.000000] pcpu-alloc: s26416 r8192 d22736 u57344 alloc=14*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,115200
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Writing ErrCtl register=00000003
[    0.000000] Readback ErrCtl register=00000003
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 114376K/131072K available (5938K kernel code, 571K rwdata, 1236K rodata, 7284K init, 206K bss, 16696K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 64
[    0.000000] realtek_rtl_of_init: new handler with base 0 b8003000 and base 1 b8003018
[    0.000000] Domain data 00000000
[    0.000000] map_interrupts, chip data 00000000
[    0.000000] map_interrupts: 0 writing 00000000 to b8003014
[    0.000000] map_interrupts: 1 writing 00000000 to b8003010
[    0.000000] map_interrupts: 2 writing 44434500 to b800300c
[    0.000000] map_interrupts: 3 writing 21511114 to b8003008
[    0.000000] map_interrupts: 0 writing 00000000 to b800302c
[    0.000000] map_interrupts: 1 writing 00000000 to b8003028
[    0.000000] map_interrupts: 2 writing 44434500 to b8003024
[    0.000000] map_interrupts: 3 writing 21511114 to b8003020
[    0.000000] 0 00000000 00000000 21511114 44434500 00000000 00000000
[    0.000000] 1 00000000 00000000 21511114 44434500 00000000 00000000
[    0.000000] random: get_random_bytes called from start_kernel+0x32c/0x544 with crng_init=0
[    0.000000] CPU frequency from device tree: 700MHz
[    0.000000] timer_probe: no matching timers found
[    0.000000] mips_clockevent_init: ################## 1
[    0.000000] mips_clockevent_init: ################## 2
[    0.000000] init_mips_clocksource: ################## 1
[    0.000000] init_mips_clocksource: ################## 2
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5460744132 ns
[    0.000008] sched_clock: 32 bits at 350MHz, resolution 2ns, wraps every 6135667710ns
[    0.009242] Calibrating delay loop... 464.48 BogoMIPS (lpj=2322432)
[    0.076527] pid_max: default: 32768 minimum: 301
[    0.082159] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.090753] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.103314] rcu: Hierarchical SRCU implementation.
[    0.109334] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.118809] smp: Bringing up secondary CPUs ...
[    0.125136] vsmp_boot_secondary ++++++++++++++
[    0.130446] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.130467] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.130567] mips_clockevent_init: ################## 1
[    0.130577] mips_clockevent_init: ################## 2
[    0.130602] vsmp_init_secondary ++++++++++++++
[    0.130613] CPU1 revision is: 00019555 (MIPS 34Kc)
[    0.190543] Synchronize counters for CPU 1: done.
[    0.236083] smp: Brought up 1 node, 2 CPUs
[    0.247186] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.258813] futex hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.266952] pinctrl core: initialized pinctrl subsystem
[    0.273748] NET: Registered protocol family 16
[    0.289891] intc_map mapping hw-irq 31 linux irq 31
[    0.296174] intc_map mapping hw-irq 23 linux irq 23
[    0.303533] intc_map mapping hw-irq 24 linux irq 24
[    0.309827] intc_map mapping hw-irq 20 linux irq 20
[    0.381579] clocksource: Switched to clocksource MIPS
[    0.390865] NET: Registered protocol family 2
[    0.396359] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.406328] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.416401] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.425551] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.433945] TCP: Hash tables configured (established 1024 bind 1024)
[    0.441859] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.449653] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.458653] NET: Registered protocol family 1
[    0.561441] random: fast init done
[    0.626530] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.639493] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.646362] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.661007] pinctrl-single 1b001000.pinmux: 32 pins, size 4
[    0.668382] pinctrl-single 1b00a000.pinmux: 32 pins, size 4
[    0.675888] Probing RTL8231 GPIOs
[    0.679812] rtl8231_init called, MDIO bus ID: 3
[    0.690518] Probing RTL838X GPIOs for 00008393
[    0.806679] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.816650] printk: console [ttyS0] disabled
[    0.821874] 18002000.uart: ttyS0 at MMIO 0x18002000 (irq = 31, base_baud = 12500000) is a 16550A
[    0.832373] printk: console [ttyS0] enabled
[    0.832373] printk: console [ttyS0] enabled
[    0.842351] printk: bootconsole [early0] disabled
[    0.842351] printk: bootconsole [early0] disabled
[    1.064626] brd: module loaded
[    1.073067] spi-nor spi0.0: mx25l12805d (16384 Kbytes)
[    1.079396] 7 fixed-partitions partitions found on MTD device spi0.0
[    1.087188] Creating 7 MTD partitions on "spi0.0":
[    1.092966] 0x000000000000-0x000000040000 : "u-boot"
[    1.100295] 0x000000040000-0x000000050000 : "u-boot-env"
[    1.109024] 0x000000050000-0x000000060000 : "u-boot-env2"
[    1.117449] 0x000000060000-0x000000160000 : "jffs"
[    1.125009] 0x000000160000-0x000000260000 : "jffs2"
[    1.132628] 0x000000260000-0x000001000000 : "firmware"
[    1.143143] 2 uimage-fw partitions found on MTD device firmware
[    1.150227] Creating 2 MTD partitions on "firmware":
[    1.156259] 0x000000000000-0x000000310000 : "kernel"
[    1.163810] 0x000000310000-0x000000da0000 : "rootfs"
[    1.171304] mtd: device 7 (rootfs) set to be root filesystem
[    1.178568] 1 squashfs-split partitions found on MTD device rootfs
[    1.186231] 0x000000540000-0x000000da0000 : "rootfs_data"
[    1.194405] 0x000000930000-0x000001000000 : "runtime2"
[    1.217036] libphy: Fixed MDIO Bus: probed
[    1.227802] Probing RTL838X switch device
[    1.232756] SOC ID 8393, FAMILY ID 8390
[    1.237412] Chip version A
[    1.240711] rtl83xx_sw_probe calling rtl83xx_mdio_probe
[    1.247097] In rtl83xx_mdio_probe
[    1.251175] Found compatible MDIO node!
[    1.255877] Deferring probe of mdio bus
[    1.260539] rtl83xx_sw_probe returned -517
[    1.265517] rtl83xx_sw_probe Delaying probe for now
[    1.271976] Probing RTL838X eth device pdev: 820d9a00, dev: 820d9a10
[    1.279785] Allocate 4710564 bytes for DMA
[    1.309408] Found SoC ID: 8393: RTL8393, family 8390
[    1.315463] Using MAC 0000588bf3fe05d5
[    1.320093] rtl838x_mdio_init: looking at port 0
[    1.325741] rtl838x_mdio_init: looking at port 1
[    1.331351] rtl838x_mdio_init: looking at port 2
[    1.337022] rtl838x_mdio_init: looking at port 3
[    1.342674] rtl838x_mdio_init: looking at port 4
[    1.348280] rtl838x_mdio_init: looking at port 5
[    1.353922] rtl838x_mdio_init: looking at port 6
[    1.359533] rtl838x_mdio_init: looking at port 7
[    1.365230] rtl838x_mdio_init: looking at port 8
[    1.370841] rtl838x_mdio_init: looking at port 9
[    1.376481] rtl838x_mdio_init: looking at port 10
[    1.382230] rtl838x_mdio_init: looking at port 11
[    1.387949] rtl838x_mdio_init: looking at port 12
[    1.393749] rtl838x_mdio_init: looking at port 13
[    1.399455] rtl838x_mdio_init: looking at port 14
[    1.405199] rtl838x_mdio_init: looking at port 15
[    1.410916] rtl838x_mdio_init: looking at port 16
[    1.416658] rtl838x_mdio_init: looking at port 17
[    1.422456] rtl838x_mdio_init: looking at port 18
[    1.428164] rtl838x_mdio_init: looking at port 19
[    1.433913] rtl838x_mdio_init: looking at port 20
[    1.439625] rtl838x_mdio_init: looking at port 21
[    1.445375] rtl838x_mdio_init: looking at port 22
[    1.451097] rtl838x_mdio_init: looking at port 23
[    1.456853] rtl838x_mdio_init: looking at port 24
[    1.462597] rtl838x_mdio_init: looking at port 25
[    1.468320] rtl838x_mdio_init: looking at port 26
[    1.474072] rtl838x_mdio_init: looking at port 27
[    1.479794] rtl838x_mdio_init: looking at port 28
[    1.485692] rtl838x_mdio_init: looking at port 29
[    1.491388] rtl838x_mdio_init: looking at port 30
[    1.497152] rtl838x_mdio_init: looking at port 31
[    1.502898] rtl838x_mdio_init: looking at port 32
[    1.508613] rtl838x_mdio_init: looking at port 33
[    1.514455] rtl838x_mdio_init: looking at port 34
[    1.520174] rtl838x_mdio_init: looking at port 35
[    1.525921] rtl838x_mdio_init: looking at port 36
[    1.531671] rtl838x_mdio_init: looking at port 37
[    1.537329] rtl838x_mdio_init: looking at port 38
[    1.543015] rtl838x_mdio_init: looking at port 39
[    1.548632] rtl838x_mdio_init: looking at port 40
[    1.554310] rtl838x_mdio_init: looking at port 41
[    1.559928] rtl838x_mdio_init: looking at port 42
[    1.565592] rtl838x_mdio_init: looking at port 43
[    1.571213] rtl838x_mdio_init: looking at port 44
[    1.576882] rtl838x_mdio_init: looking at port 45
[    1.582543] rtl838x_mdio_init: looking at port 46
[    1.588166] rtl838x_mdio_init: looking at port 47
[    1.593845] rtl838x_mdio_init: looking at port 48
[    1.599471] rtl838x_mdio_init: looking at port 49
[    1.606712] libphy: rtl839x-eth-mdio: probed
[    2.414527] rtl8393_serdes_probe: id: 48
[    2.419225] Realtek RTL8393 SERDES mdio-bus:30: Detected internal RTL8390 SERDES
[    2.443888] rtl8393_serdes_probe: id: 49
[    2.448663] Realtek RTL8393 SERDES mdio-bus:31: Detected internal RTL8390 SERDES
[    2.464265] NET: Registered protocol family 10
[    2.475206] Segment Routing with IPv6
[    2.479863] NET: Registered protocol family 17
[    2.485870] 8021q: 802.1Q VLAN Support v1.8
[    2.491683] i2c-gpio i2c-gpio-0: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    2.502033] i2c-gpio i2c-gpio-0: using lines 184 (SDA) and 185 (SCL)
[    2.510524] i2c-gpio i2c-gpio-1: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    2.520977] i2c-gpio i2c-gpio-1: using lines 190 (SDA) and 191 (SCL)
[    2.530310] libphy: SFP I2C Bus: probed
[    2.535609] sfp sfp-p9: Host maximum power 1.0W
[    2.542876] libphy: SFP I2C Bus: probed
[    2.548133] sfp sfp-p10: Host maximum power 1.0W
[    2.554429] Probing RTL838X switch device
[    2.559367] SOC ID 8393, FAMILY ID 8390
[    2.564087] Chip version A
[    2.567350] rtl83xx_sw_probe calling rtl83xx_mdio_probe
[    2.573642] In rtl83xx_mdio_probe
[    2.577639] Found compatible MDIO node!
[   24.371403] rcu: INFO: rcu_sched self-detected stall on CPU
[   24.378106] rcu: 	0-....: (2099 ticks this GP) idle=d0a/1/0x40000002 softirq=575/575 fqs=1050
[   24.388395] 	(t=2100 jiffies g=-655 q=122)
[   24.393288] NMI backtrace for cpu 0
[   24.397457] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.10.72 #0
[   24.404851] Workqueue: events deferred_probe_work_func
[   24.410988] Stack : 80690afc 8070d0e0 8200bcfc 8007b8e4 80669ebc 80710000 8201dd80 80670000
[   24.420994]         00000000 80710000 80710000 8007ba0c 8070fba7 00000001 8200bcb8 3247374a
[   24.430997]         00000000 00000000 80669ebc 8200bb38 ffffefff 00000000 00000000 ffffffea
[   24.441002]         000000de 8200bb44 000000de 80715020 00000000 00000000 00000000 80670000
[   24.451005]         00000000 80710000 80710000 8070d0e0 00000018 80350ff4 00000000 80eb0000
[   24.461008]         ...
[   24.463934] Call Trace:
[   24.466866] [<80006f88>] show_stack+0x30/0x100
[   24.472188] [<802f7634>] dump_stack+0x9c/0xcc
[   24.477393] [<802fdf88>] nmi_cpu_backtrace+0xf8/0x13c
[   24.483432] [<802fe120>] nmi_trigger_cpumask_backtrace+0x154/0x184
[   24.490810] [<8008e538>] rcu_dump_cpu_stacks+0x128/0x17c
[   24.497161] [<8008fb28>] print_cpu_stall+0x1ac/0x26c
[   24.503100] [<80091f40>] check_cpu_stall+0x114/0x28c
[   24.509034] [<80094b1c>] rcu_sched_clock_irq+0xc0/0x20c
[   24.515293] [<8009a3ec>] update_process_times+0xb4/0x110
[   24.521649] [<800abd1c>] tick_handle_periodic+0x34/0xbc
[   24.527897] [<8000d8a8>] c0_compare_interrupt+0x80/0x94
[   24.534157] [<8007ec48>] __handle_irq_event_percpu+0x70/0x1b0
[   24.541016] [<8007eda8>] handle_irq_event_percpu+0x20/0x78
[   24.547580] [<800845e4>] handle_percpu_irq+0x88/0xb8
[   24.553515] [<8007e2e8>] generic_handle_irq+0x44/0x5c
[   24.559561] [<805cbbb4>] do_IRQ+0x1c/0x2c
[   24.564349] [<80313afc>] plat_irq_dispatch+0x68/0xf0
[   24.570282] [<800022c8>] except_vec_vi_end+0xb8/0xc4
[   24.576228] [<803cbe14>] rtl839x_read_phy+0xb4/0x110
[   24.582168] [<803d8884>] rtl839x_mdio_read+0x3c/0x58
[   24.588111] [<803ad790>] __mdiobus_read+0x44/0x134
[   24.593830] [<803ad960>] mdiobus_read+0x40/0x6c
[   24.599236] [<803ab048>] get_phy_device+0x80/0x158
[   24.604956] [<803ad01c>] mdiobus_scan+0x44/0x1d8
[   24.610466] [<803adca8>] __mdiobus_register+0x1d0/0x360
[   24.616714] [<807ac5a0>] rtl83xx_mdio_probe+0x13c/0x3e0
[   24.622963] [<807acbe4>] rtl83xx_sw_probe+0x3a0/0x858
[   24.628998] [<80363550>] platform_drv_probe+0x40/0x94
[   24.635033] [<8036123c>] really_probe+0x108/0x4d8
[   24.640661] [<8035ee48>] bus_for_each_drv+0x70/0xb0
[   24.646487] [<80361810>] __device_attach+0xe4/0x15c
[   24.652315] [<8036014c>] bus_probe_device+0x9c/0xb8
[   24.658136] [<80360688>] deferred_probe_work_func+0x90/0xd0
[   24.664797] [<8004391c>] process_one_work+0x208/0x46c
[   24.670827] [<8004438c>] worker_thread+0x360/0x5dc
[   24.676548] [<80049ff4>] kthread+0x13c/0x144
[   24.681648] [<80001db8>] ret_from_kernel_thread+0x14/0x1c
[   24.688089]
[   58.261493] random: crng init done
[   87.401414] rcu: INFO: rcu_sched self-detected stall on CPU
[   87.408091] rcu: 	0-....: (8402 ticks this GP) idle=d0a/1/0x40000002 softirq=575/575 fqs=4186
[   87.418377] 	(t=8403 jiffies g=-655 q=122)
[   87.423270] NMI backtrace for cpu 0
[   87.427439] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.10.72 #0
[   87.434831] Workqueue: events deferred_probe_work_func
[   87.440970] Stack : 80690afc 8070d0e0 8200bcfc 8007b8e4 80669ebc 80710000 8201dd80 80670000
[   87.450976]         00000000 80710000 80710000 8007ba0c 8070fba7 00000001 8200bcb8 3247374a
[   87.460980]         00000000 00000000 80669ebc 8200bb38 ffffefff 00000000 00000000 ffffffea
[   87.470984]         00000112 8200bb44 00000112 80715020 00000000 00000000 00000000 80670000
[   87.480987]         00000000 80710000 80710000 8070d0e0 00000018 80350ff4 00000000 80eb0000
[   87.490991]         ...
[   87.493916] Call Trace:
[   87.496842] [<80006f88>] show_stack+0x30/0x100
[   87.502171] [<802f7634>] dump_stack+0x9c/0xcc
[   87.507376] [<802fdf88>] nmi_cpu_backtrace+0xf8/0x13c
[   87.513414] [<802fe120>] nmi_trigger_cpumask_backtrace+0x154/0x184
[   87.520802] [<8008e538>] rcu_dump_cpu_stacks+0x128/0x17c
[   87.527153] [<8008fb28>] print_cpu_stall+0x1ac/0x26c
[   87.533093] [<80091f40>] check_cpu_stall+0x114/0x28c
[   87.539027] [<80094b1c>] rcu_sched_clock_irq+0xc0/0x20c
[   87.545285] [<8009a3ec>] update_process_times+0xb4/0x110
[   87.551642] [<800abd1c>] tick_handle_periodic+0x34/0xbc
[   87.557890] [<8000d8a8>] c0_compare_interrupt+0x80/0x94
[   87.564148] [<8007ec48>] __handle_irq_event_percpu+0x70/0x1b0
[   87.571007] [<8007eda8>] handle_irq_event_percpu+0x20/0x78
[   87.577572] [<800845e4>] handle_percpu_irq+0x88/0xb8
[   87.583507] [<8007e2e8>] generic_handle_irq+0x44/0x5c
[   87.589550] [<805cbbb4>] do_IRQ+0x1c/0x2c
[   87.594342] [<80313afc>] plat_irq_dispatch+0x68/0xf0
[   87.600273] [<800022c8>] except_vec_vi_end+0xb8/0xc4
[   87.606209] [<803cbe14>] rtl839x_read_phy+0xb4/0x110
[   87.612149] [<803d8884>] rtl839x_mdio_read+0x3c/0x58
[   87.618083] [<803ad790>] __mdiobus_read+0x44/0x134
[   87.623803] [<803ad960>] mdiobus_read+0x40/0x6c
[   87.629210] [<803ab048>] get_phy_device+0x80/0x158
[   87.634930] [<803ad01c>] mdiobus_scan+0x44/0x1d8
[   87.640439] [<803adca8>] __mdiobus_register+0x1d0/0x360
[   87.646687] [<807ac5a0>] rtl83xx_mdio_probe+0x13c/0x3e0
[   87.652927] [<807acbe4>] rtl83xx_sw_probe+0x3a0/0x858
[   87.658961] [<80363550>] platform_drv_probe+0x40/0x94
[   87.664997] [<8036123c>] really_probe+0x108/0x4d8
[   87.670625] [<8035ee48>] bus_for_each_drv+0x70/0xb0
[   87.676451] [<80361810>] __device_attach+0xe4/0x15c
[   87.682279] [<8036014c>] bus_probe_device+0x9c/0xb8
[   87.688099] [<80360688>] deferred_probe_work_func+0x90/0xd0
[   87.694764] [<8004391c>] process_one_work+0x208/0x46c
[   87.700801] [<8004438c>] worker_thread+0x360/0x5dc
[   87.706520] [<80049ff4>] kthread+0x13c/0x144
[   87.711621] [<80001db8>] ret_from_kernel_thread+0x14/0x1c
[   87.718063]
[  150.431415] rcu: INFO: rcu_sched self-detected stall on CPU

(It loops endlessly)

No, thank you for all your good work :+1:.

1 Like

Heads up to everyone using master builds, the default network configuration has changed in master!

@bmork's patch to revert the config to standard OpenWrt behaviour got merged, so now the switch will default once again to address 192.168.1.1, accessible on all switch ports without a VLAN tag.

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=9e7149f729e9b7b18a2ad0e7ba9d939f678e3eac;hp=889043a155dac4e329d0698ef5f67d44b1865ab5

8 Likes

Fooken finally! I understand the possible need for VLAN-tagged defaults for more advanced users, but a lot just want the first install to be painless, plug and play (aside from the usual OpenWrt limitations like WiFi being disabled by default on devices that support it). It took me a solid 20 minutes every time I had to reset my switch just to get things up and running. Hell, in case of a switch I'd even go one step further and have it set up as DHCP client only, no static IPs. Pretty much no switch will be used as a gateway (except in very rare circumstances), default behaviour should mirror this.

I presume this defconf change should not affect already configured devices, right?

But then why shouldn't the same be done for e.g. access point devices with only one port? Even though the static address can be a bit annoying (depending on the network you start the device in), having the same defaults for all devices at least has be benefit of being clear and easier to document.

If you keep your settings on sysupgrade, this won't affect you, no.

2 Likes

Are there any devices supported by OpenWrt (sans the Unifi APs) that are truly "just AP" mode? Most of the devices supported are routers, so the default config works well, and through the WAN port, it's easy to access and reconfigure the target. So yeah, I think APs should also be in a DHCP-client-only mode, which is why I proposed a few months back to have "role specific" config packages in the repo, which would allow one to build a custom image (via ImageBuilder or ASU), and the default role of the device bundled (so e.g. AP-only devices would get an AP-only profile (no DHCP server, no firewall config, IP received via DHCP), routers would get the current profile, switches would have a similar config to AP-only, without wireless, et cetera).

Good to know, I was worried that the default config change would affect an already running system adversely.

Aside from the Unifi APs, I've ported the TP-Link EAP series, and before that the TP-Link CPEs were also supported. So there's plenty of non-router devices supported by OpenWrt, none of them get a special treatment. But let's stick to discussing the Realtek switches here :upside_down_face:

2 Likes

Hello - I'm new to this topic of OWRT on switches. I have a couple of older 1910-24 and one or two 1900-24. Are those devices available in master? I don't mind doing a bit of work to get those in to master if the chipset support is already there. Edit: Looks like 1900-24 is theoretically supported.

Questions:
How is LAG and LACP in OpenWRT? I have practical use of LAGs between some switches to achieve higher bandwidth and redundancy. Is this configurable via (Luci) GUI?

Is Allnet ALL-NAS200 SG8316 (theoretically) supported? I had to write to Zyxel and ask why we cannot find ZyXEL 1900-16 in Europe. It's the ONLY ZyXEL managed switch which fits the 10 inch racks. But they don't sell it in Europe. So this German Allnet is a great (and ONLY) substitute. The TOH shows ALL-SG8208M is in, but that's no guarantee.

Edit: Looks like SG8316 is theoretically supported.

If boot-up detects max_addr as 48 ports, probing up to 52 is possibly a problem, which propagates into the DSA. Try changing PHY_MAX_ADDR to 49 and see how that goes.

At the moment there is no support in OpenWRT master. But code is available in brainslayer's repository, see the various links above. There is no immediate plan to merge this into master as that code also uses SMP and that does currently not work well (or at all ) on all 4 SoC generations.

2 Likes

thanks @anon13997276.

Could you try my branch sfp_10g on the USW switch? I used what you had found out (great work!) and fixed some things in the switch driver.

Now I get all the SFP+ modules up with a 10GBit SFP+ module. I am not able to use 1GBit modules, also with the original firmware. Also a 10GBit DC cable does not work, which however works on the original firmware. There is also something funny about port 5, the SFP module cannot be read out. But The external GPIOs on the PCA9555a chips work nicely. I added an I2C driver and I2C muxer to the code.
Could you explain how you sniffed the JSON protocol of the communication with the STM microcontroller for the small touch-screen?

@svanheule with the right .dts this should also work on the XGS1250.

2 Likes

Yes. Disappeared for a bit, got a booster shot and local holidays. Will try that branch today, can also clean up the current state I had and share. As for the JSON protocol, mainly observed via strings on the OEM binary. Killing the binary and seizing the UART in the OEM firmware kind of works, but I think the best thing to do would be to make a small interceptor with a promicro32 or similar, that can can MITM the lines (I think it's the two with pull ups on the STM32F side).

Small note, updating KERNEL_PATCHVER is required in targets/linux/realtek Makefile, it was defaulting to 5.4 on this branch

1 Like

Using a copper (10GBase-T) SFP, I'm not seeing traffic passing. ethtool shows '500B' received on lan1 (and the ethtool properties look sane), which is better than I was getting. I can try a DAC or fiber later.

Possibly this:

[    5.681418] rtl83xx-switch switch@1b000000 lan1 (uninitialized): validation with support 0000000,00000000,00006440 failed: -22

I encountered similar issues on my patch, there were some hardcodes in dsa.c and friends IIRC causing validation to fail, but haven't looked at this branch.

This is an "issue" with the .dts, which wants a 10g fibre:
phy-mode = "10gbase-kr";
The copper SFP very likely has a PHY on board which would need to be accessed via the I2C bus connecting to the SFP module. Unfortunately the I2C hardware of the RTL9300 only speaks SMBus. We are not the first to hit that problem:
https://bootlin.com/blog/sfp-modules-on-a-board-running-linux/
I added SMBus support for the SFP module itself along the lines of these patches, but I did not add that for a PHY on such a module. In fact I even disabled I2C for any such PHY on an SFP module. My impression is that the Linux kernel is not able to do any auto-detection of SFP modules of a type different than the one given in the .dts. Please try the 10G Fibre module, that is what works for me.

I think this is one the issues the i2c demuxer tries to solve. You could have two pins, which can be muxed as GPIO or as SMBus master. Then, for these pins, you specify two I2C masters: a bitbanged master using the GPIO functionality to provide a fully functional I2C bus, and the SMBus master for hardware offloading when possible.

Of course, this also requires a proper pincontroller to be implemented, and those tend to be quite a bit of code :confused: