ath79: enterasys,ws-ap3705i: use nvmem
authorRosen Penev <[email protected]>
Sun, 18 Feb 2024 04:58:33 +0000 (20:58 -0800)
committerHauke Mehrtens <[email protected]>
Wed, 22 Oct 2025 22:04:47 +0000 (00:04 +0200)
Userspace handling is deprecated.

Use ath9k LED binding to avoid generic LED usage.

Signed-off-by: Rosen Penev <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/16286
Signed-off-by: Hauke Mehrtens <[email protected]>
target/linux/ath79/dts/ar9344_enterasys_ws-ap3705i.dts
target/linux/ath79/generic/base-files/etc/board.d/02_network
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh

index 0605baa58e7f01d23474e13a834f8941c247c845..27dfff72dec72628c45f1666c1390372c343728d 100644 (file)
                        color = <LED_COLOR_ID_GREEN>;
                        gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
                };
-
-               radio2 {
-                       label = "green:radio2";
-                       gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
-                       linux,default-trigger = "phy0tpt";
-               };
-       };
-
-       ath9k-leds {
-               compatible = "gpio-leds";
-
-               radio1 {
-                       label = "green:radio1";
-                       gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
-                       linux,default-trigger = "phy1tpt";
-               };
        };
 
        keys {
 
 &wmac {
        status = "okay";
-       qca,no-eeprom;
+
+       nvmem-cells = <&cal_art_1000>;
+       nvmem-cell-names = "calibration";
+
+       led {
+               led-sources = <11>;
+               led-active-low;
+       };
 };
 
 &spi {
                        };
 
                        partition@80000 {
+                               compatible = "u-boot,env";
                                label = "u-boot-env0";
                                reg = <0x80000 0x10000>;
                                read-only;
+
+                               macaddr_uboot_ethaddr: ethaddr {
+                               };
                        };
 
                        partition@90000 {
                                label = "calibrate";
                                reg = <0x120000 0x10000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       cal_art_1000: calibration@1000 {
+                                               reg = <0x1000 0x440>;
+                                       };
+
+                                       cal_art_5000: calibration@5000 {
+                                               reg = <0x5000 0x440>;
+                                       };
+                               };
                        };
 
                        partition@130000 {
 &pcie {
        status = "okay";
 
-       ath9k: wifi@0,0 {
+       wifi@0,0 {
                compatible = "pci168c,0033";
                reg = <0x0000 0 0 0 0>;
-               qca,no-eeprom;
-               #gpio-cells = <2>;
-               gpio-controller;
+               nvmem-cells = <&cal_art_5000>;
+               nvmem-cell-names = "calibration";
+
+               led {
+                       led-sources = <0>;
+                       led-active-low;
+               };
        };
 };
 
        phy-mode = "rgmii";
        phy-handle = <&phy0>;
 
+       nvmem-cells = <&macaddr_uboot_ethaddr>;
+       nvmem-cell-names = "mac-address";
+
        gmac-config {
                device = <&gmac>;
                rgmii-gmac0 = <1>;
index d1ba702340f558ce7ae3423a01532ec7962ce751..48787f0f9bc6fee44b43affb6471f81100acc9fc 100644 (file)
@@ -746,9 +746,6 @@ ath79_setup_macs()
                ucidef_set_interface "eth0" ifname "eth0" protocol "none" macaddr "$lan_mac"
                ucidef_set_interface "eth1" ifname "eth1" protocol "none" macaddr "$eth1_mac"
                ;;
-       enterasys,ws-ap3705i)
-               label_mac=$(mtd_get_mac_ascii u-boot-env0 ethaddr)
-               ;;
        hak5,lan-turtle|\
        hak5,packet-squirrel)
                label_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
index 11c916427d3a8b3ac5114ea562970ae4d25104ae..d6ae5b1aa193cf4b5904b1d9f711d8f2e47297ce 100644 (file)
@@ -20,10 +20,6 @@ case "$FIRMWARE" in
                caldata_extract "art" 0x1000 0x440
                ath9k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env athaddr) 1)
                ;;
-       enterasys,ws-ap3705i)
-               caldata_extract "calibrate" 0x1000 0x440
-               ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env0 RADIOADDR1)
-               ;;
        extreme-networks,ws-ap3805i)
                caldata_extract "art" 0x1000 0x440
                ath9k_patch_mac $(mtd_get_mac_ascii cfg1 RADIOADDR1)
@@ -47,10 +43,6 @@ case "$FIRMWARE" in
        avm,fritz300e)
                caldata_extract_reverse "urloader" 0x1541 0x440
                ;;
-       enterasys,ws-ap3705i)
-               caldata_extract "calibrate" 0x5000 0x440
-               ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env0 RADIOADDR0)
-               ;;
        meraki,mr12)
                caldata_extract "art" 0x11000 0xeb8
                ;;
index f30cc438167ce0a5d7f5603232aabd07701f099e..dcebc16679ad9cf0fd33431a97d825390c98a040 100644 (file)
@@ -62,6 +62,12 @@ case "$board" in
                [ "$PHYNBR" -eq 0 ] && \
                macaddr_add $(cat /sys/class/net/eth0/address) 1 > /sys${DEVPATH}/macaddress
                ;;
+       enterasys,ws-ap3705i)
+               [ "$PHYNBR" -eq 0 ] && \
+                       mtd_get_mac_ascii u-boot-env0 RADIOADDR1 > /sys${DEVPATH}/macaddress
+               [ "$PHYNBR" -eq 1 ] && \
+                       mtd_get_mac_ascii u-boot-env0 RADIOADDR0 > /sys${DEVPATH}/macaddress
+               ;;
        extreme-networks,ws-ap3805i)
                [ "$PHYNBR" -eq 0 ] && \
                mtd_get_mac_ascii cfg1 RADIOADDR0 > /sys${DEVPATH}/macaddress
index 41aa43e986918ae89562b24e055dd5bf0a6d6780..2d68e02eafd0c0d0a32c13f0f3fc70f080197a84 100644 (file)
@@ -18,9 +18,6 @@ preinit_set_mac_address() {
        engenius,esr900)
                ip link set dev eth0 address $(mtd_get_mac_ascii u-boot-env ethaddr)
                ;;
-       enterasys,ws-ap3705i)
-               ip link set dev eth0 address $(mtd_get_mac_ascii u-boot-env0 ethaddr)
-               ;;
        extreme-networks,ws-ap3805i|\
        siemens,ws-ap3610)
                ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr)