]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ath79: mr18: use nvmem for MACs 17068/head
authorRosen Penev <rosenp@gmail.com>
Thu, 4 Dec 2025 05:23:33 +0000 (21:23 -0800)
committerRobert Marko <robimarko@gmail.com>
Tue, 17 Feb 2026 19:56:27 +0000 (20:56 +0100)
NVMEM in UBI support has been present for a while. Use it to get the
MACs. Seems caldata needs to continue to be obtained through userspace.

This fixes label-mac-device as it needs a mac-address nvmem cell.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17068
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ath79/dts/qca9557_meraki_mr18.dts
target/linux/ath79/nand/base-files/etc/board.d/02_network
target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
target/linux/ath79/nand/config-default

index 4e9b3d1e9a6a7b5f9640e6d0f82274073a365ff2..3fa4e57456b852e6a07c24a45823c1da19129664 100644 (file)
                partition@1080000 {
                        label = "ubi";
                        reg = <0x1080000 0x6f00000>;
+
+                       volumes {
+                               ubi-volume-board-config {
+                                       volname = "board-config";
+
+                                       nvmem-layout {
+                                               compatible = "fixed-layout";
+                                               #address-cells = <1>;
+                                               #size-cells = <1>;
+
+                                               macaddr_board_102: macaddr@102 {
+                                                       compatible = "mac-base";
+                                                       reg = <0x102 0x6>;
+                                                       #nvmem-cell-cells = <1>;
+                                               };
+                                       };
+                               };
+                       };
                };
 
                partition@7fe0000 {
                compatible = "pci168c,0033";
                reg = <0x0000 0 0 0 0>;
                qca,no-eeprom;
+               nvmem-cells = <&macaddr_board_102 2>;
+               nvmem-cell-names = "mac-address";
        };
 };
 
                compatible = "pci168c,0033";
                reg = <0x0000 0 0 0 0>;
                qca,no-eeprom;
+               nvmem-cells = <&macaddr_board_102 3>;
+               nvmem-cell-names = "mac-address";
        };
 };
 
        pll-data = <0xa6000000 0xa0000101 0x80001313>;
        phy-handle = <&phy>;
 
+       nvmem-cells = <&macaddr_board_102 0>;
+       nvmem-cell-names = "mac-address";
+
        gmac-config {
                device = <&gmac>;
                rgmii-enabled = <1>;
 &wmac {
        status = "okay";
        qca,no-eeprom;
+
+       nvmem-cells = <&macaddr_board_102 1>;
+       nvmem-cell-names = "mac-address";
 };
index 968a441617224f7f5a2e80dadcfc31ef7093dbbb..362898630f82e1dca59d38521478bc199971a290 100644 (file)
@@ -104,9 +104,6 @@ ath79_setup_macs()
                wan_mac=$(mtd_get_mac_binary art 0x0)
                lan_mac=$(macaddr_add "$wan_mac" 1)
                ;;
-       meraki,mr18)
-               lan_mac=$(mtd_get_mac_binary_ubi board-config 102)
-               ;;
        netgear,wndr3700-v4|\
        netgear,wndr4300|\
        netgear,wndr4300sw|\
index ca722040f6ec05321858dd9b87615add324477f2..d88bcb552f107313fc125c9bb0ee868e8616b9f6 100644 (file)
@@ -17,7 +17,6 @@ case "$FIRMWARE" in
                else
                        caldata_extract "odm-caldata" 0x1000 0x440
                fi
-               ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 1)
                ;;
        *)
                caldata_die "board $board is not supported yet"
@@ -34,7 +33,6 @@ case "$FIRMWARE" in
                else
                        caldata_extract "odm-caldata" 0x5000 0x440
                fi
-               ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 2)
                ;;
        *)
                caldata_die "board $board is not supported yet"
@@ -51,7 +49,6 @@ case "$FIRMWARE" in
                else
                        caldata_extract "odm-caldata" 0x9000 0x440
                fi
-               ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 3)
                ;;
        *)
                caldata_die "board $board is not supported yet"
index 71ce1caad7d400078ef811a641ff23fa588fad00..10dc596693181a51c1152d3d696771fe418903f1 100644 (file)
@@ -16,6 +16,7 @@ CONFIG_MTD_SPI_NAND=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=20
 CONFIG_MTD_UBI_BLOCK=y
+CONFIG_MTD_UBI_NVMEM=y
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
 # CONFIG_PCI_AR71XX is not set
 CONFIG_POWER_RESET=y