Explorar el Código

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 <[email protected]>
Shiji Yang hace 1 año
padre
commit
0db4f9785c

+ 12 - 0
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>;
+					};
+				};
 			};
 		};
 	};

+ 12 - 0
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";
 	};
 };
 

+ 17 - 0
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 {

+ 12 - 0
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>;
+					};
+				};
 			};
 		};
 	};

+ 12 - 0
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";
 	};
 };
 

+ 7 - 0
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;
+	};
+};

+ 12 - 1
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";
 	};
 };

+ 12 - 0
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";
 	};
 };
 

+ 12 - 0
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";
 	};
 };

+ 12 - 1
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";
 	};
 };
 

+ 29 - 0
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 {

+ 0 - 40
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|\

+ 21 - 2
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
 		;;

+ 0 - 22
target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata

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

+ 4 - 2
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