ath79: elecom,wab: use nvmem
authorRosen Penev <rosenp@gmail.com>
Sat, 15 Jun 2024 20:42:25 +0000 (13:42 -0700)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 29 Aug 2024 19:14:50 +0000 (21:14 +0200)
Userspace handling is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16247
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/ath79/dts/qca955x_elecom_wab.dtsi
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 43e34c6029182d7467164246543c0d540e206dbc..53bb5b0141254b428917c6f1d1c4f820577d4be7 100644 (file)
@@ -8,6 +8,7 @@
 
 / {
        aliases {
+               label-mac-device = &eth0;
                led-boot = &led_status;
                led-failsafe = &led_status;
                led-upgrade = &led_status;
        phy-mode = "rgmii-rxid";
        pll-data = <0xae000000 0x80000101 0x80001313>;
 
+       nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "mac-address";
+
        gmac-config {
                device = <&gmac>;
 
        wifi@0,0 {
                compatible = "qcom,ath10k";
                reg = <0x0000 0 0 0 0>;
-               nvmem-cells = <&cal_art_5000>;
-               nvmem-cell-names = "calibration";
+               nvmem-cells = <&cal_art_5000>, <&macaddr_uboot_ethaddr 1>;
+               nvmem-cell-names = "calibration", "mac-address";
        };
 };
 
                        };
 
                        partition@40000 {
+                               compatible = "u-boot,env";
                                label = "u-boot-env";
                                reg = <0x40000 0x10000>;
                                read-only;
+
+                               macaddr_uboot_ethaddr: ethaddr {
+                                       #nvmem-cell-cells = <1>;
+                               };
                        };
 
                        partition@50000 {
 &wmac {
        status = "okay";
 
-       nvmem-cells = <&cal_art_1000>;
-       nvmem-cell-names = "calibration";
+       nvmem-cells = <&cal_art_1000>, <&macaddr_uboot_ethaddr 0>;
+       nvmem-cell-names = "calibration", "mac-address";
 };
index ccb296a62afebb4ecfb0b6c28fa548091bc63d1d..bc251d048484610102ebee6d09d2321ed12ef6f4 100644 (file)
@@ -712,9 +712,6 @@ ath79_setup_macs()
                lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
                wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
                ;;
-       elecom,wab-i1750-ps|\
-       elecom,wab-s1167-ps|\
-       elecom,wab-s600-ps|\
        engenius,ecb1200|\
        engenius,ecb1750)
                lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
index 15cd2adda38056ecab45c84fd90668fa2ee1a6bd..0a49c0b5aa4512bc2bd84d0bbd93e711dbb19340 100644 (file)
@@ -42,16 +42,6 @@ case "$board" in
                [ "$PHYNBR" -eq 1 ] && \
                        mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress
                ;;
-       elecom,wab-i1750-ps|\
-       elecom,wab-s1167-ps|\
-       elecom,wab-s600-ps)
-               # set the 5G MAC address (= ethaddr + 1)
-               [ "$PHYNBR" -eq 0 ] && \
-                       macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
-               # set the 2.4G MAC address (= ethaddr)
-               [ "$PHYNBR" -eq 1 ] && \
-                       mtd_get_mac_ascii u-boot-env "ethaddr" > /sys${DEVPATH}/macaddress
-               ;;
        engenius,ecb1200|\
        engenius,ecb1750)
                [ "$PHYNBR" -eq 0 ] && \