ath79: tplink,deco-s4-v2: use nvmem for cal
authorRosen Penev <rosenp@gmail.com>
Sun, 16 Jun 2024 19:40:53 +0000 (12:40 -0700)
committerRobert Marko <robimarko@gmail.com>
Wed, 18 Dec 2024 19:27:03 +0000 (20:27 +0100)
Userspace handling is deprecated. MAC address stuff needs to remain
handled in userspace as it's encrypted. Maybe an NVMEM driver can be
written in the future...

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17276
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ath79/dts/qca9563_tplink_deco-s4-v2.dts
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

index 7cbc77f64b5777c08599217ccf7f20c48c31df3c..147a880de88ba46c6ee9cce8e11f6de628ddc1b2 100644 (file)
                                        #address-cells = <1>;
                                        #size-cells = <1>;
 
+                                       cal_art_1000: calibration@1000 {
+                                               reg = <0x1000 0x440>;
+                                       };
+
                                        precal_art_5000: pre-calibration@5000 {
                                                reg = <0x5000 0x2f20>;
                                        };
 &wmac {
        status = "okay";
 
-       qca,no-eeprom;
+       nvmem-cells = <&cal_art_1000>;
+       nvmem-cell-names = "calibration";
 };
index 17639ad439e5b3942fe03e7b689fa9451ebb7d34..675522823f61cab3f5988c5187afcb0dff1f9f7b 100644 (file)
@@ -58,11 +58,6 @@ case "$FIRMWARE" in
                caldata_extract "art" 0x1000 0x440
                ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env mac_addr)
                ;;
-       tplink,deco-s4-v2)
-               caldata_extract "art" 0x1000 0x440
-               base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
-               ath9k_patch_mac $(macaddr_add $base_mac 1)
-               ;;
        *)
                caldata_die "board $board is not supported yet"
                ;;
index 5155d240a825acc74c6e93ca6b46b7721108be97..b10599cc1549708636223d5d2facd6e3a511558a 100644 (file)
@@ -110,7 +110,8 @@ case "$board" in
                base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
                [ "$PHYNBR" -eq 0 ] && \
                        macaddr_add $base_mac 2 > /sys${DEVPATH}/macaddress
-
+               [ "$PHYNBR" -eq 1 ] && \
+                       macaddr_add $base_mac 1 > /sys${DEVPATH}/macaddress
                ;;
        trendnet,tew-823dru)
                # set the 2.4G interface mac address to LAN MAC