Support for RTL838x based managed switches

To my knowledge, it's not yet implemented

1 Like

Ok, I got little confused because I noticed in the dts file for -10p that the reset bt seems to be defined.

But I have also a memory from this huge tread that there was a issue with this function. But I can’t find the actual post mention it anymore.

I'm sorry I dropped the ball on helping someone who posted patches to fix the DGS-1210 devices on the mailing list. Family obligations, work and COVID got in the way and I never tested his patches as I planned to and now the link to the patch series on https://patchwork.ozlabs.org/project/openwrt/list/?series=265587 appears to be dead. You might try posting to openwrt-devel@lists.openwrt.org and ask Paul Ferster if he still has patches available.

Ray

1 Like

https://patchwork.ozlabs.org/project/openwrt/cover/20211005194024.31909-1-fercerpav@gmail.com/
(hit series or mbox to fetch all patches).

4 Likes

The relevant part of his patch description is:
realtek: add all LEDs, buttons and SFP signals to DGS-1210-10

2 Likes

https://forum.openwrt.org/t/dgs-1210-10mp-as-a-spin-off-from-dgs-1210-10p/122862?u=flygarn12
I don’t know really how to proceed with my -10mp?

They way I am going now is to have a (for now a public) OpenWRT fork for this device on my flygarn12 GitHub account.

Step 1. is to copy the current -10p device so the -10mp has its own dts base file. I have already done this at round1 on a clone but I realized a fork instead of clone of the parent OpenWRT was better to work with when pulling changes from the parent to my fork. So I have to redo this step 1.

But then we have this patch for the buttons and also the poe patch. I surely pretty easy can install these on my personal device fork. But it feels more meaningful that these two patches gets in the actual OpenWRT system instead of everyone interested is going to build their own setup of the same hardware but sooner or later on a little different way?

Older patches will probably also get more harder to install for example when the Realtek was splitted in four a while ago. After that the old file names doesn’t work.

Do you think I should make a pull request for the dgs-1210-10mp device to the real OpenWRT project?
-10mp has built in mains PSU and 130W PoE instead of -10p 54V DC adaptor and 65W PoE.
Or should I wait until the poe and the button patch is included in OpenWRT or not do a pull request at all and only run it on my fork?

PoE patches won't get merged. If you don't want to hack together device support every single time something changes, create a PR.

@anon13997276 Find some time to look at the XGS1250-12 by any chance?

1 Like

https://github.com/bkobl/openwrt/commit/fd48f9f20be21bf98ef2592b9bfa5289fa3a5a87
should fix the issue with the 8 1GBit ports not working on the XGS1250. I tested it only on the XGS1210, however, but that has the same RTL8218D PHY. I am at the moment trying to figure out how to get the PHYs also to work without the help of u-boot and doing a register-by-register comparison of the SerDes configuration against what is done on the XGS1010, where there is a "diag" utility to read out SerDes register contents while running... The issue is definitely in the link between the different RTL9300 SDS and the PHYs, one can see this from link failure registers, and it is very likely on the SDS side of the link that is not correctly set up, which explains also why the above fix is so important: don't reset the SDS that was set up by u-boot.

1 Like

Going to give that a shot, thanks!

https://openwrt.org/docs/guide-developer/add.new.device
I thought I give the GPIO buttons mapping a chance on the dgs-1210-10mp to verify the address for the mode and reset button.
But when I first tried the script gpio-dump.sh, it gave an error that the folders in the script didn't exist, so I looked in the file explorer on the router and the files was actually named gpiochip451 and gpiochip488.
So, I tried folder 451 in the script and after some tries I found the Mode switch on GPIO481 and Reset on GPIO484!?

Does anyone know how to convert these GPIO numbers to actual pin numbers on the RTL8231?

In the dgs-1210-10p the reset key is under comment defined like this:

	keys {
		compatible = "gpio-keys-polled";
		poll-interval = <20>;

		/* is this pin 30 on the external RTL8231 (&gpio1)? */
		/*mode {
			label = "reset";
			gpios = <&gpio0 94 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};*/
	};

Is the gpios acording to the mapping really supposed to be defined like this on -10mp?

gpios = <&gpio451 484 GPIO_ACTIVE_LOW>;

Hey there Borromini,

I added some additional translation to realtek-poe -d, and I'm noticing that I get some errors from the MCU. I'm wondering whether this is related to the inability of realtek-poe to bring ports actually up?

:
TX -> 0x1a 0x09 0x03 0x01 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x20
Set port priority 
RX -> 0x1a 0x09 0x03 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x1f
Set port priority 
TX -> 0x1c 0x0a 0x03 0x01 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x23
Set port power-up mode 
RX -> 0xfe 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xf4
Request checksum n/a Request frame checksum was incorrect 
TX -> 0x15 0x0b 0x03 0x01 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x1d
Set port power limit type 
RX -> 0x15 0x0b 0x03 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x1c
Set port power limit type 
:

Is there any code you'd like me to try? I can see how it behaves and report back, but I have no C skills whatsoever unfortunately. But happy to help where I can.

If you're able to compile it, here's a copy of realtek-poe's main.c; see if you get the same "Request checksum" issues.

