[openwrt/openwrt] ath79: iodata: extract calibration with nvmem

LEDE Commits lede-commits at lists.infradead.org
Mon Aug 25 01:21:37 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/5eef79a249017eafec422117412bc72a320edfe6

commit 5eef79a249017eafec422117412bc72a320edfe6
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Tue May 20 18:17:32 2025 -0700

    ath79: iodata: extract calibration with nvmem
    
    Userspace handling is deprecated.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/18873
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts        | 13 ++++++++++++-
 target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi        |  7 ++++++-
 .../base-files/etc/hotplug.d/firmware/10-ath9k-eeprom       |  4 ----
 .../base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac      | 13 +++++++++----
 4 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts b/target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts
index e1d5f2dac1..6eb072ef2f 100644
--- a/target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts
+++ b/target/linux/ath79/dts/ar1022_iodata_wn-ag300dgr.dts
@@ -159,6 +159,16 @@
 				label = "art";
 				reg = <0xff0000 0x010000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					cal_art_1000: calibration at 1000 {
+						reg = <0x1000 0x440>;
+					};
+				};
 			};
 		};
 	};
@@ -207,5 +217,6 @@
 &wmac {
 	status = "okay";
 
-	qca,no-eeprom;
+	nvmem-cells = <&cal_art_1000>;
+	nvmem-cell-names = "calibration";
 };
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 bdba469383..bc05ec559a 100644
--- a/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi
+++ b/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi
@@ -148,6 +148,10 @@
 					#address-cells = <1>;
 					#size-cells = <1>;
 
+					cal_art_1000: calibration at 1000 {
+						reg = <0x1000 0x440>;
+					};
+
 					cal_art_5000: calibration at 5000 {
 						reg = <0x5000 0x844>;
 					};
@@ -199,5 +203,6 @@
 &wmac {
 	status = "okay";
 
-	qca,no-eeprom;
+	nvmem-cells = <&cal_art_1000>;
+	nvmem-cell-names = "calibration";
 };
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 89cb3df6f2..f912ad4150 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -45,10 +45,6 @@ case "$FIRMWARE" in
 		caldata_extract "art" 0x1000 0x440
 		ath9k_patch_mac $(mtd_get_mac_ascii cfg1 RADIOADDR1)
 		;;
-	iodata,wn-ac1167dgr|\
-	iodata,wn-ac1600dgr|\
-	iodata,wn-ac1600dgr2|\
-	iodata,wn-ag300dgr|\
 	sitecom,wlr-7100|\
 	sitecom,wlr-8100)
 		caldata_extract "art" 0x1000 0x440
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 9b5593b972..1774b9f8f2 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
@@ -73,18 +73,23 @@ case "$board" in
 		;;
 	iodata,wn-ac1167dgr|\
 	iodata,wn-ac1600dgr|\
-	iodata,wn-ac1600dgr2|\
-	sitecom,wlr-7100|\
-	sitecom,wlr-8100)
+	iodata,wn-ac1600dgr2)
 		# There is no eeprom data for 5 GHz wlan in "art" partition
 		# which would allow to patch the macaddress
 		[ "$PHYNBR" -eq 0 ] && \
 			macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
 		;;
+		[ "$PHYNBR" -eq 1 ] && \
+			macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 0 > /sys${DEVPATH}/macaddress
+		;;
 	iodata,wn-ag300dgr)
 		# There is no eeprom data for 5 GHz wlan in "art" partition
 		# which would allow to patch the macaddress
-		[ "$PHYNBR" -eq 1 ] && \
+		macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" $PHYNBR > /sys${DEVPATH}/macaddress
+		;;
+	sitecom,wlr-7100|\
+	sitecom,wlr-8100)
+		[ "$PHYNBR" -eq 0 ] && \
 			macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
 		;;
 	nec,wf1200cr|\




More information about the lede-commits mailing list