Adding OpenWrt support for Zyxel EX5601-T0

You did not do what I suggested

i Just recompiled without fixed link on lan5 but that's not appearing at all in the bootlog.

// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/*
 * Copyright (C) 2021 MediaTek Inc.
 * Author: Sam.Shih <sam.shih@mediatek.com>
 */

/dts-v1/;
#include "mt7986a.dtsi"

/ {
	model = "MediaTek MT7986a RFB";
	compatible = "mediatek,mt7986a-rfb";

	aliases {
		serial0 = &uart0;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	memory {
		reg = <0 0x40000000 0 0x40000000>;
	};

	reg_1p8v: regulator-1p8v {
		compatible = "regulator-fixed";
		regulator-name = "fixed-1.8V";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		regulator-boot-on;
		regulator-always-on;
	};

	reg_3p3v: regulator-3p3v {
		compatible = "regulator-fixed";
		regulator-name = "fixed-3.3V";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-boot-on;
		regulator-always-on;
	};

	reg_5v: regulator-5v {
		compatible = "regulator-fixed";
		regulator-name = "fixed-5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-boot-on;
		regulator-always-on;
	};
};

&eth {
	status = "okay";

	gmac0: mac@0 {
		compatible = "mediatek,eth-mac";
		reg = <0>;
		phy-mode = "2500base-x";

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

	gmac1: mac@1 {
		compatible = "mediatek,eth-mac";
		reg = <1>;
		phy-mode = "2500base-x";

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

	mdio: mdio-bus {
		#address-cells = <1>;
		#size-cells = <0>;
	};
};

&wmac {
	status = "okay";
	pinctrl-names = "default", "dbdc";
	pinctrl-0 = <&wf_2g_5g_pins>;
	pinctrl-1 = <&wf_dbdc_pins>;
};

&mdio {
	phy5: phy@5 {
		compatible = "ethernet-phy-id67c9.de0a";
		reg = <5>;
		reset-gpios = <&pio 6 1>;
		reset-assert-us = <50000>;
		reset-deassert-us = <20000>;
		phy-mode = "2500base-x";
		maxlinear,led-reg = <1008 0 0 0>;
		ifname = "lan5";
	};

	phy6: phy@6 {
		compatible = "ethernet-phy-id67c9.de0a";
		reg = <6>;
		phy-mode = "2500base-x";
		maxlinear,led-reg = <240 0 0 0>;
		ifname = "eth1";
	};

	switch: switch@0 {
		compatible = "mediatek,mt7531";
		reg = <31>;
		reset-gpios = <&pio 5 0>;
	};
};

&crypto {
	status = "okay";
};

&mmc0 {
	pinctrl-names = "default", "state_uhs";
	pinctrl-0 = <&mmc0_pins_default>;
	pinctrl-1 = <&mmc0_pins_uhs>;
	bus-width = <8>;
	max-frequency = <200000000>;
	cap-mmc-highspeed;
	mmc-hs200-1_8v;
	mmc-hs400-1_8v;
	hs400-ds-delay = <0x14014>;
	vmmc-supply = <&reg_3p3v>;
	vqmmc-supply = <&reg_1p8v>;
	non-removable;
	no-sd;
	no-sdio;
	status = "disabled";
};

&pcie {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie_pins>;
	status = "okay";
};

&pcie_phy {
	status = "okay";
};

&pio {
	mmc0_pins_default: mmc0-pins {
		mux {
			function = "emmc";
			groups = "emmc_51";
		};
		conf-cmd-dat {
			pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
			       "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
			       "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
			input-enable;
			drive-strength = <4>;
			mediatek,pull-up-adv = <1>;	/* pull-up 10K */
		};
		conf-clk {
			pins = "EMMC_CK";
			drive-strength = <6>;
			mediatek,pull-down-adv = <2>;	/* pull-down 50K */
		};
		conf-ds {
			pins = "EMMC_DSL";
			mediatek,pull-down-adv = <2>;	/* pull-down 50K */
		};
		conf-rst {
			pins = "EMMC_RSTB";
			drive-strength = <4>;
			mediatek,pull-up-adv = <1>;	/* pull-up 10K */
		};
	};

	mmc0_pins_uhs: mmc0-uhs-pins {
		mux {
			function = "emmc";
			groups = "emmc_51";
		};
		conf-cmd-dat {
			pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
			       "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
			       "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
			input-enable;
			drive-strength = <4>;
			mediatek,pull-up-adv = <1>;	/* pull-up 10K */
		};
		conf-clk {
			pins = "EMMC_CK";
			drive-strength = <6>;
			mediatek,pull-down-adv = <2>;	/* pull-down 50K */
		};
		conf-ds {
			pins = "EMMC_DSL";
			mediatek,pull-down-adv = <2>;	/* pull-down 50K */
		};
		conf-rst {
			pins = "EMMC_RSTB";
			drive-strength = <4>;
			mediatek,pull-up-adv = <1>;	/* pull-up 10K */
		};
	};

	pcie_pins: pcie-pins {
		mux {
			function = "pcie";
			groups = "pcie_clk", "pcie_wake", "pcie_pereset";
		};
	};

	spic_pins_g2: spic-pins-29-to-32 {
		mux {
			function = "spi";
			groups = "spi1_2";
		};
	};

	spi_flash_pins: spi-flash-pins-33-to-38 {
		mux {
			function = "spi";
			groups = "spi0", "spi0_wp_hold";
		};
		conf-pu {
			pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
			drive-strength = <8>;
			mediatek,pull-up-adv = <0>;	/* bias-disable */
		};
		conf-pd {
			pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
			drive-strength = <8>;
			mediatek,pull-down-adv = <0>;	/* bias-disable */
		};
	};

	uart1_pins: uart1-pins {
		mux {
			function = "uart";
			groups = "uart1";
		};
	};

	uart2_pins: uart2-pins {
		mux {
			function = "uart";
			groups = "uart2";
		};
	};

	wf_2g_5g_pins: wf_2g_5g-pins {
		mux {
			function = "wifi";
			groups = "wf_2g", "wf_5g";
		};
		conf {
			pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
			       "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
			       "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
			       "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
			       "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
			       "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
			       "WF1_TOP_CLK", "WF1_TOP_DATA";
			drive-strength = <4>;
		};
	};

	wf_dbdc_pins: wf_dbdc-pins {
		mux {
			function = "wifi";
			groups = "wf_dbdc";
		};
		conf {
			pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
			       "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
			       "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
			       "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
			       "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
			       "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
			       "WF1_TOP_CLK", "WF1_TOP_DATA";
			drive-strength = <4>;
		};
	};
};

&spi0 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi_flash_pins>;
	cs-gpios = <0>, <0>;
	#address-cells = <1>;
	#size-cells = <0>;
	status = "disabled";
};

&spi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&spic_pins_g2>;
	status = "okay";

	proslic_spi: proslic_spi@0 {
		compatible = "silabs,proslic_spi";
		reg = <0>;
		spi-max-frequency = <10000000>;
		spi-cpha = <1>;
		spi-cpol = <1>;
		channel_count = <1>;
		debug_level = <4>;       /* 1 = TRC, 2 = DBG, 4 = ERR */
		reset_gpio = <&pio 7 0>;
		ig,enable-spi = <1>;     /* 1: Enable, 0: Disable */
	};
};

&switch {
	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@1 {
			reg = <1>;
			label = "lan1";
		};

		port@2 {
			reg = <2>;
			label = "lan2";
		};

		port@3 {
			reg = <3>;
			label = "lan3";
		};

		port@5 {
			reg = <5>;
			label = "lan5";
			phy-mode= "2500base-x";
			phy-handle = <&phy5>;
		};

		port@6 {
			reg = <6>;
			ethernet = <&gmac0>;
			phy-mode = "2500base-x";

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

&ssusb {
	vusb33-supply = <&reg_3p3v>;
	vbus-supply = <&reg_5v>;
	status = "okay";
};

&uart0 {
	status = "okay";
};

&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart1_pins>;
	status = "okay";
};

&uart2 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart2_pins>;
	status = "okay";
};

&usb_phy {
	status = "okay";
};
[    5.133786] mt7530 mdio-bus:1f: no interrupt support
[    5.187483] mt7530 mdio-bus:1f lan1 (uninitialized): PHY [mt7530-0:01] driver [MediaTek MT7531 PHY] (irq=POLL)
[    5.207307] mt7530 mdio-bus:1f lan2 (uninitialized): PHY [mt7530-0:02] driver [MediaTek MT7531 PHY] (irq=POLL)
[    5.226840] mt7530 mdio-bus:1f lan3 (uninitialized): PHY [mt7530-0:03] driver [MediaTek MT7531 PHY] (irq=POLL)
[    5.277850] mt7530 mdio-bus:1f lan5 (uninitialized): validation of 2500base-x with support 0000000,00000000,00006000 and advertisement 0000000,00000000,00006000 failed: -22
[    5.357013] mt7530 mdio-bus:1f lan5 (uninitialized): failed to connect to PHY: -EINVAL
[    5.364910] mt7530 mdio-bus:1f lan5 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 5

I managed to make the SFP work, I added the mtk feed and added a package that allows me to switch between SPF and eth wan (reusing Zyxel scripts).

I'm than able to plug an SFP, ping it and ssh into it too.

As soon as I remove the SFP the script switch back to eth mode.

Still lan2.5 and wan eth 2.5 are not working.

Too no matter what if I remove the fixed link 2500 stuff from the dts the bootlog will be full of

[    5.277850] mt7530 mdio-bus:1f lan5 (uninitialized): validation of 2500base-x with support 0000000,00000000,00006000 and advertisement 0000000,00000000,00006000 failed: -22
[    5.357013] mt7530 mdio-bus:1f lan5 (uninitialized): failed to connect to PHY: -EINVAL
[    5.364910] mt7530 mdio-bus:1f lan5 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 5

Hence there must be something weird on how Zyxel wired this stuff.

I'm done, i don't know what else to do.

I m sure Zyxel did many changes to the software too (which is why IMHO their source code has additional stuff inside the /target/Linux/mediatek/files* folder)

Anyone can suggest here what to do next?

The problem is that none of the two work :smiley: with the work i've currently done I'm able to use only wifi, 3 gbit ports and the wan sfp 2.5. So you end up losing the 2.5lan port which is the nicest thing of this router.

I'm still investigating in the hardware of this router and I think the following:

probably both the lan 2.5 and the wan 2.5 are XOR ports of the respectives sfp/ethernet ports, if you look closely there are 2 sfp cages indeed.. That's why I'm able to use the wan 2.5 sfp (thanks to the zyxel script exporting the GPIOs).

There unfortunately is no script to switch the LAN 2.5 gpio pins from sfp to ethernet (probably the zyxel firmware has something embedded in the code to default to eth ports both the two phys.)

these are the script that detect the sfp and switch to it the wan port or to ethernet port
zyxel-ex5601t0/sfp_wan.sh at V5.70(ACDZ.0)C0 · ErnyTech/zyxel-ex5601t0 (github.com)
zyxel-ex5601t0/check_sfp_link.sh at V5.70(ACDZ.0)C0 · ErnyTech/zyxel-ex5601t0 (github.com)

There is no script to switch the lan port to ethernet instead of sfp (there is no need to because the case of the router will physically deny you access to it hence the zyxel firmware will default to lan ethernet 2.5)

I compiled the zyxel DTS but the clock mappings of the zyxel firmware are not matching the clock mappings of the default openwrt mt7986a.dtsi. Hence you need to change the clock mappings into zyxel-ex5601t0/mt7986-clk.h at V5.70(ACDZ.0)C0 · ErnyTech/zyxel-ex5601t0 (github.com) and everything messes up.
zyxel-ex5601t0/ex5601-t0.dts at V5.70(ACDZ.0)C0 · ErnyTech/zyxel-ex5601t0 (github.com)

this is the result than :smiley:

[    0.414998] of_clk_src_onecell_get: invalid clock index 75
[    0.420552] clk: couldn't get assigned clock 0 for /ethernet@15100000
[    0.427044] mtk_soc_eth: probe of 15100000.ethernet failed with error -22

Ok I'm back with some news.

I had suspects that the 5.15 kernel is not really ok with this device (the mediatek feeds and git repos are only referring to 5.4) indeed the zyxel firmware mt7986a.dtsi is based on kernel 5.4 (owrt 21.02) and in 5.15 many clock mappings are missing.

So i decided to

git clone --branch openwrt-21.02 https://git.openwrt.org/openwrt/openwrt.git

add mediatek feeds, update and install all the feeds and than
git clone mediatek repo.

Merge the mediatek stuff with the owrt 21.02 repo with prepare_sdk.sh and started working on the DTS (this was very easy because the mt7986a.dtsi was totally the same of the zyxel firmware, including clock and stuff)

I compiled and nothing, neither in this version the lan 2,5 ethernet and wan 2.5 ethernet are working.
So there must be something in the zyxel code which swaps the phy to ethernet mode.

After hours i found it!
During init here is what happens:

Set: port6 dev1Eh_reg8h = 0xA4E2
Set: port5 dev1Eh_reg8h = 0xA4E2

I started looking for strings inside binaries and here we go:

mii_mgr_cl45 -s -p 0x6 -d 0x1e -r 0x8 -v A4E2
mii_mgr_cl45 -s -p 0x5 -d 0x1e -r 0x8 -v A4E2

I decided to look for any commands regarding mii_mgr_cl45
and here we go:

mii_mgr_cl45 -g -p 0x6 -d 0x0 -r 0x18 > /tmp/port6

these are commands launched from the sfp_wan script to check the status of the wan phy
Now here is the thing

Owrt 21.02 5.4 kernel
root@OpenWrt:/bin# mii_mgr_cl45 -g -p 0x5 -d 0x0 -r 0x18
Get: port5 dev0h_reg18h = 0x0003
root@OpenWrt:/bin# mii_mgr_cl45 -g -p 0x6 -d 0x0 -r 0x18
Get: port6 dev0h_reg18h = 0x020B

Let's try the set commands manually!

mii_mgr_cl45 -s -p 0x6 -d 0x1e -r 0x8 -v A4E2
mii_mgr_cl45 -s -p 0x5 -d 0x1e -r 0x8 -v A4E2

It works!!!! Lan5 2.5 is working (even if not blinking, but I don't care)
the sfp_wan script works and activates the sfp, after removing the sfp even the wan ethernet 2.5 works!

Let's try this with 5.15, and I immediately notice something strange:

Owrt 5.15 kernel
root@OpenWrt:/# mii_mgr_cl45 -g -p 0x6 -d 0x0 -r 0x18
Get: port6 dev0h_reg18h = 0x0000
root@OpenWrt:/# mii_mgr_cl45 -g -p 0x5 -d 0x0 -r 0x18
Get: port5 dev0h_reg18h = 0x0000

Even if I use the set commands the values are not changing and the 2.5 ports are not working.
What's the issue with 5.15?
How do I understand what are good values for mii_mgr settings? I'd like to better understand what I'm really passing to the phys with mii_mgr -s instead of just trying zyxel stuff.

You could say, just use 5.4.... well the wifi is not working in 5.4... the wbsys is declared as Ok, with lsmod i see the mt7915e loaded and in the device tree i see too wbsys. But no radios are brought up and no /etc/config/wireless configuration is generated. Bootlog shows no errors.

@bmork sorry for tagging you directly where did you take
pinctrl-0 = <&eth_pins>;

If I use that the labels $eth_pins is not declared anywhere and the DTS build fails
ERROR (phandle_references): /soc/ethernet@15100000: Reference to non-existent node or label "eth_pins

It's defined right there in the same dts: https://github.com/bmork/openwrt/blob/ex5700/target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts#L249

Don't remember exactly where I found that, but I'm pretty sure I did't invent it myself. Probably direct copy from one of the supported filogic devices

1 Like

I'm becoming blind... sorry. One question in your opinion is a DTS problem the fact that mdio-tools or mii_mgr in kernel 5.15 are not able to edit or get the registers values?

mdio-tools works for me. I even got it running on the OEM firmware by hacking up a few compatibility functions for 5.4 kernels: https://github.com/wkz/mdio-tools/pull/25

If it doesn't work, then I guess it means you mdio bus doesn't work. That sounds like a DTS problem, yes.

Ok, so in your last opinion, I'm sorry for getting back to this but why if I remove

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

from

	port@5 {
		reg = <5>;
		label = "lan5";
		phy-mode= "2500base-x";
		phy-handle = <&phy5>;
	};

I get the following

[    5.277850] mt7530 mdio-bus:1f lan5 (uninitialized): validation of 2500base-x with support 0000000,00000000,00006000 and advertisement 0000000,00000000,00006000 failed: -22
[    5.357013] mt7530 mdio-bus:1f lan5 (uninitialized): failed to connect to PHY: -EINVAL
[    5.364910] mt7530 mdio-bus:1f lan5 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 5

I can't really find an answer to this. And I tried that for the wan (port 6 reg 6), the same thing happens

CONFIG_MT753X_GSW definition missing in kernel_menconfig · Issue #12491 · openwrt/openwrt (github.com)

While I try to figure out the 5.15 phy regs I decided to build a sysupgrade with the Zyxel fwid to see if I can finally flash and boot a firmware with zloader.

To recap I've ubi and ubi2 and zloader is responsible to load one or the other.

So I started with the Zyxel firmware on ubi and via web gui i flashed my custom firmware and it is successfully flashed into ubi2 thanks to the Zyxel build scripts.

The router than reboots and i see that the boot cmdline mentions rootubi=ubi2 which is perfect!

The problem is that a some point I think it's ignoring the command line and loading mtd6 which is ubi!!!

UBI: auto-attach mtd6

The result is the kernel loaded from my firmware but the rootfs loaded from ubi instead of ubi2(i think), a complete mess

Here is the bootlog of my custom firmware flashed on ubi2

ubi0: attaching mtd8
ubi0: scanning is finished
ubi0: attached mtd8 (name "ubi2", size 64 MiB)
ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes
ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
ubi0: VID header offset: 4096 (aligned 4096), data offset: 8192
ubi0: good PEBs: 256, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 5, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 52/44, WL threshold: 4096, image sequence number: 0
ubi0: available PEBs: 0, total reserved PEBs: 256, PEBs reserved for bad PEB handling: 38
Reading from volume 'kernel' to 0x46000000, size 0x0 ... OK
##

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 5.4.238 (piameruo@compiler) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r20110-eab0d53b0d)) #0 SMP Tue Apr 11 14:32:10 2023
[    0.000000] Machine model: MediaTek MT7986a RFB
[    0.000000] earlycon: uart8250 at MMIO32 0x0000000011002000 (options '')
[    0.000000] printk: bootconsole [uart8250] enabled
[    0.000000] On node 0 totalpages: 261136
[    0.000000]   DMA32 zone: 4096 pages used for memmap
[    0.000000]   DMA32 zone: 0 pages reserved
[    0.000000]   DMA32 zone: 261136 pages, LIFO batch:63
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.0
[    0.000000] percpu: Embedded 20 pages/cpu s44056 r8192 d29672 u81920
[    0.000000] pcpu-alloc: s44056 r8192 d29672 u81920 alloc=20*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: kernel page table isolation disabled by kernel configuration
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 257040
[    0.000000] Kernel command line: console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 rootubi=ubi2
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 1013472K/1044544K available (7230K kernel code, 528K rwdata, 2012K rodata, 448K init, 290K bss, 31072K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	CONFIG_RCU_FANOUT set to non-default value of 32.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 640 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] GICv3: Distributor has no Range Selector support
[    0.000000] GICv3: 16 PPIs implemented
[    0.000000] GICv3: no VLPI support, no direct LPI support
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x000000000c080000
[    0.000000] arch_timer: cp15 timer(s) running at 12.98MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x2feb955e7, max_idle_ns: 440795202655 ns
[    0.000002] sched_clock: 56 bits at 12MHz, resolution 77ns, wraps every 4398046511072ns
[    0.008210] Calibrating delay loop (skipped), value calculated using timer frequency.. 25.97 BogoMIPS (lpj=51944)
[    0.018536] pid_max: default: 32768 minimum: 301
[    0.023245] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.030687] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.039361] ASID allocator initialised with 65536 entries
[    0.044842] rcu: Hierarchical SRCU implementation.
[    0.049954] smp: Bringing up secondary CPUs ...
[    0.054750] Detected VIPT I-cache on CPU1
[    0.054769] GICv3: CPU1: found redistributor 1 region 0:0x000000000c0a0000
[    0.054789] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.055037] Detected VIPT I-cache on CPU2
[    0.055048] GICv3: CPU2: found redistributor 2 region 0:0x000000000c0c0000
[    0.055057] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.055278] Detected VIPT I-cache on CPU3
[    0.055286] GICv3: CPU3: found redistributor 3 region 0:0x000000000c0e0000
[    0.055293] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.055320] smp: Brought up 1 node, 4 CPUs
[    0.111934] SMP: Total of 4 processors activated.
[    0.116661] CPU features: detected: 32-bit EL0 Support
[    0.121826] CPU features: detected: CRC32 instructions
[    0.127079] CPU: All CPU(s) started at EL2
[    0.131202] alternatives: patching kernel code
[    0.137896] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.147720] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.154720] pinctrl core: initialized pinctrl subsystem
[    0.160491] NET: Registered protocol family 16
[    0.165144] DMA: preallocated 256 KiB pool for atomic allocations
[    0.171965] pstore: Registered ramoops as persistent store backend
[    0.178195] ramoops: using 0x10000@0x42ff0000, ecc: 0
[    0.191162] cryptd: max_cpu_qlen set to 1000
[    0.196637] SCSI subsystem initialized
[    0.200494] libata version 3.00 loaded.
[    0.204548] usbcore: registered new interface driver usbfs
[    0.210086] usbcore: registered new interface driver hub
[    0.215444] usbcore: registered new device driver usb
[    0.221215] Bluetooth: Core ver 2.22
[    0.224833] NET: Registered protocol family 31
[    0.229298] Bluetooth: HCI device and connection manager initialized
[    0.235689] Bluetooth: HCI socket layer initialized
[    0.240591] Bluetooth: L2CAP socket layer initialized
[    0.245672] Bluetooth: SCO socket layer initialized
[    0.251294] rbus 18000000.wbsys: PCI host bridge to bus 0000:00
[    0.257253] pci_bus 0000:00: root bus resource [mem 0x18000000-0x18ffffff]
[    0.264168] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.269682] pci_bus 0000:00: scanning bus
[    0.273720] pci 0000:00:00.0: [14c3:7986] type 00 class 0x000280
[    0.279768] pci 0000:00:00.0: reg 0x10: [mem 0x18000000-0x1800000f 64bit]
[    0.286594] pci 0000:00:00.0: reg 0x18: [mem 0x00000000-0x0000000f]
[    0.292896] pci 0000:00:00.0: reg 0x1c: [mem 0x00000000-0x0000000f]
[    0.299197] pci 0000:00:00.0: reg 0x20: [mem 0x00000000-0x0000000f]
[    0.305499] pci 0000:00:00.0: reg 0x24: [mem 0x00000000-0x0000000f]
[    0.312620] pci_bus 0000:00: fixups for bus
[    0.316825] pci_bus 0000:00: bus scan returning with max=00
[    0.322689] clocksource: Switched to clocksource arch_sys_counter
[    0.329448] thermal_sys: Registered thermal governor 'fair_share'
[    0.329452] thermal_sys: Registered thermal governor 'bang_bang'
[    0.335592] thermal_sys: Registered thermal governor 'step_wise'
[    0.341631] thermal_sys: Registered thermal governor 'user_space'
[    0.347670] thermal_sys: Registered thermal governor 'power_allocator'
[    0.354015] NET: Registered protocol family 2
[    0.365044] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.372879] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear)
[    0.381300] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.389121] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[    0.396459] TCP: Hash tables configured (established 8192 bind 8192)
[    0.402912] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.409576] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.416741] NET: Registered protocol family 1
[    0.421140] PCI: CLS 0 bytes, default 64
[    0.425757] workingset: timestamp_bits=46 max_order=18 bucket_order=0
[    0.434338] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.440224] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.457864] NET: Registered protocol family 38
[    0.471557] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.478413] printk: console [ttyS0] disabled
[    0.502827] 11002000.serial: ttyS0 at MMIO 0x11002000 (irq = 11, base_baud = 2500000) is a ST16650V2
[    0.512043] printk: console [ttyS0] enabled
[    0.512043] printk: console [ttyS0] enabled
[    0.520401] printk: bootconsole [uart8250] disabled
[    0.520401] printk: bootconsole [uart8250] disabled
[    0.550491] 11003000.serial: ttyS1 at MMIO 0x11003000 (irq = 12, base_baud = 1625000) is a ST16650V2
[    0.579931] 11004000.serial: ttyS2 at MMIO 0x11004000 (irq = 13, base_baud = 1625000) is a ST16650V2
[    0.589497] mtk_rng 1020f000.trng: registered RNG driver
[    0.589703] random: crng init done
[    0.594934] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.605941] loop: module loaded
[    0.609791] mt7986-pinctrl 1001f000.pinctrl: pin_config_set op failed for pin 36
[    0.617186] mtk-spi 1100a000.spi: Error applying setting, reverse things back
[    0.624714] spi-nor spi0.0: unrecognized JEDEC id bytes: ff 2c 34 2c 34 2c
[    0.631599] spi-nor: probe of spi0.0 failed with error -2
[    0.637208] spi-nand spi0.1: Micron SPI NAND was found.
[    0.642437] spi-nand spi0.1: 512 MiB, block size: 256 KiB, page size: 4096, OOB size: 256
[    0.652433] [mtk_hw_init] reset_lock:0, force:0
[    0.656988] [mtk_hw_init] execute fe cold reset
[    0.772780] mtk_soc_eth 15100000.ethernet: generated random MAC address 56:38:e6:59:64:90
[    0.781177] mtk_soc_eth 15100000.ethernet eth0: mediatek frame engine at 0xffffffc011780000, irq 122
[    0.790319] mtk_soc_eth 15100000.ethernet: generated random MAC address ae:33:34:c2:4d:9d
[    0.798646] mtk_soc_eth 15100000.ethernet eth1: mediatek frame engine at 0xffffffc011780000, irq 122
[    0.807769] (unnamed net_device) (dummy): netif_napi_add() called with weight 256
[    0.815472] xhci-mtk 11200000.xhci: 11200000.xhci supply vbus not found, using dummy regulator
[    0.824103] xhci-mtk 11200000.xhci: 11200000.xhci supply vusb33 not found, using dummy regulator
[    0.832995] phy phy-usb-phy@11e10000.1: try to get sw efuse
[    0.838558] phy phy-usb-phy@11e10000.1: try to get sw efuse+
[    0.844218] phy phy-usb-phy@11e10000.1: u2 auto load valid efuse: ENABLE with value: 1
[    0.852127] phy phy-usb-phy@11e10000.1: u2 efuse - intr 13
[    0.857607] phy phy-usb-phy@11e10000.2: try to get sw efuse
[    0.863167] phy phy-usb-phy@11e10000.2: try to get sw efuse+
[    0.868820] phy phy-usb-phy@11e10000.2: u3 auto load valid efuse: ENABLE with value: 1
[    0.876739] phy phy-usb-phy@11e10000.2: u3 efuse - intr 28, rx_imp f, tx_imp f
[    0.883952] phy phy-usb-phy@11e10000.3: try to get sw efuse
[    0.889513] phy phy-usb-phy@11e10000.3: try to get sw efuse+
[    0.895170] phy phy-usb-phy@11e10000.3: u2 auto load valid efuse: ENABLE with value: 1
[    0.903082] phy phy-usb-phy@11e10000.3: u2 efuse - intr 13
[    0.908971] xhci-mtk 11200000.xhci: xHCI Host Controller
[    0.914285] xhci-mtk 11200000.xhci: new USB bus registered, assigned bus number 1
[    0.924820] xhci-mtk 11200000.xhci: hcc params 0x01403f99 hci version 0x110 quirks 0x0000000000210010
[    0.934063] xhci-mtk 11200000.xhci: irq 132, io mem 0x11200000
[    0.939960] xhci-mtk 11200000.xhci: xHCI Host Controller
[    0.945265] xhci-mtk 11200000.xhci: new USB bus registered, assigned bus number 2
[    0.952739] xhci-mtk 11200000.xhci: Host supports USB 3.2 Enhanced SuperSpeed
[    0.960143] hub 1-0:1.0: USB hub found
[    0.963907] hub 1-0:1.0: 2 ports detected
[    0.968134] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    0.976407] hub 2-0:1.0: USB hub found
[    0.980162] hub 2-0:1.0: 1 port detected
[    0.984373] usbcore: registered new interface driver uas
[    0.989716] usbcore: registered new interface driver usb-storage
[    0.995811] i2c /dev entries driver
[    1.000411] mtk-wdt 1001c000.watchdog: Watchdog enabled (timeout=31 sec, nowayout=0)
[    1.008320] device-mapper: ioctl: 4.41.0-ioctl (2019-09-16) initialised: dm-devel@redhat.com
[    1.016829] Bluetooth: HCI UART driver ver 2.3
[    1.021265] Bluetooth: HCI UART protocol H4 registered
[    1.026393] Bluetooth: HCI UART protocol BCSP registered
[    1.031747] Bluetooth: HCI UART protocol Broadcom registered
[    1.037410] Bluetooth: HCI UART protocol QCA registered
[    1.043014] crypto-safexcel 10320000.crypto: EIP97:230(0,1,4,4)-HIA:270(0,5,5),PE:150/433(alg:7fcdfc00)/0/0/0
[    1.056933] Initializing XFRM netlink socket
[    1.061460] NET: Registered protocol family 10
[    1.066383] Segment Routing with IPv6
[    1.070102] NET: Registered protocol family 17
[    1.074566] Bridge firewalling registered
[    1.078635] 8021q: 802.1Q VLAN Support v1.8
[    1.083286] pstore: Using crash dump compression: deflate
[    1.095498] nmbm nmbm_spim_nand: Signature found at block 2047 [0x1ffc0000]
[    1.104886] nmbm nmbm_spim_nand: First info table with writecount 0 found in block 1920
[    1.120245] nmbm nmbm_spim_nand: Second info table with writecount 0 found in block 1923
[    1.128331] nmbm nmbm_spim_nand: NMBM has been successfully attached 
[    1.134894] 8 fixed-partitions partitions found on MTD device nmbm_spim_nand
[    1.141935] Creating 8 MTD partitions on "nmbm_spim_nand":
[    1.147413] 0x000000000000-0x000000100000 : "BL2"
[    1.152552] 0x000000100000-0x000000180000 : "u-boot-env"
[    1.158188] 0x000000180000-0x000000380000 : "Factory"
[    1.163543] 0x000000380000-0x000000540000 : "FIP"
[    1.168528] 0x000000540000-0x000000580000 : "zloader"
[    1.173871] 0x000000580000-0x000004580000 : "ubi"
[    1.178909] 0x000004580000-0x000008580000 : "ubi2"
[    1.184021] 0x000008580000-0x00001e000000 : "zyubi"
[    1.399679] mt7530 mdio-bus:1f lan1 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY]
[    1.409119] mt7530 mdio-bus:1f lan2 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY]
[    1.418460] mt7530 mdio-bus:1f lan3 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY]
[    1.427435] mt7530 mdio-bus:1f: configuring for fixed/2500base-x link mode
[    1.434583] DSA: tree 0 setup
[    1.434832] mt7530 mdio-bus:1f: Link is Up - 2.5Gbps/Full - flow control rx/tx
[    1.437542] mt7530-nl: genl_register_family_with_ops 
[    1.450585] UBI: auto-attach mtd6
[    1.453899] ubi0: attaching mtd6
[    1.753874] ubi0: scanning is finished
[    1.765123] ubi0: attached mtd6 (name "ubi", size 64 MiB)
[    1.770517] ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes
[    1.777378] ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
[    1.784153] ubi0: VID header offset: 4096 (aligned 4096), data offset: 8192
[    1.791101] ubi0: good PEBs: 256, bad PEBs: 0, corrupted PEBs: 0
[    1.797095] ubi0: user volume: 5, internal volumes: 1, max. volumes count: 128
[    1.804304] ubi0: max/mean erase counter: 47/10, WL threshold: 4096, image sequence number: 1658393161
[    1.813594] ubi0: available PEBs: 1, total reserved PEBs: 255, PEBs reserved for bad PEB handling: 38
[    1.822803] ubi0: background thread "ubi_bgt0d" started, PID 809
[    1.823752] block ubiblock0_1: created from ubi0:1(rootfs)
[    1.834276] ubiblock: device ubiblock0_1 (rootfs) set to be root filesystem
[    1.841230] hctosys: unable to open rtc device (rtc0)
[    1.851167] VFS: Mounted root (squashfs filesystem) readonly on device 253:0.
[    1.858457] Freeing unused kernel memory: 448K
[    1.878721] Run /sbin/init as init process
[    2.077908] init: Console is alive
[    2.081453] init: - watchdog -
[    2.097940] kmodloader: no module folders for kernel version 5.4.238 found
[    2.114996] init: - preinit -
[    2.704337] mtk_soc_eth 15100000.ethernet eth0: configuring for fixed/2500base-x link mode
[    2.712663] mtk_soc_eth 15100000.ethernet eth0: Link is Up - 2.5Gbps/Full - flow control rx/tx
/etc/preinit: line 30: lock: not found
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
/etc/preinit: line 67: lock: not found
/etc/preinit: line 39: lock: not found
rm: can't remove '/tmp/tmp.bOCJlo': No such file or directory
/etc/preinit: line 72: lock: not found
[    4.777816] mount_root: loading kmods from internal overlay
[    4.786424] kmodloader: no module folders for kernel version 5.4.238 found
[    4.793536] mount_root: failed to launch kmodloader from internal overlay
[    7.220157] UBIFS (ubi0:4): Mounting in unauthenticated mode
[    7.225898] UBIFS (ubi0:4): background thread "ubifs_bgt0_4" started, PID 870
[    7.297990] UBIFS (ubi0:4): recovery needed
[    7.585932] UBIFS (ubi0:4): recovery completed
[    7.590446] UBIFS (ubi0:4): UBIFS: mounted UBI device 0, volume 4, name "rootfs_data"
[    7.598271] UBIFS (ubi0:4): LEB size: 253952 bytes (248 KiB), min./max. I/O unit sizes: 4096 bytes/4096 bytes
[    7.608173] UBIFS (ubi0:4): FS size: 8380416 bytes (7 MiB, 33 LEBs), journal size 2031617 bytes (1 MiB, 6 LEBs)
[    7.618249] UBIFS (ubi0:4): reserved for root: 395827 bytes (386 KiB)
[    7.624684] UBIFS (ubi0:4): media format: w5/r0 (latest is w5/r0), UUID 6E0B34AB-5019-4D60-815A-29C24B4432A2, small LPT model
[    7.639593] block: attempting to load /tmp/ubifs_cfg/upper/etc/config/fstab
[    7.657253] block: extroot: not configured
[    7.661441] UBIFS (ubi0:4): un-mount UBI device 0
[    7.666147] UBIFS (ubi0:4): background thread "ubifs_bgt0_4" stops
[    7.675639] UBIFS (ubi0:4): Mounting in unauthenticated mode
[    7.681353] UBIFS (ubi0:4): background thread "ubifs_bgt0_4" started, PID 873
[    7.815907] UBIFS (ubi0:4): UBIFS: mounted UBI device 0, volume 4, name "rootfs_data"
[    7.823736] UBIFS (ubi0:4): LEB size: 253952 bytes (248 KiB), min./max. I/O unit sizes: 4096 bytes/4096 bytes
[    7.833637] UBIFS (ubi0:4): FS size: 8380416 bytes (7 MiB, 33 LEBs), journal size 2031617 bytes (1 MiB, 6 LEBs)
[    7.843709] UBIFS (ubi0:4): reserved for root: 395827 bytes (386 KiB)
[    7.850139] UBIFS (ubi0:4): media format: w5/r0 (latest is w5/r0), UUID 6E0B34AB-5019-4D60-815A-29C24B4432A2, small LPT model
[    7.869794] mount_root: loading kmods from internal overlay
[    7.881671] kmodloader: no module folders for kernel version 5.4.238 found
[    7.888731] mount_root: failed to launch kmodloader from internal overlay
[   10.248113] block: attempting to load /tmp/ubifs_cfg/upper/etc/config/fstab
[   10.264018] block: extroot: not configured
[   10.270852] mount_root: switching to ubifs overlay
[   10.346674] urandom-seed: Seed file not found (/etc/urandom.seed)
[   10.410741] procd: - early -
[   10.413639] procd: - watchdog -
[   10.926273] procd: - watchdog -
[   10.930829] procd: - ubus -
[   10.983733] procd: - init -
Please press Enter to activate this console.
[   11.279901] urngd: v1.0.2 started.
[   11.334745] kmodloader: no module folders for kernel version 5.4.238 found
[   12.614612] mtk_soc_eth 15100000.ethernet eth0: TX vlan offload cannot be enabled when dsa is attached.
[   12.624518] mtk_soc_eth 15100000.ethernet eth0: TX vlan offload cannot be enabled when dsa is attached.
[   15.174308] /dev/ubi0_3: Can't open blockdev
[   15.242900] block ubiblock0_3: created from ubi0:3(zydefault)
[   15.268051] ubi1: attaching mtd8
[   16.874652] ubi1: scanning is finished
[   16.886361] ubi1: attached mtd8 (name "zyubi", size 346 MiB)
[   16.892023] ubi1: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes
[   16.898888] ubi1: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
[   16.905664] ubi1: VID header offset: 4096 (aligned 4096), data offset: 8192
[   16.912612] ubi1: good PEBs: 1386, bad PEBs: 0, corrupted PEBs: 0
[   16.918692] ubi1: user volume: 5, internal volumes: 1, max. volumes count: 128
[   16.925902] ubi1: max/mean erase counter: 8/4, WL threshold: 4096, image sequence number: 2420492800
[   16.935019] ubi1: available PEBs: 0, total reserved PEBs: 1386, PEBs reserved for bad PEB handling: 38
[   16.944315] ubi1: background thread "ubi_bgt1d" started, PID 1263
[   16.966883] UBIFS (ubi1:3): Mounting in unauthenticated mode
[   16.972615] UBIFS (ubi1:3): background thread "ubifs_bgt1_3" started, PID 1271
[   17.130380] UBIFS (ubi1:3): UBIFS: mounted UBI device 1, volume 3, name "data"
[   17.137601] UBIFS (ubi1:3): LEB size: 253952 bytes (248 KiB), min./max. I/O unit sizes: 4096 bytes/4096 bytes
[   17.147503] UBIFS (ubi1:3): FS size: 18538496 bytes (17 MiB, 73 LEBs), journal size 2031617 bytes (1 MiB, 6 LEBs)
[   17.157748] UBIFS (ubi1:3): reserved for root: 875618 bytes (855 KiB)
[   17.164180] UBIFS (ubi1:3): media format: w5/r0 (latest is w5/r0), UUID B6227958-D77B-4218-93A3-024B2D1DEA2B, small LPT model
[   17.190663] UBIFS (ubi1:4): Mounting in unauthenticated mode
[   17.196397] UBIFS (ubi1:4): background thread "ubifs_bgt1_4" started, PID 1276
[   17.348209] UBIFS (ubi1:4): UBIFS: mounted UBI device 1, volume 4, name "misc"
[   17.355435] UBIFS (ubi1:4): LEB size: 253952 bytes (248 KiB), min./max. I/O unit sizes: 4096 bytes/4096 bytes
[   17.365337] UBIFS (ubi1:4): FS size: 310583296 bytes (296 MiB, 1223 LEBs), journal size 15491072 bytes (14 MiB, 61 LEBs)
[   17.376189] UBIFS (ubi1:4): reserved for root: 4952683 bytes (4836 KiB)
[   17.382794] UBIFS (ubi1:4): media format: w5/r0 (latest is w5/r0), UUID C74F7EC9-F1F8-487B-A585-A684B2F89030, small LPT model

