Support for RTL838x based managed switches

JP2 (3.3V). While JP1 is part of the board design, it's left unpopulated and missing half a dozen crucial components.

It's almost tempting to sacrifice simplicity and add some dummy header to the sysupgrade images to prevent this from happening. What do you think? Would need to add

"dd skip=xxx"

to the default_do_upgrade command in target/linux/realtek/base-files/lib/upgrade/platform.sh

A suitable amount of zero bytes would do. But we could also put something useful there. Like install instructions.

EDIT: Didn't think about the bootstrapping of existing installs - that will be a problem..

1 Like

Thank you. I got a FTDI TTL-232R-3V3, and connected the three (of six) ports/cables GND (black), TXD (orange), and RXD (yellow) to GND, TX, and RX. On the other system I do sudo screen /dev/ttyUSB0, and I see the log messages. Unfortunately, my key presses are not accepted to interrupt the autoboot. (Connected VCC does not make a difference either.)

serial log
U-Boot Version 1.0.0.48161 (Nov 28 2014 - 19:10:20)

Board: RTL838x CPU:500MHz LXB:200MHz MEM:300MHz
DRAM:  128 MB
SPI-F: 1x16 MB
Loading 65536B env. variables from offset 0x80000
[DBG] ### Board Probe ###
[DBG] ### Mac Driver Init ###
[DBG] ### Chip Config ###
Switch Model: NETRONIX_DEMO (Port Count: 8)
Switch Chip: RTL8382M
[DBG]   PHY[0] RTL8218B : macid =  8, phy_max = 8
[DBG] ### Platform Config ###
[DBG] ### MAC Config ###
[DBG] ### Intra-Serdes Config ###
[DBG] ### PHY Config (RTL82XX) ###
**************************************************
#### RTL8218B config - MAC ID = 8 ####
Now Internal PHY
[DBG] ### Misc Config ###
Net:   Net Initialization Skipped
rtl8380#0
Hit any key to stop autoboot:  0
## Booting kernel from Legacy Image at b42a0000 ...
   Image Name:   2.2.2.0
   Created:      2022-05-02  17:57:49 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    3277715 Bytes = 3.1 MB
   Load Address: 80000000
   Entry Point:  80000400
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Linux version 5.10.113 (pmenzel@invidia.molgen.mpg.de) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r19537-c283defa88) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 Mon May 2 17:57:49 2022
[    0.000000] RTL838X model is 83806800
[    0.000000] SoC Type: RTL8380
[    0.000000] Kernel command line:
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019070 (MIPS 4KEc)
[    0.000000] MIPS: machine is ALLNET ALL-SG8208M
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Using appended Device Tree.
[    0.000000] Primary instruction cache 16kB, VIPT, 4-way, linesize 16 bytes.
[    0.000000] Primary data cache 16kB, 2-way, VIPT, cache aliases, linesize 16 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] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 120784K/131072K available (5681K kernel code, 610K rwdata, 1232K rodata, 1236K init, 203K bss, 10288K 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] CPU frequency from device tree: 500MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041786 ns
[    0.000019] sched_clock: 32 bits at 250MHz, resolution 4ns, wraps every 8589934590ns
[    0.008693] Calibrating delay loop... 498.89 BogoMIPS (lpj=2494464)
[    0.075569] pid_max: default: 32768 minimum: 301
[    0.081114] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.089165] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.103446] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.119123] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.130047] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.137727] pinctrl core: initialized pinctrl subsystem
[    0.144921] NET: Registered protocol family 16
[    0.298955] clocksource: Switched to clocksource MIPS
[    0.307721] NET: Registered protocol family 2
[    0.313053] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.322445] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.331888] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.340457] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.348214] TCP: Hash tables configured (established 1024 bind 1024)
[    0.355861] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.363231] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.371498] NET: Registered protocol family 1
[    0.397668] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.422276] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.428661] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.444501] pinctrl-single 1b001000.pinmux: 32 pins, size 4
[    0.451425] pinctrl-single 1b00a000.pinmux: 32 pins, size 4
[    0.458413] realtek_gpio_probe probing RTL GPIO
[    0.585319] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.594876] printk: console [ttyS0] disabled
[    0.599812] 18002000.uart: ttyS0 at MMIO 0x18002000 (irq = 31, base_baud = 12500000) is a 16550A
[    0.609637] printk: console [ttyS0] enabled
[    0.609637] printk: console [ttyS0] enabled
[    0.618875] printk: bootconsole [early0] disabled
[    0.618875] printk: bootconsole [early0] disabled
[    1.305192] brd: module loaded
[    1.317876] spi-nor spi0.0: mx25l12805d (16384 Kbytes)
[    1.323909] 6 fixed-partitions partitions found on MTD device spi0.0
[    1.331142] Creating 6 MTD partitions on "spi0.0":
[    1.336539] 0x000000000000-0x000000080000 : "u-boot"
[    1.348154] 0x000000080000-0x000000090000 : "u-boot-env"
[    1.357069] 0x000000090000-0x0000000a0000 : "u-boot-env2"
[    1.370870] 0x0000000a0000-0x0000001a0000 : "jffs"
[    1.379111] 0x0000001a0000-0x0000002a0000 : "jffs2"
[    1.392241] 0x0000002a0000-0x000001000000 : "firmware"
[    1.444565] Probing RTL838X eth device pdev: 82071a00, dev: 82071a10
[    1.502194] Found SoC ID: 8380: RTL8380, family 8380
[    1.507882] rtl8380_init_mac
[    1.511278] Using MAC 000000085478564c
[    1.597768] Realtek RTL8218B (internal) mdio-bus:08: Detected internal RTL8218B
[    1.606115] Firmware loaded. Size 1184, magic: 83808380
[    2.598970] random: fast init done
[    4.148270] i2c /dev entries driver
[    4.157467] NET: Registered protocol family 10
[    4.188294] Segment Routing with IPv6
[    4.192777] NET: Registered protocol family 17
[    4.198622] 8021q: 802.1Q VLAN Support v1.8
[    4.242027] Realtek RTL8218B (internal) rtl838x slave mii-0:08: Detected internal RTL8218B
[    4.251404] Firmware loaded. Size 1184, magic: 83808380
[    6.783880] Realtek RTL8380 SERDES rtl838x slave mii-0:18: Detected internal RTL8380 SERDES
[    6.793408] Firmware loaded. Size 1184, magic: 83808380
[    6.799404] SDS power down value: 33
[    6.827519] PLL control register: aaaaaaaf
[    6.832241] SDS power down value now: 3f
[    6.836635] Configuration of SERDES done
[    6.867327] rtl83xx_mdio_probe found port 8
[    6.872167] rtl83xx_mdio_probe port 8 has phandle
[    6.877436] rtl83xx_mdio_probe port -1 has SDS
[    6.882543] rtl83xx_mdio_probe found port 9
[    6.887236] rtl83xx_mdio_probe port 9 has phandle
[    6.892603] rtl83xx_mdio_probe port -1 has SDS
[    6.897593] rtl83xx_mdio_probe found port 10
[    6.902469] rtl83xx_mdio_probe port 10 has phandle
[    6.907831] rtl83xx_mdio_probe port -1 has SDS
[    6.912912] rtl83xx_mdio_probe found port 11
[    6.917701] rtl83xx_mdio_probe port 11 has phandle
[    6.923155] rtl83xx_mdio_probe port -1 has SDS
[    6.928146] rtl83xx_mdio_probe found port 12
[    6.933046] rtl83xx_mdio_probe port 12 has phandle
[    6.938411] rtl83xx_mdio_probe port -1 has SDS
[    6.943498] rtl83xx_mdio_probe found port 13
[    6.948291] rtl83xx_mdio_probe port 13 has phandle
[    6.953744] rtl83xx_mdio_probe port -1 has SDS
[    6.958734] rtl83xx_mdio_probe found port 14
[    6.963611] rtl83xx_mdio_probe port 14 has phandle
[    6.969077] rtl83xx_mdio_probe port -1 has SDS
[    6.974064] rtl83xx_mdio_probe found port 15
[    6.978835] rtl83xx_mdio_probe port 15 has phandle
[    6.984287] rtl83xx_mdio_probe port -1 has SDS
[    6.989382] rtl83xx_mdio_probe found port 28
[    6.998425] In rtl83xx_vlan_setup
[    7.002299] UNKNOWN_MC_PMASK: 000000001fffffff
[    7.007276] VLAN profile 0: L2 learning: 1, UNKN L2MC FLD PMSK 511,         UNKN IPMC FLD PMSK 511, UNKN IPv6MC FLD PMSK: 511
[    8.029006] rtl83xx_enable_phy_polling:             ff00
[    9.069837] rtl83xx-switch switch@1b000000 lan1 (uninitialized): PHY [mdio-bus:08] driver [Realtek RTL8218B (internal)] (irq=POLL)
[    9.096672] rtl83xx-switch switch@1b000000 lan2 (uninitialized): PHY [mdio-bus:09] driver [Realtek RTL8218B (internal)] (irq=POLL)
[    9.123497] rtl83xx-switch switch@1b000000 lan3 (uninitialized): PHY [mdio-bus:0a] driver [Realtek RTL8218B (internal)] (irq=POLL)
[    9.150333] rtl83xx-switch switch@1b000000 lan4 (uninitialized): PHY [mdio-bus:0b] driver [Realtek RTL8218B (internal)] (irq=POLL)
[    9.177163] rtl83xx-switch switch@1b000000 lan5 (uninitialized): PHY [mdio-bus:0c] driver [Realtek RTL8218B (internal)] (irq=POLL)
[    9.203997] rtl83xx-switch switch@1b000000 lan6 (uninitialized): PHY [mdio-bus:0d] driver [Realtek RTL8218B (internal)] (irq=POLL)
[    9.230829] rtl83xx-switch switch@1b000000 lan7 (uninitialized): PHY [mdio-bus:0e] driver [Realtek RTL8218B (internal)] (irq=POLL)
[    9.257655] rtl83xx-switch switch@1b000000 lan8 (uninitialized): PHY [mdio-bus:0f] driver [Realtek RTL8218B (internal)] (irq=POLL)
[    9.273452] rtl83xx-switch switch@1b000000: configuring for fixed/internal link mode
[    9.282981] DSA: tree 0 setup
[    9.286398] LINK state irq: 20
[    9.290009] In rtl83xx_setup_qos
[    9.293630] Setting up RTL838X QoS
[    9.297423] RTL838X_PRI_SEL_TBL_CTRL(i): 00033112
[    9.302806] Current Intprio2queue setting: 00000000
[    9.308266] QM_PKT2CPU_INTPRI_MAP: 00fac688
[    9.313204] rtl838x_dbgfs_init called
[    9.342404] rtl83xx-switch switch@1b000000: Link is Up - 1Gbps/Full - flow control off
[    9.352525] /dev/root: Can't open blockdev
[    9.357143] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    9.365621] Please append a correct "root=" boot option; here are the available partitions:
[    9.375075] 0100            4096 ram0
[    9.375086]  (driver?)
[    9.382029] 0101            4096 ram1
[    9.382039]  (driver?)
[    9.388834] 0102            4096 ram2
[    9.388840]  (driver?)
[    9.395766] 0103            4096 ram3
[    9.395776]  (driver?)
[    9.402700] 0104            4096 ram4
[    9.402710]  (driver?)
[    9.409622] 0105            4096 ram5
[    9.409633]  (driver?)
[    9.416440] 0106            4096 ram6
[    9.416446]  (driver?)
[    9.423372] 0107            4096 ram7
[    9.423382]  (driver?)
[    9.430294] 0108            4096 ram8
[    9.430304]  (driver?)
[    9.437112] 0109            4096 ram9
[    9.437117]  (driver?)
[    9.444043] 010a            4096 ram10
[    9.444053]  (driver?)
[    9.451071] 010b            4096 ram11
[    9.451081]  (driver?)
[    9.457986] 010c            4096 ram12
[    9.457992]  (driver?)
[    9.465042] 010d            4096 ram13
[    9.465053]  (driver?)
[    9.472081] 010e            4096 ram14
[    9.472090]  (driver?)
[    9.479108] 010f            4096 ram15
[    9.479118]  (driver?)
[    9.486022] 1f00             512 mtdblock0
[    9.486028]  (driver?)
[    9.493438] 1f01              64 mtdblock1
[    9.493448]  (driver?)
[    9.500855] 1f02              64 mtdblock2
[    9.500865]  (driver?)
[    9.508163] 1f03            1024 mtdblock3
[    9.508169]  (driver?)
[    9.515578] 1f04            1024 mtdblock4
[    9.515588]  (driver?)
[    9.523006] 1f05           13696 mtdblock5
[    9.523015]  (driver?)
[    9.530414] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    9.539664] Rebooting in 1 seconds..

