]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ath79: wlr-7100: fix MAC assignment
authorTomasz Maciej Nowak <tmn505@gmail.com>
Mon, 4 May 2026 17:48:39 +0000 (19:48 +0200)
committerRobert Marko <robimarko@gmail.com>
Thu, 7 May 2026 16:24:12 +0000 (18:24 +0200)
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")
Reviewed-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
target/linux/ath79/generic/base-files/etc/board.d/02_network
target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac

index da5eba26de9c000a53a8bd65edd83823defd4608..a8589b769f7568791abc2ba05686aadc24379fd5 100644 (file)
@@ -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@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";
        };
 };
 
                                read-only;
                        };
 
-                       uenv: partition@30000 {
+                       partition@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>;
-                                       };
                                };
                        };
 
 &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>;
index 161ecbbbc677f649a604a70de7b33ec17080c349..ee8fe2edd11888a8c902535080db8edfd43195ec 100644 (file)
@@ -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)
                ;;
index 0ef322e898ec8d3c7a6a4dfe21457fabf386a62e..cde032c0fd2d73bec98565c210f54d549f422385 100644 (file)
@@ -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 ] && \