Fortunately i switch back via zloader to ubi and it loads again the firmware on ubi successfully, hence i can do multiple tests...

Here is an example bootlog of the firmware loaded from ubi2, same thing but I read that:

UBI: plan to attach ubi2
 UBI: auto-attach mtd7

Full bootlog on ubi2

Everything loads fine of course... But why my firmware is ignoring the boot args that i read in the bootlog?

The bootlog you are sharing here has little in common with vanilla OpenWrt. You are using a heavily patched downstream form, with lots of custom drivers, hence it will be difficult to provide support for that here without you at least sharing the full sourcecode. The question remains what you are going to achieve: Do you want to run OpenWrt? Or do you want to run a heavily patched fork, apparently at least partially based on MediaTek SDK (a OpenWrt downstream fork)? If you want to run a fork, please request support from where ever you got that fork from.

To me it looks like what you are trying is to add support for this device to OpenWrt simply by copying stuff from the vendor firmware sources to your OpenWrt tree. This will never work. It's good to have the sourcecode, esp. device tree. But you can't use it as-is and just copy it to OpenWrt. It also simply isn't needed. Example: the SDK driver for nmbm has a equivalent replacement which does not need a fake MTD device, but rather hooks into the NAND driver. We already support many boards for which the vendor firmware is using NMBM...