Any key on these devices usually means either exactly ESC or SPACE. Try pressing first ESC from the moment on it says it will reboot and if this does not work, try SPACE the next time.

1 Like

Do as you do to get into a BIOS. Don’t “press the key”, hit it like a machine gun from power on until it stops the boot when passed the “hit the key to stop”.

2 Likes

I don't mean to flood the support thread with this but as someone with a GS1900-24EP, I'm happy to jump into any testing of firmware. Feel free to reach out.

It's probably pretty easy to add support for it (as all members of the gs1900 family have been rather similar so far), but it still needs to be developed by someone with the hardware.

For sure. Due to work and travelling it is probably not for 3 weeks or end of month before I could do the work myself.

I did see @RaylynnKnight mention eventual patches for the GS1900-24EP, so indirectly offering to help there.

I've used openwrt for many many years the idea of being personally responsible for hardware enablement will/would be very cool, so to me porting it "myself" would be great. I've never spent much time in the Developer Guide or this Discussion page, so if you had suggestions for this specific hardware or a post within here to link as a getting started, I'm all ears.

Basically; I'm eager to help contribute or verify, a contribution is less likely but I'm totally game if I can work out how.

It's looking like I won't make much progress on this until after the 15th. I'll let you know when I have something as it would be good to have a "Tested By" on the pull request when I submit.

