ath79: iodata: extract calibration with nvmem
authorRosen Penev <[email protected]>
Wed, 21 May 2025 01:17:32 +0000 (18:17 -0700)
committerRobert Marko <[email protected]>
Mon, 25 Aug 2025 08:21:33 +0000 (10:21 +0200)
Userspace handling is deprecated.

Signed-off-by: Rosen Penev <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/18873
Signed-off-by: Robert Marko <[email protected]>
target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts
target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac

index e1d5f2dac1b83a1bdc503402be974744aa6fea58..6eb072ef2ff84338b788c818a409e31faaef6e51 100644 (file)
                                label = "art";
                                reg = <0xff0000 0x010000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       cal_art_1000: calibration@1000 {
+                                               reg = <0x1000 0x440>;
+                                       };
+                               };
                        };
                };
        };
 &wmac {
        status = "okay";
 
-       qca,no-eeprom;
+       nvmem-cells = <&cal_art_1000>;
+       nvmem-cell-names = "calibration";
 };
index bdba46938325ab8c0637a8657d34a0a04165e6c4..bc05ec559a4e02becc09375695b3c31474ef12d0 100644 (file)
                                        #address-cells = <1>;
                                        #size-cells = <1>;
 
+                                       cal_art_1000: calibration@1000 {
+                                               reg = <0x1000 0x440>;
+                                       };
+
                                        cal_art_5000: calibration@5000 {
                                                reg = <0x5000 0x844>;
                                        };
 &wmac {
        status = "okay";
 
-       qca,no-eeprom;
+       nvmem-cells = <&cal_art_1000>;
+       nvmem-cell-names = "calibration";
 };
index 89cb3df6f2108215d989e6d57b38a1eb154661ea..f912ad4150b50c6401f8f6ac94b7d900506ab7c1 100644 (file)
@@ -45,10 +45,6 @@ case "$FIRMWARE" in
                caldata_extract "art" 0x1000 0x440
                ath9k_patch_mac $(mtd_get_mac_ascii cfg1 RADIOADDR1)
                ;;
-       iodata,wn-ac1167dgr|\
-       iodata,wn-ac1600dgr|\
-       iodata,wn-ac1600dgr2|\
-       iodata,wn-ag300dgr|\
        sitecom,wlr-7100|\
        sitecom,wlr-8100)
                caldata_extract "art" 0x1000 0x440
index 9b5593b9728993271670e114b038a83ff4f8089a..1774b9f8f2e80448f4ab2079ab241614969dd2a2 100644 (file)
@@ -73,18 +73,23 @@ case "$board" in
                ;;
        iodata,wn-ac1167dgr|\
        iodata,wn-ac1600dgr|\
-       iodata,wn-ac1600dgr2|\
-       sitecom,wlr-7100|\
-       sitecom,wlr-8100)
+       iodata,wn-ac1600dgr2)
                # There is no eeprom data for 5 GHz wlan in "art" partition
                # which would allow to patch the macaddress
                [ "$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)" 0 > /sys${DEVPATH}/macaddress
+               ;;
        iodata,wn-ag300dgr)
                # There is no eeprom data for 5 GHz wlan in "art" partition
                # which would allow to patch the macaddress
-               [ "$PHYNBR" -eq 1 ] && \
+               macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" $PHYNBR > /sys${DEVPATH}/macaddress
+               ;;
+       sitecom,wlr-7100|\
+       sitecom,wlr-8100)
+               [ "$PHYNBR" -eq 0 ] && \
                        macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
                ;;
        nec,wf1200cr|\