Support for RTL838x based managed switches

There are 2 types of solutions for this.
The quick and dirty, which works very well for me for all 839x based switches:

And then there would be the proper solution. While working on the 93xx SoCs I finally understood that the SoCs actually address transparently multiple MDIO busses. For the 839x they are automatically configured on reset, there does not seem to be any example in the SDK how to do this manually. But they can be configured freely, i.e. which virtual PHY address (0-64) maps to which bus/physical PHY address on that bus, I am pretty sure. You can find an example how this is done on the 930x here:

With the configuration of the SMI/MDIO bus address e.g. here:

Again, this is merely an intermediate solution which while allowing to configure things freely, is not really proper.

The proper solution would be to expose the multiple busses to the .dtsi, configure the phys with their respective physical address on the physical bus in the .dts and then write code for the driver that converts the physical bus/ phy address to the virtual phy address used through the SoC registers.

2 Likes

@anon13997276 Has there been any progress on the 93xx family? I might be looking at an extra switch and the XGS1250-12 e.g. looks tempting.

I had a closer look at the MDIO / SMI bus mapping configuration code again. The relevant code is in sdk/src/hal/mac/drv/drv_rtlXXXX.c:smiAddr_init
While on all other architectures (including the 838x!) there is an actual mapping done, this is not the case for the 839x, everything seems to be automagical. I am very sure that the PHYs do not sit on a single SMI bus, though and have PHY-addresses >=32. That would be completely incompatible when mixing with non-RTL PHYs and the RTL PHYs would be useless for other vendors. Very likely there are at least 2 PHY busses and the RTL839x SoCs have a fixed mapping for them. I even think that the mapping is actually different for 8391, 8392, 8393 and 8396, why else would there be so many different SoCs, which do not seem to differ in features? Maybe you can check whether there are traces between the PHYs on your board that chain them on 2 busses? I was never able to figure that out. Anyway, I suggest to use the dirty solution for OWRT, but I am pretty sure that will never be able to go upstream.

1 Like

There has been considerable progress on the rtl9300. Offloading of both routing and traffic filtering works, making this spectacularly fast (multi-gbit wirespeed). I could get the 3 Aquantia PHYs working up to 5GBit on the XGS1250. The 2 2.5 GBit ports on the XGS1210 work flawlessly. What does not (yet) work is the 10GBit SFP+ ports on both models and the 10GBit mode on the 3 multi-gbit ports on the XGS1250. The reason is that the 10GBit mode needs a calibration based on the actual cable or fibre used. In the SDK there are even different sets of initial calibrations for direct attach cables of the SFP+ port depending on the cable length (.5m, 1m, 2m, 5m). Code for this is in the SDK but it is complicated and I do not understand it due to my lack of technical knowledge of eye-diagrams and timings for such ethernet speeds. Also not working yet is the fan on the XGS1250, which seems to be simply a PWM on a GPIO, but I did not really try, I simply unplugged it. I would suggest to bye the device, unless you really need a 10GBit fibre port.

4 Likes

Thanks a bunch! Goes on the list then :slight_smile:

I finally had the time to create a PR with the latest features: packet filtering offload and L3 routing offload as well as 10G support. Please test:

I also want to draw your attention to some more exiting work by brainslayer together with @blogic building on this:

He has started with RTL931x support and Link Aggregation finally works!

6 Likes

Hi kobi,
I was able to get a serial connection to the ZyXEL GS1900-48 by manually connecting TXD,RXD and GND to a male DB9 RS232 port.

White is the switches TXD, connected to a male DB-9, pin 2 (RXD).
Black is the switches RXD, connected to a male DB-9, pin 3 (TXD).
Purple is GND, connected to GND.
Baudrate is 115200, otherwise standard settings for screen or minicom.
Autoboot is set to 1 second. Pressing space multiple times before the autoboot prompt works for me.

I'm currently compiling your master branch. I'll probably test it tomorrow.

Edwin

3 Likes

Hi,
so I've tried booting the kernel-initramfs via tftpboot. I also tried flashing it via the OEM webinterface, for which I had to patch the image Makefile (same as Default/gs1900, using UIMAGE_MAGIC and ZYXEL_VERS and a customized KERNEL_INITRAMFS, but I'm not sure whether both were necessary).
Unfortunately, the kernel hangs after random: fast init done and then comes back with random: crng init done only to freeze completely. There's no reaction to keypresses and network also does not seem to come up. The behaviour and (kernel) log is the same with both methods.

Boot log
II: Copied Preloader data from 0x9fc00000(15804B) to 0x9f000000.
II: Cleared Preloader BSS section at 0x9f003dbc(0B).
II: PLL...�II: PLL is set by SW... OK
Setting DTR
II: DRAM is set by software calibration... PASSED