OpenWrt automatically UBI-attaches any MTD partition called ubi. If you don't want that, rename the partition to ubi1 (in dts), then you will be able to use the cmdline paramter to ubi.mtd=ubi1 vs. ubi.mtd=ubi2 to select which one to attach. I've never seen a paramter rootubi=..., it doesn't appear anywhere in kernel sources nor in documentation...

You are apparently missing all PHY drivers. Most (if not all?) 2.5G PHYs will need a driver. Drivers for Aquantia, MaxLinear and RealTek are enabled in config-5.15 in vanilla OpenWrt -- but you are apparently not using that as also the driver for the MediaTek switch PHY is missing:

In an other bootlog at least the MediaTek driver is present:

Which 2.5G PHY chip is used on that board?

Hi Daniel thank you for supporting me on this.

I'd like your help to only focus on the following:
I did git clone the master branch of openwrt and started working on the DTS and menuconfig for my ex5601-t0
Everything works but the lan and wan 2.5ethernet ports.
When I try to set the registers with mii_mgr (mdio-tools too) I cant make them work:

Owrt 5.15 kernel
root@OpenWrt:/# mii_mgr_cl45 -g -p 0x6 -d 0x0 -r 0x18
Get: port6 dev0h_reg18h = 0x0000
root@OpenWrt:/# mii_mgr_cl45 -g -p 0x5 -d 0x0 -r 0x18
Get: port5 dev0h_reg18h = 0x0000