1 Like

Sounds great. That should line up with some of my availability. Let me know and I'll get testing. Hopefully I can find some time in the interim if I'm able to work out how to do this. From your PR it seems pretty straight forward, perhaps I can suss out the details and try a build for my specific hardware. Thanks!

This may take longer than expected. The GS1900-24EP is quite different than the GS1900-24E which I expected it to be similar to. It contains two Realtek RTL8238B chips that I have not encountered before. Not finding any references on Realteks website. Based on the fact I can't locate any of the common PSE controllers found on other Realtek based boards with PoE I'm guessing these might be PSE controllers. Has anyone here encountered the RTL8238B before?

I'm going out of town for the weekend, but will try to update wikidevi and https://svanheule.net/switches with this device sometime early next week.

1 Like

There is an RTL8238 on the far right. I don't know what chip it is. From the perspective of the peripheral circuit, it is related to POE power supply.

1 Like

That does look like it's a PSE chip. I wonder if this is something new, and I hope they will be less trouble than those Broadcom PSE chips...

1 Like

I found this with regards to the RTL8238:

there it states it is a 10/100MBit Ethernet controller.

If this picture is real, I doubt it's a 10/100 Mb/s ethernet controller. Those bulky diodes and fuses certainly make it look like a four-channel PSE chip.

