[openwrt/openwrt] ath79: tew-673gru: use nvmem

LEDE Commits lede-commits at lists.infradead.org
Tue Sep 30 02:21:22 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/6c20daed133e93f8a72831fffc60f40d3a729dca

commit 6c20daed133e93f8a72831fffc60f40d3a729dca
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Fri Jun 14 10:59:16 2024 -0700

    ath79: tew-673gru: use nvmem
    
    Userspace handling is deprecated.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/20176
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../linux/ath79/dts/ar7161_trendnet_tew-673gru.dts | 39 ++++++++++++++++++++--
 .../generic/base-files/etc/board.d/02_network      |  5 ---
 .../etc/hotplug.d/firmware/10-ath9k-eeprom         |  8 -----
 3 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/target/linux/ath79/dts/ar7161_trendnet_tew-673gru.dts b/target/linux/ath79/dts/ar7161_trendnet_tew-673gru.dts
index d10c75c0d6..c704b062f1 100644
--- a/target/linux/ath79/dts/ar7161_trendnet_tew-673gru.dts
+++ b/target/linux/ath79/dts/ar7161_trendnet_tew-673gru.dts
@@ -11,6 +11,7 @@
 	model = "TRENDNET TEW-673GRU";
 
 	aliases {
+		label-mac-device = &eth1;
 		led-boot = &led_wps;
 		led-failsafe = &led_wps;
 		led-running = &led_wps;
@@ -97,13 +98,15 @@
 	wifi at 11,0 {
 		compatible = "pci168c,0029";
 		reg = <0x8800 0 0 0 0>;
-		qca,no-eeprom;
+		nvmem-cells = <&cal_caldata_1000>, <&macaddr_lan 0>;
+		nvmem-cell-names = "calibration", "mac-address";
 	};
 
 	wifi at 12,0 {
 		compatible = "pci168c,0029";
 		reg = <0x9000 0 0 0 0>;
-		qca,no-eeprom;
+		nvmem-cells = <&cal_caldata_5000>, <&macaddr_wan 1>;
+		nvmem-cell-names = "calibration", "mac-address";
 	};
 };
 
@@ -141,6 +144,32 @@
 				label = "caldata";
 				reg = <0x660000 0x010000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					cal_caldata_1000: calibration at 1000 {
+						reg = <0x1000 0xeb8>;
+					};
+
+					cal_caldata_5000: calibration at 5000 {
+						reg = <0x5000 0xeb8>;
+					};
+
+					macaddr_lan: macaddr at ffa0 {
+						compatible = "mac-base";
+						reg = <0xffa0 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_wan: macaddr at ffb4 {
+						compatible = "mac-base";
+						reg = <0xffb4 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 
 			fwconcat1: partition at 670000 {
@@ -156,6 +185,9 @@
 
 	pll-data = <0x11110000 0x00001099 0x00991099>;
 
+	nvmem-cells = <&macaddr_lan 0>;
+	nvmem-cell-names = "mac-address";
+
 	fixed-link {
 		speed = <1000>;
 		full-duplex;
@@ -167,5 +199,8 @@
 
 	pll-data = <0x11110000 0x00001099 0x00991099>;
 
+	nvmem-cells = <&macaddr_wan 0>;
+	nvmem-cell-names = "mac-address";
+
 	phy-handle = <&phy4>;
 };
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index 464fec44d1..d397600ddc 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -709,11 +709,6 @@ ath79_setup_macs()
 	dlink,dir-629-a1)
 		wan_mac=$(mtd_get_mac_text "mfcdata" 0x6a)
 		;;
-	trendnet,tew-673gru)
-		lan_mac=$(mtd_get_mac_text "caldata" 0xffa0)
-		wan_mac=$(mtd_get_mac_text "caldata" 0xffb4)
-		label_mac=$wan_mac
-		;;
 	dlink,dir-505)
 		lan_mac=$(mtd_get_mac_text "mac" 0x4)
 		;;
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 0a98a8ef8c..97acc60b80 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
@@ -90,10 +90,6 @@ case "$FIRMWARE" in
 	buffalo,wzr-hp-ag300h)
 		caldata_extract "art" 0x1000 0xeb8
 		;;
-	trendnet,tew-673gru)
-		caldata_extract "caldata" 0x1000 0xeb8
-		ath9k_patch_mac_crc $(mtd_get_mac_text "caldata" 0xffa0) 0x20c
-		;;
 	meraki,mr16)
 		caldata_extract "art" 0x11000 0xeb8
 		;;
@@ -108,10 +104,6 @@ case "$FIRMWARE" in
 	buffalo,wzr-hp-ag300h)
 		caldata_extract "art" 0x5000 0xeb8
 		;;
-	trendnet,tew-673gru)
-		caldata_extract "caldata" 0x5000 0xeb8
-		ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_text "caldata" 0xffb4) 1) 0x20c
-		;;
 	meraki,mr16)
 		caldata_extract "art" 0x15000 0xeb8
 		;;




More information about the lede-commits mailing list