[openwrt/openwrt] ipq806x: use nvmem for wifi mac

LEDE Commits lede-commits at lists.infradead.org
Sun Mar 16 14:20:25 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/148f82ad4525e9358759d3438b6c738dc03fadeb

commit 148f82ad4525e9358759d3438b6c738dc03fadeb
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Thu Aug 22 10:47:03 2024 -0700

    ipq806x: use nvmem for wifi mac
    
    Userspace handling is deprecated.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/16229
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../etc/hotplug.d/firmware/11-ath10k-caldata       | 10 --------
 .../etc/hotplug.d/ieee80211/10_fix_wifi_mac        |  6 ++---
 .../arm/boot/dts/qcom/qcom-ipq8064-eax500.dtsi     | 28 ++++++++++++++++++++++
 .../arm/boot/dts/qcom/qcom-ipq8064-unifi-ac-hd.dts | 18 +++++++++++++-
 4 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 4c5019cf5b..4e9d536bbc 100644
--- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -43,11 +43,6 @@ case "$FIRMWARE" in
 	asrock,g10)
 		caldata_extract "0:art" 0x1000 0x2f20
 		;;
-	linksys,ea7500-v1 |\
-	linksys,ea8500)
-		caldata_extract "art" 0x1000 0x2f20
-		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) 1)
-		;;
 	meraki,mr42)
 		CI_UBIPART=art
 		caldata_extract_ubi "ART" 0x1000 0x2f20
@@ -78,11 +73,6 @@ case "$FIRMWARE" in
 	edgecore,ecw5410)
 		caldata_extract "0:art" 0x1000 0x2f20
 		;;
-	linksys,ea7500-v1 |\
-	linksys,ea8500)
-		caldata_extract "art" 0x5000 0x2f20
-		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) 2)
-		;;
 	meraki,mr42 |\
 	meraki,mr52)
 		CI_UBIPART=art
diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index ef5fc344a6..ee641fc24c 100644
--- a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -12,14 +12,14 @@ PHYNBR=${DEVPATH##*/phy}
 board=$(board_name)
 
 case "$board" in
-	ubnt,unifi-ac-hd)
-		macaddr_add $(mtd_get_mac_binary EEPROM 0x6) $(($PHYNBR + 1)) > /sys${DEVPATH}/macaddress
-		;;
 	extreme,ap3935)
 		echo "##### PHYNBR=$PHYNBR DEVPATH=$DEVPATH"
 		[ "$PHYNBR" = "0" ] && echo $(mtd_get_mac_ascii CFG1 RADIOADDR0) > /sys${DEVPATH}/macaddress
 		[ "$PHYNBR" = "1" ] && echo $(mtd_get_mac_ascii CFG1 RADIOADDR1) > /sys${DEVPATH}/macaddress
 		;;
+	linksys,ea7500-v1 |\
+	linksys,ea8500)
+		macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) $(($PHYNBR + 1)) > /sys${DEVPATH}/macaddress
 esac
 
 OPATH=${DEVPATH##/devices/platform/}
diff --git a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-eax500.dtsi b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-eax500.dtsi
index c66a2b973e..59f6dc8698 100644
--- a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-eax500.dtsi
+++ b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-eax500.dtsi
@@ -52,10 +52,24 @@
 	status = "okay";
 
 	max-link-speed = <1>;
+
+	wifi at 0,0 {
+		compatible = "qcom,ath10k";
+		reg = <0x0000 0 0 0 0>;
+		nvmem-cells = <&precal_art_1000>;
+		nvmem-cell-names = "pre-calibration";
+	};
 };
 
 &pcie1 {
 	status = "okay";
+
+	wifi at 0,0 {
+		compatible = "qcom,ath10k";
+		reg = <0x0000 0 0 0 0>;
+		nvmem-cells = <&precal_art_5000>;
+		nvmem-cell-names = "pre-calibration";
+	};
 };
 
 &nand {
@@ -129,6 +143,20 @@
 				label = "art";
 				reg = <0x0c80000 0x0140000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					precal_art_1000: pre-calibration at 1000 {
+						reg = <0x1000 0x2f20>;
+					};
+
+					precal_art_5000: pre-calibration at 5000 {
+						reg = <0x5000 0x2f20>;
+					};
+				};
 			};
 
 			partition at dc0000 {
diff --git a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-unifi-ac-hd.dts b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-unifi-ac-hd.dts
index fac41897d4..c415b5901a 100644
--- a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-unifi-ac-hd.dts
+++ b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-unifi-ac-hd.dts
@@ -190,7 +190,9 @@
 						};
 
 						macaddr_eeprom_6: macaddr at 6 {
+							compatible = "mac-base";
 							reg = <0x6 0x6>;
+							#nvmem-cell-cells = <1>;
 						};
 					};
 				};
@@ -262,7 +264,7 @@
 	phy-mode = "sgmii";
 	qcom,id = <1>;
 
-	nvmem-cells = <&macaddr_eeprom_6>;
+	nvmem-cells = <&macaddr_eeprom_6 0>;
 	nvmem-cell-names = "mac-address";
 };
 
@@ -280,10 +282,24 @@
 
 &pcie0 {
 	status = "okay";
+
+	wifi at 0,0 {
+		compatible = "qcom,ath10k";
+		reg = <0x0000 0 0 0 0>;
+		nvmem-cells = <&macaddr_eeprom_6 1>;
+		nvmem-cell-names = "mac-address";
+	};
 };
 
 &pcie1 {
 	status = "okay";
+
+	wifi at 0,0 {
+		compatible = "qcom,ath10k";
+		reg = <0x0000 0 0 0 0>;
+		nvmem-cells = <&macaddr_eeprom_6 2>;
+		nvmem-cell-names = "mac-address";
+	};
 };
 
 &tcsr {




More information about the lede-commits mailing list