Ubiquiti Edgerouter 10X - ER-10X

Does anyone have some high resolution pictures from the PCB? That would be a good start.

I've got an ER-10X now and started to lookup all the datasheets and the GPL code from Ubiquiti to create a port.

The good news is that it's very much the same as the ER-X but the upper 5 ports are connected to an RTL8367RB which is connected to the MediaTek switch via rgmii (1GBit link speed). That integration looks very dirty in the GPL sources and is based on a rtl8367c driver from RealTek that does not exist in OpenWRT yet.

This is my first port so don't expect an image yet or fast progress but if anyone wants to help feel free to do so. https://github.com/decke/openwrt-er10x

I'm not an expert, but it looks like the same RTL8367RB switch is used in TP-Link Archer C2 AC750
https://openwrt.org/toh/tp-link/archer_c2_ac750

Yes, the RealTek chip itself is quite common and used by a handfull MT7620 based devices but usually instead of the 5 port mediatek. In the ER-10X it is added in addition to the 5 port mediatek and connected via the rgmii link of the nic chip which seems to be unique but absolutely valid when looking at the datasheet of the MT7621AT.
From the software point of view it looks clumsy what they did in the the original firmware but I am not sure if that is because the Ubiquiti guys didn't know better or because the constellation is so special.

Any progress?

No, not much progress since March. Next step would be to build an initramfs image to test if the dts file and other changes are correct. This was broken in openwrt 19.07 because of size restrictions but I found an introduction recently that looks promising:

After a bit of fixing it should be possible to flash openwrt on ER-10X but only with the 5 lower ethernet ports for now because we still need a solution how to support the realtek chip.

This looks like an interesting combo router + managed switch for those of us who need lots of ethernet ports.

Bringing the thread back from the dead..

I've gotten one of these, Ports 0-4 work, 5-9 not yet. the RTL8367RB drivers are in, but I'm unsure how to alter/create the DTS to create tell the kernel "Hey, this is here".

I've got no practical experience with Device Tree files, since my last device it was embedded in Uboot and I never had to touch it.

Any suggestions/tips on how to enable this? This is the stub I've got so far.

/dts-v1/;

#include "mt7621_ubnt_edgerouter-x.dtsi"

/ {
        model = "Ubiquiti EdgeRouter 10X";
        compatible = "ubnt,edgerouter-10x", "mediatek,mt7621-soc";

	rtl8367rb {
		compatible = "realtek,rtl8367b";
	};
};

&gsw {
	interrupt-parent = <&gic>;
	interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH
		      GIC_SHARED 12 IRQ_TYPE_LEVEL_HIGH>;
	interrupt-names = "gsw", "rtl8367";
};

&nand {
	partitions {
		partition@740000 {
			reg = <0x740000 0x1f4c0000>;
		};
	};
};

&xhci {
	status = "okay";
};

&sdhci {
	status = "okay";
};

&pcie {
	status = "okay";
};

&i2c {
	status = "okay";
};
root@OpenWrt:/# uname -a
Linux OpenWrt 5.10.20 #0 SMP Sat Mar 6 19:23:48 2021 mips GNU/Linux
root@OpenWrt:/# cat /var/sysinfo/board_name
ubnt,edgerouter-10x
root@OpenWrt:/#
root@OpenWrt:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr 74:AC:B9: 
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fd42:bcc8:69d1:4::1/62 Scope:Global
          inet6 addr: fe80::76ac:b9ff:feeb:4376/64 Scope:Link
          inet6 addr: fd0e:ff6e:8fd::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9051 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6018 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:723689 (706.7 KiB)  TX bytes:826033 (806.6 KiB)

dsa       Link encap:Ethernet  HWaddr 74:AC:B9: 
          inet6 addr: fe80::76ac:b9ff:feeb:4375/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1504  Metric:1
          RX packets:21685 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9535 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2792170 (2.6 MiB)  TX bytes:1218485 (1.1 MiB)
          Interrupt:22

eth0      Link encap:Ethernet  HWaddr 74:AC:B9: 
          inet addr:192.168.200.114  Bcast:192.168.200.255  Mask:255.255.255.0
          inet6 addr: fd42:bcc8:69d1:0:76ac:b9ff:feeb:4375/64 Scope:Global
          inet6 addr: fd42:bcc8:69d1::9b7/128 Scope:Global
          inet6 addr: fe80::76ac:b9ff:feeb:4375/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12633 errors:0 dropped:803 overruns:0 frame:0
          TX packets:3511 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1678109 (1.5 MiB)  TX bytes:313236 (305.8 KiB)

eth1      Link encap:Ethernet  HWaddr 74:AC:B9: 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9051 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6016 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:723689 (706.7 KiB)  TX bytes:825761 (806.4 KiB)

eth2      Link encap:Ethernet  HWaddr 74:AC:B9: 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth3      Link encap:Ethernet  HWaddr 74:AC:B9: 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth4      Link encap:Ethernet  HWaddr 74:AC:B9: 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:747 errors:0 dropped:0 overruns:0 frame:0
          TX packets:747 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:78858 (77.0 KiB)  TX bytes:78858 (77.0 KiB)

root@OpenWrt:/#

The RTL8367RB will need a new DSA driver

