Support for RTL838x based managed switches

I noticed @robimarko has upstreamed support for the TPS23681 PSE controllers, including a sysfs interface to manage the ports. Nice to see some PoE support going upstream :slight_smile:

1 Like

It just landed in 5.12 kernel, I just upstream basic support for auto mode.


Very interesting!
Unfortunately, I can't work on the T1600G-52PS any longer because it is in use. I've updated the Wiki with what I've found out.

Hi all,

thanks for the awesome work you did.

I have a Zyxel GS1900-10HP flashed with the image from

But so far no SFP and PoE is working.
I'm also missing gpio entries below /sys/class which are shown In posts above.
And where's that "poe package" which was mentioned a couple of times?

Am I using a wrong snapshot? Or are PR in mainstream missing? Or do I need to build my own image from a forked repo?

The PoE package is still in blogic's OpenWRT staging tree. A link and instructions how to use the PoE package can be found her:
The easiest if you did not compile the image yourself is simply to copy over the files directly onto the router. It's all written in Lua, so no compilation necessary, you will need:


Both poe.lua and init.d/poe need to be made executable. Then follow the configuration hints you can find linked from biot's wiki into this forum thread earlier on to see how to change config/poe to set up power on specific ports, since it is all auto-configuring by the poe controller chip you can simply turn them all on by default. Maybe someone could look into moving that package into the master? It would also be great to have an OpenWRT device wiki page on that switch so it becomes easier to set up.

1 Like

Looking at the rtl83xx-poe package it appears that it assumes that all PoE switches will only have 8 PoE ports. I'm looking to add support for the D-Link and TRENDnet switches with 24 PoE ports! Will have to play with the rtl83xx-poe code to see how to modify to support the increased number of PoE ports.

Sander has written a complete description of the PoE protocol in the wiki:
Blogic's code is still based on my early hack to simply get it working. With the stuff Sander found out, it should be possible to do much better.

1 Like

Btw., the ssl cert is not valid for (SSL_ERROR_BAD_CERT_DOMAIN), but the content is available from

I've nudged blogic about it before.

There is a pretty complete page on the GS1900-10HP already, if that's what you are referring to?

Edit: I've added a PoE setup section to the page. Going to look into adding a stand-alone page so the different Realtek switch pages can just refer to that.

1 Like

Thank you.
Thank you, too.
I added a small hint on the device page about the lua packages required.

  1. Even with the three files installed from blogic's staging dir (and required lua packages) it still does not work. poe.lua is just printing serial parameters and then nothing happens anymore.
    What I did:
    a) configure poe
    b) start poe daemon (status says "running")
    c) tried ubus call: all "enabled" (but still no power)
    d) started poe.lua, killed it after approx. one minute inactivity
    e) ubus call: all "off"
    Do I need to take the poe files from a specific branch from blogic's repo?
  2. How to enable SFP ports? They are also not working.

Did you switch on the PoE on all the ports?

poe-package$ cat etc/config/poe 
config poe poe
        option budget   65
        option port1    1
        option port2    1
        option port3    1
        option port4    1
        option port5    1
        option port6    1
        option port7    1
        option port8    1

The SFP ports should simply work. The SFP module needs to be inserted already at boot time, though. The fibre can be inserted later on.

You're welcome!

That should not be needed under the right circumstances. Lua-rs232 is a default package for oth the GS1900-8HP v1 and v2, but somehow not for the GS1900-10HP. I'll send in a patch to fix that. Not sure how I overlooked that myself since I'vebeen staring at that Makefile long enough lately.

Edit: patch sent in.

Unfortunalely the DTS in OpenWrt master still has that
"compatible = "_sff,sfp"
hack to disable the sfp driver. SFPs inserted at boot should still work as you say.

But it's so much nicer to have the full driver support, with hotplug etc. I have been holding off the minor fixes I've been using myself, waiting for the upstreamed drivers to appear. But things haven't moved as fast as I hoped. As usual. Maybe I should just clean up my stuff as-is against the current OpenWrt master and submit it?

kobi, yes, it is configured:

root@OpenWrt:/# ubus call poe info
        "ports": [
        "power_budget": "77W",
        "power_consumption": "0W"

I tried several PoE capable Alfa routers (AP121) but noone did work. And the poe.lua script is still hanging. Am I missing some code in my image? I'm using the snapshot from yesterday. Of course I can try to build my one. But which repo/branch do I need for that?

SFP is still not working after reboot. I have 1000Base-T modules which should be compatible with Zyxel. Maybe they are not. Postponing test/examination of SFP.

Borromini, the lua packages were missing in the snapshot from yesterday.

Yes, well... That follows from what I wrote above.

Right. Those won't work without fixes. I'll try to clean up the mess I have and submit the necessary patches.

It's all here if you want to look at it, but this is mixed with lots of unrelated stuff which is more or less in master now. So you should not use this branch as-is. Only cherry-pick the SFP related commits:

I believe the relevant commits are

bd3dc70b8c28 realtek: enable SerDes NWAY and SGMII negotiation
c899999ad27c realtek: enabled Marvell and Realtek PHYs
e7ca9b95608b realtek: set phy-mode to "sgmii" to support 1000Base-T SFPs
a1c032b3cba7 realtek: enable HWMON for SFP sensors
d8e1e5326adc realtek: handle all the cascaded irqs as defined by the IRRs
3e1ebafeddbe realtek: need to handle PHY_INTERFACE_MODE_NA for sfps
c15d09752079 realtek: re-enable sfp driver for ZyXEL GS1900-10HP

The HWMON support is mostly for fun. Not sure if the irq fix is still necessary or if that has been applied? The main clue for copper SFP support is enabling the sfp driver and handling PHY_INTERFACE_MODE_NA. Most (all?) copper SFPs have a Marvell phy, and that driver is therefore required. The NWAY fix is required if you want to use 10 or 100 Mbits.

1 Like

I already tried your branch zyxel-gs1900-10hp but got messages like

'package/rtl83xx-poe/Makefile' has a dependency on 'lua-rs232', which does not exist


I think I should try master and pull required commits.

Do you have any idea what could be wrong on my poe?

No, sorry. Looks like you are communicating with the micro-controller. Although I can't quite understand how unless you have lua-rs232. I thought that was required by that script.

Anyway, AFAICS, the two PoE related fixes I remember are already in master: poe-enable gpio-hog, and the associated setting of value along with direction in the gpio driver. I believe that was all I needed to make it work. All the changes to the lua script before figuring out that master gpio thing were unnecessary.

@reichhart I have my own builds up here, includes the rtl83xx-poe package and dependencies by default. Feel free to give them a shot. Do note they self-configure on at first, though (and no VLAN 100). These are 21.02 but if you move up into the tree you can find an older master based build as well.

If you dare test something that might not even boot, then I've put together a master based branch here with what I believe is sufficient to make 1000Base-T SFPs work, with full support for 10/100/1000 negotiation:

NOTE: This branch is build tested only. I am not joking when I say that it might not boot at all...

I am using my GS1900-10HP in a semi-remote location (garden shed), and had to remove my temporary console solution. So I am not prepared to boot test this myself right now.