DCDR(0xb8001060):0x80000000
DIDER(0xb8001050):0x80800000
MCR (0xb8001000):0x200421e0, 0x21220000, 0x65533b30, 0x05050313
DTR2(0xb8001010):0x08311000
PHY Registers(0xb8001500):
0xb8001500:0x80060730, 0x0000007f, 0xa1a00000, 0xffffffff
0xb8001510:0x00180c00, 0x00180c00, 0x001a0d00, 0x00160b00
0xb8001520:0x001a0d00, 0x00160b00, 0x001a0d00, 0x00160b00
0xb8001530:0x00180c00, 0x001a0d00, 0x00160b00, 0x00180c00
0xb8001540:0x00180c00, 0x00180c00, 0x00160b00, 0x00180c00
0xb8001550:0x00180c00, 0x00180c00, 0x001a0d00, 0x00160b00
0xb8001560:0x00180c00, 0x00160b00, 0x001a0d00, 0x00160b00
0xb8001570:0x00180c00, 0x00180c00, 0x00160b00, 0x00180c00
0xb8001580:0x00180c00, 0x00180c00, 0x00160b00, 0x00180c00
0xb8001590:0x00000000, 0x81810505, 0x02000820, 0x50505858
0xb80015a0:0x5a5a4a4a, 0x00000000, 0x00000000, 0x00000000
II: Selected DRAM model #0.
II: Copying U-Boot from 0x9fc03dbc(225728B) to 0x83f00000... OK
II: NOR SPI Flash... searching flash parameters... supported flash ID: [c22018][c22018][c22018]... detected flash ID: [c22018]... OK


U-Boot 1.0.2-svn45936 (Jan 15 2014 - 16:30:16)

Board: RTL839x CPU:750MHz LXB:200MHz MEM:400MHz
DRAM:  128 MB
SPI-F: 1x16 MB
Loading 1024B env. variables from offset 0x40000
Switch Model: ZyXEL_GS1900_48 (Port Count: 50)
Switch Chip: RTL8393M
Model Info: 83936802
### RTL8218B config - MAC ID = 0 ###
### RTL8218B config - MAC ID = 8 ###
### RTL8218B config - MAC ID = 16 ###
### RTL8218B config - MAC ID = 24 ###
### RTL8218B config - MAC ID = 32 ###
### RTL8218B config - MAC ID = 40 ###
PHY[0]: disable EEE
PHY[1]: disable EEE
PHY[2]: disable EEE
PHY[3]: disable EEE
PHY[4]: disable EEE
PHY[5]: disable EEE
PHY[6]: not supported in EEE
Net:   Net Initialization Skipped
rtl8390#0
Hit any key to stop autoboot:  1  0 
RTL839x#     setenv bootargs console=ttyS0,115200 console=ttyS1,115200 mem=128M;
RTL839x# setenv ipaddr 192.168.2.16;
RTL839x# setenv serverip 192.168.2.8;
RTL839x# rtk network on;
Enable network
Please wait for PHY init-time ...

RTL839x# tftpboot 0x84f00000 zyxel/kinit.bin
Using rtl8390#0 device
TFTP from server 192.168.2.8; our IP address is 192.168.2.16
Filename 'zyxel/kinit.bin'.
Load address: 0x84f00000
Loading: *#################################################################
	 ####################################T #############################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 ########################