https://paste.c-net.org/StingsWinnings

1 Like

Alternatively, just copy this to your /usr/bin/realtek-poe: https://paste.c-net.org/ReturnedDiploma

I can recompile the binary package, thanks! Just grabbed your code and diffed it out of curiosity :slightly_smiling_face:.

It's running rather late here so I won't be able to try this tonight still (European time), but I will report back to you in the next days. Will keep you posted!

@hurricos Beat me up, but with your code changes it just seems to work again somehow :face_with_open_eyes_and_hand_over_mouth:. Not sure if realtek-poe -d is supposed to return the prompt, it didn't print anything new when I plugged in a second PoE client. This is with your code (on 22.03):

root@OpenWrt:~# ubus call poe info
{
	"firmware": "v17.1",
	"mcu": "ST Micro ST32F100 Microcontroller",
	"budget": 70.000000,
	"consumption": 6.200000,
	"ports": {
		"lan1": {
			"priority": 2,
			"mode": "Legacy",
			"status": "Delivering power",
			"consumption": 3.100000
		},
		"lan2": {
			"priority": 2,
			"mode": "Legacy",
			"status": "Delivering power",
			"consumption": 3.100000
		},
		"lan3": {
			"priority": 2,
			"mode": "Legacy",
			"status": "Searching"
		},
		"lan4": {
			"priority": 2,
			"mode": "PoE",
			"status": "Searching"
		}
	}
}
root@OpenWrt:~# realtek-poe -d
Failed to add object: Invalid argument
TX -> 0x20 0x01 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x18
Get system info

Configuration:

root@OpenWrt:~# cat /etc/config/poe 
config global
	option budget	'70'

config port
	option enable	'1'
	option id	'1'
	option name	'lan1'
	option poe_plus	'1'
	option priority	'2'

config port
        option enable   '1'
        option id       '2'
        option name     'lan2'
        option poe_plus '1'
        option priority '2'

config port
        option enable   '1'
        option id       '3'
        option name     'lan3'
        option poe_plus '1'
        option priority '2'

config port
        option enable   '1'
        option id       '4'
        option name     'lan4'
        option poe_plus '1'
        option priority '2'

config port
        option enable   '0'
        option id       '5'
        option name     'lan5'
        option poe_plus '1'
        option priority '2'

config port
        option enable   '0'
        option id       '6'
        option name     'lan6'
        option poe_plus '1'
        option priority '2'

config port
        option enable   '0'
        option id       '7'
        option name     'lan7'
        option poe_plus '1'
        option priority '2'

config port
        option enable   '0'
        option id       '8'
        option name     'lan8'
        option poe_plus '1'
        option priority '2'

Is there any way to download OpenWRT for xgs1210?

Hey there -- you must actually stop the other realtek-poe from running in order for realtek-poe -d to actually show anything.

That is, /etc/init.d/poe stop; /etc/init.d/poe disable; realtek-poe -d.

I'm also currently in the process of cherry-picking commits to compile a new image for my xgs1010-12

I think, you need at least these 3 commits from @yarrick (https://github.com/yarrick/openwrt/commits/xgs1210) for the xgs1210 to show up in menuconfig, and declare partitions and i2c:

  • c26a70792c59bfed050f6f11332b23f80f10b446
  • d4f254ddfd40e15ea9645580ef29388e1c116fef
  • 6069036dc4c99ed6e0373dfcfc9b9a89e96a2eee

I think, most/all of the remaining changes in the other commits have been rolled into the commits targeting the xgs1250 by (i think) @blogic, and have already? arrived in master. I'm currently building with the 3 cherrypicks above, and'll check if it boots later today.

That image booted, but no ethernet link.
I also then cherry-picked:

  • 7c0eb56eb06f73939bca64395ccf6cec70c7b7a4
  • 3e4d838fb8bf23a081c65dca2565b28fe199b491

this boots, and has functioning network on ports 1-8, but sysupgrade fails.
(I think, this is because sysupgrade wants partition 'firmware', while the partition name is 'firmware1'. I'll look into it tomorrow)
Did you get further @DienoX ?

I obviously did not do that :person_facepalming:. This is just from running realtek-poe -d as you instructed. I did notice the first PoE client coming up, the second one stays down for whatever reason. Weird stuff.

Only have PoE enabled on the first four ports of my GS1900-8HP v1, but ubus prints port 2 as disabled despite it being set to enabled in /etc/config/poe :confused:.

root@OpenWrt:~# ubus call poe info
{
	"firmware": "v17.1",
	"mcu": "ST Micro ST32F100 Microcontroller",
	"budget": 70.000000,
	"consumption": 3.100000,
	"ports": {
		"lan1": {
			"priority": 2,
			"mode": "Legacy",
			"status": "Delivering power",
			"consumption": 3.100000
		},
		"lan2": {
			"priority": 2,
			"mode": "Legacy",
			"status": "Disabled"
		},
		"lan3": {
			"priority": 2,
			"mode": "Legacy",
			"status": "Disabled"
		},
		"lan4": {
			"priority": 2,
			"mode": "Legacy",
			"status": "Searching"
		}
	}
}