Yes, indeed you are absolutely right.

Has there been that much trouble with the PSE chips on this platform? I though most (all?) of them were hidden behind some microcontroller, leaving any problems to the closed source MC firmware?

Not so much trouble, but those MCUs require firmware to be uploaded at least once by stock firmware. And they have firmware versioning, although the interface appears to be quite stable. The MCU firmware in turn contains a FW blob for the BCM59xxx PSE(s) it's controlling, so I doubt a free replacement FW will ever be a real option.

Seeing that this a PSE chip from Realtek, I guess we'll have to reverse engineer the control protocol if we ever encounter it.

I tried out this image on my XGS1210, and it boots, but there are some odd hangs in the ethernet driver. If I ssh to the switch and run dmesg, the ssh session just plain locks up partway through, and sometimes even <enter>~. to force disconnect won't work. When I install LUCI (ignoring the kernel hash mismatch in the firewall dependencies), the js files likewise leave the browser spinning forever.

I see messages like this:
rtl838x-eth 1b00a300.ethernet eth0: Ring contention: r: 0, last a2800000, cur a2800128

It is probably this warning itself that is causing the unresponsiveness. It basically warns that the processor is not able to keep up with the load on the ethernet device, e.g. because of NAT and has to throttle. But if you are looking at this through LUCI or ssh these warnings themselves reduce the throughput. I have removed them and updated the images.

The RTL9300 CPU is not powerful, and we are not even using the 2nd virtual core because of issues with our understanding between the interplay of IRQ controller, the RTL9300's timer and the rest of the SMP code, so do not expect wonders from it. There is a lot of potential in these devices because of the very powerful offloading capabilities, but this will take some development still.

Could you say something about your setup and especially what works? Most of the development in the past months was focused on getting the network to work without u-boot and making the SFP+ and 2.5 GBit ports work.

1 Like