done
Bytes transferred = 6066589 (5c919d hex)
RTL839x# bootm
## Booting kernel from Legacy Image at 84f00000 ...
   Image Name:   MIPS OpenWrt Linux-5.4.143
   Created:      2021-09-04   6:39:45 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    6066525 Bytes = 5.8 MB
   Load Address: 80000000
   Entry Point:  80000400
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Linux version 5.4.143 (edwin@medusa) (gcc version 10.3.0 (OpenWrt GCC 10.3.0 r17476-27a99e40f7)) #0 Sat Sep 4 06:39:45 2021
[    0.000000] RTL838X model is ffffffff
[    0.000000] RTL839X model is 83936802
[    0.000000] SoC Type: RTL8393
[    0.000000] Kernel command line: console=ttyS0,115200 console=ttyS1,115200 mem=128M 
[    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=00000003
[    0.000000] Readback ErrCtl register=00000003
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 114804K/131072K available (5078K kernel code, 166K rwdata, 1104K rodata, 8364K init, 199K bss, 16268K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 32
[    0.000000] random: get_random_bytes called from start_kernel+0x288/0x468 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.009211] Calibrating delay loop... 464.48 BogoMIPS (lpj=2322432)
[    0.076465] pid_max: default: 32768 minimum: 301
[    0.082095] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.090673] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.106989] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.118580] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.126674] pinctrl core: initialized pinctrl subsystem
[    0.133380] NET: Registered protocol family 16
[    0.170149] workqueue: max_active 576 requested for napi_workq is out of range, clamping between 1 and 512
[    0.185194] clocksource: Switched to clocksource MIPS
[    0.192286] NET: Registered protocol family 2
[    0.197506] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.206639] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.216516] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.225506] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.233804] TCP: Hash tables configured (established 1024 bind 1024)
[    0.241475] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.249175] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.257682] NET: Registered protocol family 1
[    0.420351] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.435447] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.442246] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.475165] pinctrl-single bb001000.pinmux: 32 pins, size 4
[    0.482067] Probing RTL8231 GPIOs
[    0.485943] rtl8231_init called, MDIO bus ID: 3
[    0.496427] Probing RTL838X GPIOs
[    0.537144] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.545652] printk: console [ttyS0] disabled
[    0.550646] b8002000.uart: ttyS0 at MMIO 0xb8002000 (irq = 31, base_baud = 12500000) is a 16550A
[    0.561052] printk: console [ttyS0] enabled
[    0.561052] printk: console [ttyS0] enabled
[    0.570963] printk: bootconsole [early0] disabled
[    0.570963] printk: bootconsole [early0] disabled
[    0.582960] b8002100.uart: ttyS1 at MMIO 0xb8002100 (irq = 30, base_baud = 12500000) is a 16550A
[    0.734079] brd: module loaded
[    0.738160] Initializing rtl838x_nor_driver
[    0.743170] SPI resource base is b8001200
[    0.747997] Address mode is 3 bytes
[    0.752145] rtl838x_nor_init called
[    0.761297] rtl838x-nor b8001200.spi: mx25l12805d (16384 Kbytes)
[    0.768575] 7 fixed-partitions partitions found on MTD device rtl838x_nor
[    0.776709] Creating 7 MTD partitions on "rtl838x_nor":
[    0.782954] 0x000000000000-0x000000040000 : "u-boot"
[    0.789976] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.797421] 0x000000050000-0x000000060000 : "u-boot-env2"
[    0.804863] 0x000000060000-0x000000160000 : "jffs"
[    0.811678] 0x000000160000-0x000000260000 : "jffs2"
[    0.818575] 0x000000260000-0x000000930000 : "runtime"
[    0.836137] 0x000000930000-0x000001000000 : "runtime2"
[    0.844088] libphy: Fixed MDIO Bus: probed
[    0.851118] Probing RTL838X eth device pdev: 87c9aa00, dev: 87c9aa10
[    0.861028] Found SoC ID: 8393: RTL8393, family 8390
[    0.867023] Using MAC 0000588bf3fe05d5
[    0.871669] libphy: rtl839x-eth-mdio: probed
[    1.558020] rtl8393_serdes_probe: id: 48
[    1.562712] Realtek RTL8393 SERDES mdio-bus:30: Detected internal RTL8390 SERDES
[    1.584358] rtl8393_serdes_probe: id: 49
[    1.589099] Realtek RTL8393 SERDES mdio-bus:31: Detected internal RTL8390 SERDES
[    1.600417] NET: Registered protocol family 10
[    1.610836] Segment Routing with IPv6
[    1.615381] NET: Registered protocol family 17
[    1.620996] 8021q: 802.1Q VLAN Support v1.8
[    1.626858] i2c-gpio i2c-gpio-0: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.637024] i2c-gpio i2c-gpio-0: using lines 184 (SDA) and 185 (SCL)
[    1.644893] i2c-gpio i2c-gpio-1: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.655066] i2c-gpio i2c-gpio-1: using lines 190 (SDA) and 191 (SCL)
[    1.662956] libphy: SFP I2C Bus: probed
[    1.667943] sfp sfp-p9: Host maximum power 1.0W
[    1.673762] libphy: SFP I2C Bus: probed
[    1.678773] sfp sfp-p10: Host maximum power 1.0W
[    2.595182] random: fast init done
[  133.795239] random: crng init done

Have a look at https://github.com/openwrt/openwrt/pull/4535 and https://gitlab.com/bkoblitz/openwrt-rtl838x/-/tree/rtl839x (I'd suggest trying to import the device specifics into the new PR#4535.

1 Like

Yes, indeed that PR#4535 was actually continuously tested with the Zyxel GS-1900-48 as my RTL839x test device. Just clone my repository, checkout branch merge_pie (which corresponds to the PR), and then add the device-specific .dts, which you can find here:

and the image makefile I use is here:

The device support is not in the PR because I do not have a way of installing the image without opening the device. There is also a fan, which I did not investigate how to control. So I unplugged it because for my tests with maybe 3 Ethernet ports and an SFP port used, a fan is very likely not necessary (and would probably have considerably driven up the number of bugs due to its annoying sound).

Here is a boot-log:

3 Likes

@anon13997276 I checked out merge_pie and then checked out the image Makefile and the dts dir from the xgs1250 branch. Boot still hangs at the same step:

Boot log
II: Copied Preloader data from 0x9fc00000(15804B) to 0x9f000000.
II: Cleared Preloader BSS section at 0x9f003dbc(0B).
II: PLL...�II: PLL is set by SW... OK
Setting DTR
II: DRAM is set by software calibration... PASSED

DCDR(0xb8001060):0x80000000
DIDER(0xb8001050):0x80800000
MCR (0xb8001000):0x200421e0, 0x21220000, 0x65533b30, 0x05050313
DTR2(0xb8001010):0x08311000
PHY Registers(0xb8001500):
0xb8001500:0x80060730, 0x0000007f, 0xa1a00000, 0xffffffff
0xb8001510:0x00180c00, 0x00180c00, 0x001a0d00, 0x00180c00
0xb8001520:0x001a0d00, 0x00160b00, 0x001a0d00, 0x00160b00
0xb8001530:0x00180c00, 0x001a0d00, 0x00160b00, 0x00180c00
0xb8001540:0x00180c00, 0x00180c00, 0x00160b00, 0x00180c00
0xb8001550:0x00180c00, 0x00180c00, 0x001a0d00, 0x00160b00
0xb8001560:0x00180c00, 0x00160b00, 0x001a0d00, 0x00160b00
0xb8001570:0x00180c00, 0x00180c00, 0x00160b00, 0x00180c00
0xb8001580:0x00180c00, 0x00180c00, 0x00160b00, 0x00180c00
0xb8001590:0x00000000, 0x89810525, 0x20202020, 0x5050505a
0xb80015a0:0x5a5a4a4a, 0x00000000, 0x00000000, 0x00000000
II: Selected DRAM model #0.
II: Copying U-Boot from 0x9fc03dbc(225728B) to 0x83f00000... OK
II: NOR SPI Flash... searching flash parameters... supported flash ID: [c22018][c22018][c22018]... detected flash ID: [c22018]... OK


