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 <yangshiji66@qq.com>
This commit is contained in:
Shiji Yang 2024-02-01 19:39:51 +08:00 committed by Christian Marangi
parent 2f1c62e5af
commit 0db4f9785c
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7
15 changed files with 174 additions and 68 deletions

View File

@ -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>;
};
};
};
};
};

View File

@ -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";
};
};

View File

@ -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 {

View File

@ -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>;
};
};
};
};
};

View File

@ -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";
};
};

View File

@ -22,3 +22,10 @@
debounce-interval = <60>;
};
};
&pcie1 {
wifi@0,0 {
/delete-property/ nvmem-cells;
/delete-property/ nvmem-cell-names;
};
};

View File

@ -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";
};
};

View File

@ -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";
};
};

View File

@ -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";
};
};

View File

@ -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";
};
};

View File

@ -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 {

View File

@ -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|\

View File

@ -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
;;

View File

@ -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

View File

@ -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