ath79: convert ath10k pre-calibration data to NVMEM (binary MAC)

This patch converts ath10k pre-calibration data to NVMEM format for
wave 2 devices with mtd binary MAC address. The "pre-calibration"
NVMEM cell size is 0x2f20. The MAC addresses are assigned via dts.

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 650d37a809
commit 348e0ee157
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7
21 changed files with 342 additions and 80 deletions

View File

@ -103,9 +103,17 @@
reg = <0x0 0x6>;
};
macaddr_art_6: macaddr@6 {
reg = <0x6 0x6>;
};
macaddr_art_1002: macaddr@1002 {
reg = <0x1002 0x6>;
};
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
@ -155,5 +163,7 @@
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_art_6>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};

View File

@ -114,6 +114,10 @@
reg = <0x0 0x6>;
#nvmem-cell-cells = <1>;
};
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
@ -140,6 +144,13 @@
&pcie0 {
status = "okay";
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_art_0 2>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&usb_phy {

View File

@ -62,6 +62,13 @@
&pcie0 {
status = "okay";
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_art_0 2>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
@ -98,6 +105,10 @@
reg = <0x0 0x6>;
#nvmem-cell-cells = <1>;
};
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};

View File

@ -62,6 +62,13 @@
&pcie0 {
status = "okay";
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_art_0 2>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
@ -98,6 +105,10 @@
reg = <0x0 0x6>;
#nvmem-cell-cells = <1>;
};
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};

View File

@ -11,6 +11,15 @@
};
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
status = "okay";
@ -64,6 +73,16 @@
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};

View File

@ -28,6 +28,15 @@
status = "okay";
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
status = "okay";
@ -81,6 +90,16 @@
label = "art";
reg = <0xff0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};

View File

@ -28,6 +28,15 @@
status = "okay";
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
status = "okay";
@ -87,6 +96,16 @@
label = "art";
reg = <0xff0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};

View File

@ -23,6 +23,15 @@
};
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
status = "okay";
@ -76,6 +85,16 @@
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};

View File

@ -23,6 +23,15 @@
};
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
status = "okay";
@ -82,6 +91,16 @@
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};

View File

@ -18,6 +18,15 @@
};
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
status = "okay";
@ -77,6 +86,16 @@
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};

View File

@ -59,6 +59,13 @@
&pcie {
status = "okay";
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_art_0 2>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
@ -95,6 +102,10 @@
reg = <0x0 0x6>;
#nvmem-cell-cells = <1>;
};
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};

View File

@ -76,6 +76,15 @@
};
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
status = "okay";
@ -106,7 +115,9 @@
#size-cells = <1>;
macaddr_info_8: macaddr@8 {
compatible = "mac-base";
reg = <0x8 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
@ -133,19 +144,29 @@
label = "art";
reg = <0xff0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};
};
&eth0 {
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};
&wmac {
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};

View File

@ -76,6 +76,15 @@
};
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
status = "okay";
@ -106,7 +115,9 @@
#size-cells = <1>;
macaddr_info_8: macaddr@8 {
compatible = "mac-base";
reg = <0x8 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
@ -127,19 +138,29 @@
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};
};
&eth0 {
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};
&wmac {
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};

View File

@ -45,6 +45,13 @@
&pcie {
status = "okay";
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&spi {
@ -109,6 +116,16 @@
label = "art";
reg = <0xff0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};

View File

@ -53,6 +53,13 @@
&pcie {
status = "okay";
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_config_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&mdio0 {
@ -113,7 +120,9 @@
#size-cells = <1>;
macaddr_config_8: macaddr@8 {
compatible = "mac-base";
reg = <0x8 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
@ -122,6 +131,16 @@
label = "art";
reg = <0xff0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};
@ -133,7 +152,7 @@
phy-mode = "sgmii";
phy-handle = <&phy0>;
nvmem-cells = <&macaddr_config_8>;
nvmem-cells = <&macaddr_config_8 0>;
nvmem-cell-names = "mac-address";
};
@ -141,6 +160,6 @@
status = "okay";
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_config_8>;
nvmem-cells = <&macaddr_config_8 0>;
nvmem-cell-names = "mac-address";
};

View File

@ -83,6 +83,13 @@
&pcie {
status = "okay";
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 (-1)>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&eth0 {
@ -91,7 +98,7 @@
phy-mode = "sgmii";
phy-handle = <&phy4>;
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};
@ -100,7 +107,7 @@
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};
@ -134,7 +141,9 @@
#size-cells = <1>;
macaddr_info_8: macaddr@8 {
compatible = "mac-base";
reg = <0x8 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
@ -155,6 +164,16 @@
label = "art";
reg = <0xff0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
};

View File

@ -53,7 +53,9 @@
#size-cells = <1>;
macaddr_info_8: macaddr@8 {
compatible = "mac-base";
reg = <0x8 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
@ -62,17 +64,36 @@
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
&eth0 {
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 1>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&wmac {
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};

View File

@ -47,7 +47,9 @@
#size-cells = <1>;
macaddr_info_8: macaddr@8 {
compatible = "mac-base";
reg = <0x8 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
@ -62,17 +64,36 @@
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
&eth0 {
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 1>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&wmac {
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};

View File

@ -49,7 +49,9 @@
#size-cells = <1>;
macaddr_info_8: macaddr@8 {
compatible = "mac-base";
reg = <0x8 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
@ -58,17 +60,36 @@
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
};
};
};
&pcie {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>, <&macaddr_info_8 1>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
&eth0 {
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};
&wmac {
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_info_8>;
nvmem-cells = <&macaddr_info_8 0>;
nvmem-cell-names = "mac-address";
};

View File

@ -173,21 +173,6 @@ case "$FIRMWARE" in
;;
"ath10k/pre-cal-pci-0000:00:00.0.bin")
case $board in
comfast,cf-e313ac)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary art 0x6)
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
comfast,cf-e375ac|\
comfast,cf-e560ac|\
comfast,cf-ew72|\
comfast,cf-wr752ac-v1)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 2)
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
dlink,dir-842-c1|\
dlink,dir-842-c2|\
dlink,dir-842-c3)
@ -210,32 +195,6 @@ case "$FIRMWARE" in
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
tplink,archer-c58-v1|\
tplink,archer-c59-v1|\
tplink,archer-c59-v2|\
tplink,archer-c60-v1|\
tplink,archer-c60-v2|\
tplink,archer-c60-v3|\
tplink,archer-c6-v2|\
tplink,archer-c6-v2-us|\
tplink,tl-wa1201-v2)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) -1)
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
tplink,cpe710-v1)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary info 0x8)
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
tplink,deco-m4r-v1)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary config 0x8) -1)
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
tplink,deco-s4-v2)
caldata_extract "art" 0x5000 0x2f20
base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))

View File

@ -1,25 +0,0 @@
#!/bin/sh
[ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/functions/caldata.sh
board=$(board_name)
case "$FIRMWARE" in
"ath10k/pre-cal-pci-0000:00:00.0.bin")
case $board in
tplink,tl-wpa8630p-v2-int|\
tplink,tl-wpa8630p-v2.0-eu|\
tplink,tl-wpa8630p-v2.1-eu)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) 1)
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
esac
;;
*)
exit 1
;;
esac