U-Boot 1.0.2-svn45936 (Jan 15 2014 - 16:30:16)

Board: RTL839x CPU:750MHz LXB:200MHz MEM:400MHz
DRAM:  128 MB
SPI-F: 1x16 MB
Loading 1024B env. variables from offset 0x40000
Switch Model: ZyXEL_GS1900_48 (Port Count: 50)
Switch Chip: RTL8393M
Model Info: 83936802
### RTL8218B config - MAC ID = 0 ###
### RTL8218B config - MAC ID = 8 ###
### RTL8218B config - MAC ID = 16 ###
### RTL8218B config - MAC ID = 24 ###
### RTL8218B config - MAC ID = 32 ###
### RTL8218B config - MAC ID = 40 ###
PHY[0]: disable EEE
PHY[1]: disable EEE
PHY[2]: disable EEE
PHY[3]: disable EEE
PHY[4]: disable EEE
PHY[5]: disable EEE
PHY[6]: not supported in EEE
Net:   Net Initialization Skipped
rtl8390#0
Hit any key to stop autoboot:  1  0 
RTL839x#         setenv bootargs console=ttyS0,115200 mem=128M;
RTL839x# setenv ipaddr 192.168.2.16;
RTL839x# setenv serverip 192.168.2.8;
RTL839x# rtk network on;
Enable network
Please wait for PHY init-time ...

RTL839x# tftpboot 0x84f00000 zyxel/kinit.bin;
Using rtl8390#0 device
TFTP from server 192.168.2.8; our IP address is 192.168.2.16
Filename 'zyxel/kinit.bin'.
Load address: 0x84f00000
Loading: *#################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 ######################
done
Bytes transferred = 6043794 (5c3892 hex)
RTL839x# bootm
## Booting kernel from Legacy Image at 84f00000 ...
   Image Name:   MIPS OpenWrt Linux-5.4.143
   Created:      2021-09-11   8:16:17 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    6043730 Bytes = 5.8 MB
   Load Address: 80000000
   Entry Point:  80000400
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Linux version 5.4.143 (edwin@medusa) (gcc version 10.3.0 (OpenWrt GCC 10.3.0 r17476-27a99e40f7)) #0 Sat Sep 11 08:16:17 2021
[    0.000000] RTL838X model is ffffffff
[    0.000000] RTL839X model is 83936802
[    0.000000] SoC Type: RTL8393
[    0.000000] Kernel command line: console=ttyS0,115200 mem=128M 
[    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=000297f0
[    0.000000] Readback ErrCtl register=000297f0
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 114868K/131072K available (5122K kernel code, 169K rwdata, 1116K rodata, 8240K init, 199K bss, 16204K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 32
[    0.000000] random: get_random_bytes called from start_kernel+0x288/0x468 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.009211] Calibrating delay loop... 464.48 BogoMIPS (lpj=2322432)
[    0.076462] pid_max: default: 32768 minimum: 301
[    0.082092] 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.106681] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.118269] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.126369] pinctrl core: initialized pinctrl subsystem
[    0.133084] NET: Registered protocol family 16
[    0.169923] workqueue: max_active 576 requested for napi_workq is out of range, clamping between 1 and 512
[    0.184951] clocksource: Switched to clocksource MIPS
[    0.192078] NET: Registered protocol family 2
[    0.197302] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.206432] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.216309] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.225302] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.233598] TCP: Hash tables configured (established 1024 bind 1024)
[    0.241266] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.248968] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.257471] NET: Registered protocol family 1
[    0.419211] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.434198] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.441062] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.473534] pinctrl-single bb001000.pinmux: 32 pins, size 4
[    0.480440] Probing RTL8231 GPIOs
[    0.484265] rtl8231_init called, MDIO bus ID: 3
[    0.491168] Probing RTL838X GPIOs
[    0.534614] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.543161] printk: console [ttyS0] disabled
[    0.548224] b8002000.uart: ttyS0 at MMIO 0xb8002000 (irq = 31, base_baud = 12500000) is a 16550A
[    0.558561] printk: console [ttyS0] enabled
[    0.558561] printk: console [ttyS0] enabled
[    0.568497] printk: bootconsole [early0] disabled
[    0.568497] printk: bootconsole [early0] disabled
[    0.580493] b8002100.uart: ttyS1 at MMIO 0xb8002100 (irq = 30, base_baud = 12500000) is a 16550A
[    0.730716] brd: module loaded
[    0.734724] Initializing rtl838x_nor_driver
[    0.739803] SPI resource base is b8001200
[    0.744581] Address mode is 3 bytes
[    0.748763] rtl838x_nor_init called
[    0.757896] rtl838x-nor b8001200.spi: mx25l12805d (16384 Kbytes)
[    0.765157] 7 fixed-partitions partitions found on MTD device rtl838x_nor
[    0.773261] Creating 7 MTD partitions on "rtl838x_nor":
[    0.779535] 0x000000000000-0x000000040000 : "u-boot"
[    0.786542] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.793941] 0x000000050000-0x000000060000 : "u-boot-env2"
[    0.801475] 0x000000060000-0x000000160000 : "jffs"
[    0.808269] 0x000000160000-0x000000260000 : "jffs2"
[    0.815193] 0x000000260000-0x000000930000 : "runtime"
[    0.832549] 0x000000930000-0x000001000000 : "runtime2"
[    0.840938] libphy: Fixed MDIO Bus: probed
[    0.848178] Probing RTL838X eth device pdev: 87c9aa00, dev: 87c9aa10
[    0.872290] Found SoC ID: 8393: RTL8393, family 8390
[    0.878270] Using MAC 0000588bf3fe05d5
[    0.883141] libphy: rtl839x-eth-mdio: probed
[    1.572281] rtl8393_serdes_probe: id: 48
[    1.577038] Realtek RTL8393 SERDES mdio-bus:30: Detected internal RTL8390 SERDES
[    1.598602] rtl8393_serdes_probe: id: 49
[    1.603297] Realtek RTL8393 SERDES mdio-bus:31: Detected internal RTL8390 SERDES
[    1.614613] NET: Registered protocol family 10
[    1.624917] Segment Routing with IPv6
[    1.629454] NET: Registered protocol family 17
[    1.635166] 8021q: 802.1Q VLAN Support v1.8
[    1.641034] i2c-gpio i2c-gpio-0: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.651210] i2c-gpio i2c-gpio-0: using lines 184 (SDA) and 185 (SCL)
[    1.659134] i2c-gpio i2c-gpio-1: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.669300] i2c-gpio i2c-gpio-1: using lines 190 (SDA) and 191 (SCL)
[    1.677215] libphy: SFP I2C Bus: probed
[    1.682135] sfp sfp-p9: Host maximum power 1.0W
[    1.688006] libphy: SFP I2C Bus: probed
[    1.692955] sfp sfp-p10: Host maximum power 1.0W
[    2.594937] random: fast init done
[  133.794996] random: crng init done

