Switch Setup for Edgerouter 10X (RTL8367RB)

I am working to bring up OpenWrt on a ER10x (Ubiquiti Edgerouter 10X - ER-10X - long)

I've gotten the MT7621a ports working (eth0-eth4) and the RTL8367RB internal switch (eth5-eth9). The issue I'm having is that the Realtek switch is only working on ports 1-4 (eth6-eth9) and refuses to bring up switch0:port0 (eth5).

The MT7621a is DSA, the RTL8367RB is a swconfig driver (I know, but I cannot find a DSA driver for the RTL8367RB). The RTL connects via external PHY to the MT7621a on CPU port 6. Switch0:port0 (eth5) doesn't even recognize a cable being plugged in.

My commit (https://github.com/Itus-Shield/openwrt/commit/789faf443404d89d211ebcab5a2da2459d6526cc) outlines the dts and other changes made for those who want to see..

I'm posting here because the Network experts may or may not read the Dev section :slight_smile:

tldr;
The RTL switch works, with the exception of port0. This appears to be a switch/swconfig issue, but I've never used swconfig so I've got no practical knowledge in how the config SHOULD be.

Network config

root@OpenWrt:/# cat /etc/config/network

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

config globals 'globals'
        option packet_steering '1'
        option ula_prefix 'fdec:f190:caf0::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth1 eth2 eth3 eth4 eth5'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'

config interface 'wan6'
        option ifname 'eth0'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 4 6'

swconfig dev switch0 show is long, and will post if requested

Bump for exposure :slight_smile:

You create so many topics that I don't understand where to answer :slight_smile:
First of all your device have rtl8367s switch chip:

[    8.634803] rtl8367b rtl8367rb: unknown chip num:6367 ver:0020, mode:0020

This chip is not supported yet but see PR 4327. 6367 is id of the chip.
rtl8367s use another init regs array al least.
Second. It's very possible that port7 of rtl8367s (digital interface 2) is connected to port5 of internal mt7530 switch in rgmii mode. So

	rtl8367rb {
		compatible = "realtek,rtl8367b";
		cpu_port = <7>;
		realtek,extif2 = <1 0 1 1 1 1 1 1 2>; /* digital interface 2 in rgmii mode */
		mii-bus = <&mdio>;
		phy_id = <29>; /* if you apply patch to explicitly set switch phy address */
	};

and

&switch0 {
        ports {
                port@5 {
                        reg = <5>;
                        label = "eth5";
                        phy-mode = "rgmii-rxid";
                        mtd-mac-address = <&factory 0x22>;
                        mtd-mac-address-increment = <5>;

                fixed-link {
                        speed = <1000>;
                        full-duplex;
                        pause;
                        };
                };
        };
};

are correct with probability 99% :slight_smile:
In this config you must see traffic in port5 of mt7530. If no traffic then rgmii synchronization problem is very possible. Try to change rgmi tx/rx internal delays for mt7530 or rtl8367s.
E.g.for port5 of mt7530:phy-mode = "rgmii"; - no delays, phy-mode = "rgmii-txid"; - tx delay, phy-mode = "rgmii-id"; - both tx/rx/delays.
E.g. for port7 of rtl8367s (first two value are tx an rx delay):
realtek,extif2 = <1 0 1 1 1 1 1 1 2>; - tx delay and no rx delay.
realtek,extif2 = <1 1 1 1 1 1 1 1 2>; - both tx/rx delay an so on (see for details). After any changes of delays see receive statistics for port5 of mt7530 and port7 fo rtl8367s.
Third. Because of rtl8367s is not dsa configurable you need configure rtl8367s the same vlans as port5 of mt7530 by swconfig.

Hi, @Grommish , I encountered the same issue with the same rtl8367rb chip, on a hiwifi r33 (aka. c312b, or b52).

I confirm that my rtl8367rb chip has chip num 0x6367 and chip ver 0x0020 just like yours.

It may seem a bit odd, but for now I solved the port0 not working issue (no cable detection) by skipping writing of initvals altogether.

I didn't bother to check how it caused the issue as even if we narrowed it done to just exact one bit of register setting, lacking proper datasheet doc there is no way I can discern the meaning whatever.