[openwrt/openwrt] ath79: utilize nvmem on Netgear EX7300 v2

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 19 23:45:45 PST 2022


mans0n pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/3e3e78de1103cb0c5af4cc229152236758c37901

commit 3e3e78de1103cb0c5af4cc229152236758c37901
Author: Sungbo Eo <mans0n at gorani.run>
AuthorDate: Wed Feb 9 01:32:47 2022 +0900

    ath79: utilize nvmem on Netgear EX7300 v2
    
    mtd-mac-address should no longer be used after commit 5ae2e786395c
    ("kernel: drop support for mtd-mac-address"). Convert it to nvmem-cells.
    
    While at it, also convert OpenWrt's custom mtd-cal-data property and
    userspace pre-calibration data extraction to the nvmem implementation.
    
    Note: nvmem-cells in QCN5502 wmac has not been tested.
    
    Fixes: c32008a37b81 ("ath79: add partial support for Netgear EX7300v2")
    Signed-off-by: Sungbo Eo <mans0n at gorani.run>
---
 .../linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts  | 56 ++++++++++++++++++----
 .../etc/hotplug.d/firmware/11-ath10k-caldata       |  4 --
 2 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/target/linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts b/target/linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts
index ba8dae0b36..e5d897029d 100644
--- a/target/linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts
+++ b/target/linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts
@@ -114,6 +114,14 @@
 
 &pcie {
 	status = "okay";
+
+	wifi at 0,0 {
+		compatible = "qcom,ath10k";
+		reg = <0 0 0 0 0>;
+
+		nvmem-cells = <&macaddr_artmtd_c>, <&precal_art_5000>;
+		nvmem-cell-names = "mac-address", "pre-calibration";
+	};
 };
 
 &pll {
@@ -133,7 +141,7 @@
 			#address-cells = <1>;
 			#size-cells = <1>;
 
-			uboot: partition at 0 {
+			partition at 0 {
 				label = "u-boot";
 				reg = <0x000000 0x040000>;
 				read-only;
@@ -174,29 +182,56 @@
 				read-only;
 			};
 
-			artmtd: partition at fe0000 {
+			partition at fe0000 {
 				label = "artmtd";
 				reg = <0xfe0000 0x10000>;
+
+				compatible = "nvmem-cells";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				macaddr_artmtd_0: macaddr at 0 {
+					reg = <0x0 0x6>;
+				};
+
+				macaddr_artmtd_6: macaddr at 6 {
+					reg = <0x6 0x6>;
+				};
+
+				macaddr_artmtd_c: macaddr at c {
+					reg = <0xc 0x6>;
+				};
 			};
 
-			art: partition at ff0000 {
+			partition at ff0000 {
 				label = "art";
 				reg = <0xff0000 0x10000>;
 				read-only;
+
+				compatible = "nvmem-cells";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				cal_art_1000: cal at 1000 {
+					reg = <0x1000 0x440>;
+				};
+
+				precal_art_5000: precal at 5000 {
+					reg = <0x5000 0x2f20>;
+				};
 			};
 		};
 	};
 };
 
-/*
-Does not work due to lack of QCN5502 support in ath9k.
+
 &wmac {
-	status = "okay";
+	/* Does not work due to lack of QCN5502 support in ath9k. */
+	status = "disabled";
 
-	mtd-cal-data = <&art 0x1000>;
-	mtd-mac-address = <&artmtd 0x6>;
+	nvmem-cells = <&macaddr_artmtd_6>, <&cal_art_1000>;
+	nvmem-cell-names = "mac-address", "calibration";
 };
-*/
 
 &mdio0 {
 	status = "okay";
@@ -210,7 +245,8 @@ Does not work due to lack of QCN5502 support in ath9k.
 &eth0 {
 	status = "okay";
 
-	mtd-mac-address = <&artmtd 0x0>;
+	nvmem-cells = <&macaddr_artmtd_0>;
+	nvmem-cell-names = "mac-address";
 
 	phy-handle = <&phy5>;
 	phy-mode = "sgmii";
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index cf16fa2318..a7ea58b507 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -219,10 +219,6 @@ case "$FIRMWARE" in
 		caldata_extract "caldata" 0x5000 0x2f20
 		ath10k_patch_mac $(mtd_get_mac_binary caldata 0xc)
 		;;
-	netgear,ex7300-v2)
-		caldata_extract "art" 0x5000 0x2f20
-		ath10k_patch_mac $(mtd_get_mac_binary artmtd 0xc)
-		;;
 	phicomm,k2t)
 		caldata_extract "art" 0x5000 0x2f20
 		ath10k_patch_mac $(k2t_get_mac "5g_mac")



More information about the lede-commits mailing list