[openwrt/openwrt] ath79: sitecom,wlrx100: use nvmem

LEDE Commits lede-commits at lists.infradead.org
Tue Dec 2 15:56:04 PST 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/5e3a602def72475398e84c55eefec642921e236c

commit 5e3a602def72475398e84c55eefec642921e236c
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Sat Jun 15 15:13:07 2024 -0700

    ath79: sitecom,wlrx100: use nvmem
    
    Userspace handling is deprecated.
    
    Also use led-sources for simplicity.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/20508
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts | 34 +++++++++++++++------
 .../linux/ath79/dts/qca9558_sitecom_wlr-8100.dts   | 35 ++++++++++++++++------
 .../generic/base-files/etc/board.d/02_network      |  2 --
 .../etc/hotplug.d/firmware/10-ath9k-eeprom         |  5 ----
 .../etc/hotplug.d/ieee80211/10_fix_wifi_mac        |  5 ----
 5 files changed, 51 insertions(+), 30 deletions(-)

diff --git a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
index 67d954dd14..7903f3d73f 100644
--- a/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
+++ b/target/linux/ath79/dts/ar1022_sitecom_wlr-7100.dts
@@ -11,6 +11,7 @@
 	compatible = "sitecom,wlr-7100", "qca,ar9344";
 
 	aliases {
+		label-mac-device = &eth0;
 		led-boot = &led_power;
 		led-failsafe = &led_power;
 		led-running = &led_power;
@@ -47,12 +48,6 @@
 			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
 			default-state = "on";
 		};
-
-		wlan2g {
-			label = "blue:wlan2g";
-			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "phy1tpt";
-		};
 	};
 };
 
@@ -64,6 +59,9 @@
 	phy-mode = "rgmii";
 	phy-handle = <&phy0>;
 
+	nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+	nvmem-cell-names = "mac-address";
+
 	gmac-config {
 		device = <&gmac>;
 		rgmii-gmac0 = <1>;
@@ -95,8 +93,8 @@
 	wifi at 0,0 {
 		compatible = "qcom,ath10k";
 		reg = <0x0000 0 0 0 0>;
-		nvmem-cells = <&cal_art_5000>;
-		nvmem-cell-names = "calibration";
+		nvmem-cells = <&cal_art_5000>, <&macaddr_uboot_ethaddr 1>;
+		nvmem-cell-names = "calibration", "mac-address";
 	};
 };
 
@@ -127,6 +125,14 @@
 				label = "u-boot-env";
 				reg = <0x030000 0x010000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "u-boot,env";
+
+					macaddr_uboot_ethaddr: ethaddr {
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 
 			partition at 40000 {
@@ -157,6 +163,10 @@
 					#address-cells = <1>;
 					#size-cells = <1>;
 
+					cal_art_1000: calibration at 1000 {
+						reg = <0x1000 0x440>;
+					};
+
 					cal_art_5000: calibration at 5000 {
 						reg = <0x5000 0x844>;
 					};
@@ -177,5 +187,11 @@
 &wmac {
 	status = "okay";
 
-	qca,no-eeprom;
+	nvmem-cells = <&cal_art_1000>, <&macaddr_uboot_ethaddr 0>;
+	nvmem-cell-names = "calibration", "mac-address";
+
+	led {
+		led-sources = <14>;
+		led-active-low;
+	};
 };
diff --git a/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts b/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts
index 1c8d88c20d..9978a3d7d1 100644
--- a/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts
+++ b/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts
@@ -11,6 +11,7 @@
 	compatible = "sitecom,wlr-8100", "qca,qca9558";
 
 	aliases {
+		label-mac-device = &eth0;
 		led-boot = &led_status_amber;
 		led-failsafe = &led_status_amber;
 		led-running = &led_status_amber;
@@ -48,12 +49,6 @@
 			gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 		};
 
-		wifi2g {
-			label = "blue:wifi2g";
-			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
-			linux,default-trigger = "phy1tpt";
-		};
-
 		wifi5g {
 			label = "blue:wifi5g";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
@@ -85,6 +80,14 @@
 				label = "u-boot-env";
 				reg = <0x030000 0x010000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "u-boot,env";
+
+					macaddr_uboot_ethaddr: ethaddr {
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 
 			partition at 40000 {
@@ -121,6 +124,10 @@
 					#address-cells = <1>;
 					#size-cells = <1>;
 
+					cal_art_1000: calibration at 1000 {
+						reg = <0x1000 0x440>;
+					};
+
 					cal_art_5000: calibration at 5000 {
 						reg = <0x5000 0x844>;
 					};
@@ -140,8 +147,8 @@
 	wifi at 0,0 {
 		compatible = "qcom,ath10k";
 		reg = <0 0 0 0 0>;
-		nvmem-cells = <&cal_art_5000>;
-		nvmem-cell-names = "calibration";
+		nvmem-cells = <&cal_art_5000>, <&macaddr_uboot_ethaddr 1>;
+		nvmem-cell-names = "calibration", "mac-address";
 	};
 };
 
@@ -175,6 +182,9 @@
 	phy-handle = <&phy0>;
 	pll-data = <0xa6000000 0x00000101 0x00001616>;
 
+	nvmem-cells = <&macaddr_uboot_ethaddr 0>;
+	nvmem-cell-names = "mac-address";
+
 	gmac-config {
 		device = <&gmac>;
 		rgmii-enabled = <1>;
@@ -183,5 +193,12 @@
 
 &wmac {
 	status = "okay";
-	qca,no-eeprom;
+
+	nvmem-cells = <&cal_art_1000>, <&macaddr_uboot_ethaddr 0>;
+	nvmem-cell-names = "calibration", "mac-address";
+
+	led {
+		led-sources = <19>;
+		led-active-low;
+	};
 };
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 fcb56bd777..1d5ddc605c 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
@@ -808,9 +808,7 @@ ath79_setup_macs()
 		;;
 	sitecom,wlr-7100|\
 	sitecom,wlr-8100)
-		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
 		wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
-		label_mac=$lan_mac
 		;;
 	tplink,archer-a7-v5|\
 	tplink,archer-a9-v6|\
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 b3181372be..ed2b846433 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
@@ -15,11 +15,6 @@ case "$FIRMWARE" in
 	avm,fritzdvbc)
 		caldata_extract_reverse "urlader" 0x1541 0x440
 		;;
-	sitecom,wlr-7100|\
-	sitecom,wlr-8100)
-		caldata_extract "art" 0x1000 0x440
-		ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env ethaddr)
-		;;
 	moxa,awk-1137c)
 		caldata_extract "art" 0x1000 0x440
 		ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env mac_addr)
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 c71ba436b4..e3336174d5 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
@@ -80,11 +80,6 @@ case "$board" in
 		# which would allow to patch the macaddress
 		macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" $PHYNBR > /sys${DEVPATH}/macaddress
 		;;
-	sitecom,wlr-7100|\
-	sitecom,wlr-8100)
-		[ "$PHYNBR" -eq 0 ] && \
-			macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
-		;;
 	dlink,dir-842-c1|\
 	dlink,dir-842-c2|\
 	dlink,dir-842-c3|\




More information about the lede-commits mailing list