From fa846e7e64445ec470fde78b72a308ad4765529a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 29 Apr 2026 13:52:15 -0700 Subject: [PATCH] mediatek: predator-w6x: set MAC in NVMEM Userspace handling is deprecated. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/23764 Signed-off-by: Jonas Jelonek --- .../dts/mt7986a-acer-predator-w6x-stock.dts | 14 ++++++++++++++ .../dts/mt7986a-acer-predator-w6x-ubootmod.dts | 12 ++++++++++++ .../mediatek/dts/mt7986a-acer-predator-w6x.dtsi | 6 ++++++ .../base-files/lib/preinit/10_fix_eth_mac.sh | 10 ---------- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6x-stock.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6x-stock.dts index 68b3481dd83..7c5c89b0a52 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6x-stock.dts +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6x-stock.dts @@ -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 { diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6x-ubootmod.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6x-ubootmod.dts index e7920f515dd..851dbb80caf 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6x-ubootmod.dts +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6x-ubootmod.dts @@ -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>; + }; + }; + }; }; }; }; diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6x.dtsi b/target/linux/mediatek/dts/mt7986a-acer-predator-w6x.dtsi index 1d299b70e13..fb5b5d63c21 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6x.dtsi +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6x.dtsi @@ -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 { diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh index 0d4c165e485..ead84eca265 100644 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -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) -- 2.47.3