ramips: MSG1500 X.00: switch to mac-address-ascii dts
authorChukun Pan <amadeus@jmu.edu.cn>
Wed, 19 Oct 2022 15:16:30 +0000 (23:16 +0800)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 21 Apr 2023 19:35:41 +0000 (21:35 +0200)
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@jmu.edu.cn>
target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
target/linux/ramips/mt7621/base-files/etc/board.d/02_network
target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac

index 3c5f1e520c79e8256120abb48e1c7e02dd363cc1..5d713c00987fb27099c43581be2a002820ccf62e 100644 (file)
@@ -13,6 +13,7 @@
                led-boot = &led_usb;
                led-failsafe = &led_usb;
                led-upgrade = &led_usb;
+               label-mac-device = &gmac0;
        };
 
        leds {
                        label = "Config";
                        reg = <0x80000 0x80000>;
                        read-only;
+
+                       compatible = "nvmem-cells";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       macaddr_config_8014: macaddr@8014 {
+                               reg = <0x8014 0x11>;
+                       };
+
+                       macaddr_config_8036: macaddr@8036 {
+                               reg = <0x8036 0x11>;
+                       };
                };
 
                factory: partition@100000 {
                        label = "Factory";
                        reg = <0x100000 0x40000>;
                        read-only;
+
+                       compatible = "nvmem-cells";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       macaddr_factory_4: macaddr@4 {
+                               reg = <0x4 0x6>;
+                       };
                };
 
                partition@140000 {
        };
 };
 
+&gmac0 {
+       nvmem-cells = <&macaddr_config_8014>;
+       nvmem-cell-names = "mac-address-ascii";
+};
+
 &gmac1 {
        status = "okay";
        label = "wan";
        phy-handle = <&ethphy4>;
+
+       nvmem-cells = <&macaddr_config_8036>;
+       nvmem-cell-names = "mac-address-ascii";
 };
 
 &mdio {
                function = "gpio";
        };
 };
-
-&factory {
-       compatible = "nvmem-cells";
-       #address-cells = <1>;
-       #size-cells = <1>;
-
-       macaddr_factory_4: macaddr@4 {
-               reg = <0x4 0x6>;
-       };
-};
index 3a864f6f04d63759b29387d3e1c4387b0896c0b9..e357b47a4ca0585708eb52e437e27e22d830be8a 100644 (file)
@@ -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)
                ;;
index b3de1f39cf087b8e39bbd47c674428079eae11de..30a10423ad51b320836fde0c751fbe2988b65860 100644 (file)
@@ -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)"