From: Rosen Penev Date: Mon, 27 Apr 2026 07:15:31 +0000 (-0700) Subject: mpc85xx: ws-ap3xxxi: use u-boot,env for MAC X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F23761%2Fhead;p=thirdparty%2Fopenwrt.git mpc85xx: ws-ap3xxxi: use u-boot,env for MAC Userspace handling is deprecated. Fix bad copy/paste error with ws-ap3710i. enet2 is unused. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/23761 Signed-off-by: Jonas Jelonek --- diff --git a/target/linux/mpc85xx/base-files/etc/board.d/02_network b/target/linux/mpc85xx/base-files/etc/board.d/02_network index 8b5623a032d..c5509ca312c 100644 --- a/target/linux/mpc85xx/base-files/etc/board.d/02_network +++ b/target/linux/mpc85xx/base-files/etc/board.d/02_network @@ -18,14 +18,13 @@ enterasys,ws-ap3715i) ;; enterasys,ws-ap3710i) ucidef_set_interface_lan "eth0" - ucidef_set_label_macaddr "$(mtd_get_mac_ascii cfg1 ethaddr)" ;; fsl,P2020RDB) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth1" ;; hpe,msm460) ucidef_set_interface_lan "eth0" - ;; + ;; ocedo,panda) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8" "eth1" ;; diff --git a/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh deleted file mode 100644 index 23d20ed08cf..00000000000 --- a/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh +++ /dev/null @@ -1,17 +0,0 @@ -. /lib/functions.sh -. /lib/functions/system.sh - -preinit_set_mac_address() { - case $(board_name) in - enterasys,ws-ap3710i) - ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr) - ;; - enterasys,ws-ap3715i|\ - extreme-networks,ws-ap3825i) - ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr) - ip link set dev eth1 address $(mtd_get_mac_ascii cfg1 eth1addr) - ;; - esac -} - -boot_hook_add preinit_main preinit_set_mac_address diff --git a/target/linux/mpc85xx/config-6.12 b/target/linux/mpc85xx/config-6.12 index 7d7c469dc5f..b949ce01009 100644 --- a/target/linux/mpc85xx/config-6.12 +++ b/target/linux/mpc85xx/config-6.12 @@ -179,6 +179,7 @@ CONFIG_NR_CPUS=1 CONFIG_NR_IRQS=512 CONFIG_NVMEM=y CONFIG_NVMEM_LAYOUTS=y +CONFIG_NVMEM_LAYOUT_U_BOOT_ENV=y # CONFIG_NVMEM_QORIQ_EFUSE is not set CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/mpc85xx/config-6.18 b/target/linux/mpc85xx/config-6.18 index ce0fccd29d8..142d6249db5 100644 --- a/target/linux/mpc85xx/config-6.18 +++ b/target/linux/mpc85xx/config-6.18 @@ -174,6 +174,7 @@ CONFIG_NR_CPUS=1 CONFIG_NR_IRQS=512 CONFIG_NVMEM=y CONFIG_NVMEM_LAYOUTS=y +CONFIG_NVMEM_LAYOUT_U_BOOT_ENV=y # CONFIG_NVMEM_QORIQ_EFUSE is not set CONFIG_OBJTOOL=y CONFIG_OF=y diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3710i.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3710i.dts index 9e6c458fa5b..833db68343f 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3710i.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3710i.dts @@ -9,12 +9,11 @@ compatible = "enterasys,ws-ap3710i"; aliases { - ethernet0 = &enet0; - ethernet1 = &enet2; led-boot = &led_power_green; led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_red; + label-mac-device = &enet0; }; chosen { @@ -105,6 +104,14 @@ reg = <0x1f20000 0x20000>; label = "cfg1"; read-only; + + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + env-size = <0x10000>; + + macaddr_cfg1_ethaddr: ethaddr { + }; + }; }; }; }; @@ -126,6 +133,9 @@ enet0: ethernet@b0000 { phy-connection-type = "rgmii-id"; phy-handle = <&phy4>; + + nvmem-cells = <&macaddr_cfg1_ethaddr>; + nvmem-cell-names = "mac-address"; }; enet1: ethernet@b1000 { @@ -266,12 +276,6 @@ bd-stash; }; -&enet2 { - rx-stash-idx = <0x00>; - rx-stash-len = <0x60>; - bd-stash; -}; - /* * For the OpenWrt 22.03 release, since Linux 5.10.138 now uses * aliases to determine PCI domain numbers, drop aliases so as not to diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts index ebe210761ab..dfc0ed05383 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3715i.dts @@ -15,6 +15,7 @@ led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_red; + label-mac-device = &enet0; }; chosen { @@ -118,6 +119,9 @@ phy-handle = <&phy0>; phy-connection-type = "rgmii-id"; + nvmem-cells = <&macaddr_cfg1_ethaddr 0>; + nvmem-cell-names = "mac-address"; + label = "lan1"; }; @@ -127,6 +131,9 @@ tbi-handle = <&tbi_phy>; + nvmem-cells = <&macaddr_cfg1_ethaddr 1>; + nvmem-cell-names = "mac-address"; + label = "lan2"; }; @@ -234,6 +241,15 @@ partition@120000 { reg = <0x120000 0x10000>; label = "cfg1"; + + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + env-size = <0x1000>; + + macaddr_cfg1_ethaddr: ethaddr { + #nvmem-cell-cells = <1>; + }; + }; }; partition@130000 { diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts index f2698e4dace..3487c6ed78f 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/ws-ap3825i.dts @@ -14,12 +14,11 @@ #size-cells = <2>; aliases { - ethernet0 = &enet0; - ethernet1 = &enet2; led-boot = &led_power_green; led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_red; + label-mac-device = &enet0; }; chosen { @@ -136,6 +135,15 @@ partition@3f20000 { reg = <0x3f20000 0x20000>; label = "cfg1"; + + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + env-size = <0x10000>; + + macaddr_cfg1_ethaddr: ethaddr { + #nvmem-cell-cells = <1>; + }; + }; }; }; }; @@ -176,6 +184,9 @@ enet0: ethernet@b0000 { phy-handle = <&phy0>; phy-connection-type = "rgmii-id"; + + nvmem-cells = <&macaddr_cfg1_ethaddr 0>; + nvmem-cell-names = "mac-address"; }; enet1: ethernet@b1000 { @@ -185,6 +196,9 @@ enet2: ethernet@b2000 { phy-handle = <&phy2>; phy-connection-type = "rgmii-id"; + + nvmem-cells = <&macaddr_cfg1_ethaddr (-1)>; + nvmem-cell-names = "mac-address"; }; usb@22000 {