I noticed in the boot log you posted that your GS1900-48 runs a different u-boot version (2.0.0.59413 (Jul 08 2015 - 10:01:28)) than mine (U-Boot 1.0.2-svn45936 (Jan 15 2014 - 16:30:16)). Also, your kernel prints
[ 0.000000] RTL839X model is 83936806,
while mine prints
[ 0.000000] RTL839X model is 83936802.

Looking at the Zyxel web-page there seems to be only one model of the GS1900-48, with only one firmware download. So the difference is not in something that is configured at compile-time such as GPIOs, but in something that is auto-detected and for this the CPU-model is a good candidate. I'll go through their source code to look at whether this might cause differences. Looks like

is a bit simplistic :wink:

So, I figured out that the revision of the RTL8393 chips is given by the last digit of the model number divided by 2.
This gives in your case revision "B" (A is 0) and in mine "D" (because I have version 3).
Unfortunately, it looks as if there is a bigger difference in the features of Chip models < Revision C, one seems to be related to the 10GPort, the other to the PMASK table (it seems broken in revisions < C).

Could you try the following:
In target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/rtl839x.c edit function
rtl839x_write_mcast_pmask
to do nothing by commenting everything in {} out with /* */
and in function rtl839x_write_read_pmask
return 0x001fffffffffffff and comment everything else out?

If this does not work, you would need to help me figure out where it hangs by putting pr_info() into the code until you find the place it hangs.

May be the same issue as Switch-M48eG PN28480K.

bootlog


U-Boot 2011.12.46351-1.00.09-svn5722 (Mar 12 2015 - 20:08:54)

Board: RTL839x CPU:700MHz LXB:200MHz MEM:400MHz
DRAM:  128 MB
SPI-F: 1x32 MB
Loading 65536B env. variables from offset 0x80000
#### Periphery Devices Init Successfully #### 
Switch Model: RTL8393M_8218B_8218FB_2SFP (Port Count: 48)
Switch Chip: RTL8393M
Model Info: 83936802
### RTL8218B config - MAC ID = 0 ###
### RTL8218B config - MAC ID = 8 ###
### RTL8218B config - MAC ID = 16 ###
### RTL8218B config - MAC ID = 24 ###
### RTL8218B config - MAC ID = 32 ###
### RTL8218FB config - MAC ID = 40 ###
PHY[0]: disable EEE
PHY[1]: disable EEE
PHY[2]: disable EEE
PHY[3]: disable EEE
PHY[4]: disable EEE
PHY[5]: disable EEE
RTL839x# # rtk network on
Enable network
Please wait for PHY init-time ...

