Support for RTL838x based managed switches

I don't know who maintains the wiki page(s?)... However:

I can confirm DGS-1210-20 H/W: F2; F/W: 6.30.016, fresh out of the box:
d-link_dgs-1210-20-squashfs-factory_image1.bin (Sat Jan 7 17:54:10 2023) works just fine. (Don't know if it matters or if d-link has a filename length limit, so I renamed it to factory_image1.bin just to be sure.)

I followed the instructions from https://openwrt.org/toh/d-link/dgs-1210-16_g1

  1. Make sure you are booting using OEM in image 2 slot. If not, switch to image2 using the menus System > Firmware Information > Boot from image2
    Tools > reboot
  2. Upload image in vendor firmware via
    Tools > Backup / Upgrade Firmware > image1
  3. Toogle startup image via
    System > Firmware Information > Boot from image1
  4. Tools > reboot

PS:
As it was not clear for me which network config is applied or not; I just want to say it load enough:
PLEASE, someone should just add ping ff02::1%ethN to the instructions!

Using IPv6 LLA with ssh is just simple as:

ssh root@<IPv6-LLA>%ethN
1 Like

Regarding your first post: You can't downgrade to F1, since F1/F2 is the hardware version, not the software version.

The linked wiki page already contains very specific information on the network configuration, so the ping is IMHO unnecessary: https://openwrt.org/toh/d-link/dgs-1210-16_g1#network_interfaces

If you want to improve the instructions, please apply for a Wiki account and do the necessary changes.

:roll_eyes: Thanks for pointing out that I can not downgrade the hardware revision.
Regarding software version: Maybe my memory does not serve me well, but I was under the impression / or think I've read it somewhere that there was an issue with the vendor software version. (Yes D-Link is not TP-Link, but TP-Link had some firmware versions which you needed to downgrade first; or IIRC ubnt was also one of these specialists.)
Edit: I see I have written "downgrade to F1". Don't know what kind of brain fart was that but not by intention.

Pardon me, I must have scrolled past that and have not seen it.

I'm not a fan of uncoordinated changes. And currently the documentation looks already cluttered enough.
And, as I have more or less zero insights in what and which models and what revisions are out there and are supported or not. No thanks. That's why I just confirmed here that F2 is also able to boot and someone with more details should populate that data.

Where in make menuconfig is this set?

CONFIG_TESTING_KERNEL. Can be found under "Global build settings > Use the testing kernel version"

2 Likes

I have read all of these pages of this thread, but I am a bit lost on the current status of support for Realtek based switches. What is the current status on supporting switches with the RTL9301 and RTL9311 chipsets? I might be able to give free switches to developers who have time to get these supported, but would need to understand who is actively working on these chipsets. Who are the realtek pros that can make this happen?

I think @olliver would love an XGS1210-10 or XGS1250-12 to tinker with.

1 Like

Thanks, that made this easier than changing the make files.

I just tried this on my TL-SG2008P v1.6, which is identical to the SG2210P v3.26, with the exception of a few unpopulated footprints. For uImage.img, I used the snapshot sysupgrade build. The device flashes the sysupgrade, then boots OpenWRT:

$ md5sum /var/lib/tftpboot/uImage.img 
dca80a1b4e787af67b0d4d64c61d7099  /var/lib/tftpboot/uImage.img
$ picocom /dev/ttyUSB0 -b 38400
picocom v3.1

port is        : /dev/ttyUSB0
flowcontrol    : none
baudrate is    : 38400
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready

Hit any key to stop autoboot:  0 
                **********************************************
                *         TP-Link  BOOTUTIL(v1.0.0)          *
                **********************************************
                Copyright (c) 2021 TP-Link Corporation Limited    
                Create Date: Jul 29 2021 - 04:15:16

   Boot Menu
0  - Print this boot menu
1  - Reboot
2  - Reset
3  - Start
4  - Activate Backup Image
5  - Display image(s) info
6  - Password recovery

Enter your choice(0-6)

tplink> 3
Erasing SPI flash...Writing to SPI flash...done
The kernel has been damaged!
begin to fix kernel...
Please put the uimage.img into the tftpserver directory
You can press CTRL-C to stop loading
Force port28 link up 1G
Please wait for PHY init-time ...

Using rtl8380#0 device
TFTP from server 192.168.0.146; our IP address is 192.168.0.30
Filename 'uImage.img'.
Load address: 0x81000000
Loading: T #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #####################
done
Bytes transferred = 6029624 (5c0138 hex)
##############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################The kernel has been repaired, begin to startup.

Starting kernel ...

[    0.000000] Linux version 5.10.162 (builder@buildhost) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 11.3.0 r21732-ef3919bea9) 11.3.0, GNU ld (GNU Binutils) 2.39) #0 Sun Jan 8 17:51:27 2023
[    0.000000] RTL838X model is 83806800
[    0.000000] SoC Type: RTL8380
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019070 (MIPS 4KEc)
[    0.000000] MIPS: machine is TP-Link SG2008P v1
[    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-0x000000000fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] On node 0 totalpages: 65536
[    0.000000]   Normal zone: 576 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 65536 pages, LIFO batch:15
[    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: 64960
[    0.000000] Kernel command line: console=ttyS0,115200
[    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] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 250208K/262144K available (5969K kernel code, 626K rwdata, 1292K rodata, 1256K init, 211K bss, 11936K 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] rtl83xx-clk: initialized, CPU 500 MHz, MEM 300 MHz (8 Bit DDR3), LXB 200 MHz
[    0.000000] clocksource: realtek_otto_timer: mask: 0xfffffff max_cycles: 0xfffffff, max_idle_ns: 38225208801 ns
[    0.000000] sched_clock: 28 bits at 3125kHz, resolution 320ns, wraps every 42949672800ns
[    0.000000] Calibrating delay loop... 498.89 BogoMIPS (lpj=2494464)
[    0.000000] pid_max: default: 32768 minimum: 301
[    0.000000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.000000] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.000000] pinctrl core: initialized pinctrl subsystem
[    0.000000] NET: Registered protocol family 16
[    0.000000] OF: /ethernet@1b00a300: could not get #nvmem-cell-cells for /soc/spi@1200/flash@0/partitions/partition@1f00000/macaddr@fdff4
[    0.000000] rtl83xx-clk clock-controller: rate setting enabled, CPU 300-625 MHz, MEM 300-300 MHz, LXB 200-200 MHz, OVERCLOCK AT OWN RISK
[    0.000054] clocksource: Switched to clocksource realtek_otto_timer
[    0.023597] NET: Registered protocol family 2
[    0.038649] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.064346] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.091958] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.117204] TCP bind hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.140416] TCP: Hash tables configured (established 2048 bind 2048)
[    0.161834] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.183347] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.206853] NET: Registered protocol family 1
[    0.245517] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.275969] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.295110] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.332845] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.360603] pinctrl-single 1b001000.pinmux: 32 pins, size 4
[    0.379612] pinctrl-single 1b00a000.pinmux: 32 pins, size 4
[    0.398987] gpio-502 (watchdog-enable): hogged as output/low
[    0.520375] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.547844] printk: console [ttyS0] disabled
����Ի�ȷ�3|�c����ȷ��|=�������3���u��'

