From: Felix Fietkau Date: Wed, 8 May 2024 11:40:14 +0000 (+0200) Subject: mediatek: convert mt7988a-rfb to keep bl31/uboot in UBI X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=59ac0440b160a007f2ad7a7e64af58be224de04e;p=openwrt%2Fstaging%2Fneocturne.git mediatek: convert mt7988a-rfb to keep bl31/uboot in UBI Add ubi volumes for mt7988a-rfb and support for using factory data for Ethernet MAC addresses and MT7996 WLAN calibration data. Also add rootdisk handle. Removes the need to keep using nmbm Signed-off-by: Felix Fietkau --- diff --git a/package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch b/package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch index 311a828a93..535af4fa09 100644 --- a/package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch +++ b/package/boot/uboot-mediatek/patches/105-configs-add-usefull-stuff-to-mt7988-rfb.patch @@ -315,3 +315,29 @@ CONFIG_MMC_HS200_SUPPORT=y CONFIG_MMC_MTK=y CONFIG_MTD=y +--- a/arch/arm/dts/mt7988-rfb.dts ++++ b/arch/arm/dts/mt7988-rfb.dts +@@ -144,6 +144,23 @@ + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x0 0x200000>; ++ }; ++ ++ partition@200000 { ++ label = "ubi"; ++ reg = <0x200000 0x7e00000>; ++ compatible = "linux,ubi"; ++ }; ++ }; + }; + }; + diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand-factory.dtso b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand-factory.dtso new file mode 100644 index 0000000000..3fe75aca36 --- /dev/null +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand-factory.dtso @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +/plugin/; + +/ { + compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a"; + + fragment@0 { + target = <&ubi_part>; + + __overlay__ { + volumes { + ubi_factory: ubi-volume-factory { + volname = "factory"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_wmac: eeprom@0 { + reg = <0x0 0x1e00>; + }; + + gmac2_mac: eeprom@fffee { + reg = <0xfffee 0x6>; + }; + + gmac1_mac: eeprom@ffff4 { + reg = <0xffff4 0x6>; + }; + + gmac0_mac: eeprom@ffffa { + reg = <0xffffa 0x6>; + }; + }; + }; + }; + }; + }; + + fragment@1 { + target = <&pcie0>; + __overlay__ { + pcie@0,0 { + reg = <0x0000 0 0 0 0>; + + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_wmac>; + }; + }; + }; + }; + + fragment@2 { + target = <&gmac0>; + __overlay__ { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&gmac0_mac>; + }; + }; + + fragment@3 { + target = <&gmac1>; + __overlay__ { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&gmac1_mac>; + }; + }; + + fragment@4 { + target = <&gmac2>; + __overlay__ { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&gmac2_mac>; + }; + }; +}; diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso index a9eca00d44..b5a67c725b 100644 --- a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso @@ -23,9 +23,6 @@ spi-max-frequency = <52000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; - mediatek,nmbm; - mediatek,bmt-max-ratio = <1>; - mediatek,bmt-max-reserved-blocks = <64>; partitions { compatible = "fixed-partitions"; @@ -34,31 +31,45 @@ partition@0 { label = "BL2"; - reg = <0x00000 0x0100000>; + reg = <0x00000 0x0200000>; read-only; }; - partition@100000 { - label = "u-boot-env"; - reg = <0x0100000 0x0080000>; - }; + ubi_part: partition@200000 { + label = "ubi"; + reg = <0x0200000 0x7e00000>; + compatible = "linux,ubi"; - partition@180000 { - label = "Factory"; - reg = <0x180000 0x0400000>; - }; + volumes { + ubi-volume-ubootenv { + volname = "ubootenv"; + nvmem-layout { + compatible = "u-boot,env-redundant-bool-layout"; + }; + }; - partition@580000 { - label = "FIP"; - reg = <0x580000 0x0200000>; - }; + ubi-volume-ubootenv2 { + volname = "ubootenv2"; + nvmem-layout { + compatible = "u-boot,env-redundant-bool-layout"; + }; + }; - partition@780000 { - label = "ubi"; - reg = <0x780000 0x7080000>; + ubi_root: ubi-volume-fit { + volname = "fit"; + }; + + }; }; }; }; }; }; + + fragment@1 { + target-path = "/chosen"; + __overlay__ { + rootdisk-spim-nand = <&ubi_root>; + }; + }; }; diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index ff791a600a..e7b347dc5f 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -84,6 +84,7 @@ platform_do_upgrade() { bananapi,bpi-r3-mini|\ bananapi,bpi-r4|\ bananapi,bpi-r4-poe|\ + mediatek,mt7988a-rfb|\ jdcloud,re-cp-03|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 7948955842..5c2f67eb99 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -824,6 +824,7 @@ define Device/mediatek_mt7988a-rfb mt7988a-rfb-sd \ mt7988a-rfb-snfi-nand \ mt7988a-rfb-spim-nand \ + mt7988a-rfb-spim-nand-factory \ mt7988a-rfb-spim-nor \ mt7988a-rfb-eth1-aqr \ mt7988a-rfb-eth1-i2p5g-phy \ @@ -855,7 +856,7 @@ define Device/mediatek_mt7988a-rfb ARTIFACT/emmc-bl31-uboot.fip := mt7988-bl31-uboot rfb-emmc ARTIFACT/nor-preloader.bin := mt7988-bl2 nor-comb ARTIFACT/nor-bl31-uboot.fip := mt7988-bl31-uboot rfb-nor - ARTIFACT/snand-preloader.bin := mt7988-bl2 spim-nand-comb + ARTIFACT/snand-preloader.bin := mt7988-bl2 spim-nand-ubi-comb ARTIFACT/snand-bl31-uboot.fip := mt7988-bl31-uboot rfb-snand ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\ pad-to 17k | mt7988-bl2 sdmmc-comb |\