From: Daniel Golle Date: Mon, 19 Feb 2024 03:11:18 +0000 (+0000) Subject: mediatek: filogic: asus-rt-ax59u: use NVMEM-on-UBI X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fstaging%2Fstintel.git;a=commitdiff_plain;h=33197d22f0045b491ddea580bb2940a730918233 mediatek: filogic: asus-rt-ax59u: use NVMEM-on-UBI Use newly added support for NVMEM-on-UBI instead of extracting MAC address and WiFi EEPROM data in userspace. Signed-off-by: Daniel Golle --- diff --git a/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts b/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts index e2acb63771..0034ad8284 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-rt-ax59u.dts @@ -14,6 +14,7 @@ aliases { serial0 = &uart0; + label-mac-device = &gmac0; led-boot = &led_status_green; led-failsafe = &led_status_red; led-running = &led_status_green; @@ -22,7 +23,7 @@ chosen { stdout-path = "serial0:115200n8"; - bootargs-override = "ubi.mtd=UBI_DEV"; + bootargs-override = ""; }; memory { @@ -89,6 +90,8 @@ /* LAN */ compatible = "mediatek,eth-mac"; reg = <0>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; phy-mode = "2500base-x"; fixed-link { @@ -206,44 +209,87 @@ pinctrl-0 = <&spi_flash_pins>; status = "okay"; - spi_nand: spi_nand@0 { + spi_nand: flash@0 { compatible = "spi-nand"; + reg = <0>; #address-cells = <1>; #size-cells = <1>; - reg = <0>; spi-max-frequency = <20000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; - partitions: partitions { + /* + * ASUS bootloader tries to replace the partitions defined in + * Device Tree and by that also deletes all additional properties + * needed for UBI and NVMEM-on-UBI. + * Prevent this from happening by tricking the loader to delete and + * replace a bait node instead. + */ + partitions: dummy { + compatible = "u-boot-dummy-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x0>; + label = "remove_me"; + }; + }; + + partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { - label = "u-boot"; reg = <0x0 0x400000>; + label = "u-boot"; read-only; }; partition@400000 { + compatible = "linux,ubi"; + reg = <0x400000 0xfc00000>; label = "UBI_DEV"; - reg = <0x400000 0x7c00000>; + + volumes { + ubi_factory: ubi-volume-factory { + volname = "Factory"; + }; + }; }; }; }; }; +&ubi_factory { + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; +}; + &watchdog { status = "okay"; }; &wifi { - status = "okay"; - pinctrl-names = "default", "dbdc"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; pinctrl-0 = <&wf_2g_5g_pins>; pinctrl-1 = <&wf_dbdc_pins>; + pinctrl-names = "default", "dbdc"; + status = "okay"; }; &trng { diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 683282b87c..a639f3df16 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -109,7 +109,6 @@ mediatek_setup_macs() local label_mac="" case $board in - asus,rt-ax59u|\ asus,tuf-ax4200|\ asus,tuf-ax6000) CI_UBIPART="UBI_DEV" diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index 1ec648584d..9f9084732d 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -59,7 +59,6 @@ case "$FIRMWARE" in ;; "mediatek/mt7986_eeprom_mt7976_dbdc.bin") case "$board" in - asus,rt-ax59u|\ asus,tuf-ax4200) CI_UBIPART="UBI_DEV" caldata_extract_ubi "Factory" 0x0 0x1000