mediatek: filogic: convert GL.iNet MT-6000 to NVMEM-on-MMC
authorDaniel Golle <daniel@makrotopia.org>
Sat, 17 Feb 2024 22:14:01 +0000 (22:14 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 18 Feb 2024 03:26:15 +0000 (03:26 +0000)
Now that we can reference MMC partitions in device tree, use that
to get rid of Wi-Fi EEPROM and MAC address setup in userspace.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts
target/linux/mediatek/filogic/base-files/etc/board.d/02_network
target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata

index 26996e7b4a5ab218ee9d61f46445c46111eaa270..fd0e1a69157ed0f27c32376aabab0fcc85ce23b9 100644 (file)
@@ -13,6 +13,7 @@
 
        aliases {
                serial0 = &uart0;
+               label-mac-device = &gmac1;
                led-boot = &led_blue;
                led-failsafe = &led_blue;
                led-running = &led_white;
@@ -84,6 +85,8 @@
                compatible = "mediatek,eth-mac";
                reg = <0>;
                phy-mode = "2500base-x";
+               nvmem-cells = <&macaddr_factory_a 2>;
+               nvmem-cell-names = "mac-address";
 
                fixed-link {
                        speed = <2500>;
@@ -95,6 +98,8 @@
        gmac1: mac@1 {
                compatible = "mediatek,eth-mac";
                reg = <1>;
+               nvmem-cells = <&macaddr_factory_a 0>;
+               nvmem-cell-names = "mac-address";
                phy-mode = "2500base-x";
                phy-handle = <&phy1>;
        };
 };
 
 &wifi {
+       nvmem-cells = <&eeprom_factory_0>;
+       nvmem-cell-names = "eeprom";
        pinctrl-names = "default";
        pinctrl-0 = <&wf_2g_5g_pins>;
        status = "okay";
        no-sd;
        no-sdio;
        status = "okay";
+
+       card@0 {
+               compatible = "mmc-card";
+               reg = <0>;
+
+               block {
+                       compatible = "block-device";
+                       partitions {
+                               block-partition-env {
+                                       partname = "u-boot-env";
+
+                                       nvmem-layout {
+                                               compatible = "u-boot,env-layout";
+                                       };
+                               };
+
+                               block-partition-factory {
+                                       partname = "factory";
+
+                                       nvmem-layout {
+                                               compatible = "fixed-layout";
+                                               #address-cells = <1>;
+                                               #size-cells = <1>;
+
+                                               eeprom_factory_0: eeprom@0 {
+                                                       reg = <0x0 0x1000>;
+                                               };
+
+                                               macaddr_factory_a: macaddr@a {
+                                                       compatible = "mac-base";
+                                                       reg = <0xa 0x6>;
+                                                       #nvmem-cell-cells = <1>;
+                                               };
+                                       };
+                               };
+                       };
+               };
+       };
 };
index 5542f1518afae2c8ddb4a89de362744ac6fa410d..caeeaaf22346f0ce754971d4b253d96a54edd8d8 100644 (file)
@@ -134,11 +134,6 @@ mediatek_setup_macs()
                wan_mac="$label_mac"
                lan_mac="$(macaddr_add $label_mac 1)"
                ;;
-       glinet,gl-mt6000)
-               label_mac=$(mmc_get_mac_binary factory 0x0a)
-               wan_mac=$label_mac
-               lan_mac=$(macaddr_add "$label_mac" 2)
-               ;;
        h3c,magic-nx30-pro)
                wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr)
                lan_mac=$(macaddr_add "$wan_mac" 1)
index 22ab26608f8ab64d22d2c06060fa14e147c56863..1ec648584d9829a19df9a5f1c2f88bbbd1947bd8 100644 (file)
@@ -72,7 +72,6 @@ case "$FIRMWARE" in
                CI_UBIPART="UBI_DEV"
                caldata_extract_ubi "Factory" 0x0 0x1000
                ;;
-       glinet,gl-mt6000|\
        jdcloud,re-cp-03)
                caldata_extract_mmc "factory" 0x0 0x1000
                ;;