I came to this conclusion because if I work on openwrt 21.02 there is a different driver from the new one which is the following issue I opened:

CONFIG_MT753X_GSW definition missing in kernel_menconfig · Issue #12491 · openwrt/openwrt (github.com)

With openwrt kernel 5.4 21.02 openwrt version i can correctly set the registers

Owrt 21.02 5.4 kernel
root@OpenWrt:/bin# mii_mgr_cl45 -g -p 0x5 -d 0x0 -r 0x18
Get: port5 dev0h_reg18h = 0x0003
root@OpenWrt:/bin# mii_mgr_cl45 -g -p 0x6 -d 0x0 -r 0x18
Get: port6 dev0h_reg18h = 0x020B

In the issue I opened someone answered that the driver I'm trying to use has been replaced, hence in 5.15 I can't set correctly the registers with the new driver.

the phys are maxlinear and the driver for the phys is working. IMHO the problem is the new driver for the DSA.

Please answer this question.
You will need the correct PHY driver. Sure, you can poke around in the raw PHY registers and probably somehow make things work, but you are wasting your time, as all that will already be done by the PHY driver which just has to be included in your kernel configuration.

If you don't know which PHY chip is used, please share the output of

# show all PHYs on bus
mdio mdio-bus

# identify C45 PHY on address 5
mdio mdio-bus mmd 5:1 raw 2
mdio mdio-bus mmd 5:1 raw 3