RTL839x# # tftp 0x81000000
*** Warning: no boot file name; using '0101A8C0.img'
Using rtl8390#0 device
TFTP from server 192.168.1.111; our IP address is 192.168.1.1
Filename '0101A8C0.img'.
Load address: 0x81000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ############################################
done
Bytes transferred = 6362748 (61167c hex)
RTL839x# # bootm
## Booting kernel from Legacy Image at 81000000 ...
   Image Name:   MIPS OpenWrt Linux-5.4.143
   Created:      2021-09-12  13:37:17 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    6362684 Bytes = 6.1 MB
   Load Address: 80000000
   Entry Point:  80000400
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Linux version 5.4.143 (musashino205@TAIHA.NET) (gcc version 10.3.0 (OpenWrt GCC 10.3.0 r17396+47-98eb95dd00)) #0 Sun Sep 12 13:37:17 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 Panasonic Switch-M48eG PN28480K
[    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,9600
[    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=0001fd86
[    0.000000] Readback ErrCtl register=0001fd86
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 113520K/131072K available (5156K kernel code, 191K rwdata, 1168K rodata, 9476K init, 199K bss, 17552K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 32
[    0.000000] random: get_random_bytes called from start_kernel+0x288/0x468 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.102036] Calibrating delay loop... 464.48 BogoMIPS (lpj=2322432)
[    0.243325] pid_max: default: 32768 minimum: 301
[    0.304248] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.400321] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.510664] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.638977] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.728466] pinctrl core: initialized pinctrl subsystem
[    0.797699] NET: Registered protocol family 16
[    0.889654] workqueue: max_active 576 requested for napi_workq is out of range, clamping between 1 and 512
[    1.019532] clocksource: Switched to clocksource MIPS
[    1.086319] NET: Registered protocol family 2
[    1.142687] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    1.238227] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    1.347629] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    1.448405] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    1.541205] TCP: Hash tables configured (established 1024 bind 1024)
[    1.625003] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    1.710824] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    1.802783] NET: Registered protocol family 1
[    2.108820] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    2.200297] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.275960] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    2.434125] pinctrl-single bb000004.pinmux: 32 pins, size 4
[    2.506796] Probing RTL838X GPIOs
[    2.592639] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    2.676288] printk: console [ttyS0] disabled
[    2.731406] b8002000.uart: ttyS0 at MMIO 0xb8002000 (irq = 31, base_baud = 12500000) is a 16550A
[    2.847078] printk: console [ttyS0] enabled
[    2.847078] printk: console [ttyS0] enabled
[    2.957124] printk: bootconsole [early0] disabled
[    2.957124] printk: bootconsole [early0] disabled
[    3.081814] b8002100.uart: ttyS1 at MMIO 0xb8002100 (irq = 30, base_baud = 12500000) is a 16550A
[    3.351180] brd: module loaded
[    3.391738] Initializing rtl838x_nor_driver
[    3.446885] SPI resource base is b8001200
[    3.499680] Address mode is 4 bytes
[    3.545536] rtl838x_nor_init called
[    3.596596] rtl838x-nor b8001200.spi: mx25l25635e (32768 Kbytes)
[    3.675848] 8 fixed-partitions partitions found on MTD device rtl838x_nor
[    3.765294] Creating 8 MTD partitions on "rtl838x_nor":
[    3.834097] 0x000000000000-0x000000080000 : "u-boot"
[    3.900564] 0x000000080000-0x000000090000 : "u-boot-env"
[    3.971649] 0x000000090000-0x0000000a0000 : "u-boot-env2"
[    4.043847] 0x0000000a0000-0x000000100000 : "sysinfo"
[    4.111452] 0x000000100000-0x000000e00000 : "fs_reserved"
[    4.183652] 0x000000e00000-0x000001e00000 : "firmware"
[    4.268353] 0x000001e00000-0x000001f00000 : "vlog_data"
[    4.338306] 0x000001f00000-0x000002000000 : "elog_data"
[    4.409086] libphy: Fixed MDIO Bus: probed
[    4.465363] Probing RTL838X eth device pdev: 87ca4800, dev: 87ca4810
[    4.557479] Found SoC ID: 8393: RTL8393, family 8390
[    4.622894] Using MAC 0000005040101ab6
[    4.672330] libphy: rtl839x-eth-mdio: probed
[    5.482638] NET: Registered protocol family 10
[    5.546024] Segment Routing with IPv6
[    5.594322] NET: Registered protocol family 17
[    5.653138] 8021q: 802.1Q VLAN Support v1.8
[    5.708991] i2c-gpio i2c-gpio-0: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    5.819498] i2c-gpio i2c-gpio-0: using lines 23 (SDA) and 22 (SCL)
[    5.901178] i2c-gpio i2c-gpio-1: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    6.011613] pca953x 1-0020: using no AI
[    6.063773] pca953x 1-0075: using no AI
[    6.115478] GPIO line 492 (ext-switch-reset) hogged as output/high
[    6.197274] GPIO line 494 (portled-sregister-reset) hogged as output/high
[    6.287329] i2c-gpio i2c-gpio-1: using lines 9 (SDA) and 8 (SCL)
[    6.929560] random: fast init done
[  138.159580] random: crng init done

You meant rtl839x_read_mcast_pmask, right?
I compiled with the modifications. It's still the same.

Boot log
II: Copied Preloader data from 0x9fc00000(15804B) to 0x9f000000.
II: Cleared Preloader BSS section at 0x9f003dbc(0B).
II: PLL...�II: PLL is set by SW... OK
Setting DTR
II: DRAM is set by software calibration... PASSED

