Support for RTL838x based managed switches

I have one of these https://openwrt.org/toh/zyxel/gs1900-8hp_v1 and I accidentally flashed OpenWrt on the backup partition. After fiddling about I was able to always boot from the secondary partition and flash the full OpenWrt image. The problem now is that I only have 960 KB available storage. Which seems low considering the device has 16 MB flash. When doing SSH I get this message
Your JFFS2-partition seems full and overlayfs is mounted read-only. Please try to remove files from /overlay/upper/... and reboot!

Am i constrained by running from the backup partition? Can I flash OpenWrt on the main partition, and get more usable storage that way?

Flash 24.10 RC5 from the bootloader, you'll loose the backup partition but you will have plenty of space again.

The bootloader is easily accessible so I wouldn't worry about losing the backup partition.

Serial to USB cable? isn't there a simpler way, via the GUI/SSH? How about flashing stock firmware, then using that to flash OpenWrt on the main partition?

Hey not sure if you know or not. I have the SG2210P v5.26.

From what I can tell on TP-Link's website the v3 has a "Software update" that changes the HW version to v5.26.

That makes me wonder if the v5.26 by OpenWRT or not. I would be open to making support for this model if they aren't cross compatible.

From opening up the v5.26 this is the hardware
CPU: RTL8380M
RAM: ESMT M15T2G16128A, 256MB:
FLASH: Winbond 25Q256JVFQ, 32MB

Seems like all SKS8300-8X disappeared from AliExpress (there's a bunch of identical looking ones from other brands but who knows what's really inside) And amazon refuses to ship them to Switzerland, well I guess I'll wait and see :frowning:

Looks like it was replaced by the SKS8310-8X. The ads claims this:

Difference between SKS8300-8X and SKS8310-8X

Compared with the old SKS8300-8X, the new SKS8310-8X has a better heat dissipation effect, the internal air duct of SKS8310-8X has been optimized, the heat dissipation scale has been added, and the intelligent temperature control fan has a better and quieter heat dissipation effect, so its submission is also a little larger.

There's an obvious risk of differences in default boot loader config and/or image, so we can't say anything about OpenWrt support until someone has tried.

Yes and it sadly has a fan which I decidedly dislike for noise concerns...

FWIW, I suspect https://www.aliexpress.com/item/1005005777395543.html?spm=oneshop.home.fastdelivery.2.11fb7f6blJ4Y0t&skuId=12000034757401414&pdp_ext_f={"sku_id"%3A"12000034757401414"}&aecmd=true is the same OEM device as the SKS8300-8X (and https://blog.masa23.jp/en/posts/2024/09/19/ont-s508cl-8s/ agrees), so I am contemplating :slight_smile:

Link gives a 404.

Strange, it does load for me... Maybe AE is having issues today, I had odd behavior earlier. In any case, Model is Onti ONT-S508CL-8S

1 Like

Seems likely. Picture of the device info page in the web gui shows software version V300SP10231205. Similar to the most current XikeStore image version (V300SP10240912-C200117-U).

231205 and 240912 look like build dates.

1 Like

Hi, I'm trying to backport the upstreamed I2C driver for RTL930x SoCs.

Can anyone test the following changes on ZyXEL XGS1250-12?

2 Likes

What should one exactly test for? I've got this switch and will bisect another issue over the weekend, so i can give this a spin as well.

3 Likes

Thanks, please test the following points on XGS1250-12:

  • availability of the SFP+ port
    • detection
    • networking
    • reading eeprom of SFP modules (ethtool -m lan12)
3 Likes

SFP+ port and module insertion/removal is properly detected.

Insertion-Log:

[   88.176556] sfp sfp-p12: module FS               SFP-10G-PC05     rev A    sn C2411706410-2    dc 241125  
[   88.187403] rtl83xx-switch switch@1b000000 lan12: switched to inband/10gbase-r link mode
[   88.196478] rtl93xx_phylink_mac_config port 27, mode 2, phy-mode: 10gbase-r, speed -1, link 0
[   88.206018] rtl93xx_phylink_mac_config SDS is 9
[   88.211062] rtl9300_sds_rst 31
[   88.341310] rtl9300_phy_enable_10g_1g 1gbit phy: 00001140
[   88.348365] rtl9300_phy_enable_10g_1g 1gbit phy enabled: 00001140
[   88.356183] rtl9300_phy_enable_10g_1g 10gbit phy: 00002040
[   88.363280] rtl9300_phy_enable_10g_1g 10gbit phy after: 00002040
[   88.370986] rtl9300_phy_enable_10g_1g set medium: 00000002
[   88.378120] rtl9300_phy_enable_10g_1g set medium after: 00000002
[   88.404832] rtl9300_serdes_setup: Configuring RTL9300 SERDES 9
[   88.413327] rtl9300_serdes_mac_link_config: registers before 00000000 00001403
[   88.425411] rtl9300_serdes_mac_link_config: registers after 00000000 00001403
[   88.433352] rtl9300_force_sds_mode: SDS: 9, mode 28
[   88.438810] rtl9300_force_sds_mode --------------------- serdes 9 forcing to 1a ...
[   88.758863] rtl9300_force_sds_mode --------------------- serdes 9 forced to 1a DONE
[   88.772411] start_1.1.1 initial value for sds 9
[   88.834415] end_1.1.1 --
[   88.837272] start_1.1.2 Load DFE init. value
[   88.844020] end_1.1.2
[   88.846569] start_1.1.3 disable LEQ training,enable DFE clock
[   88.864981] end_1.1.3 --
[   88.867803] start_1.1.4 offset cali setting
[   88.874441] end_1.1.4
[   88.876990] start_1.1.5 LEQ and DFE setting
[   88.895653] end_1.1.5
[   88.907187] start_1.2.1 ForegroundOffsetCal_Manual
[   88.916545] end_1.2.1
[   88.927551] start_1.2.3 Foreground Calibration
[   88.946040] rtl9300_do_rx_calibration_2_3: fgcal_gray: 26, fgcal_binary 23
[   88.954724] rtl9300_do_rx_calibration_2_3: end_1.2.3
[   88.960253] start_1.4.1
[   89.183832] end_1.4.1
[   89.186581] start_1.4.2
[   89.199112] vth_set_bin = 1
[   89.201835] vth_set_bin = 1
[   89.205964] Vth Maunal = 0
[   89.324879] Tap0 Sign : +
[   89.327893] tap0_coef_bin = 16
[   89.331794] tap0 manual = 0
[   89.341205] end_1.4.2
[   89.344313] start_1.5.2
[   89.424751] end_1.5.2
[   89.448454] rtl9300_do_rx_calibration: SDS enabled
[   89.509264] start_1.4.1
[   89.732863] end_1.4.1
[   89.735618] start_1.4.2
[   89.748150] vth_set_bin = 1
[   89.750871] vth_set_bin = 1
[   89.754997] Vth Maunal = 0
[   89.873897] Tap0 Sign : +
[   89.876940] tap0_coef_bin = 17
[   89.880848] tap0 manual = 0
[   89.890247] end_1.4.2
[   89.893360] start_1.5.2
[   89.973773] end_1.5.2
[   90.106490] rtl83xx-switch switch@1b000000 lan12: Link is Up - 10Gbps/Full - flow control off
[   90.118629] switch: port 12(lan12) entered blocking state
[   90.124717] switch: port 12(lan12) entered forwarding state

Removal-Log:

[  205.861942] rtl83xx-switch switch@1b000000 lan12: Link is Down
[  205.868574] sfp sfp-p12: module removed
[  205.873501] switch: port 12(lan12) entered disabled state

Networking works as well, I was able to ping in both directions.

Reading EEPROMS works, but only in hex (dont know if thats really an issue):

root@OpenWrt:~# ethtool -m lan12
Offset          Values
------          ------
0x0000:         03 04 21 01 00 00 00 00 04 00 00 00 67 00 00 00 
0x0010:         00 00 05 00 46 53 20 20 20 20 20 20 20 20 20 20 
0x0020:         20 20 20 20 00 00 02 c9 53 46 50 2d 31 30 47 2d 
0x0030:         50 43 30 35 20 20 20 20 41 20 20 20 00 00 00 c1 
0x0040:         00 12 00 00 43 32 34 31 31 37 30 36 34 31 30 2d 
0x0050:         32 20 20 20 32 34 31 31 32 35 20 20 00 00 00 7d 
0x0060:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0070:         00 00 00 00 00 00 00 00 00 00 00 00 20 20 20 20 
0x0080:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x0090:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00a0:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00b0:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00c0:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00d0:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00e0:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x00f0:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Let me know if you need anything else tested.

3 Likes

Thank you for the testing, and that's great, the SFP+ port works as expected.
The default ethtool package supports only hexadecimal printing, but ethtool-full supports parsed values.

3 Likes

@svanheule b7af54d seems to have broken poe on Netgear GS310TP

I will test on my HPE 1920-8g-poe-65w once the kernel makes it's way to the image builder and owut
EDIT - HPE switches not included yet. Don't have one of the affected models.

I don't see a poe_disable GPIO line defined for this devices (series), so I would think that line is now left in the wrong state. I have an GS110TPP I can have a look at this evening, as it's likely to use the same GPIO.

2 Likes

On my GS110TPP, it's RTL8231 GPIO10 having changed from in (with pull-up) to out-low that makes the difference. If I set line 10 high, PoE works again.

