ath79: convert Engenius EPG5000 radios to nvmem-cells
authorMichael Pratt <mcpratt@pm.me>
Tue, 31 Jan 2023 17:54:14 +0000 (12:54 -0500)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 12 Feb 2023 17:07:31 +0000 (18:07 +0100)
Use nvmem kernel subsystem to pull radio calibration data
with the devicetree instead of userspace scripts.

Existing blocks for caldata_extract are reordered alphabetically.

MAC address is set using the hotplug script.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
target/linux/ath79/dts/qca9558_engenius_epg5000.dts
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac

index 37ad32f330e79087fb2046afb05cad7bc89b97a7..ee0b36d6deeeaeb7c6611b717da43f9e43e89f71 100644 (file)
 };
 
 &wmac {
-       qca,no-eeprom;
+       nvmem-cells = <&calibration_art_1000>;
+       nvmem-cell-names = "calibration";
+};
+
+&ath10k_0 {
+       nvmem-cells = <&calibration_art_5000>;
+       nvmem-cell-names = "calibration";
 };
index 14c8eb7d642053cdd84a9f69c3b781b8f93527fb..9827508c04a5d4432a3a598047343f2743fc04fc 100644 (file)
@@ -43,7 +43,14 @@ case "$FIRMWARE" in
                caldata_extract "art" 0x1000 0x440
                ath9k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env athaddr) 1)
                ;;
-       engenius,epg5000|\
+       enterasys,ws-ap3705i)
+               caldata_extract "calibrate" 0x1000 0x440
+               ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env0 RADIOADDR1)
+               ;;
+       extreme-networks,ws-ap3805i)
+               caldata_extract "art" 0x1000 0x440
+               ath9k_patch_mac $(mtd_get_mac_ascii cfg1 RADIOADDR1)
+               ;;
        iodata,wn-ac1167dgr|\
        iodata,wn-ac1600dgr|\
        iodata,wn-ac1600dgr2|\
@@ -53,14 +60,6 @@ case "$FIRMWARE" in
                caldata_extract "art" 0x1000 0x440
                ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env ethaddr)
                ;;
-       enterasys,ws-ap3705i)
-               caldata_extract "calibrate" 0x1000 0x440
-               ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env0 RADIOADDR1)
-               ;;
-       extreme-networks,ws-ap3805i)
-               caldata_extract "art" 0x1000 0x440
-               ath9k_patch_mac $(mtd_get_mac_ascii cfg1 RADIOADDR1)
-               ;;
        nec,wg800hp)
                caldata_extract "art" 0x1000 0x440
                ath9k_patch_mac $(mtd_get_mac_text board_data 0x680)
index b0b91f1c8abf196626e8b7055b6201148750326f..4db311fde0abb4f5426a9c1ad194809d5dbf374c 100644 (file)
@@ -77,14 +77,6 @@ case "$FIRMWARE" in
                caldata_extract "art" 0x5000 0x844
                ath10k_patch_mac $(mtd_get_mac_ascii u-boot-env athaddr)
                ;;
-       engenius,epg5000|\
-       iodata,wn-ac1167dgr|\
-       iodata,wn-ac1600dgr2|\
-       sitecom,wlr-7100|\
-       zyxel,nbg6616)
-               caldata_extract "art" 0x5000 0x844
-               ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 1)
-               ;;
        engenius,ews511ap)
                caldata_extract "art" 0x5000 0x844
                ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) 1)
@@ -97,6 +89,13 @@ case "$FIRMWARE" in
                caldata_extract "art" 0x5000 0x844
                ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 1)
                ;;
+       iodata,wn-ac1167dgr|\
+       iodata,wn-ac1600dgr2|\
+       sitecom,wlr-7100|\
+       zyxel,nbg6616)
+               caldata_extract "art" 0x5000 0x844
+               ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 1)
+               ;;
        nec,wg800hp)
                caldata_extract "art" 0x5000 0x844
                ath10k_patch_mac $(mtd_get_mac_text board_data 0x880)
index f4df2c4edbe3054fdbb46be4c936bd0438a2310b..5d74208a5d8eea6ec365f0d3c75c1ca6c727348f 100644 (file)
@@ -35,6 +35,7 @@ case "$board" in
                [ "$PHYNBR" -eq 1 ] && \
                        mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress
                ;;
+       engenius,epg5000|\
        engenius,esr1200|\
        engenius,esr1750|\
        engenius,esr900)