I have an XGS1010-12 so I'd be interested something that is NOT that :smiley: I did want at some point the config partitions of those, to see/compare what is in there :slight_smile:

But thank you for thinking of me!

I have (as just written) an XGS1010-12, which for all intense and purposes is the same as the XGS1210-12 (but without a reset button).

My branch is currently not working, as I'm trying to integrate generic mips/generic mips kernel. Which is going very slowly, but going.

I do not have an RTL9311 based device, which is causing a lot of problems for the RTL9311 branch (nobody has this hardware) so we have no idea if any of our changes are actually working. So having hardware for that, would be great. Also would be a useful target to setup some CI/automated testing, as I have no use for a 48? port switch :slight_smile:

May I asked if there was some progress on using lacp on rtl838x? If not, could someone explain in a few sentences "what is the issue"? (I would like to understand the current limitations). Thanks.

Driver support AFAIK, the SoC is capable of it.

So driver does not support it right now, or how do I need to parse your statement?

The limitation is the driver, which is lacking bonding support. The devices I need bonding on are all on the OEM firmware still - XGS1250-12 and GS1900-8HP v2.

could it be that my sg2210p v3.20 bricked/was unnable to get openwrt running because of newer bootloader? they update timestamp (and maybe something under the hood?) with each firmware update. yours is from 2021 and all my switches are from 2022.

is there a way you could try newer firmware?

probably there is some software differences between that models

Well, we have a couple hundred of the RTL9301 and RTL9311 based POE switches, so I would be happy to provide one, but I need to understand who you and the rest of these Realtek based developers are in this thread. Who is the lead on this project, or is there not such a thing? Please PM me with you address and contact details so we can discuss.

2 Likes

I don't think the bootloader version has anything to do with it.

Try to

  1. Power cycle the device
  2. Probe the UART TX with a logic analyzer on boot
  3. Probe the ROM CLK pin with a logic analyzer on boot

The question is, is this a software fault, or a hardware fried issue? For step 1, make sure the UART cable doesn't provide 3.3V to the system.

[mrnuke@nukework ~]$ picocom /dev/ttyUSB0 -b 38400
picocom v3.1

port is        : /dev/ttyUSB0
flowcontrol    : none
baudrate is    : 38400
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready

Hit any key to stop autoboot:  0 
                **********************************************
                *         TP-Link  BOOTUTIL(v1.0.0)          *
                **********************************************
                Copyright (c) 2022 TP-Link Corporation Limited    
                Create Date: Mar 28 2022 - 18:30:03

   Boot Menu
0  - Print this boot menu
1  - Reboot
2  - Reset
3  - Start
4  - Activate Backup Image
5  - Display image(s) info
6  - Password recovery

Enter your choice(0-6)

