From: Shiji Yang Date: Thu, 1 Feb 2024 11:39:51 +0000 (+0800) Subject: ath79: convert ath10k calibration data to NVMEM (ASCII MAC) X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0db4f9785ca30f79fa1abbffb0fab5a6053f68f5;p=openwrt%2Fstaging%2Fnbd.git ath79: convert ath10k calibration data to NVMEM (ASCII MAC) This patch converts ath10k calibration data to NVMEM format for wave 1 devices with mtd ASCII MAC address. The "calibration" NVMEM cell size is 0x844. All unportable MAC address settings have been moved to '10_fix_wifi_mac' scripts. Signed-off-by: Shiji Yang --- diff --git a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts index e2ccef105d..b45d6bd77f 100644 --- a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts +++ b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts @@ -93,6 +93,8 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0000 0 0 0 0>; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; }; }; @@ -147,6 +149,16 @@ label = "art"; reg = <0x7f0000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; }; }; diff --git a/target/linux/ath79/dts/ar9344_qihoo_c301.dts b/target/linux/ath79/dts/ar9344_qihoo_c301.dts index d7e2e24239..8241c21dd0 100644 --- a/target/linux/ath79/dts/ar9344_qihoo_c301.dts +++ b/target/linux/ath79/dts/ar9344_qihoo_c301.dts @@ -157,6 +157,16 @@ label = "radiocfg"; reg = <0xff0000 0x10000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_radiocfg_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; }; }; @@ -200,6 +210,8 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0 0 0 0 0>; + nvmem-cells = <&cal_radiocfg_5000>; + nvmem-cell-names = "calibration"; }; }; diff --git a/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts b/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts index 6fd28d5b36..07b0655e35 100644 --- a/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts +++ b/target/linux/ath79/dts/qca9531_engenius_ews511ap.dts @@ -82,6 +82,13 @@ &pcie0 { status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; + }; }; &spi { @@ -112,6 +119,16 @@ label = "art"; reg = <0x050000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; partition@60000 { diff --git a/target/linux/ath79/dts/qca9557_extreme-networks_ws-ap3805i.dts b/target/linux/ath79/dts/qca9557_extreme-networks_ws-ap3805i.dts index 4a68f53075..686a474517 100644 --- a/target/linux/ath79/dts/qca9557_extreme-networks_ws-ap3805i.dts +++ b/target/linux/ath79/dts/qca9557_extreme-networks_ws-ap3805i.dts @@ -78,6 +78,8 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0 0 0 0 0>; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; }; }; @@ -193,6 +195,16 @@ label = "art"; reg = <0x3fc0000 0x40000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; }; }; diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi b/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi index 204a63cda8..76932be64a 100644 --- a/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi +++ b/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi @@ -140,6 +140,16 @@ label = "art"; reg = <0xff0000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; }; }; @@ -171,6 +181,8 @@ wifi@0,0 { compatible = "pci168c,003c"; reg = <0x0000 0 0 0 0>; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; }; }; diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts index 1e7d92db3f..934422f571 100644 --- a/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts +++ b/target/linux/ath79/dts/qca9557_iodata_wn-ac1600dgr.dts @@ -22,3 +22,10 @@ debounce-interval = <60>; }; }; + +&pcie1 { + wifi@0,0 { + /delete-property/ nvmem-cells; + /delete-property/ nvmem-cell-names; + }; +}; diff --git a/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts b/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts index fff23dcf2b..25b36e50be 100644 --- a/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts +++ b/target/linux/ath79/dts/qca9557_zyxel_nbg6616.dts @@ -86,6 +86,16 @@ label = "art"; reg = <0x040000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; partition@50000 { @@ -118,6 +128,7 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0 0 0 0 0>; - qca,no-eeprom; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; }; }; diff --git a/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts b/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts index 01a69fce15..ba7feeab5a 100644 --- a/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts +++ b/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts @@ -113,6 +113,16 @@ label = "art"; reg = <0xff0000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; }; }; @@ -128,6 +138,8 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0 0 0 0 0>; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; }; }; diff --git a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts index 20230e684e..27341a88e6 100644 --- a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts +++ b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts @@ -107,6 +107,16 @@ label = "art"; reg = <0x050000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; partition@60000 { @@ -167,6 +177,8 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0 0 0 0 0>; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; qcom,ath10k-calibration-variant = "ZyXEL-NBG6716"; }; }; diff --git a/target/linux/ath79/dts/qca955x_engenius_ecb1xxx.dtsi b/target/linux/ath79/dts/qca955x_engenius_ecb1xxx.dtsi index 66f2e38853..9d591bd6b3 100644 --- a/target/linux/ath79/dts/qca955x_engenius_ecb1xxx.dtsi +++ b/target/linux/ath79/dts/qca955x_engenius_ecb1xxx.dtsi @@ -87,6 +87,16 @@ label = "art"; reg = <0xff0000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; }; }; @@ -122,7 +132,8 @@ wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0 0 0 0 0>; - qca,no-eeprom; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; }; }; diff --git a/target/linux/ath79/dts/qca9563_nec_wg800hp.dts b/target/linux/ath79/dts/qca9563_nec_wg800hp.dts index 1069a63a5e..a7390573cd 100644 --- a/target/linux/ath79/dts/qca9563_nec_wg800hp.dts +++ b/target/linux/ath79/dts/qca9563_nec_wg800hp.dts @@ -133,12 +133,34 @@ label = "board_data"; reg = <0x7e0000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_board_data_880: macaddr@880 { + compatible = "mac-base"; + reg = <0x880 0x11>; + #nvmem-cell-cells = <1>; + }; + }; }; art: partition@7f0000 { label = "art"; reg = <0x7f0000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; }; }; }; @@ -170,6 +192,13 @@ &pcie { status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&cal_art_5000>, <&macaddr_board_data_880 0>; + nvmem-cell-names = "calibration", "mac-address"; + }; }; &wmac { 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 02cc293a6e..19b02a5905 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 @@ -7,46 +7,6 @@ board=$(board_name) case "$FIRMWARE" in -"ath10k/cal-pci-0000:00:00.0.bin") - case $board in - engenius,ecb1200|\ - engenius,ecb1750) - caldata_extract "art" 0x5000 0x844 - ath10k_patch_mac $(mtd_get_mac_ascii u-boot-env athaddr) - ;; - engenius,ews511ap) - caldata_extract "art" 0x5000 0x844 - ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) 1) - ;; - extreme-networks,ws-ap3805i) - caldata_extract "art" 0x5000 0x844 - ath10k_patch_mac $(mtd_get_mac_ascii cfg1 RADIOADDR0) - ;; - 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) - ;; - qihoo,c301) - caldata_extract "radiocfg" 0x5000 0x844 - ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) - ;; - esac - ;; -"ath10k/cal-pci-0000:01:00.0.bin") - case $board in - sitecom,wlr-8100) - caldata_extract "art" 0x5000 0x844 - ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 1) - ;; - esac - ;; "ath10k/pre-cal-pci-0000:00:00.0.bin") case $board in dlink,dir-842-c1|\ 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 d3392aa61e..1a845a4ed7 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 @@ -41,13 +41,31 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress ;; + engenius,ecb1200|\ + engenius,ecb1750) + [ "$PHYNBR" -eq 0 ] && \ + mtd_get_mac_ascii u-boot-env ethaddr > /sys${DEVPATH}/macaddress + ;; engenius,epg5000|\ engenius,esr1200|\ engenius,esr1750|\ engenius,esr900) macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" "$PHYNBR" > /sys${DEVPATH}/macaddress ;; - iodata,wn-ac1600dgr) + engenius,ews511ap) + [ "$PHYNBR" -eq 0 ] && \ + macaddr_add $(cat /sys/class/net/eth0/address) 1 > /sys${DEVPATH}/macaddress + ;; + extreme-networks,ws-ap3805i) + [ "$PHYNBR" -eq 0 ] && \ + mtd_get_mac_ascii cfg1 RADIOADDR0 > /sys${DEVPATH}/macaddress + ;; + iodata,wn-ac1167dgr|\ + iodata,wn-ac1600dgr|\ + iodata,wn-ac1600dgr2|\ + sitecom,wlr-7100|\ + sitecom,wlr-8100|\ + zyxel,nbg6616) # There is no eeprom data for 5 GHz wlan in "art" partition # which would allow to patch the macaddress [ "$PHYNBR" -eq 0 ] && \ @@ -60,7 +78,8 @@ case "$board" in macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress ;; nec,wf1200cr|\ - nec,wg1200cr) + nec,wg1200cr|\ + qihoo,c301) [ "$PHYNBR" -eq 0 ] && \ mtd_get_mac_ascii devdata wlan5mac > /sys${DEVPATH}/macaddress ;; diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata deleted file mode 100644 index c85a134b58..0000000000 --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -[ -e /lib/firmware/$FIRMWARE ] && exit 0 - -. /lib/functions/caldata.sh - -board=$(board_name) - -case "$FIRMWARE" in -"ath10k/cal-pci-0000:00:00.0.bin") - case $board in - zyxel,emg2926-q10a|\ - zyxel,nbg6716) - caldata_extract "art" 0x5000 0x844 - ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 1) - ;; - esac - ;; -*) - exit 1 - ;; -esac diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac b/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac index 20974248c1..5a933df501 100644 --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac +++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac @@ -17,8 +17,10 @@ case $board in ;; zyxel,emg2926-q10a|\ zyxel,nbg6716) - # Set mac address for 2.4g device + ethaddr=$(mtd_get_mac_ascii u-boot-env ethaddr) + [ "$PHYNBR" -eq 0 ] && \ + macaddr_add $ethaddr 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" -eq 1 ] && \ - mtd_get_mac_ascii u-boot-env ethaddr > /sys${DEVPATH}/macaddress + echo -n $ethaddr > /sys${DEVPATH}/macaddress ;; esac