First I had taken my multimeter to the board and found line 25 to lead to an opto-coupler into the PoE power domain. But toggling that one didn't help and the driver switch didn't cause a line value change there.

Edit:
FWIW, I figured it out by changing the unused GPIO lines to input one by one, since that was the behaviour of the old driver. If there are other devices with regressions due to the new RTL8231 driver, this can be an easy and safe way to debug those issues.

5 Likes

My Xikestor SKS8300-8X arrived, I tried with SNAPSHOT (r28695-22d1e6cd26) but I get a boot error. Any ideas @musashino ?

UPDATE - Appears that we need to load the vendor firmware at least one time before OpenWRT initramfs will load - guess it's expecting some config to be created or similar?

SKS8300-8X boots fine now, backing up firmware and loading sysupgrade currently.

SKS8300-8X first OpenWRT initramfs boot before booting vendor firmware log
RTL9300# tftpboot 0x82000000 openwrt-realtek-rtl930x-xikestor_sks8300-8x-initramfs-kernel.bin
Using rtl9300#0 device
TFTP from server 192.168.2.36; our IP address is 192.168.2.1
Filename 'openwrt-realtek-rtl930x-xikestor_sks8300-8x-initramfs-kernel.bin'. Size is 0x1129c00 Bytes = 17.2 MB
Load address: 0x82000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ################################################
done
Bytes transferred = 6426059 (620dcb hex)
RTL9300# bootm
Booting kernel with Legacy format image at 82000000
2772 bytes written, 0 bytes skipped
2772 bytes written, 0 bytes skipped
Start checking the Kernel Image CRC ............OK
Start uncompressing the Kernel Image ...........OK

Starting kernel ...