So, this isn't the RTL8367R/RB Driver? I'll go back to digging then :slight_smile:

From drivers/net/phy/rtl8367b.c

        switch (chip_ver) {
        case 0x1000:
                chip_name = "8367RB";
                break;
        case 0x1010:
                chip_name = "8367R-VB";
                break;
        default:
                dev_err(smi->parent,
                        "unknown chip num:%04x ver:%04x, mode:%04x\n",
                        chip_num, chip_ver, chip_mode);
                return -ENODEV;
        }

Well that's legacy swconfig driver.
If you are still going to mix it with DSA, you should know:

  • On swconfig driver, switch ports won't be recognised as standalone interfaces.
  • How are MT7621 and RTL8367RB connected together, in both data plane (GMAC1 to RGMII or Port5 to RGMII?) and management plane (Bit-banged Realtek SMI or MDIO? What's the PHY address?).
1 Like

From what I can tell, its on RGMII2, MDIO, PHY address 29 (https://github.com/Lochnair/kernel_e50/blob/v2.0.9/master/drivers/net/ethernet/realtek/rtl8367c/smi.c#L38). But, this is what others have related who looked at it, so take it as hearsay.

GMAC1 is status = "disabled" in the dtsi (either the ERx or the mt7621.dtsi, I don't remember offhand)

Is there an actual DSA driver available for the RTL8367RB? I don't mind trying to port it over if I had a place to start.

I'm willing to do whatever testing and grunt work. Building the image takes almost no time at all, and flashing to test is even faster (I've been just TFTP'ing to RAM to boot)

This is the EdgeOS v2 stock DTS on whatever kernel version it ships with

Warning (unit_address_vs_reg): Node /pcie@1e140000/pcie2 has a reg or ranges property, but no unit name
Warning (unit_address_vs_reg): Node /pcie@1e140000/pcie0 has a reg or ranges property, but no unit name
Warning (unit_address_vs_reg): Node /pcie@1e140000/pcie1 has a reg or ranges property, but no unit name
Warning (unit_address_vs_reg): Node /cpuintc@0 has a unit name, but no reg property
Warning (unit_address_vs_reg): Node /sysclock@0 has a unit name, but no reg property
Warning (unit_address_vs_reg): Node /cpuclock@0 has a unit name, but no reg property
Warning (unit_address_vs_reg): Node /cpus/cpu@1 has a unit name, but no reg property
Warning (unit_address_vs_reg): Node /cpus/cpu@0 has a unit name, but no reg property
/dts-v1/;

/ {
        compatible = "ubiquiti,edgerouter";
        model = "Ubiquiti EdgeRouter";
        #address-cells = <0x1>;
        #size-cells = <0x1>;

        palmbus@1E000000 {
                compatible = "palmbus";
                ranges = <0x0 0x1e000000 0xfffff>;
                #address-cells = <0x1>;
                #size-cells = <0x1>;
                phandle = <0x10>;
                reg = <0x1e000000 0x100000>;
                linux,phandle = <0x10>;

                sysc@0 {
                        compatible = "mtk,mt7621-sysc";
                        phandle = <0x11>;
                        reg = <0x0 0x100>;
                        linux,phandle = <0x11>;
                };

                wdt@100 {
                        compatible = "mtk,mt7621-wdt";
                        phandle = <0x12>;
                        reg = <0x100 0x100>;
                        linux,phandle = <0x12>;
                };

                mc@1fbf8000 {
                        compatible = "mtk,mt7621-mc";
                        phandle = <0x19>;
                        reg = <0x1fbf8000 0x8000>;
                        linux,phandle = <0x19>;
                };

                i2c@900 {
                        compatible = "mediatek,mt7621-i2c";
                        clocks = <0x1>;
                        resets = <0x2 0x10>;
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        phandle = <0x15>;
                        reg = <0x900 0x100>;
                        pinctrl-0 = <0x3>;
                        reset-names = "i2c";
                        linux,phandle = <0x15>;
                        pinctrl-names = "default";

                        pca9555@25 {
                                compatible = "nxp,pca9555";
                                status = "okay";
                                phandle = <0xe>;
                                reg = <0x25>;
                                #gpio-cells = <0x2>;
                                linux,phandle = <0xe>;
                        };
                };

                gpio@600 {
                        compatible = "mtk,mt7621-gpio";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        reg = <0x600 0x100>;

                        bank@1 {
                                compatible = "mtk,mt7621-gpio-bank";
                                gpio-controller;
                                phandle = <0x13>;
                                reg = <0x1>;
                                #gpio-cells = <0x2>;
                                linux,phandle = <0x13>;
                        };

                        bank@2 {
                                compatible = "mtk,mt7621-gpio-bank";
                                gpio-controller;
                                phandle = <0x14>;
                                reg = <0x2>;
                                #gpio-cells = <0x2>;
                                linux,phandle = <0x14>;
                        };

                        bank@0 {
                                compatible = "mtk,mt7621-gpio-bank";
                                gpio-controller;
                                phandle = <0xd>;
                                reg = <0x0>;
                                #gpio-cells = <0x2>;
                                linux,phandle = <0xd>;
                        };
                };

                hsdma@7000 {
                        #dma-cells = <0x1>;
                        compatible = "mediatek,mt7621-hsdma";
                        resets = <0x2 0x5>;
                        #dma-requests = <0x1>;
                        status = "disabled";
                        interrupt-parent = <0x4>;
                        interrupts = <0x0 0xb 0x4>;
                        phandle = <0x1c>;
                        reg = <0x7000 0x1000>;
                        reset-names = "hsdma";
                        linux,phandle = <0x1c>;
                        #dma-channels = <0x1>;
                };

                memc@5000 {
                        compatible = "mtk,mt7621-memc";
                        phandle = <0x17>;
                        reg = <0x300 0x100>;
                        linux,phandle = <0x17>;
                };

                uartlite@c00 {
                        reg-io-width = <0x4>;
                        compatible = "ns16550a";
                        clocks = <0x1>;
                        interrupt-parent = <0x4>;
                        interrupts = <0x0 0x1a 0x4>;
                        phandle = <0x1a>;
                        reg = <0xc00 0x100>;
                        clock-frequency = <0x2faf080>;
                        reg-shift = <0x2>;
                        linux,phandle = <0x1a>;
                        no-loopback-test;
                };

                spi@b00 {
                        compatible = "ralink,mt7621-spi";
                        clocks = <0x1>;
                        resets = <0x2 0x12>;
                        status = "disabled";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        phandle = <0x1b>;
                        reg = <0xb00 0x100>;
                        pinctrl-0 = <0x6>;
                        reset-names = "spi";
                        linux,phandle = <0x1b>;
                        pinctrl-names = "default";
                };

                i2s@a00 {
                        compatible = "mediatek,mt7621-i2s";
                        clocks = <0x1>;
                        resets = <0x2 0x11>;
                        txdma-req = <0x2>;
                        status = "disabled";
                        interrupt-parent = <0x4>;
                        interrupts = <0x0 0x10 0x4>;
                        dma-names = "tx", "rx";
                        phandle = <0x16>;
                        rxdma-req = <0x3>;
                        reg = <0xa00 0x100>;
                        dmas = <0x5 0x4 0x5 0x6>;
                        reset-names = "i2s";
                        linux,phandle = <0x16>;
                };

                gdma@2800 {
                        #dma-cells = <0x1>;
                        compatible = "ralink,rt3883-gdma";
                        resets = <0x2 0xe>;
                        #dma-requests = <0x10>;
                        status = "disabled";
                        interrupt-parent = <0x4>;
                        interrupts = <0x0 0xd 0x4>;
                        phandle = <0x5>;
                        reg = <0x2800 0x800>;
                        reset-names = "dma";
                        linux,phandle = <0x5>;
                        #dma-channels = <0x10>;
                };

                cpc@1fbf0000 {
                        compatible = "mtk,mt7621-cpc";
                        phandle = <0x18>;
                        reg = <0x1fbf0000 0x8000>;
                        linux,phandle = <0x18>;
                };
        };

        nand@1e003000 {
                compatible = "mtk,mt7621-nand";
                status = "okay";
                #address-cells = <0x1>;
                bank-width = <0x2>;
                #size-cells = <0x1>;
                phandle = <0x28>;
                reg = <0x1e003000 0x800 0x1e003800 0x800>;
                linux,phandle = <0x28>;

                partition@0 {
                        read-only;
                        label = "ALL";
                        reg = <0x0 0x0>;
                };

                partition@e0000 {
                        label = "eeprom";
                        phandle = <0xa>;
                        reg = <0xe0000 0x60000>;
                        linux,phandle = <0xa>;
                };

                partition@440000 {
                        label = "Kernel2";
                        reg = <0x440000 0x300000>;
                };

                partition@80000 {
                        read-only;
                        label = "Config";
                        reg = <0x80000 0x60000>;
                };

                partition@1 {
                        read-only;
                        label = "ALL";
                        reg = <0x0 0x0>;
                };

                partition@140000 {
                        label = "Kernel1";
                        reg = <0x140000 0x300000>;
                };

                partition@740000 {
                        label = "RootFS";
                        reg = <0x740000 0x1f4c0000>;
                };

                partition@2 {
                        label = "Bootloader";
                        reg = <0x0 0x80000>;
                };
        };

        sdhci@1E130000 {
                compatible = "ralink,mt7620-sdhci";
                status = "okay";
                interrupt-parent = <0x4>;
                interrupts = <0x0 0x14 0x4>;
                phandle = <0x26>;
                reg = <0x1e130000 0x4000>;
                linux,phandle = <0x26>;
        };

        ethernet@1e100000 {
                compatible = "mediatek,mt7621-eth";
                mac-address = [74 ac b9 eb 43 75];
                resets = <0x2 0x6 0x2 0x17>;
                mediatek,ethsys = <0x2b>;
                mediatek,switch = <0x9>;
                interrupt-parent = <0x4>;
                #address-cells = <0x1>;
                interrupts = <0x0 0x3 0x4>;
                #size-cells = <0x0>;
                phandle = <0x29>;
                reg = <0x1e100000 0x10000>;
                mtd-mac-address = <0xa 0x22>;
                reset-names = "fe", "eth";
                linux,phandle = <0x29>;

                mdio-bus {
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;

                        ethernet-phy@1f {
                                phandle = <0x2a>;
                                reg = <0x1f>;
                                phy-mode = "rgmii";
                                linux,phandle = <0x2a>;
                        };
                };
        };

        clkctrl {
                compatible = "ralink,rt2880-clock";
                #clock-cells = <0x1>;
                phandle = <0xc>;
                linux,phandle = <0xc>;
        };

        __symbols__ {
                gpio2 = "/palmbus@1E000000/gpio@600/bank@2";
                sdhci_pins = "/pinctrl/sdhci";
                gpio0 = "/palmbus@1E000000/gpio@600/bank@0";
                nand_pins = "/pinctrl/nand";
                spi0 = "/palmbus@1E000000/spi@b00";
                memc = "/palmbus@1E000000/memc@5000";
                uartlite = "/palmbus@1E000000/uartlite@c00";
                sdhci = "/sdhci@1E130000";
                sysclock = "/sysclock@0";
                clkctrl = "/clkctrl";
                rgmii2_pins = "/pinctrl/rgmii2";
                xhci = "/xhci@1E1C0000";
                ethsys = "/syscon@1e000000";
                spi_pins = "/pinctrl/spi";
                uart3_pins = "/pinctrl/uart3";
                cpuintc = "/cpuintc@0";
                hsdma = "/palmbus@1E000000/hsdma@7000";
                gic = "/interrupt-controller@1fbc0000";
                rgmii1_pins = "/pinctrl/rgmii1";
                leds = "/leds";
                palmbus = "/palmbus@1E000000";
                uart2_pins = "/pinctrl/uart2";
                state_default = "/pinctrl/pinctrl0";
                phy1f = "/ethernet@1e100000/mdio-bus/ethernet-phy@1f";
                nand = "/nand@1e003000";
                ethernet = "/ethernet@1e100000";
                pcie = "/pcie@1e140000";
                gpio_i2c_25 = "/palmbus@1E000000/i2c@900/pca9555@25";
                wdt = "/palmbus@1E000000/wdt@100";
                uart1_pins = "/pinctrl/uart1";
                gpio1 = "/palmbus@1E000000/gpio@600/bank@1";
                i2s = "/palmbus@1E000000/i2s@a00";
                gdma = "/palmbus@1E000000/gdma@2800";
                pcie_pins = "/pinctrl/pcie";
                i2c_pins = "/pinctrl/i2c";
                cpuclock = "/cpuclock@0";
                mc = "/palmbus@1E000000/mc@1fbf8000";
                factory = "/nand@1e003000/partition@e0000";
                cpc = "/palmbus@1E000000/cpc@1fbf0000";
                sysc = "/palmbus@1E000000/sysc@0";
                rstctrl = "/rstctrl";
                pinctrl = "/pinctrl";
                i2c = "/palmbus@1E000000/i2c@900";
                gsw = "/gsw@1e110000";
                mdio_pins = "/pinctrl/mdio";
        };

        pcie@1e140000 {
                compatible = "mediatek,mt7621-pci";
                clocks = <0xc 0x18 0xc 0x19 0xc 0x1a>;
                resets = <0x2 0x18 0x2 0x19 0x2 0x1a>;
                device_type = "pci";
                clock-names = "pcie0", "pcie1", "pcie2";
                ranges = <0x2000000 0x0 0x0 0x60000000 0x0 0x10000000 0x1000000 0x0 0x0 0x1e160000 0x0 0x10000>;
                status = "okay";
                bus-range = <0x0 0xff>;
                interrupt-parent = <0x4>;
                #address-cells = <0x3>;
                interrupts = <0x0 0x4 0x4 0x0 0x18 0x4 0x0 0x19 0x4>;
                #size-cells = <0x2>;
                phandle = <0x2c>;
                reg = <0x1e140000 0x100 0x1e142000 0x100>;
                pinctrl-0 = <0xb>;
                reset-names = "pcie0", "pcie1", "pcie2";
                linux,phandle = <0x2c>;
                pinctrl-names = "default";

                pcie2 {
                        device_type = "pci";
                        #address-cells = <0x3>;
                        #size-cells = <0x2>;
                        reg = <0x1000 0x0 0x0 0x0 0x0>;
                };

                pcie0 {
                        device_type = "pci";
                        #address-cells = <0x3>;
                        #size-cells = <0x2>;
                        reg = <0x0 0x0 0x0 0x0 0x0>;
                };

                pcie1 {
                        device_type = "pci";
                        #address-cells = <0x3>;
                        #size-cells = <0x2>;
                        reg = <0x800 0x0 0x0 0x0 0x0>;
                };
        };

        leds {
                compatible = "gpio-leds";
                phandle = <0x2d>;
                linux,phandle = <0x2d>;

                pwr_blue {
                        gpios = <0xe 0x10 0x0>;
                        default-state = "on";
                };

                pwr_white {
                        gpios = <0xe 0xd 0x0>;
                        default-state = "off";
                };
        };

        aliases {
                serial1 = "/palmbus@1E000000/uartlite@c00";
        };

        cpuintc@0 {
                compatible = "mti,cpu-interrupt-controller";
                #interrupt-cells = <0x1>;
                #address-cells = <0x0>;
                phandle = <0xf>;
                linux,phandle = <0xf>;
                interrupt-controller;
        };

        sysclock@0 {
                compatible = "fixed-clock";
                #clock-cells = <0x0>;
                phandle = <0x1>;
                clock-frequency = <0x2faf080>;
                linux,phandle = <0x1>;
        };

        gsw@1e110000 {
                compatible = "mediatek,mt7621-gsw";
                interrupt-parent = <0x4>;
                interrupts = <0x0 0x17 0x4 0x0 0xc 0x4>;
                phandle = <0x9>;
                reg = <0x1e110000 0x8000>;
                linux,phandle = <0x9>;
                interrupt-names = "gsw", "rtl8367_int";
        };

        xhci@1E1C0000 {
                compatible = "mediatek,mt8173-xhci";
                clocks = <0x1>;
                clock-names = "sys_ck";
                status = "okay";
                interrupt-parent = <0x4>;
                interrupts = <0x0 0x16 0x4>;
                phandle = <0x27>;
                reg = <0x1e1c0000 0x1000 0x1e1d0700 0x100>;
                linux,phandle = <0x27>;
        };

        interrupt-controller@1fbc0000 {
                compatible = "mti,gic";
                #interrupt-cells = <0x3>;
                mti,reserved-cpu-vectors = <0x7>;
                phandle = <0x4>;
                reg = <0x1fbc0000 0x2000>;
                linux,phandle = <0x4>;
                interrupt-controller;

                timer {
                        compatible = "mti,gic-timer";
                        clocks = <0x8>;
                        interrupts = <0x1 0x1 0x0>;
                };
        };

        gpio-keys-polled {
                compatible = "gpio-keys-polled";
                poll-interval = <0x14>;
                #address-cells = <0x1>;
                #size-cells = <0x0>;

                reset {
                        gpios = <0xd 0xc 0x1>;
                        label = "reset";
                        linux,code = <0x198>;
                };
        };

        cpuclock@0 {
                compatible = "fixed-clock";
                #clock-cells = <0x0>;
                phandle = <0x8>;
                clock-frequency = <0x3473bc00>;
                linux,phandle = <0x8>;
        };

        syscon@1e000000 {
                compatible = "mediatek,mt7621-ethsys", "syscon";
                #clock-cells = <0x1>;
                phandle = <0x2b>;
                reg = <0x1e000000 0x1000>;
                linux,phandle = <0x2b>;
        };

        cpus {

                cpu@1 {
                        compatible = "mips,mips1004Kc";
                };

                cpu@0 {
                        compatible = "mips,mips1004Kc";
                };
        };

        rstctrl {
                compatible = "ralink,rt2880-reset";
                #reset-cells = <0x1>;
                phandle = <0x2>;
                linux,phandle = <0x2>;
        };

        pinctrl {
                compatible = "ralink,rt2880-pinmux";
                phandle = <0x1d>;
                pinctrl-0 = <0x7>;
                linux,phandle = <0x1d>;
                pinctrl-names = "default";

                mdio {
                        phandle = <0x23>;
                        linux,phandle = <0x23>;

                        mdio {
                                ralink,group = "mdio";
                                ralink,function = "mdio";
                        };
                };

                rgmii1 {
                        phandle = <0x21>;
                        linux,phandle = <0x21>;

                        rgmii1 {
                                ralink,group = "rgmii1";
                                ralink,function = "rgmii1";
                        };
                };

                sdhci {
                        phandle = <0x25>;
                        linux,phandle = <0x25>;

                        sdhci {
                                ralink,group = "sdhci";
                                ralink,function = "sdhci";
                        };
                };

                uart2 {
                        phandle = <0x1f>;
                        linux,phandle = <0x1f>;

                        uart2 {
                                ralink,group = "uart2";
                                ralink,function = "uart2";
                        };
                };

                nand {
                        phandle = <0x24>;
                        linux,phandle = <0x24>;

                        sdhci-nand {
                                ralink,group = "sdhci";
                                ralink,function = "nand2";
                        };

                        spi-nand {
                                ralink,group = "spi";
                                ralink,function = "nand1";
                        };
                };

                pinctrl0 {
                        phandle = <0x7>;
                        linux,phandle = <0x7>;

                        gpio {
                                ralink,group = "uart2", "uart3", "rgmii2", "sdhci";
                                ralink,function = "gpio";
                        };
                };

                spi {
                        phandle = <0x6>;
                        linux,phandle = <0x6>;

                        spi {
                                ralink,group = "spi";
                                ralink,function = "spi";
                        };
                };

                pcie {
                        phandle = <0xb>;
                        linux,phandle = <0xb>;

                        pcie {
                                ralink,group = "pcie";
                                ralink,function = "pcie rst";
                        };
                };

                rgmii2 {
                        phandle = <0x22>;
                        linux,phandle = <0x22>;

                        rgmii2 {
                                ralink,group = "rgmii2";
                                ralink,function = "rgmii2";
                        };
                };

                uart3 {
                        phandle = <0x20>;
                        linux,phandle = <0x20>;

                        uart3 {
                                ralink,group = "uart3";
                                ralink,function = "uart3";
                        };
                };

                uart1 {
                        phandle = <0x1e>;
                        linux,phandle = <0x1e>;

                        uart1 {
                                ralink,group = "uart1";
                                ralink,function = "uart1";
                        };
                };

                i2c {
                        phandle = <0x3>;
                        linux,phandle = <0x3>;

                        i2c {
                                ralink,group = "i2c";
                                ralink,function = "i2c";
                        };
                };
        };
};
In your case, based on the HW TRAP value. RTL8367RB is wired to it talks to PORT 5 of the switch.
so the diagram looks more like this: MT7621 GMAC0 -> RGMII BUS -> MT7530 PORT 6 -> MT7530 SWITCH -> MT7530 PORT 5 -> RGMII2 BUS -> RTL8367RB PORT x -> RTL8367RB switch -> RTL8367RB other ports.

So, seeing this, we devised a:

/ {
        model = "Ubiquiti EdgeRouter 10X";
        compatible = "ubnt,edgerouter-10x", "mediatek,mt7621-soc";

        rtl8367rb {
                compatible = "realtek,rtl8367b";
        };
};

&mdio {
	ephy29: ethernet-phy@29 {
		reg = <29>;
	};
};

&switch0 {
	ports {
		port@5 {
			reg = <5>;
			label = "eth5";
			phy-handle = <&ephy29>;
			phy-mode = "rgmii";
			mtd-mac-address = <&factory 0x22>;
			mtd-mac-address-increment = <5>;
		};
	};
};
[    8.596232] rtl8367b rtl8367rb: cannot find mdio node phandle
[    8.607755] rtl8367b rtl8367rb: gpios missing in devictree
[    8.618720] rtl8367b: probe of rtl8367rb failed with error -22
[    8.632009] libphy: Fixed MDIO Bus: probed
[    8.668510] libphy: mdio: probed
[    8.675394] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    8.702178] mtk_soc_eth 1e100000.ethernet dsa: mediatek frame engine at 0xbe100000, irq 22
[    8.723811] NET: Registered protocol family 10
[    8.734307] Segment Routing with IPv6
[    8.741814] NET: Registered protocol family 17
[    8.751089] 8021q: 802.1Q VLAN Support v1.8
[    8.761171] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    8.850916] libphy: dsa slave smi: probed
[    8.859428] mt7530 mdio-bus:1f eth0 (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY] (irq=POLL)
[    8.879616] mt7530 mdio-bus:1f eth1 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY] (irq=POLL)
[    8.899790] mt7530 mdio-bus:1f eth2 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY] (irq=POLL)
[    8.919978] mt7530 mdio-bus:1f eth3 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY] (irq=POLL)
[    8.940148] mt7530 mdio-bus:1f eth4 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY] (irq=POLL)
[    8.960317] mt7530 mdio-bus:1f eth5 (uninitialized): validation of rgmii with support 0000000,00000000,00006280 and advertisement 0000000,00000000,00006280 failed: -22
[    8.990356] mt7530 mdio-bus:1f eth5 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 5
[    9.010175] mt7530 mdio-bus:1f: configuring for fixed/rgmii link mode
[    9.028114] DSA: tree 0 setup

