mediatek: filogic: convert GL.iNet MT-2500 to use NVMEM-on-MMC
authorDaniel Golle <daniel@makrotopia.org>
Sat, 17 Feb 2024 22:22:28 +0000 (22:22 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 18 Feb 2024 03:36:06 +0000 (03:36 +0000)
Use nvmem-layout in device tree instead of extracting MAC addresses
in userspace.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
target/linux/mediatek/filogic/base-files/etc/board.d/02_network

index 068dd0f236e28a744abcfad27177f9085f1e228e..03cfe4c825bc296565cb29dd1761b83111e9eac8 100644 (file)
 
        gmac0: mac@0 {
                compatible = "mediatek,eth-mac";
+               nvmem-cells = <&macaddr_boot1_a 0>;
+               nvmem-cell-names = "mac-address";
                reg = <0>;
 
                phy-mode = "2500base-x";
 
        gmac1: mac@1 {
                compatible = "mediatek,eth-mac";
+               nvmem-cells = <&macaddr_boot1_a 1>;
+               nvmem-cell-names = "mac-address";
                reg = <1>;
                phy-mode = "gmii";
                phy-handle = <&int_gbe_phy>;
        vmmc-supply = <&reg_3p3v>;
        cap-mmc-highspeed;
        non-removable;
+
+       card@0 {
+               compatible = "mmc-card";
+               reg = <0>;
+
+               block {
+                       compatible = "block-device";
+
+                       partitions {
+                               block-partition-u-boot-env {
+                                       partname = "u-boot-env";
+                                       nvmem-layout {
+                                               compatible = "u-boot,env-layout";
+                                       };
+                               };
+                       };
+               };
+
+               boot1 {
+                       compatible = "block-device";
+
+                       nvmem-layout {
+                               compatible = "fixed-layout";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               macaddr_boot1_a: macaddr@a {
+                                       compatible = "mac-base";
+                                       reg = <0xa 0x6>;
+                                       #nvmem-cell-cells = <1>;
+                               };
+
+                               ddns_boot1_10@10 {
+                                       reg = <0x10 0x10>;
+                               };
+
+                               sn_bak_boot1_20@20 {
+                                       reg = <0x20 0x10>;
+                               };
+
+                               sn_boot1_20@30 {
+                                       reg = <0x30 0x10>;
+                               };
+
+                               country_code_boot1_88@88 {
+                                       reg = <0x88 0x10>;
+                               };
+                       };
+               };
+       };
 };
index caeeaaf22346f0ce754971d4b253d96a54edd8d8..683282b87cef14dd283bfd3339382d5639130f5b 100644 (file)
@@ -129,11 +129,6 @@ mediatek_setup_macs()
                ;;
                esac
                ;;
-       glinet,gl-mt2500)
-               label_mac="$(get_mac_binary "/dev/mmcblk0boot1" 0xA)"
-               wan_mac="$label_mac"
-               lan_mac="$(macaddr_add $label_mac 1)"
-               ;;
        h3c,magic-nx30-pro)
                wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr)
                lan_mac=$(macaddr_add "$wan_mac" 1)