mediatek: predator-w6x: set MAC in NVMEM

Userspace handling is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23764
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
This commit is contained in:
Rosen Penev
2026-06-16 09:47:22 +02:00
committed by Jonas Jelonek
parent bd58777845
commit fa846e7e64
4 changed files with 32 additions and 10 deletions
@@ -23,6 +23,20 @@
partition@800000 {
label = "ubi";
reg = <0x800000 0x6400000>;
volumes {
ubi-volume-ubootenv {
volname = "ubootenv";
nvmem-layout {
compatible = "u-boot,env-redundant-bool";
macaddr_uboot_ethaddr: ethaddr {
#nvmem-cell-cells = <1>;
};
};
};
};
};
partition@6C00000 {
@@ -22,6 +22,18 @@
ubi_rootdisk: ubi-volume-fit {
volname = "fit";
};
ubi-volume-ubootenv {
volname = "ubootenv";
nvmem-layout {
compatible = "u-boot,env-redundant-bool";
macaddr_uboot_ethaddr: ethaddr {
#nvmem-cell-cells = <1>;
};
};
};
};
};
};
@@ -77,6 +77,9 @@
reg = <0>;
phy-mode = "2500base-x";
nvmem-cells = <&macaddr_uboot_ethaddr 1>;
nvmem-cell-names = "mac-address";
fixed-link {
speed = <2500>;
full-duplex;
@@ -88,6 +91,9 @@
reg = <1>;
phy-mode = "2500base-x";
phy-handle = <&phy6>;
nvmem-cells = <&macaddr_uboot_ethaddr 0>;
nvmem-cell-names = "mac-address";
};
mdio-bus {
@@ -12,16 +12,6 @@ preinit_set_mac_address() {
ip link set dev game address "$lan_mac"
ip link set dev eth1 address "$wan_mac"
;;
acer,predator-w6x-stock|\
acer,predator-w6x-ubootmod)
wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
lan_mac=$(macaddr_add "$wan_mac" 1)
ip link set dev lan1 address "$lan_mac"
ip link set dev lan2 address "$lan_mac"
ip link set dev lan3 address "$lan_mac"
ip link set dev lan4 address "$lan_mac"
ip link set dev eth1 address "$wan_mac"
;;
acer,vero-w6m)
wan_mac=$(mmc_get_mac_ascii u-boot-env WANMAC)
lan_mac=$(mmc_get_mac_ascii u-boot-env LANMAC)