Well.. Some sort of progress. I've now got eth5 showing and listed as UP, but I suspect I'm not actually using it.. I know the LEDs don't work, but I suspect they won't until I figure out the LED settings for the dts.

Any suggestions @LGA1150 ?

[    8.596700] libphy: Fixed MDIO Bus: probed
[    8.631453] libphy: mdio: probed
[    8.638355] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    8.664936] mtk_soc_eth 1e100000.ethernet dsa: mediatek frame engine at 0xbe100000, irq 22
[    8.686570] NET: Registered protocol family 10
[    8.696934] Segment Routing with IPv6
[    8.704368] NET: Registered protocol family 17
[    8.713660] 8021q: 802.1Q VLAN Support v1.8
[    8.723819] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    8.814386] libphy: dsa slave smi: probed
[    8.822870] mt7530 mdio-bus:1f eth0 (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY] (irq=POLL)
[    8.843124] mt7530 mdio-bus:1f eth1 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY] (irq=POLL)
[    8.863390] mt7530 mdio-bus:1f eth2 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY] (irq=POLL)
[    8.883715] mt7530 mdio-bus:1f eth3 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY] (irq=POLL)
[    8.904012] mt7530 mdio-bus:1f eth4 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY] (irq=POLL)
[    8.924312] mt7530 mdio-bus:1f eth5 (uninitialized): PHY [mdio-bus:00] driver [Generic PHY] (irq=POLL)
[    8.944870] mt7530 mdio-bus:1f: configuring for fixed/rgmii link mode
[    8.962789] DSA: tree 0 setup
root@OpenWrt:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr 74:AC:B9:
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fd42:bcc8:69d1:4::1/62 Scope:Global
          inet6 addr: fe80::76ac:b9ff:feeb:4376/64 Scope:Link
          inet6 addr: fd24:7d53:8eee::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1360 errors:0 dropped:0 overruns:0 frame:0
          TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:118929 (116.1 KiB)  TX bytes:9016 (8.8 KiB)