# identify C45 PHY on address 6
mdio mdio-bus mmd 6:1 raw 2
mdio mdio-bus mmd 6:1 raw 3
root@OpenWrt:/# mdio mdio-bus
 DEV      PHY-ID  LINK
0x00  0x00000000  down
0x01  0x00000000  down
0x02  0x00000000  down
0x03  0x00000000  down
0x04  0x00000000  down
0x05  0x67c9de08  down
0x06  0x67c9de08  down
0x07  0x00000000  down
0x08  0x00000000  down
0x09  0x00000000  down
0x0a  0x00000000  down
0x0b  0x00000000  down
0x0c  0x00000000  down
0x0d  0x00000000  down
0x0e  0x00000000  down
0x0f  0x00000000  down
0x10  0x00000000  down
0x11  0x00000000  down
0x12  0x00000000  down
0x13  0x00000000  down
0x14  0x00000000  down
0x15  0x00000000  down
0x16  0x00000000  down
0x17  0x00000000  down
0x18  0x00000000  down
0x19  0x00000000  down
0x1a  0x00000000  down
0x1b  0x00000000  down
0x1c  0x00000000  down
0x1d  0x00000000  down
0x1e  0x00000000  down
0x1f  0x00000002  down
root@OpenWrt:/# mdio mdio-bus mmd 5:1 raw 2
0x67c9
root@OpenWrt:/# mdio mdio-bus mmd 5:1 raw 3
0xde08
root@OpenWrt:/# mdio mdio-bus mmd 6:1 raw 2
0x67c9
root@OpenWrt:/# mdio mdio-bus mmd 6:1 raw 3
0xde08
root@OpenWrt:/#