DCDR(0xb8001060):0x80000000
DIDER(0xb8001050):0x80800000
MCR (0xb8001000):0x200421e0, 0x21220000, 0x65533b30, 0x05050313
DTR2(0xb8001010):0x08311000
PHY Registers(0xb8001500):
0xb8001500:0x80060730, 0x0000007f, 0xa1a00000, 0xffffffff
0xb8001510:0x001a0d00, 0x001a0d00, 0x001a0d00, 0x00180c00
0xb8001520:0x001c0e00, 0x00180c00, 0x001c0e00, 0x00180c00
0xb8001530:0x00180c00, 0x001a0d00, 0x00180c00, 0x001a0d00
0xb8001540:0x001a0d00, 0x001a0d00, 0x00180c00, 0x001a0d00
0xb8001550:0x00180c00, 0x00180c00, 0x001a0d00, 0x00160b00
0xb8001560:0x00180c00, 0x00160b00, 0x001a0d00, 0x00160b00
0xb8001570:0x00180c00, 0x00180c00, 0x00160b00, 0x00180c00
0xb8001580:0x00160b00, 0x00180c00, 0x00160b00, 0x00180c00
0xb8001590:0x00000000, 0x09498696, 0xa0a01850, 0x5050acad
0xb80015a0:0x5252a5a5, 0x00000000, 0x00000000, 0x00000000
II: Selected DRAM model #0.
II: Copying U-Boot from 0x9fc03dbc(225728B) to 0x83f00000... OK
II: NOR SPI Flash... searching flash parameters... supported flash ID: [c22018][c22018][c22018]... detected flash ID: [c22018]... OK


U-Boot 1.0.2-svn45936 (Jan 15 2014 - 16:30:16)

Board: RTL839x CPU:750MHz LXB:200MHz MEM:400MHz
DRAM:  128 MB
SPI-F: 1x16 MB
Loading 1024B env. variables from offset 0x40000
Switch Model: ZyXEL_GS1900_48 (Port Count: 50)
Switch Chip: RTL8393M
Model Info: 83936802
### RTL8218B config - MAC ID = 0 ###
### RTL8218B config - MAC ID = 8 ###
### RTL8218B config - MAC ID = 16 ###
### RTL8218B config - MAC ID = 24 ###
### RTL8218B config - MAC ID = 32 ###
### RTL8218B config - MAC ID = 40 ###
PHY[0]: disable EEE
PHY[1]: disable EEE
PHY[2]: disable EEE
PHY[3]: disable EEE
PHY[4]: disable EEE
PHY[5]: disable EEE
PHY[6]: not supported in EEE
Net:   Net Initialization Skipped
rtl8390#0
Hit any key to stop autoboot:  1  0 
RTL839x#       setenv bootargs console=ttyS0,115200 mem=128M;
RTL839x# setenv ipaddr 192.168.2.16;
RTL839x# setenv serverip 192.168.2.8;
RTL839x# rtk network on;
Enable network
Please wait for PHY init-time ...

