[openwrt/openwrt] ath79: calibrate all ar9344 tl-WDRxxxx with nvmem

LEDE Commits lede-commits at lists.infradead.org
Fri Nov 18 12:09:45 PST 2022


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/e354b01baf886e7715dd7928472fb858f7c8e4c3

commit e354b01baf886e7715dd7928472fb858f7c8e4c3
Author: Edward Chow <equu at openmail.cc>
AuthorDate: Wed Nov 9 17:18:17 2022 +0800

    ath79: calibrate all ar9344 tl-WDRxxxx with nvmem
    
    Driver for both soc (2.4GHz Wifi) and pci (5 GHz) now pull the calibration
    data from the nvmem subsystem.
    
    This allows us to move the userspace caldata extraction for the pci-e ath9k
    supported wifi into the device-tree definition of the device.
    
    wmac's nodes are also changed over to use nvmem-cells over OpenWrt's
    custom mtd-cal-data property.
    
    The wifi mac address remains correct after these changes, because When both
    "mac-address" and "calibration" are defined, the effective mac address
    comes from the cell corresponding to "mac-address" and
    mac-address-increment.
    
    Test passed on my tplink tl-wdr4310.
    
    Signed-off-by: Edward Chow <equu at openmail.cc>
---
 .../ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts      | 17 -------------
 .../linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi  | 17 -------------
 .../linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi  | 29 ++++++++++++++++++++--
 .../etc/hotplug.d/firmware/10-ath9k-eeprom         |  5 ----
 4 files changed, 27 insertions(+), 41 deletions(-)

diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts b/target/linux/ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts
index 77f6637188..1600e12b64 100644
--- a/target/linux/ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts
+++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts
@@ -50,16 +50,9 @@
 };
 
 &ath9k {
-	nvmem-cells = <&macaddr_uboot_1fc00>;
-	nvmem-cell-names = "mac-address";
 	mac-address-increment = <1>;
 };
 
-&wmac {
-	nvmem-cells = <&macaddr_uboot_1fc00>;
-	nvmem-cell-names = "mac-address";
-};
-
 &eth1 {
 	status = "okay";
 
@@ -83,13 +76,3 @@
 	nvmem-cell-names = "mac-address";
 	mac-address-increment = <2>;
 };
-
-&uboot {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_uboot_1fc00: macaddr at 1fc00 {
-		reg = <0x1fc00 0x6>;
-	};
-};
diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
index 55ddb74184..d2791aee70 100644
--- a/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
@@ -75,14 +75,7 @@
 	status = "okay";
 };
 
-&ath9k {
-	nvmem-cells = <&macaddr_uboot_1fc00>;
-	nvmem-cell-names = "mac-address";
-};
-
 &wmac {
-	nvmem-cells = <&macaddr_uboot_1fc00>;
-	nvmem-cell-names = "mac-address";
 	mac-address-increment = <(-1)>;
 };
 
@@ -117,13 +110,3 @@
 	phy-mode = "rgmii";
 	phy-handle = <&phy0>;
 };
-
-&uboot {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_uboot_1fc00: macaddr at 1fc00 {
-		reg = <0x1fc00 0x6>;
-	};
-};
diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi b/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
index a3f4dc036d..a2649d19e9 100644
--- a/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
@@ -106,14 +106,39 @@
 	ath9k: wifi at 0,0 {
 		compatible = "pci168c,0033";
 		reg = <0x0000 0 0 0 0>;
-		qca,no-eeprom;
 		#gpio-cells = <2>;
 		gpio-controller;
+		nvmem-cells = <&macaddr_uboot_1fc00>, <&cal_art_5000>;
+		nvmem-cell-names = "mac-address", "calibration";
 	};
 };
 
 &wmac {
 	status = "okay";
+	nvmem-cells = <&macaddr_uboot_1fc00>, <&cal_art_1000>;
+	nvmem-cell-names = "mac-address", "calibration";
+};
+
+&uboot {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_uboot_1fc00: macaddr at 1fc00 {
+		reg = <0x1fc00 0x6>;
+	};
+};
 
-	mtd-cal-data = <&art 0x1000>;
+&art {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cal_art_1000: cal at 1000 {
+		reg = <0x1000 0x440>;
+	};
+
+	cal_art_5000: cal at 5000 {
+		reg = <0x5000 0x440>;
+	};
 };
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 924d6407af..bddaf0bdf8 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
@@ -89,11 +89,6 @@ case "$FIRMWARE" in
 	engenius,ecb600|\
 	mercury,mw4530r-v1|\
 	ocedo,raccoon|\
-	tplink,tl-wdr3500-v1|\
-	tplink,tl-wdr3600-v1|\
-	tplink,tl-wdr4300-v1|\
-	tplink,tl-wdr4300-v1-il|\
-	tplink,tl-wdr4310-v1|\
 	ubnt,unifi-ap-pro|\
 	watchguard,ap100|\
 	watchguard,ap200|\




More information about the lede-commits mailing list