Support for RTL838x based managed switches

Well I have written to Realtek asking for the datasheets for the RTL838x. Let's start there and see where this goes. In my experience the hardest step is usually making the initial contact.

That is great! I hope this works, it would be really cool to be able to refer to the datasheets. Thanks for the initiative.

cisco sg-250-26@marvel-armada ... has some promise... dts... serial seems read only as best I can tell... :frowning:

my 2 test samples arrived today :smiley:

1 Like

so the dlink uses a serial/tty and the netgear a usb poe driver ? is that the prolific usb chipset ? can we read power consumption and random other data ?
and is the poe passive/active 24/48V ? we could probably add a driver to drive this via the iio layer, never touched it. using the regulator sub system might also be an option
opening the dlink case i saw a cable to the top casing, i assume this is a shift register cascade to drive the leds ?

All chips use serial/tty to read out f/control PoE. We can read out power consumption and other data and set e.g. power limits per port. All brands use variations of the same binary protocol, which roughly looks like this:

Binary 12-byte sequence
cc sq dd dd FF FF FF FF FF FF FF cs
cc: command
sq: sequence number
dd: command options
FF: 0xFF for commands that do not need all 12 bytes
cs: checksum: LSB of sum over all bytes in command

Everything I know about the D-Link PoE steering is in

PoE is active 48V.
Yes, shift register cascade. Normally hardware controlled by the SoC, look for serial LEDs in the manual posted by kondike above.
Example for software control is

but normally the Bootloader already initializes the LEDs to be SoC controlled.

Great work!

I have collected some leaked documents about realtek chips on the Chinese website, some of which are related to rtl838x (sdk and uboot instructions, L2 api documents, etc.). They are on my telegram channel, @Realtek_Switch_Hacking, maybe it will help.

1 Like

That is great stuff! This will take some time to dig through, but this really amazing: I already looked at the datasheets for the RTL8231 and the RTL9301 and this invaluable. Thanks so much!


I just added Support for the ALLNET ALL-SG8208M switch: 8-port GE, 128MB RAM, 16MB flash, approx 70Euros incl. shipping, code in the github repository above.
LEDs and reset switch are supported. Installation can be done by flashing the sysupgrade image via the OEM web interface. The switch has an already soldered on serial header (with markings), a hard on/off switch and in addition to the front software reset switch a hard-wired reset switch hidden at the right behind the air-vents. Power is via external 12V power supply with standard barrel connector.



These are great news, thanks and congrats.

i've got one of these front panel PCB's from a dlink DGS-1100-16 v1 ( smallflash 2MB )...

it's got a 10 pin ribbon and two rtl square chips on it with hard to read names ( but when I searched all that came up were switch chips ) which i'd assume are the shift reg's with 2+ pins power and 2? pins for the button...

does this sound the same as the one/ones you've been working with?

if so... would you have a pinout / pointers to get the driver up and running using GPIO on another board ( i see the dts &led_sys definitions so probably just the higher level kmod / references i'm after )?

( i.e. is there 2 dedicated pins CLK/DATA per chip from the ribbon? assuming they are not daisy chained - 3.3v?)

Yes, Wulfy23, your assumption is correct.
Have a look at the datasheet klondike found above in

on page 78 is there is the description of the electrical interface. The chips you are not able to read the names of are 74HC164 shift registers. More info is also in the datasheet of the RTL8321 chip which is a driver chip for LEDs that talks the PHY serial control protocol, i.e. is on the same bus as the PHY chips of your board.
Now, there is no driver necessary to drive these shift registers and LEDs because the ASIC of the RTL838x chips knows how to do that, you just tell it the number of leds, and whether 2 or 3 colours are supported in a register. However, more information on timing is found in the RTL8321 datasheet, which can also speak that protocol. It is found in the Telegram channel

In section 10.5.3 is a drawing of the timing diagram, that you can use to bit-bang with 2 GPIO pins easily, as there are virtually no constraints on the timing speed.

1 Like

thankyou kobi for taking the time and effort to provide such an informative answer... and for all the hard work you've put into this.