[PATCH 1/2] ath79: wlr-7100: fix MAC assignment

Tomasz Maciej Nowak tmn505 at terefe.re
Fri Mar 13 14:42:06 PDT 2026


From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Partially revert 5e3a602def72. Unfortunately the ethaddr value in U-Boot
environment is enclosed in double quotes which makes it longer than
ETH_ALEN, thus nvmem returns EINVAL. Switch back to handling the MAC
addresses in user space.

Fixes: 5e3a602def72 ("ath79: sitecom,wlrx100: use nvmem")
Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../ath79/dts/ar1022_sitecom_wlr-7100.dts     | 23 ++++---------------
 .../generic/base-files/etc/board.d/02_network |  6 ++++-
 .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |  5 ++++
 3 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
index da5eba26de9c..ad5f4c809788 100644
--- a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
+++ b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
@@ -11,7 +11,6 @@
 	compatible = "sitecom,wlr-7100", "qca,ar9344";
 
 	aliases {
-		label-mac-device = &eth0;
 		led-boot = &led_power;
 		led-failsafe = &led_power;
 		led-running = &led_power;
@@ -59,9 +58,6 @@
 	phy-mode = "rgmii";
 	phy-handle = <&phy0>;
 
-	nvmem-cells = <&macaddr_uboot_ethaddr 0>;
-	nvmem-cell-names = "mac-address";
-
 	gmac-config {
 		device = <&gmac>;
 		rgmii-gmac0 = <1>;
@@ -93,8 +89,8 @@
 	wifi at 0,0 {
 		compatible = "qcom,ath10k";
 		reg = <0x0000 0 0 0 0>;
-		nvmem-cells = <&cal_art_5000>, <&macaddr_uboot_ethaddr 1>;
-		nvmem-cell-names = "calibration", "mac-address";
+		nvmem-cells = <&cal_art_5000>;
+		nvmem-cell-names = "calibration";
 	};
 };
 
@@ -121,19 +117,10 @@
 				read-only;
 			};
 
-			uenv: partition at 30000 {
+			partition at 30000 {
 				label = "u-boot-env";
 				reg = <0x030000 0x010000>;
 				read-only;
-
-				nvmem-layout {
-					compatible = "u-boot,env";
-					env-size = <0x1000>;
-
-					macaddr_uboot_ethaddr: ethaddr {
-						#nvmem-cell-cells = <1>;
-					};
-				};
 			};
 
 			partition at 40000 {
@@ -188,8 +175,8 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&cal_art_1000>, <&macaddr_uboot_ethaddr 0>;
-	nvmem-cell-names = "calibration", "mac-address";
+	nvmem-cells = <&cal_art_1000>;
+	nvmem-cell-names = "calibration";
 
 	led {
 		led-sources = <14>;
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index 1d5ddc605c43..42e53f331013 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -806,7 +806,11 @@ ath79_setup_macs()
 		lan_mac=$(mtd_get_mac_binary board-data 0x807E)
 		label_mac=$lan_mac
 		;;
-	sitecom,wlr-7100|\
+	sitecom,wlr-7100)
+		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
+		wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
+		label_mac=$lan_mac
+		;;
 	sitecom,wlr-8100)
 		wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
 		;;
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index 0ef322e898ec..cde032c0fd2d 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -103,6 +103,11 @@ case "$board" in
 	siemens,ws-ap3610)
 		mtd_get_mac_ascii cfg1 RADIOADDR${PHYNBR} > /sys${DEVPATH}/macaddress
 		;;
+	sitecom,wlr-7100)
+		[ "$PHYNBR" -eq 0 ] && \
+			macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
+		[ "$PHYNBR" -eq 1 ] && \
+			macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" > /sys${DEVPATH}/macaddress
 	tplink,deco-s4-v2)
 		base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
 		[ "$PHYNBR" -eq 0 ] && \
-- 
2.53.0




More information about the openwrt-devel mailing list