ath79: mr18: use nvmem for MACs

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>
This commit is contained in:
Rosen Penev 2025-12-03 21:23:33 -08:00 committed by Robert Marko
parent 77a7d1ce67
commit 27a673916c
4 changed files with 29 additions and 6 deletions

View file

@ -127,6 +127,24 @@
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 {
@ -158,6 +176,8 @@
compatible = "pci168c,0033";
reg = <0x0000 0 0 0 0>;
qca,no-eeprom;
nvmem-cells = <&macaddr_board_102 2>;
nvmem-cell-names = "mac-address";
};
};
@ -168,6 +188,8 @@
compatible = "pci168c,0033";
reg = <0x0000 0 0 0 0>;
qca,no-eeprom;
nvmem-cells = <&macaddr_board_102 3>;
nvmem-cell-names = "mac-address";
};
};
@ -184,6 +206,9 @@
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>;
@ -195,4 +220,7 @@
&wmac {
status = "okay";
qca,no-eeprom;
nvmem-cells = <&macaddr_board_102 1>;
nvmem-cell-names = "mac-address";
};

View 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|\

View 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"

View 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