From 6c20daed133e93f8a72831fffc60f40d3a729dca Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 14 Jun 2024 10:59:16 -0700 Subject: [PATCH] ath79: tew-673gru: use nvmem Userspace handling is deprecated. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/20176 Signed-off-by: Robert Marko --- .../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 d10c75c0d67..c704b062f13 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 = ð1; led-boot = &led_wps; led-failsafe = &led_wps; led-running = &led_wps; @@ -97,13 +98,15 @@ wifi@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@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@1000 { + reg = <0x1000 0xeb8>; + }; + + cal_caldata_5000: calibration@5000 { + reg = <0x5000 0xeb8>; + }; + + macaddr_lan: macaddr@ffa0 { + compatible = "mac-base"; + reg = <0xffa0 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_wan: macaddr@ffb4 { + compatible = "mac-base"; + reg = <0xffb4 0x11>; + #nvmem-cell-cells = <1>; + }; + }; }; fwconcat1: partition@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 464fec44d1e..d397600ddc5 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 0a98a8ef8cd..97acc60b80a 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 ;; -- 2.47.3