From: Rosen Penev Date: Thu, 4 Dec 2025 05:23:33 +0000 (-0800) Subject: ath79: mr18: use nvmem for MACs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27a673916c350909fa569835c9fc2a1349357141;p=thirdparty%2Fopenwrt.git 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 Link: https://github.com/openwrt/openwrt/pull/17068 Signed-off-by: Robert Marko --- diff --git a/target/linux/ath79/dts/qca9557_meraki_mr18.dts b/target/linux/ath79/dts/qca9557_meraki_mr18.dts index 4e9b3d1e9a6..3fa4e57456b 100644 --- a/target/linux/ath79/dts/qca9557_meraki_mr18.dts +++ b/target/linux/ath79/dts/qca9557_meraki_mr18.dts @@ -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"; }; diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network index 968a4416172..362898630f8 100644 --- a/target/linux/ath79/nand/base-files/etc/board.d/02_network +++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network @@ -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|\ diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index ca722040f6e..d88bcb552f1 100644 --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -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" diff --git a/target/linux/ath79/nand/config-default b/target/linux/ath79/nand/config-default index 71ce1caad7d..10dc5966931 100644 --- a/target/linux/ath79/nand/config-default +++ b/target/linux/ath79/nand/config-default @@ -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