So this is MaxLinear GPY211B.
You need to enable CONFIG_MAXLINEAR_GPHY=y which should already be enabled in OpenWrt's target/linux/mediatek/filogic/config-5.15.

You also need to define the PHYs in device tree in the mdio-bus node of the Ethernet:

        phy0: ethernet-phy@5 {
                reg = <5>;
                compatible = "ethernet-phy-ieee802.3-c45";
                phy-mode = "2500base-x";
        };
        phy1: ethernet-phy@6 {
                reg = <6>;
                compatible = "ethernet-phy-ieee802.3-c45";
                phy-mode = "2500base-x";
        };
piameruo@compiler:~/openwrt/target/linux/mediatek/filogic$ cat config-5.15 | grep MAXLINEAR
CONFIG_MAXLINEAR_GPHY=y
piameruo@compiler:~/openwrt/target/linux/mediatek/filogic$

This is the ethernet portion extracted from the zyxel firmware which I'm using actually in this build 5.15

&eth {
	status = "okay";

	gmac0: mac@0 {
		compatible = "mediatek,eth-mac";
		reg = <0>;
		phy-mode = "2500base-x";

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

	gmac1: mac@1 {
		compatible = "mediatek,eth-mac";
		reg = <1>;
		phy-mode = "2500base-x";

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

	mdio: mdio-bus {
		#address-cells = <1>;
		#size-cells = <0>;

		phy5: phy@5 {
			compatible = "ethernet-phy-id67c9.de0a";
			reg = <5>;
			reset-gpios = <&pio 6 1>;
			reset-assert-us = <50000>;
			reset-deassert-us = <20000>;
			phy-mode = "2500base-x";
			maxlinear,led-reg = <1008 0 0 0>; /* enable led0 for all link/act, and disable led1~3 */
			ifname = "lan5";
		};

		phy6: phy@6 {
			compatible = "ethernet-phy-id67c9.de0a";
			reg = <6>;
			phy-mode = "2500base-x";
			maxlinear,led-reg = <240 0 0 0>; /* enable led0 and no pulsing with TX, RX, and disable led1~3 */
			ifname = "eth1";
		};

		switch@0 {
			compatible = "mediatek,mt7531";
			reg = <31>;
			reset-gpios = <&pio 5 0>;

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@1 {
					reg = <1>;
					label = "lan1";
				};

				port@2 {
					reg = <2>;
					label = "lan2";
				};

				port@3 {
					reg = <3>;
					label = "lan3";
				};

				port@5 {
					reg = <5>;
					label = "lan5";
					phy-mode = "2500base-x";

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

				port@6 {
					reg = <6>;
					label = "cpu";
					ethernet = <&gmac0>;
					phy-mode = "2500base-x";

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