From f545caf00194d31f8896c729213e13859547f994 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 31 Jan 2023 12:54:14 -0500 Subject: [PATCH] ath79: convert Engenius EPG5000 radios to nvmem-cells 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 --- .../ath79/dts/qca9558_engenius_epg5000.dts | 8 +++++++- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 17 ++++++++--------- .../etc/hotplug.d/firmware/11-ath10k-caldata | 15 +++++++-------- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 1 + 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts index 37ad32f330..ee0b36d6de 100644 --- a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts +++ b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts @@ -62,5 +62,11 @@ }; &wmac { - qca,no-eeprom; + nvmem-cells = <&calibration_art_1000>; + nvmem-cell-names = "calibration"; +}; + +&ath10k_0 { + nvmem-cells = <&calibration_art_5000>; + nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 14c8eb7d64..9827508c04 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -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) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index b0b91f1c8a..4db311fde0 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -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) 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 f4df2c4edb..5d74208a5d 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 @@ -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) -- 2.30.2