RTL839x# tftpboot 0x84f00000 zyxel/kinit.bin;
Using rtl8390#0 device
TFTP from server 192.168.2.8; our IP address is 192.168.2.16
Filename 'zyxel/kinit.bin'.
Load address: 0x84f00000
Loading: *#################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 ######################
done
Bytes transferred = 6043077 (5c35c5 hex)
RTL839x# bootm
## Booting kernel from Legacy Image at 84f00000 ...
   Image Name:   MIPS OpenWrt Linux-5.4.143
   Created:      2021-09-11   8:16:17 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    6043013 Bytes = 5.8 MB
   Load Address: 80000000
   Entry Point:  80000400
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Linux version 5.4.143 (edwin@medusa) (gcc version 10.3.0 (OpenWrt GCC 10.3.0 r17476-27a99e40f7)) #0 Sat Sep 11 08:16:17 2021
[    0.000000] RTL838X model is ffffffff
[    0.000000] RTL839X model is 83936802
[    0.000000] SoC Type: RTL8393
[    0.000000] Kernel command line: console=ttyS0,115200 mem=128M 
[    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=00000004
[    0.000000] Readback ErrCtl register=00000004
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 114868K/131072K available (5122K kernel code, 169K rwdata, 1116K rodata, 8240K init, 199K bss, 16204K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 32
[    0.000000] random: get_random_bytes called from start_kernel+0x288/0x468 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.000007] sched_clock: 32 bits at 350MHz, resolution 2ns, wraps every 6135667710ns
[    0.009211] Calibrating delay loop... 464.48 BogoMIPS (lpj=2322432)
[    0.076464] pid_max: default: 32768 minimum: 301
[    0.082090] 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.107340] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.118924] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.127023] pinctrl core: initialized pinctrl subsystem
[    0.133736] NET: Registered protocol family 16
[    0.170738] workqueue: max_active 576 requested for napi_workq is out of range, clamping between 1 and 512
[    0.185800] clocksource: Switched to clocksource MIPS
[    0.192943] NET: Registered protocol family 2
[    0.198175] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.207306] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.217178] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.226170] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.234468] TCP: Hash tables configured (established 1024 bind 1024)
[    0.242136] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.249837] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.258344] NET: Registered protocol family 1
[    0.422096] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.437146] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.443947] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.477215] pinctrl-single bb001000.pinmux: 32 pins, size 4
[    0.484047] Probing RTL8231 GPIOs
[    0.487928] rtl8231_init called, MDIO bus ID: 3
[    0.494733] Probing RTL838X GPIOs
[    0.540625] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.549183] printk: console [ttyS0] disabled
[    0.554177] b8002000.uart: ttyS0 at MMIO 0xb8002000 (irq = 31, base_baud = 12500000) is a 16550A
[    0.564589] printk: console [ttyS0] enabled
[    0.564589] printk: console [ttyS0] enabled
[    0.574495] printk: bootconsole [early0] disabled
[    0.574495] printk: bootconsole [early0] disabled
[    0.586527] b8002100.uart: ttyS1 at MMIO 0xb8002100 (irq = 30, base_baud = 12500000) is a 16550A
[    0.738409] brd: module loaded
[    0.742423] Initializing rtl838x_nor_driver
[    0.747496] SPI resource base is b8001200
[    0.752276] Address mode is 3 bytes
[    0.756468] rtl838x_nor_init called
[    0.765567] rtl838x-nor b8001200.spi: mx25l12805d (16384 Kbytes)
[    0.772842] 7 fixed-partitions partitions found on MTD device rtl838x_nor
[    0.780977] Creating 7 MTD partitions on "rtl838x_nor":
[    0.787243] 0x000000000000-0x000000040000 : "u-boot"
[    0.794232] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.801712] 0x000000050000-0x000000060000 : "u-boot-env2"
[    0.809260] 0x000000060000-0x000000160000 : "jffs"
[    0.816088] 0x000000160000-0x000000260000 : "jffs2"
[    0.822942] 0x000000260000-0x000000930000 : "runtime"
[    0.840451] 0x000000930000-0x000001000000 : "runtime2"
[    0.848874] libphy: Fixed MDIO Bus: probed
[    0.856117] Probing RTL838X eth device pdev: 87c9aa00, dev: 87c9aa10
[    0.880200] Found SoC ID: 8393: RTL8393, family 8390
[    0.886171] Using MAC 0000588bf3fe05d5
[    0.891046] libphy: rtl839x-eth-mdio: probed
[    1.580963] rtl8393_serdes_probe: id: 48
[    1.585658] Realtek RTL8393 SERDES mdio-bus:30: Detected internal RTL8390 SERDES
[    1.607282] rtl8393_serdes_probe: id: 49
[    1.611973] Realtek RTL8393 SERDES mdio-bus:31: Detected internal RTL8390 SERDES
[    1.623281] NET: Registered protocol family 10
[    1.633692] Segment Routing with IPv6
[    1.638235] NET: Registered protocol family 17
[    1.643845] 8021q: 802.1Q VLAN Support v1.8
[    1.649639] i2c-gpio i2c-gpio-0: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.659807] i2c-gpio i2c-gpio-0: using lines 184 (SDA) and 185 (SCL)
[    1.667733] i2c-gpio i2c-gpio-1: Slow GPIO pins might wreak havoc into I2C/SMBus bus timing
[    1.677896] i2c-gpio i2c-gpio-1: using lines 190 (SDA) and 191 (SCL)
[    1.685747] libphy: SFP I2C Bus: probed
[    1.690725] sfp sfp-p9: Host maximum power 1.0W
[    1.696588] libphy: SFP I2C Bus: probed
[    1.701538] sfp sfp-p10: Host maximum power 1.0W
[    2.605786] random: fast init done
[  133.805843] random: crng init done

Would you show me where I have to put it?

@anon13997276 @musashino's patch worked. Boot log

Going to do some testing now.

I couldn't flash the sysupgrade after tftpbooting the ramdisk:

Sun Sep 12 15:58:44 UTC 2021 upgrade: Sending signal TERM to ntpd (3551)
[   81.320966] rtl83xx_fib4_del: found a route with id 3, nh-id 0
[   81.327953] rtl83xx-switch switch@bb000000: unknown nexthop, id 0
Sun Sep 12 15:58:48 UTC 2021 upgrade: Sending KILL to remaining processes ...
[   91.439890] sh (3664): drop_caches: 3
Sun Sep 12 15:58:54 UTC 2021 upgrade: Switching to ramdisk...
Sun Sep 12 15:58:57 UTC 2021 upgrade: Performing system upgrade...
[   93.670147] sh (3664): drop_caches: 3
Could not open mtd device: firmware
Can't open device for writing!
cat: write error: Broken [   93.700976] reboot: Restarting system
p[   93.705374] System restart.

It looks like sysupgrade is not aware of the partition layout and firmware is just a generic placeholder:

root@OpenWrt:/# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "u-boot-env2"
mtd3: 00100000 00010000 "jffs"
mtd4: 00100000 00010000 "jffs2"
mtd5: 006d0000 00010000 "runtime"
mtd6: 006d0000 00010000 "runtime2"

So you mean that instead of 64 in this patch:

we should be using only 52? Did you try 56? Because that would be the maximum number that the RTL839x can support.
Maybe there is a different solution, because in principle this should not hang, just because there is nothing on that bus at a given PHY-id...

I think you need to just rename the partition "runtime" to "firmware" in rtl8393_zyxel_gs1900-48.dts .
Have a look how this is done in rtl8380_zyxel_gs1900.dtsi

To be honest, I have no idea about it...

No I didn't, I'll try :slight_smile: