[openwrt/openwrt] apm821xx: WNDR4700: utilize ath9k nvmem-cells

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 5 05:01:56 PST 2022


chunkeey pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/a1693a8c2cdc74a5bf33cabaadc2174f2f088dbf

commit a1693a8c2cdc74a5bf33cabaadc2174f2f088dbf
Author: Christian Lamparter <chunkeey at gmail.com>
AuthorDate: Sun Jan 16 18:42:18 2022 +0100

    apm821xx: WNDR4700: utilize ath9k nvmem-cells
    
    the WNDR4700 can fetch its calibration data and
    mac-addresses directly from the "wifi_data" partition.
    This allows us to get rid of the 10-ath9k-eeprom file
    for the apm821xx target completely.
    
    Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 .../etc/hotplug.d/firmware/10-ath9k-eeprom         | 45 ----------------------
 target/linux/apm821xx/dts/netgear-wndr4700.dts     | 27 +++++++++++--
 2 files changed, 23 insertions(+), 49 deletions(-)

diff --git a/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
deleted file mode 100644
index dcdcf4dc45..0000000000
--- a/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-[ -e /lib/firmware/$FIRMWARE ] && exit 0
-
-. /lib/functions/caldata.sh
-
-board=$(board_name)
-
-case "$FIRMWARE" in
-"ath9k-eeprom-pci-0000:43:00.0.bin")
-        case $board in
-        netgear,wndr4700)
-		. /lib/upgrade/nand.sh
-
-		if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
-			caldata_extract_ubi "caldata" 0x1000 0x1000
-		else
-			caldata_extract "wifi_data" 0x1000 0x1000
-			ath9k_patch_mac $(mtd_get_mac_binary wifi_data 0x0)
-		fi
-		;;
-	*)
-		caldata_die "board $board is not supported yet"
-		;;
-	esac
-	;;
-
-"ath9k-eeprom-pci-0000:44:00.0.bin")
-        case $board in
-        netgear,wndr4700)
-		. /lib/upgrade/nand.sh
-
-		if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
-			caldata_extract_ubi "caldata" 0x5000 0x1000
-		else
-			caldata_extract "wifi_data" 0x5000 0x1000
-			ath9k_patch_mac $(mtd_get_mac_binary wifi_data 0xc)
-		fi
-		;;
-	*)
-		caldata_die "board $board is not supported yet"
-		;;
-	esac
-	;;
-esac
diff --git a/target/linux/apm821xx/dts/netgear-wndr4700.dts b/target/linux/apm821xx/dts/netgear-wndr4700.dts
index 63c96bd82a..12d9dc0bfd 100644
--- a/target/linux/apm821xx/dts/netgear-wndr4700.dts
+++ b/target/linux/apm821xx/dts/netgear-wndr4700.dts
@@ -247,6 +247,25 @@
 				label = "wifi_data";
 				reg = <0x07fc0000 0x00040000>;
 				read-only;
+
+				compatible = "nvmem-cells";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				macaddr_wifi_0: macaddr at 0 {
+					reg = <0x0 0x6>;
+				};
+				macaddr_wifi_c: macaddr at c {
+					reg = <0xc 0x6>;
+				};
+
+				calibration_wifi_1000: calibration at 1000 {
+					reg = <0x1000 0x440>;
+				};
+
+				calibration_wifi_5000: calibration at 5000 {
+					reg = <0x5000 0x440>;
+				};
 			};
 		};
 	};
@@ -457,8 +476,8 @@
 					compatible = "pci168c,0030";
 					reg = <0x00430000 0 0 0 0>;
 					interrupts = <3>; /* INTC */
-					qca,no-eeprom;
-					/* wifi CAL & MAC is stored in nvram */
+					nvmem-cell-names = "mac-address", "calibration";
+					nvmem-cells = <&macaddr_wifi_0>, <&calibration_wifi_1000>;
 
 					/*
 					 * Because this was such a pain.
@@ -480,8 +499,8 @@
 					compatible = "pci168c,0033";
 					reg = <0x00440000 0 0 0 0>;
 					interrupts = <4>; /* INTD */
-					qca,no-eeprom;
-					/* wifi CAL & MAC is stored in nvram */
+					nvmem-cell-names = "mac-address", "calibration";
+					nvmem-cells = <&macaddr_wifi_c>, <&calibration_wifi_5000>;
 				};
 			};
 



More information about the lede-commits mailing list