From 8ea6f9a6bfcd3c742a2d166c415d7181bb2dcd94 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 22 Apr 2023 07:26:32 +0800 Subject: [PATCH] ramips: switch to new mac-address-ascii bindings for jdcloud re-sp-01b Signed-off-by: Tianling Shen --- .../ramips/dts/mt7621_jdcloud_re-sp-01b.dts | 24 ++++++++++++++++++- .../mt7621/base-files/etc/board.d/02_network | 6 ----- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 6 ----- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts b/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts index 15afcfa273..4d0ac1a5a2 100644 --- a/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts +++ b/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts @@ -14,6 +14,7 @@ led-failsafe = &led_red; led-running = &led_green; led-upgrade = &led_blue; + label-mac-device = &gmac0; }; chosen { @@ -51,6 +52,11 @@ }; }; +&gmac0 { + nvmem-cells = <&macaddr_config_4429>; + nvmem-cell-names = "mac-address-ascii"; +} + &gmac1 { status = "okay"; label = "wan"; @@ -86,7 +92,7 @@ read-only; }; - partition@30000 { + config: partition@30000 { label = "config"; reg = <0x30000 0x10000>; read-only; @@ -140,6 +146,8 @@ &pcie0 { wifi@0,0 { reg = <0x0000 0 0 0 0>; + nvmem-cells = <&macaddr_config_4429>; + nvmem-cell-names = "mac-address-ascii"; mediatek,mtd-eeprom = <&factory 0x0>; }; }; @@ -147,6 +155,10 @@ &pcie1 { wifi@0,0 { reg = <0x0000 0 0 0 0>; + nvmem-cells = <&macaddr_config_4429>; + nvmem-cell-names = "mac-address-ascii"; + mac-address-increment-byte = <3>; + mac-address-increment = <0x80>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; }; @@ -158,3 +170,13 @@ function = "gpio"; }; }; + +&config { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_4429: macaddr@4429 { + reg = <0x4429 0x11>; + }; +}; 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 94e33d40c7..f3cb3f0a5f 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 @@ -223,12 +223,6 @@ ramips_setup_macs() zbtlink,zbt-wg3526-32m) label_mac=$(mtd_get_mac_binary factory 0x4) ;; - jdcloud,re-sp-01b) - local index="$(find_mtd_index "config")" - label_mac=$(macaddr_canonicalize $(dd if="/dev/mtd${index}" bs=12 skip=17449 iflag=skip_bytes count=1 2>/dev/null)) - lan_mac=$label_mac - wan_mac=$label_mac - ;; linksys,e5600|\ linksys,ea6350-v4|\ linksys,ea7300-v1|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 709e91c3a3..30a10423ad 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -98,12 +98,6 @@ case "$board" in [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress ;; - jdcloud,re-sp-01b) - local index="$(find_mtd_index "config")" - local label_mac=$(macaddr_canonicalize $(dd if="/dev/mtd${index}" bs=12 skip=17449 iflag=skip_bytes count=1 2>/dev/null)) - [ "$PHYNBR" -eq 0 ] && echo $label_mac > /sys${DEVPATH}/macaddress - [ "$PHYNBR" -eq 1 ] && macaddr_add $label_mac 0x800000 > /sys${DEVPATH}/macaddress - ;; linksys,e5600|\ linksys,ea6350-v4|\ linksys,ea7300-v1|\