From 8dd95cc6b532af599a2ad0b92b3a53371832a3a4 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 12 Jun 2024 14:03:49 -0700 Subject: [PATCH] ramips: iptime,t5004: use nvmem for ubootenv Userspace handling is deprecated. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/14182 Signed-off-by: Robert Marko --- target/linux/ramips/dts/mt7621_iptime_t5004.dts | 17 +++++++++++++++++ .../mt7621/base-files/etc/board.d/02_network | 4 ---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_iptime_t5004.dts b/target/linux/ramips/dts/mt7621_iptime_t5004.dts index 4a7f9aaaa1..19c72884b4 100644 --- a/target/linux/ramips/dts/mt7621_iptime_t5004.dts +++ b/target/linux/ramips/dts/mt7621_iptime_t5004.dts @@ -55,6 +55,15 @@ partition@80000 { label = "u-boot-env"; reg = <0x80000 0xc0000>; + + nvmem-layout { + compatible = "u-boot,env"; + env-size = <0x1000>; + + macaddr_uboot_ethaddr: ethaddr { + #nvmem-cell-cells = <1>; + }; + }; }; partition@140000 { @@ -85,10 +94,18 @@ }; }; +&gmac0 { + nvmem-cells = <&macaddr_uboot_ethaddr 0>; + nvmem-cell-names = "mac-address"; +}; + &gmac1 { status = "okay"; label = "wan"; phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_uboot_ethaddr 1>; + nvmem-cell-names = "mac-address"; }; ðphy0 { diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 493811893b..c6e440b8e9 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -274,10 +274,6 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) label_mac=$wan_mac ;; - iptime,t5004) - lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ;; jdcloud,re-sp-01b) lan_mac=$(mtd_get_mac_ascii config mac) wan_mac=$lan_mac