[openwrt/openwrt] ramips: MSG1500 X.00: switch to mac-address-ascii dts
LEDE Commits
lede-commits at lists.infradead.org
Fri Apr 21 12:49:43 PDT 2023
ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/31c15813f9d273cf7c5683132baa12a6d728f3c8
commit 31c15813f9d273cf7c5683132baa12a6d728f3c8
Author: Chukun Pan <amadeus at jmu.edu.cn>
AuthorDate: Wed Oct 19 23:16:30 2022 +0800
ramips: MSG1500 X.00: switch to mac-address-ascii dts
The Config partition of some machines is special, and the openwrt script
cannot read the protest_lan_mac correctly. This problem can be solved by
reading the mac address (ascii) in dts.
Signed-off-by: Chukun Pan <amadeus at jmu.edu.cn>
---
.../ramips/dts/mt7621_raisecom_msg1500-x-00.dts | 39 ++++++++++++++++------
.../mt7621/base-files/etc/board.d/02_network | 5 ---
.../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 3 +-
3 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
index 3c5f1e520c..5d713c0098 100644
--- a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
+++ b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
@@ -13,6 +13,7 @@
led-boot = &led_usb;
led-failsafe = &led_usb;
led-upgrade = &led_usb;
+ label-mac-device = &gmac0;
};
leds {
@@ -79,12 +80,32 @@
label = "Config";
reg = <0x80000 0x80000>;
read-only;
+
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ macaddr_config_8014: macaddr at 8014 {
+ reg = <0x8014 0x11>;
+ };
+
+ macaddr_config_8036: macaddr at 8036 {
+ reg = <0x8036 0x11>;
+ };
};
factory: partition at 100000 {
label = "Factory";
reg = <0x100000 0x40000>;
read-only;
+
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ macaddr_factory_4: macaddr at 4 {
+ reg = <0x4 0x6>;
+ };
};
partition at 140000 {
@@ -115,10 +136,18 @@
};
};
+&gmac0 {
+ nvmem-cells = <&macaddr_config_8014>;
+ nvmem-cell-names = "mac-address-ascii";
+};
+
&gmac1 {
status = "okay";
label = "wan";
phy-handle = <ðphy4>;
+
+ nvmem-cells = <&macaddr_config_8036>;
+ nvmem-cell-names = "mac-address-ascii";
};
&mdio {
@@ -157,13 +186,3 @@
function = "gpio";
};
};
-
-&factory {
- compatible = "nvmem-cells";
- #address-cells = <1>;
- #size-cells = <1>;
-
- macaddr_factory_4: macaddr at 4 {
- reg = <0x4 0x6>;
- };
-};
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 3a864f6f04..e357b47a4c 100644
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -277,11 +277,6 @@ ramips_setup_macs()
wan_mac=$(macaddr_add "$lan_mac" 1)
label_mac=$lan_mac
;;
- raisecom,msg1500-x-00)
- lan_mac=$(mtd_get_mac_ascii Config protest_lan_mac)
- wan_mac=$(mtd_get_mac_ascii Config protest_wan_mac)
- label_mac=$lan_mac
- ;;
yuncore,ax820)
label_mac=$(mtd_get_mac_binary Factory 0x4)
;;
diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index b3de1f39cf..30a10423ad 100644
--- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -141,8 +141,7 @@ case "$board" in
;;
raisecom,msg1500-x-00)
[ "$PHYNBR" = "0" ] && \
- macaddr_setbit_la "$(mtd_get_mac_ascii Config protest_lan_mac)" \
- > /sys${DEVPATH}/macaddress
+ macaddr_setbit_la "$(get_mac_label)" > /sys${DEVPATH}/macaddress
;;
snr,snr-cpe-me2-sfp)
hw_mac_addr="$(mtd_get_mac_binary factory 0x8004)"
More information about the lede-commits
mailing list