From 6157a2aeb96ca92f2dbab94d67020d1e7eb912e2 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 13 Jun 2024 17:19:07 -0700 Subject: [PATCH] ath79: replace various mtd_get_mac_text Deprecated. Replaced with nvmem. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/20176 Signed-off-by: Robert Marko --- .../ath79/dts/ar9342_zyxel_nwa1123-ac.dts | 7 +++++ .../ath79/dts/ar9342_zyxel_nwa1123-ni.dts | 7 +++++ .../ath79/dts/qca9531_dlink_dch-g020-a1.dts | 26 +++++++++++++++++-- .../ath79/dts/qca9533_dlink_dap-13xx.dtsi | 26 +++++++++++++++++-- .../generic/base-files/etc/board.d/02_network | 6 ----- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 13 ---------- 6 files changed, 62 insertions(+), 23 deletions(-) diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ac.dts b/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ac.dts index e3164259dfe..dc0b25e8e84 100644 --- a/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ac.dts +++ b/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ac.dts @@ -36,4 +36,11 @@ &pcie { status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&macaddr_mib0_66 0>; + nvmem-cell-names = "mac-address"; + }; }; diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ni.dts b/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ni.dts index cb5588c1223..c27b0e5aa47 100644 --- a/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ni.dts +++ b/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ni.dts @@ -36,4 +36,11 @@ &pcie { status = "okay"; + + wifi@0,0 { + compatible = "pci168c,0030"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&macaddr_mib0_66 0>; + nvmem-cell-names = "mac-address"; + }; }; diff --git a/target/linux/ath79/dts/qca9531_dlink_dch-g020-a1.dts b/target/linux/ath79/dts/qca9531_dlink_dch-g020-a1.dts index 198b08c56ea..a77c4b7a898 100644 --- a/target/linux/ath79/dts/qca9531_dlink_dch-g020-a1.dts +++ b/target/linux/ath79/dts/qca9531_dlink_dch-g020-a1.dts @@ -11,6 +11,7 @@ model = "D-Link DCH-G020 A1"; aliases { + label-mac-device = ð0; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; @@ -129,6 +130,24 @@ label = "mp"; reg = <0x20000 0x10000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mp_1: macaddr@1 { + compatible = "mac-base"; + reg = <0x1 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_mp_13: macaddr@13 { + compatible = "mac-base"; + reg = <0x13 0x11>; + #nvmem-cell-cells = <1>; + }; + }; }; partition@30000 { @@ -168,11 +187,14 @@ ð0 { status = "okay"; + + nvmem-cells = <&macaddr_mp_1 0>; + nvmem-cell-names = "mac-address"; }; &wmac { status = "okay"; - nvmem-cells = <&cal_art_1000>; - nvmem-cell-names = "calibration"; + nvmem-cells = <&cal_art_1000>, <&macaddr_mp_13 0>; + nvmem-cell-names = "calibration", "mac-address"; }; diff --git a/target/linux/ath79/dts/qca9533_dlink_dap-13xx.dtsi b/target/linux/ath79/dts/qca9533_dlink_dap-13xx.dtsi index 0364cf2cd70..be21bedbf8c 100644 --- a/target/linux/ath79/dts/qca9533_dlink_dap-13xx.dtsi +++ b/target/linux/ath79/dts/qca9533_dlink_dap-13xx.dtsi @@ -8,6 +8,7 @@ / { aliases { + label-mac-device = ð0; led-boot = &led_power; led-failsafe = &led_status; led-running = &led_power; @@ -106,6 +107,24 @@ label = "mp"; reg = <0x20000 0x10000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mp_1: macaddr@1 { + compatible = "mac-base"; + reg = <0x1 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_mp_13: macaddr@13 { + compatible = "mac-base"; + reg = <0x13 0x11>; + #nvmem-cell-cells = <1>; + }; + }; }; partition@30000 { @@ -125,11 +144,14 @@ ð0 { status = "okay"; + + nvmem-cells = <&macaddr_mp_1 0>; + nvmem-cell-names = "mac-address"; }; &wmac { status = "okay"; - nvmem-cells = <&cal_art_1000>; - nvmem-cell-names = "calibration"; + nvmem-cells = <&cal_art_1000>, <&macaddr_mp_13 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 30ee6405b15..d1ba702340f 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 @@ -689,12 +689,6 @@ ath79_setup_macs() plc_mac=$(mtd_get_mac_ascii art "protest_plc_mac") [ -n "$plc_mac" ] && ucidef_set_interface_macaddr "plc" $plc_mac ;; - dlink,dap-1330-a1|\ - dlink,dap-1365-a1|\ - dlink,dch-g020-a1) - lan_mac=$(mtd_get_mac_text "mp" 0x1) - label_mac=$lan_mac - ;; dlink,dap-2230-a1|\ dlink,dap-2660-a1|\ dlink,dap-2680-a1|\ 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 c4ae1c46b95..f30cc438167 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 @@ -24,11 +24,6 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii art "protest_ath0_mac" > /sys${DEVPATH}/macaddress ;; - dlink,dap-1330-a1|\ - dlink,dap-1365-a1|\ - dlink,dch-g020-a1) - mtd_get_mac_text "mp" 0x13 > /sys${DEVPATH}/macaddress - ;; dlink,dap-2230-a1|\ dlink,dap-3320-a1) mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress @@ -127,12 +122,4 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii devdata wlan5mac > /sys${DEVPATH}/macaddress ;; - zyxel,nwa1123-ac) - [ "$PHYNBR" -eq 0 ] && \ - mtd_get_mac_text mib0 0x66 > /sys${DEVPATH}/macaddress - ;; - zyxel,nwa1123-ni) - [ "$PHYNBR" -eq 1 ] && \ - mtd_get_mac_text mib0 0x66 > /sys${DEVPATH}/macaddress - ;; esac -- 2.47.3