dsa       Link encap:Ethernet  HWaddr 74:AC:B9:
          inet6 addr: fe80::76ac:b9ff:feeb:4375/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1504  Metric:1
          RX packets:2315 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1325 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:305761 (298.5 KiB)  TX bytes:147710 (144.2 KiB)
          Interrupt:22

eth0      Link encap:Ethernet  HWaddr 74:AC:B9:
          inet addr:192.168.200.161  Bcast:192.168.200.255  Mask:255.255.255.0
          inet6 addr: fe80::76ac:b9ff:feeb:4375/64 Scope:Link
          inet6 addr: fd42:bcc8:69d1::9b7/128 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:955 errors:0 dropped:8 overruns:0 frame:0
          TX packets:392 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:145162 (141.7 KiB)  TX bytes:35790 (34.9 KiB)

eth1      Link encap:Ethernet  HWaddr 74:AC:B9:
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1360 errors:0 dropped:0 overruns:0 frame:0
          TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:118929 (116.1 KiB)  TX bytes:8224 (8.0 KiB)

eth2      Link encap:Ethernet  HWaddr 74:AC:B9:
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth3      Link encap:Ethernet  HWaddr 74:AC:B9:
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth4      Link encap:Ethernet  HWaddr 74:AC:B9:
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth5      Link encap:Ethernet  HWaddr 74:AC:B9:
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:843 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:92018 (89.8 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:89 errors:0 dropped:0 overruns:0 frame:0
          TX packets:89 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6940 (6.7 KiB)  TX bytes:6940 (6.7 KiB)

root@OpenWrt:/#

Try this

/ {
	rtl8367rb {
		compatible = "realtek,rtl8367b";
		cpu_port = <7>;
		realtek,extif2 = <1 0 1 1 1 1 1 1 2>;
		mii-bus = <&mdio>;
	};
};

&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;
			};
		};
	};
};

