[openwrt/openwrt] ath79: trendnet,tew-823dru: use nvmem

LEDE Commits lede-commits at lists.infradead.org
Sun Aug 24 07:42:42 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/132b6862a074f9ebae8ef055b03e7994a2ce469f

commit 132b6862a074f9ebae8ef055b03e7994a2ce469f
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Tue Jun 11 15:37:37 2024 -0700

    ath79: trendnet,tew-823dru: use nvmem
    
    Removes deprecated userspace handling.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/16287
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../ath79/dts/qca9558_trendnet_tew-823dru.dts      | 36 ++++++++++++++++++++--
 .../generic/base-files/etc/board.d/02_network      |  5 ---
 .../etc/hotplug.d/ieee80211/10_fix_wifi_mac        |  8 -----
 3 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts b/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts
index d2e381eb4b..817ce3bf1e 100644
--- a/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts
+++ b/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts
@@ -11,6 +11,7 @@
 	model = "TRENDNET TEW-823DRU";
 
 	aliases {
+		label-mac-device = &eth1;
 		led-boot = &led_power_green;
 		led-failsafe = &led_power_green;
 		led-running = &led_power_green;
@@ -64,6 +65,13 @@
 
 &pcie0 {
 	status = "okay";
+
+	wifi at 0,0 {
+		compatible = "qcom,ath10k";
+		reg = <0 0 0 0 0>;
+		nvmem-cells = <&maccaddr_mac_wan 1>;
+		nvmem-cell-names = "mac-address";
+	};
 };
 
 &pcie1 {
@@ -133,6 +141,24 @@
 				label = "mac";
 				reg = <0xfe0000 0x010000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					maccaddr_mac_lan: macaddr at 4 {
+						compatible = "mac-base";
+						reg = <0x4 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					maccaddr_mac_wan: macaddr at 18 {
+						compatible = "mac-base";
+						reg = <0x18 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 
 			partition at ff0000 {
@@ -172,6 +198,9 @@
 &eth0 {
 	status = "okay";
 
+	nvmem-cells = <&maccaddr_mac_lan 0>;
+	nvmem-cell-names = "mac-address";
+
 	phy-handle = <&phy0>;
 	pll-data = <0x56000000 0x00000101 0x00001616>;
 
@@ -184,6 +213,9 @@
 &eth1 {
 	status = "okay";
 
+	nvmem-cells = <&maccaddr_mac_wan 0>;
+	nvmem-cell-names = "mac-address";
+
 	pll-data = <0x03000101 0x00000101 0x00001616>;
 
 	fixed-link {
@@ -195,6 +227,6 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&cal_art_1000>;
-	nvmem-cell-names = "calibration";
+	nvmem-cells = <&cal_art_1000>, <&maccaddr_mac_lan 0>;
+	nvmem-cell-names = "calibration", "mac-address";
 };
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 545bc14e36..f38eaa7866 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
@@ -846,11 +846,6 @@ ath79_setup_macs()
 		base_mac=$(mtd_get_mac_binary info 0x8)
 		wan_mac=$(macaddr_add "$base_mac" 1)
 		;;
-	trendnet,tew-823dru)
-		lan_mac=$(mtd_get_mac_text mac 0x4)
-		wan_mac=$(mtd_get_mac_text mac 0x18)
-		label_mac=$wan_mac
-		;;
 	ubnt,powerbridge-m|\
 	ubnt,rocket-m|\
 	ubnt,unifi)
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 4dfc67e280..9b5593b972 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
@@ -112,14 +112,6 @@ case "$board" in
 		[ "$PHYNBR" -eq 1 ] && \
 			macaddr_add $base_mac 1 > /sys${DEVPATH}/macaddress
 		;;
-	trendnet,tew-823dru)
-		# set the 2.4G interface mac address to LAN MAC
-		[ "$PHYNBR" -eq 1 ] && \
-			mtd_get_mac_text mac 4 > /sys${DEVPATH}/macaddress
-		# set the 5G interface mac address to WAN MAC + 1
-		[ "$PHYNBR" -eq 0 ] && \
-			macaddr_add "$(mtd_get_mac_text mac 0x18)" 1 > /sys${DEVPATH}/macaddress
-		;;
 	zyxel,nwa1123-ac)
 		[ "$PHYNBR" -eq 0 ] && \
 			mtd_get_mac_text mib0 0x66 > /sys${DEVPATH}/macaddress




More information about the lede-commits mailing list