Support for RTL838x based managed switches

Hmm, I wonder if this device dts is missing the gpio-reset block some devices have that send out a reset signal from the gpio1 when doing a software reset. And if that pin is not pre-defined to the right potential it could start a reset when initialization occurs🤔

This reset output would trigger all the reset pins on all hardware chip and that wouldn’t leave any reset trace in the log.

If the reset button had been pushed fast it should have printed reboot and rebooted. The alternative is a long push to activate the real software reset.

If this is the case a build without the gpio1 that makes the problem go away would be a proof of concept but then we need to find the reset output pin.

Is it momentarily right away at initialization or after a couple of seconds?

Is it momentarily right away at initialization or after a couple of seconds?

it resets immediately, there is not even half a second till the bootloader starts again

[    0.850000] Probing RTL8231 GPIOs
[    0.860000] rtl8231_init called, MDIO bus ID: 0
^@^@II: Copied Preloader data from 0x9fc00000(15356B) to 0x9f000000.
II: Cleared Preloader BSS section at 0x9f003bfc(0B).

I doubt it is triggered by a false reset key push then because a quick push gives a reboot message once the key is released after a quick push.
Alternative a long push gives a software reset but then you need to have the key input for many seconds.

So I belive at this point we are missing this general reset function


	gpio-restart {
		compatible = "gpio-restart";
		gpios = <&gpio1 34 GPIO_ACTIVE_LOW>;
		open-source;

for this device dts, the question is probably more what pin the connection is on this device. Because this is the only function on this gpio chip we have found in these switch project that can reset the system without a warning and without a delay.

Or this is a bug in the software somewhere else.

If the reset button had been pushed fast it should have printed reboot and rebooted. The alternative is a long push to activate the real software reset.

I found something on on this. Here is a picture of the a second button next to the front one https://openwrt.org/toh/zyxel/gs1900-8 and it says "function unclear".

This is different here. The front one can only be used for factory reset. If i push it shortly, nothing happens. It's only for the factory reset, so when I press it for a longer time. However, the one on the side, that seems to be the actual reset button.

learn how to build the image by your self.

okay, I am able to do this now and playing around with the config

vim ./target/linux/realtek/dts-5.10/rtl8380_zyxel_gs1900.dtsi
...

What I meant was: add status = "disabled"; to the gpio1 node in the device tree.

Like this:
https://git.openwrt.org/?p=openwrt/staging/svanheule.git;a=commitdiff;h=fe7037741f7a781fd07906620e05def7a5d89640

Initramfs build for testing can be found here: https://svanheule.net/files/test-no8231-zyxel_gs1900-8hp-v1-initramfs-kernel.bin

2 Likes

okay, thanks, with status = "disabled"; now it boots to the initramfs-kernel-image. :ok_hand:

I hope the stable built has got 'openssh-sftp-server' included, otherwise the wiki is not up2date.

After a network config change and a download from the internet, I flashed the sysupgrade image and now of course I got the same boot loop with this one.

Any recommendation what to test next? :slight_smile:. Is there a way to disable single pins by software? I could do the sisyphus work and further narrow down the circle.

Let's see what this does: https://svanheule.net/files/test-8231-dir-init-zyxel_gs1900-8hp-v1-initramfs-kernel.bin

I've patched the RTL8231 to change the GPIO direction before changing the pin function, so it certainly starts as an input, instead of maybe being an output for a short time.

2 Likes

None of the builds have it. OpenWrt has dropbear by default. OpenSSH would eat your flash in an instant. Which wiki entry are you talking about?

I've just pushed something to my realtek-next branch :slight_smile:

I've resolved this, which was related to SMP being enabled. This should of course work, but atm does't. S i've disabled all SMP stuff from the kernel config and experiment with that next. What works? Idk :slight_smile: i can ping, the SFP detects stuff, but I haven't tested much yet, as I was just too happy that it actually boots again and I pin-pointed the booting issue.

My next branch includes the latest versions of @plappermaul's clock and timer patches (I hope :D) but haven't even looked into if it is actually working.

Btw, I'm super interested in seeing how it behaves on rtl83xx as this branch is a go in unifying the realtek target as much as possible.

P.S. on the initramfs image, I'm occasionally seeng watchdog timeouts. I usually let it boot just enough so that i can run uci set network.lan.proto=dhcp so that when the dropbear keygen finishes and continues with network bringup, it'll try to get a dhcp lease. Doubt it's related; but not seeing where this is coming from yet either (the logs are quite quiet ...) and it also happens with static config (out of the box config)

To give a little more detail:

[   40.712032] rtl83xx-switch switch@1b000000 lan4: configuring for phy/xgmii link mode
[   40.720662] rtl93xx_phylink_mac_config port 3, mode 0, phy-mode: xgmii, speed -1, link 0
[   40.729708] rtl93xx_phylink_mac_config SDS is -1
[   40.735064] 8021q: adding VLAN 0 to HW filter on device lan4
[   40.752387] switch: port 4(lan4) entered blocking state
[   40.758206] switch: port 4(lan4) entered disabled state
[   40.764881] device lan4 entered promiscuous mode
[   40.780816] rtl83xx-switch switch@1b000000 lan5: configuring for phy/xgmii link mode
[   40.789499] rtl93xx_phylink_mac_config port 4, mode 0, phy-mode: xgmii, speed -1, link 0
[   40.798524] rtl93xx_phylink_mac_config SDS is -1
[   40.804033] 8021q: adding VLAN 0 to HW filter on device lan5
[   40.821403] switch: port 5(lan5) entered blocking state
[   40.827220] switch: port 5(lan5) entered disabled state
[   40.833896] device lan5 entered promiscuous mode
[   69.387944] realtek-otto-watchdog 18003260.watchdog: phase 1 timeout

but the port number varies where it times out, I've seen it timeout after port2, but also after port 7. For some reason, we stop to enable/setup ports. Not even sure if this is 'added to vlan' or something else. Can't even say if this is related to master, birger's patches, plappermaul's patches or mine. I do know that 'before' with an older master and just birgers patches everything seemed fine, so I'll go bisect a few things again first.

In hindsight, while this should be fixed; it might be related with me disabeling SMP, VPE and the CEVT timer stuff, so that is maybe an interesting 'bug-catcher'?

edit: So I've changed some things, but nothing relevant afaik; yet, I've not been able to reproduce the issue today. If it crops up again later; I'll see if I can nail the issue down, but with it being so intermittent, that'll be fun :frowning:

So I narrowed it down a little; as reported (somewhere) earlier, we have a few sh: out of range errors during boot, this comes from the /etc/board.d/02_network script when adding a network MAC address to the json /etc/board.json, but after the board_config_dump. For some reason, we get this error, though I have not yet pinpointed why. Not adding the mac address for the lan ports, removes this error, but causes the board to timeout (pretty much guaranteed), maybe due to duplicate mac addresses? However adding the lan mac addresses to the json, even done manually instead of that loop, causes that sh error. Not adding all of them, causes again, the watchdog timeout ...

Still no idea how it all connects together though.

1 Like

Don't know what I was looking at a few hours ago. I swear the wiki pages still had "scp" instead of "wget" stated :grinning:. Forget about it - solved :blush:

unfortunately the same with test-8231-dir-init-zyxel_gs1900-8hp-v1-initramfs-kernel.bin

[    0.770000] Probing RTL8231 GPIOs
[    0.780000] rtl8231_init called, MDIO bus ID: 0
^@^@II: Copied Preloader data from 0x9fc00000(15356B) to 0x9f000000.

(Soft) resets the RTL8231 before trying to configure it, so it's in a known state, with outputs disabled. Also added some extra pr_info()'s to see where things go south.

test-8231-reset-zyxel_gs1900-8hp-v1-initramfs-kernel.bin

1 Like

Thank you. Unfortunately the same with test-8231-reset-zyxel_gs1900-8hp-v1-initramfs-kernel.bin :anguished:

[    0.770000] Probing RTL8231 GPIOs
[    0.770000] rtl8231_init called, MDIO bus ID: 0
^@^@II: Copied Preloader data from 0x9fc00000(15356B) to 0x9f000000.
II: Cleared Preloader BSS section at 0x9f003bfc(0B).

No return from a pr_info() to be seen too.

I was trying to set up vlans on GS308T. But it was not successfull. I spent a few days googling. These two vlans are what I need: vlan 10 for IOT and 99 for main lan. If I link lan1 to router, I don't have internet access. If I use lan2 linking to router and lan3 for my computer, then I do have access. Shouldn't lan1 be the trunk?

my devices:
ISP modem ==> Nanopi R4S ==> GS308T ==> Computer

You haven't set VLAN 1 as default on LAN1 though (no asterisk). And the other way around you set the PVID on all the ports that are used in VLAN 99 only, which isn't necessary.

I changed it as you said. Vlan 99 still does not have internet but vlan 10 does when lan1 is linked to router.

cat /etc/config/network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix '1234:5678:dbb0::/48'

config device 'switch'
	option name 'switch'
	option type 'bridge'
	option macaddr '12:34:56:78:90:12'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'
	list ports 'lan5'
	list ports 'lan6'
	list ports 'lan7'
	list ports 'lan8'

config bridge-vlan 'lan_vlan'
	option device 'switch'
	option vlan '1'
	list ports 'lan1:u*'

config device
	option name 'switch.1'
	option macaddr '12:34:56:78:90:12'

config interface 'lan'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.1.3'
	option gateway '192.168.1.1'
	option device 'switch.99'

config bridge-vlan
	option device 'switch'
	option vlan '10'
	list ports 'lan1:t'
	list ports 'lan6'
	list ports 'lan7'
	list ports 'lan8'

config bridge-vlan
	option device 'switch'
	option vlan '99'
	list ports 'lan1:t'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'
	list ports 'lan5'

config device
	option type '8021q'
	option ifname 'switch.10'
	option vid '10'
	option name 'IOT.10'

config device
	option type '8021q'
	option ifname 'switch.99'
	option vid '99'
	option name 'main.99'

config interface 'IOT'
	option proto 'static'
	option device 'IOT.10'
	option ipaddr '192.168.10.2'
	option netmask '255.255.255.0'

But how have you configured the router?

Now you have made interfaces in the switch?
You must configure this switch as a multi vlan dumb access point with one single interface as dhcp client for managment vlan.
The rest should be unmanaged interfaces because they are controlled by the vlan interfaces in the router.

Better alternative.
It should actually be able to switch the data on L2 level so it should work with only one management vlan and dhcp client interface and the rest runs only on vlan filtering on the ports.

And only run a trunk line between router and switch (no untagged data in any way or form).

1 Like

anyone with working poe on gs1900 (OpenWrt 22.03.0 stable)?

root@zyxel-gs1900-8-v2:/tmp# ubus call poe info
{
        "ports": [
                "0W",
                "0W",
                "0W",
                "0W",
                "unknown",
                "unknown",
                "unknown",
                "unknown"
        ],
        "power_budget": "65W",
        "power_consumption": "0W"
}

Yes, working fine one my GS1900-24HP and GS1900-8HP. However, you may need a version of realtek-poe that is only available via a github CI build at https://github.com/Hurricos/realtek-poe

1 Like