[    0.000000] Linux version 6.6.74 (builder@buildhost) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 13.3.0 r28695-22d1e6cd26) 13.3.0, GNU ld (GNU Binutils) 2.42) #0 Su5
[    0.000000] RTL838X model is 0
[    0.000000] RTL839X model is 0
[    0.000000] RTL93XX model is 93030001
[    0.000000] SoC Type: RTL9303
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019555 (MIPS 34Kc)
[    0.000000] MIPS: machine is XikeStor SKS8300-8X
[    0.000000] earlycon: ns16550a0 at MMIO 0x18002000 (options '9600n8')
[    0.000000] printk: bootconsole [ns16550a0] enabled
[    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-0x000000001fffffff]
[    0.000000]   HighMem  [mem 0x0000000020000000-0x000000002fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000]   node   0: [mem 0x0000000020000000-0x000000002fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000002fffffff]
[    0.000000] On node 0, zone HighMem: 65536 pages in unavailable ranges
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Kernel command line: earlycon
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Writing ErrCtl register=0004e5be
[    0.000000] Readback ErrCtl register=0004e5be
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129920
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 497884K/524288K available (6969K kernel code, 628K rwdata, 1608K rodata, 9732K init, 256K bss, 26404K reserved, 0K cma-reserved, 262144K highm)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] Failed to get CPU clock: -2
[    0.000000] CPU frequency from device tree: 800MHz
[    0.000000] clocksource: realtek_otto_timer: mask: 0xfffffff max_cycles: 0xfffffff, max_idle_ns: 38225208801 ns
[    0.000002] sched_clock: 28 bits at 3125kHz, resolution 320ns, wraps every 42949672800ns
[    0.106755] Calibrating delay loop... 531.66 BogoMIPS (lpj=2658304)
[    0.238998] pid_max: default: 32768 minimum: 301
[    0.309774] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.406066] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.517884] RCU Tasks Trace: Setting shift to 0 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=1.
[    0.645761] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.775252] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.867269] pinctrl core: initialized pinctrl subsystem
[    0.938785] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    1.017496] thermal_sys: Registered thermal governor 'step_wise'
[    1.034347] clocksource: Switched to clocksource realtek_otto_timer
[    1.207142] NET: Registered PF_INET protocol family
[    1.271675] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    1.368754] tcp_listen_portaddr_hash hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    1.479989] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    1.582019] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    1.682929] TCP bind hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    1.777001] TCP: Hash tables configured (established 2048 bind 2048)
[    1.861491] MPTCP token hash table entries: 512 (order: 0, 6144 bytes, linear)
[    1.956990] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    2.043050] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    2.135773] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    2.225767] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[    2.312413] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.389296] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    2.722178] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    2.821519] pinctrl-single 1b00c600.pinmux: 32 pins, size 4
[    2.895466] pinctrl-single 1b00cc00.pinmux: 32 pins, size 4
[    2.970857] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    3.061670] printk: console [ttyS0] disabled
[    3.118484] 18002000.uart: ttyS0 at MMIO 0x18002000 (irq = 30, base_baud = 10937500) is a 16550A
[    3.234321] printk: console [ttyS0] enabled
[    3.234321] printk: console [ttyS0] enabled
[    3.344488] printk: bootconsole [early0] disabled
[    3.344488] printk: bootconsole [early0] disabled
[    3.508054] printk: bootconsole [ns16550a0] disabled
[    3.508054] printk: bootconsole [ns16550a0] disabled
[    3.677663] brd: module loaded
[    3.724880] spi-nor spi0.0: w25q256 (32768 Kbytes)
[    3.788123] 4 fixed-partitions partitions found on MTD device spi0.0
[    3.871931] OF: Bad cell count for /soc/spi@1200/flash@0/partitions
[    3.954560] OF: Bad cell count for /soc/spi@1200/flash@0/partitions
[    4.037429] Creating 4 MTD partitions on "spi0.0":
[    4.100608] 0x000000000000-0x000000100000 : "u-boot"
[    4.169745] 0x000000100000-0x000000130000 : "board-info"
[    4.242358] 0x000000130000-0x000000200000 : "syslog"
[    4.310407] 0x000000200000-0x000002000000 : "firmware"
[    4.380889] 2 fixed-partitions partitions found on MTD device firmware
[    4.466963] Creating 2 MTD partitions on "firmware":
[    4.532289] 0x000000000000-0x000000800000 : "kernel"
[    4.600218] 0x000000800000-0x000001e00000 : "rootfs"
[    4.668310] mtd: setting mtd5 (rootfs) as root device
[    4.734917] mtdsplit: no squashfs found in "rootfs"
[    4.815267] Probing RTL838X eth device pdev: 820b3200, dev: 820b3210
[    4.919109] Found SoC ID: 9303: RTL9303, family 9300
[    4.984624] CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == 00000000, ra == 805672e8
[    5.124514] Oops[#1]:
[    5.154276] CPU: 0 PID: 1 Comm: swapper Not tainted 6.6.74 #0
[    5.229944] $ 0   : 00000000 00000001 00000000 8200bf38
[    5.298734] $ 4   : 82348518 00000000 ffff8c6e 80a00000
[    5.367525] $ 8   : 04000040 11d3b942 bed06324 82021a40
[    5.436316] $12   : ffffff00 8092ad84 00000003 00000001
[    5.505106] $16   : 82348518 00000000 809fe540 8200bf33
[    5.573897] $20   : 0000000c 0000012c 8200bf38 8200bf40
[    5.642689] $24   : 00000001 80417650                  
[    5.711479] $28   : 82020000 8200bee8 80a00000 805672e8
[    5.780270] Hi    : 00005fff
[    5.818106] Lo    : 2e48f657
[    5.855940] epc   : 00000000 0x0
[    5.898361] ra    : 805672e8 __napi_poll+0x3c/0x1c0
[    5.962566] Status: 1100fc03 KERNEL EXL IE 
[    6.017598] Cause : 50800008 (ExcCode 02)
[    6.070338] BadVA : 00000000
[    6.108174] PrId  : 00019555 (MIPS 34Kc)
[    6.159767] Modules linked in:
[    6.199894] Process swapper (pid: 1, threadinfo=(ptrval), task=(ptrval), tls=00000000)
[    6.304228] Stack : 00000020 809e8c4c 0000001f 00000019 000d48a4 8016ba0c 00000001 ffffffff
[    6.414293]         82348518 809fe540 00000000 80567964 00010000 8016f05c 8088bd38 80a00000
[    6.524358]         ffff8c70 809e0000 00000000 01000000 8200bf38 8200bf38 8200bf40 8200bf40
[    6.634424]         813836f8 00000008 00000003 00000004 0000000c 00000100 00000020 3fffffff
[    6.744488]         813836ec 8012b8dc 00000005 00000001 0000001f 813b0000 809d4718 00000000
[    6.854554]         ...
[    6.886658] Call Trace:
[    6.886663] 
[    6.938251] [<8016ba0c>] handle_irq_event+0x94/0xc4
[    7.002457] [<80567964>] net_rx_action+0x298/0x334
[    7.065514] [<8016f05c>] handle_level_irq+0xb4/0x1bc
[    7.130865] [<80a00000>] do_initcalls+0xe0/0x158
[    7.191633] [<8012b8dc>] handle_softirqs+0x108/0x2a0
[    7.256983] [<80a00000>] do_initcalls+0xe0/0x158
[    7.317749] [<80417880>] plat_irq_dispatch+0x68/0x98
[    7.383100] [<80101658>] handle_int+0x138/0x144
[    7.442717] 
[    7.462206] Code: (Bad address in epc)
[    7.462206] 
[    7.530997] 
[    7.550542] ---[ end trace 0000000000000000 ]---
[    7.611288] Kernel panic - not syncing: Fatal exception in interrupt
[    7.694953] Rebooting in 1 seconds..
[    9.735781] Reboot failed -- System halted