I found later that the Port <6> I had for the cpu_port killed my Network.. I changed it to what you had, and network works again (primary ports 0-4) but still nothing on the RTL switch.

I wonder if phy-mode shiould be rgmii or trgmii rather than rgmii-rxid? I'll play with the settings, but I found https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/net/dsa/mt7530.txt#L43. Does this make any sense to you @LGA1150 ?

Does the RTL swconfig driver at least recognise the switch?

The RTL switch does not support TRGMII. I am not sure if rxid should be used. rxid is found in ER-X-SFP dts, which has a similar configuration (7530 Port 5 --> AR8033 PHY).
cc @Thirsty

I'm new to swconfig, give me a hint on how to test? My primary devices don't use a switch on it, just three full ethernet ports

I had looked at the sfp device, but I didn't know how to convert it to the RTL switch since the sfp is a single transceiver slot rather than a switch itself. I'll test the various types and see :slight_smile:

[    8.477963] rtl8367b rtl8367rb: cannot find mdio bus from bus handle (yet)
[    8.493190] libphy: Fixed MDIO Bus: probed
[    8.528145] libphy: mdio: probed
[    8.534994] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    8.561438] mtk_soc_eth 1e100000.ethernet dsa: mediatek frame engine at 0xbe100000, irq 22
[    8.582794] NET: Registered protocol family 10
[    8.593009] Segment Routing with IPv6
[    8.600461] NET: Registered protocol family 17
[    8.609725] 8021q: 802.1Q VLAN Support v1.8
[    8.619851] rtl8367b rtl8367rb: using MDIO bus 'mdio'
[    8.630895] rtl8367b rtl8367rb: unknown chip num:0000 ver:0000, mode:0000
[    8.644473] rtl8367b rtl8367rb: chip detection failed, err=-19
[    8.656203] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    8.745743] libphy: dsa slave smi: probed
[    8.754212] mt7530 mdio-bus:1f eth0 (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY] (irq=POLL)
[    8.774401] mt7530 mdio-bus:1f eth1 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY] (irq=POLL)
[    8.794510] mt7530 mdio-bus:1f eth2 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY] (irq=POLL)
[    8.814642] mt7530 mdio-bus:1f eth3 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY] (irq=POLL)
[    8.834711] mt7530 mdio-bus:1f eth4 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY] (irq=POLL)
[    8.856221] mt7530 mdio-bus:1f: configuring for fixed/rgmii link mode
[    8.874085] DSA: tree 0 setup
[    8.881501] UBI: auto-attach mtd5
[    8.888139] ubi0: attaching mtd5
[    8.894938] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control off
[   13.970088] ubi0: scanning is finished
[   14.000199] ubi0: attached mtd5 (name "ubi", size 500 MiB)
[   14.011174] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[   14.024870] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[   14.038392] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[   14.052256] ubi0: good PEBs: 4003, bad PEBs: 3, corrupted PEBs: 0
[   14.064402] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[   14.078792] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 157515308
[   14.096809] ubi0: available PEBs: 0, total reserved PEBs: 4003, PEBs reserved for bad PEB handling: 77
[   14.115379] ubi0: background thread "ubi_bgt0d" started, PID 373
[   14.138524] Freeing unused kernel memory: 3024K
[   14.147589] This architecture does not have kernel memory protection.
[   14.160434] Run /init as init process
[   14.451484] init: Console is alive
[   14.458860] init: - watchdog -
[   14.474877] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[   14.492446] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[   14.517502] init: - preinit -
ip: SIOCSIFFLAGS: Network is down
[   14.711402] random: jshn: uninitialized urandom read (4 bytes read)
[   14.782683] random: jshn: uninitialized urandom read (4 bytes read)
[   14.822821] random: jshn: uninitialized urandom read (4 bytes read)
ip: SIOCSIFFLAGS: Network is down
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
sendto(): Network unreachable
sendto(): Network unreachable
[   19.163134] procd: - early -
[   19.169011] procd: - watchdog -
[   19.709320] procd: - watchdog -
[   19.716047] procd: - ubus -
[   19.728314] urandom_read: 6 callbacks suppressed
[   19.728328] random: ubusd: uninitialized urandom read (4 bytes read)
[   19.776642] procd: - init -
Please press Enter to activate this console.
[   20.097459] kmodloader: loading kernel modules from /etc/modules.d/*
[   20.213687] xt_time: kernel timezone is -0000
[   20.230855] urngd: v1.0.2 started.
[   20.235263] PPP generic driver version 2.4.2
[   20.247444] NET: Registered protocol family 24
[   20.280180] kmodloader: done loading kernel modules from /etc/modules.d/*
[   20.383873] random: crng init done
[   34.602604] mtk_soc_eth 1e100000.ethernet dsa: configuring for fixed/rgmii link mode
[   34.618880] mtk_soc_eth 1e100000.ethernet dsa: Link is Up - 1Gbps/Full - flow control rx/tx
[   34.622065] device dsa entered promiscuous mode
[   34.645456] mt7530 mdio-bus:1f eth1: configuring for phy/gmii link mode
[   34.659668] 8021q: adding VLAN 0 to HW filter on device eth1
[   34.674368] IPv6: ADDRCONF(NETDEV_CHANGE): dsa: link becomes ready
[   34.688413] br-lan: port 1(eth1) entered blocking state
[   34.699251] br-lan: port 1(eth1) entered disabled state
[   34.710906] device eth1 entered promiscuous mode
[   34.748716] mt7530 mdio-bus:1f eth2: configuring for phy/gmii link mode
[   34.763005] 8021q: adding VLAN 0 to HW filter on device eth2
[   34.779260] br-lan: port 2(eth2) entered blocking state
[   34.789833] br-lan: port 2(eth2) entered disabled state
[   34.802242] device eth2 entered promiscuous mode
[   34.824138] mt7530 mdio-bus:1f eth3: configuring for phy/gmii link mode
[   34.838116] 8021q: adding VLAN 0 to HW filter on device eth3
[   34.853063] br-lan: port 3(eth3) entered blocking state
[   34.863657] br-lan: port 3(eth3) entered disabled state
[   34.875614] device eth3 entered promiscuous mode
[   34.895931] mt7530 mdio-bus:1f eth4: configuring for phy/gmii link mode
[   34.909825] 8021q: adding VLAN 0 to HW filter on device eth4
[   34.924781] br-lan: port 4(eth4) entered blocking state
[   34.935492] br-lan: port 4(eth4) entered disabled state
[   34.948112] device eth4 entered promiscuous mode
[   34.969295] mt7530 mdio-bus:1f eth5: configuring for fixed/rgmii-rxid link mode
[   34.984521] 8021q: adding VLAN 0 to HW filter on device eth5
[   35.000682] mt7530 mdio-bus:1f eth5: Link is Up - 1Gbps/Full - flow control rx/tx
[   35.019154] br-lan: port 5(eth5) entered blocking state
[   35.029748] br-lan: port 5(eth5) entered disabled state
[   35.042982] device eth5 entered promiscuous mode
[   35.056847] br-lan: port 5(eth5) entered blocking state
[   35.067356] br-lan: port 5(eth5) entered forwarding state
[   35.080824] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   35.221412] mt7530 mdio-bus:1f eth0: configuring for phy/gmii link mode
[   35.235340] 8021q: adding VLAN 0 to HW filter on device eth0
[   38.325636] mt7530 mdio-bus:1f eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   38.340613] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

It looks like the rtl chip isn't reporting the correct chip version

[    8.630895] rtl8367b rtl8367rb: unknown chip num:0000 ver:0000, mode:0000
[    8.644473] rtl8367b rtl8367rb: chip detection failed, err=-19

It isn't returning the 0x1000 I'd expect it to in the drivers/net/phy/rtl8367b.c but is returning 0x0000

The RTL8367RB driver in OpenWrt hardcodes its PHY address to 0, but it conflicts with the internal PHY 0 of the MT7530 switch.

Try changing it to 29 (0x1d).

Well, getting closer I think :slight_smile:

[    8.623794] rtl8367b rtl8367rb: using MDIO bus 'mdio'
[    8.634803] rtl8367b rtl8367rb: unknown chip num:6367 ver:0020, mode:0020
[    8.648327] rtl8367b rtl8367rb: chip detection failed, err=-19
[    8.660048] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module

It at least is reporting a chip number now! Still no joy on the RTL switch working.. swconfig list returns nothing.

I wonder if adding a case for 0x18DF would do something interesting