tplink> [B
Input string contains illegal characters.
tplink> 3
The kernel has been damaged!
begin to fix kernel...
Please put the uimage.img into the tftpserver directory
You can press CTRL-C to stop loading
Force port28 link up 1G
Please wait for PHY init-time ...

Using rtl8380#0 device
TFTP from server 192.168.0.146; our IP address is 192.168.0.30
Filename 'uImage.img'.
Load address: 0x81000000
Loading: T T T T T T T T T T #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #####################
done
Bytes transferred = 6029624 (5c0138 hex)
##############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################The kernel has been repaired, begin to startup.

Starting kernel ...

[    0.000000] Linux version 5.10.162 (builder@buildhost) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 11.3.0 r21732-ef3919bea9) 11.3.0, GNU ld (GNU Binutils) 2.39) #0 Sun Jan 8 17:51:27 2023
[    0.000000] RTL838X model is 83806800
[    0.000000] SoC Type: RTL8380
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019070 (MIPS 4KEc)
[    0.000000] MIPS: machine is TP-Link SG2008P v1
[    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-0x000000000fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] On node 0 totalpages: 65536
[    0.000000]   Normal zone: 576 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 65536 pages, LIFO batch:15
[    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: 64960
[    0.000000] Kernel command line: console=ttyS0,115200
[    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] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 250208K/262144K available (5969K kernel code, 626K rwdata, 1292K rodata, 1256K init, 211K bss, 11936K 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] rtl83xx-clk: initialized, CPU 500 MHz, MEM 300 MHz (8 Bit DDR3), LXB 200 MHz
[    0.000000] clocksource: realtek_otto_timer: mask: 0xfffffff max_cycles: 0xfffffff, max_idle_ns: 38225208801 ns
[    0.000000] sched_clock: 28 bits at 3125kHz, resolution 320ns, wraps every 42949672800ns
[    0.000000] Calibrating delay loop... 498.89 BogoMIPS (lpj=2494464)
[    0.000000] pid_max: default: 32768 minimum: 301
[    0.000000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.000000] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.000000] pinctrl core: initialized pinctrl subsystem
[    0.000000] NET: Registered protocol family 16
[    0.000000] OF: /ethernet@1b00a300: could not get #nvmem-cell-cells for /soc/spi@1200/flash@0/partitions/partition@1f00000/macaddr@fdff4
[    0.000000] rtl83xx-clk clock-controller: rate setting enabled, CPU 300-625 MHz, MEM 300-300 MHz, LXB 200-200 MHz, OVERCLOCK AT OWN RISK
[    0.000051] clocksource: Switched to clocksource realtek_otto_timer
[    0.023605] NET: Registered protocol family 2
[    0.038657] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.064351] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.091967] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.117213] TCP bind hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.140425] TCP: Hash tables configured (established 2048 bind 2048)
[    0.161843] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.183356] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.206862] NET: Registered protocol family 1
[    0.245525] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.275979] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.295119] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.332857] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.360642] pinctrl-single 1b001000.pinmux: 32 pins, size 4
[    0.379648] pinctrl-single 1b00a000.pinmux: 32 pins, size 4
[    0.399022] gpio-502 (watchdog-enable): hogged as output/low
[    0.520398] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.547876] printk: console [ttyS0] disabled
�������ȷ�3|�c��G�7�3

Don't think there's a lead on this project, and even then 'which project' :slight_smile:

OpenWrt has leadership, but ports like these, have maintainers. @svanheule is the main maintainer for the realtek port today. He's also the guy who hosts https://www.svanheule.net/switches/ where https://www.svanheule.net/switches/hardware_owners is interesting to look at :slight_smile:

But really, it's just a bit of rag-tag spare time development work that is happening right now.

Anyhow. I am also someone who loves to liberate stuff and get opensource working on it. I'm happy to send you my resumé. I rolled into this because I wanted to finally buy a switch that is fully OSS (which was a little bit of a disappointment I admit.

What I feel is missing the most right now, next to development work, is testing infrastructure. We really need something automated to run tests on. Even one switch could already help there. I have my development switch that I use locally for most tasks, but every time something is about to get merged, a test should run. With some smarts, electricity usage should be quite minimal, e.g. a relay to turn things on, run some tests, shut things off again, so I don't mind paying that cost.

1 Like

A small update for my WIP branch :slight_smile:

After spending almost 2 weeks and countless of rebuilds and tests (on my single xgs1010-12)I figured out how to enable MIPS_GENERIC_KERNEL. Turns out, we avoiding setting NO_EXECEPT_FILL by setting the KERNEL_ENTRY or worse, which caused things to refuse to boot.

One option I haven't figured out yet, and need to see why it's causing issues, is we can't use SWAP_IOSPACE.

One bug that's remaining, is that the debug print is missing the first few lines of early printk output, so I'll have to figure that out.

Also I have to cleanup the clock driver patches a bit.

Overal though; finally things are working again! :slight_smile:

edit: All looking good now, just have to do a few builds from HEAD (rather then mid-changeset :p) and i'll push it to my -dev branch, from that one, I hope to see some testing from others, so that once everybody is happy i can push it to -next. Meanwhile, I'll keep churning on my -wip branch :slight_smile: