[openwrt/openwrt] mediatek: use NVMEM framework on all Adtran devices
LEDE Commits
lede-commits at lists.infradead.org
Tue Oct 15 10:11:36 PDT 2024
dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/3e6de5d77a8b8cda1e02250179d964b840c203fa
commit 3e6de5d77a8b8cda1e02250179d964b840c203fa
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon Oct 7 15:33:21 2024 +0100
mediatek: use NVMEM framework on all Adtran devices
Use NVMEM framework to assign MAC addresses and WiFi EEPROM data on
all Adtran SmartRG devices.
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
.../mediatek/dts/mt7986a-smartrg-bonanza-peak.dtsi | 77 ++++++++++++++++++++--
.../mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi | 49 ++++++++++++--
.../mediatek/dts/mt7988d-smartrg-SDG-8733A.dts | 4 ++
.../filogic/base-files/etc/board.d/02_network | 10 ---
.../etc/hotplug.d/firmware/11-mt76-caldata | 21 ------
.../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 17 -----
.../base-files/lib/preinit/10_fix_eth_mac.sh | 20 ------
7 files changed, 119 insertions(+), 79 deletions(-)
diff --git a/target/linux/mediatek/dts/mt7986a-smartrg-bonanza-peak.dtsi b/target/linux/mediatek/dts/mt7986a-smartrg-bonanza-peak.dtsi
index 038a76ad73..deab53dc45 100644
--- a/target/linux/mediatek/dts/mt7986a-smartrg-bonanza-peak.dtsi
+++ b/target/linux/mediatek/dts/mt7986a-smartrg-bonanza-peak.dtsi
@@ -14,8 +14,7 @@
/ {
aliases {
serial0 = &uart0;
- ethernet0 = &gmac0;
- ethernet1 = &gmac1;
+ label-mac-device = &gmac1;
led-boot = &led_status_green;
led-failsafe = &led_status_red;
led-running = &led_status_white;
@@ -188,16 +187,17 @@
gmac0: mac at 0 {
compatible = "mediatek,eth-mac";
reg = <0>;
-
+ nvmem-cells = <&macaddr 1>;
+ nvmem-cell-names = "mac-address";
phy-mode = "2500base-x";
};
gmac1: mac at 1 {
- label = "wan";
-
compatible = "mediatek,eth-mac";
reg = <1>;
-
+ label = "wan";
+ nvmem-cells = <&macaddr 0>;
+ nvmem-cell-names = "mac-address";
phy-mode = "2500base-x";
};
@@ -254,6 +254,47 @@
no-sd;
no-sdio;
status = "okay";
+
+ card at 0 {
+ compatible = "mmc-card";
+ reg = <0>;
+
+ block {
+ compatible = "block-device";
+
+ partitions {
+ block-partition-factory {
+ partname = "factory";
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eeprom_factory_0: eeprom at 0 {
+ reg = <0x0 0x1000>;
+ };
+
+ eeprom_factory_a0000: eeprom at a0000 {
+ reg = <0xa0000 0x1000>;
+ };
+ };
+ };
+
+ block-partition-mfginfo {
+ partname = "mfginfo";
+
+ nvmem-layout {
+ compatible = "adtran,mfginfo";
+
+ macaddr: mfg-mac {
+ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
+ };
+ };
+ };
};
&pcie {
@@ -266,6 +307,9 @@
radio0: mt7915 at 0,0 {
reg = <0x0000 0 0 0 0>;
+
+ nvmem-cells = <&eeprom_factory_a0000>, <&macaddr 4>;
+ nvmem-cell-names = "eeprom", "mac-address";
};
};
};
@@ -275,9 +319,28 @@
};
&wifi {
- status = "okay";
+ nvmem-cells = <&eeprom_factory_0>;
+ nvmem-cell-names = "eeprom";
pinctrl-names = "default";
pinctrl-0 = <&wf_2g_5g_pins>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "okay";
+
+ band at 0 {
+ /* 2.4 GHz */
+ reg = <0>;
+ nvmem-cells = <&macaddr 2>;
+ nvmem-cell-names = "mac-address";
+ };
+
+ band at 1 {
+ /* lower 5 GHz */
+ reg = <1>;
+ nvmem-cells = <&macaddr 3>;
+ nvmem-cell-names = "mac-address";
+ };
};
&pio {
diff --git a/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi b/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi
index ccf85fc110..a3db288d27 100644
--- a/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi
+++ b/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi
@@ -15,8 +15,7 @@
/ {
aliases {
serial0 = &uart0;
- ethernet0 = &gmac0;
- ethernet1 = &gmac1;
+ label-mac-device = &gmac1;
led-boot = &led_sys_green;
led-failsafe = &led_sys_blue;
led-running = &led_sys_white;
@@ -250,21 +249,30 @@
};
&gmac0 {
+ nvmem-cells = <&macaddr 1>;
+ nvmem-cell-names = "mac-address";
+
status = "okay";
};
&gmac1 {
+ nvmem-cells = <&macaddr 0>;
+ nvmem-cell-names = "mac-address";
label = "wan";
- status = "okay";
phy-mode = "usxgmii";
+
+ status = "okay";
};
&gmac2 {
+ nvmem-cells = <&macaddr 1>;
+ nvmem-cell-names = "mac-address";
label = "lan1";
- status = "okay";
phy-mode = "usxgmii";
phy-connection-type = "usxgmii";
phy = <&phy8>;
+
+ status = "okay";
};
&gsw_phy0 {
@@ -513,6 +521,18 @@
};
};
};
+
+ block-partition-mfginfo {
+ partname = "mfginfo";
+
+ nvmem-layout {
+ compatible = "adtran,mfginfo";
+
+ macaddr: mfg-mac {
+ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
};
};
};
@@ -532,6 +552,27 @@
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>, <5945000 7125000>;
+
+ band at 0 {
+ /* 2.4 GHz */
+ reg = <0>;
+ nvmem-cells = <&macaddr 4>;
+ nvmem-cell-names = "mac-address";
+ };
+
+ band at 1 {
+ /* 5 GHz */
+ reg = <1>;
+ nvmem-cells = <&macaddr 10>;
+ nvmem-cell-names = "mac-address";
+ };
+
+ band at 2 {
+ /* 6 GHz */
+ reg = <2>;
+ nvmem-cells = <&macaddr 6>;
+ nvmem-cell-names = "mac-address";
+ };
};
};
};
diff --git a/target/linux/mediatek/dts/mt7988d-smartrg-SDG-8733A.dts b/target/linux/mediatek/dts/mt7988d-smartrg-SDG-8733A.dts
index 54fbbea0ba..b72ef48bea 100644
--- a/target/linux/mediatek/dts/mt7988d-smartrg-SDG-8733A.dts
+++ b/target/linux/mediatek/dts/mt7988d-smartrg-SDG-8733A.dts
@@ -62,6 +62,8 @@
&gmac1 {
label = "lan";
+ nvmem-cells = <&macaddr 1>;
+ nvmem-cell-names = "mac-address";
phy-mode = "internal";
phy-connection-type = "internal";
phy = <&int_2p5g_phy>;
@@ -69,6 +71,8 @@
&gmac2 {
label = "wan";
+ nvmem-cells = <&macaddr 0>;
+ nvmem-cell-names = "mac-address";
phy-mode = "usxgmii";
phy-connection-type = "usxgmii";
phy = <&phy8>;
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
index 74ee571bc0..d532d75b99 100644
--- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
@@ -162,16 +162,6 @@ mediatek_setup_macs()
wan_mac=$label_mac
lan_mac=$(macaddr_add "$label_mac" 1)
;;
- smartrg,sdg-8612|\
- smartrg,sdg-8614|\
- smartrg,sdg-8622|\
- smartrg,sdg-8632|\
- smartrg,sdg-8733|\
- smartrg,sdg-8734)
- label_mac=$(mmc_get_mac_ascii mfginfo MFG_MAC)
- wan_mac=$label_mac
- lan_mac=$(macaddr_add "$label_mac" 1)
- ;;
xiaomi,mi-router-ax3000t|\
xiaomi,mi-router-ax3000t-ubootmod|\
xiaomi,mi-router-wr30u-stock|\
diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata
index c6900e6ebd..d97e5c8354 100644
--- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata
+++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata
@@ -7,21 +7,6 @@
board=$(board_name)
case "$FIRMWARE" in
-"mediatek/mt7915_eeprom.bin")
- case "$board" in
- smartrg,sdg-8622)
- caldata_extract_mmc "factory" 0xa0000 0x1000
- ;;
- esac
- ;;
-"mediatek/mt7916_eeprom.bin")
- case "$board" in
- acer,predator-w6|\
- smartrg,sdg-8632)
- caldata_extract_mmc "factory" 0xa0000 0x1000
- ;;
- esac
- ;;
"mediatek/mt7981_eeprom_mt7976_dbdc.bin")
case "$board" in
ubnt,unifi-6-plus)
@@ -36,12 +21,6 @@ case "$FIRMWARE" in
ln -sf /tmp/tp_data/MT7986_EEPROM.bin \
/lib/firmware/$FIRMWARE
;;
- smartrg,sdg-8612|\
- smartrg,sdg-8614|\
- smartrg,sdg-8622|\
- smartrg,sdg-8632)
- caldata_extract_mmc "factory" 0x0 0x1000
- ;;
esac
;;
"mediatek/mt7986_eeprom_mt7976.bin")
diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
index 3600e32340..3042858353 100644
--- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
+++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
@@ -139,23 +139,6 @@ case "$board" in
[ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
;;
- smartrg,sdg-8612|\
- smartrg,sdg-8614|\
- smartrg,sdg-8622|\
- smartrg,sdg-8632)
- addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
- [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
- [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
- [ "$PHYNBR" = "2" ] && macaddr_add $addr 4 > /sys${DEVPATH}/macaddress
- ;;
- smartrg,sdg-8733|\
- smartrg,sdg-8733a|\
- smartrg,sdg-8734)
- addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
- [ "$PHYNBR" = "0" ] && macaddr_add $addr 4 > /sys${DEVPATH}/macaddress
- [ "$PHYNBR" = "1" ] && macaddr_add $addr a > /sys${DEVPATH}/macaddress
- [ "$PHYNBR" = "2" ] && macaddr_add $addr 6 > /sys${DEVPATH}/macaddress
- ;;
tplink,tl-xdr4288|\
tplink,tl-xdr6086|\
tplink,tl-xdr6088)
diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh
index 65bd517824..0497d7dfa2 100644
--- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh
@@ -22,26 +22,6 @@ preinit_set_mac_address() {
addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0)
ip link set dev eth1 address "$(macaddr_add $addr 1)"
;;
- smartrg,sdg-8612|\
- smartrg,sdg-8614|\
- smartrg,sdg-8733|\
- smartrg,sdg-8734)
- addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
- lan_addr=$(macaddr_add $addr 1)
- ip link set dev wan address "$addr"
- ip link set dev eth0 address "$lan_addr"
- ip link set dev lan1 address "$lan_addr"
- ip link set dev lan2 address "$lan_addr"
- ip link set dev lan3 address "$lan_addr"
- ip link set dev lan4 address "$lan_addr"
- ;;
- smartrg,sdg-8622|\
- smartrg,sdg-8632|\
- smartrg,sdg-8733a)
- addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
- ip link set dev wan address "$addr"
- ip link set dev lan address "$(macaddr_add $addr 1)"
- ;;
*)
;;
esac
More information about the lede-commits
mailing list