[openwrt/openwrt] mediatek: 6.12: mt7988a-rfb: complete conversion to all-UBI fitblk

LEDE Commits lede-commits at lists.infradead.org
Wed Jun 25 17:11:12 PDT 2025


dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/e46eeb89d7b64c0f4281a88ca25ef295bb7e3212

commit e46eeb89d7b64c0f4281a88ca25ef295bb7e3212
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Thu Jun 26 00:44:38 2025 +0100

    mediatek: 6.12: mt7988a-rfb: complete conversion to all-UBI fitblk
    
    Restore the conversion to an all-UBI NAND layout and use of fitblk on
    SPI-NAND connected via the mt65xx SPI controller.
    Apply the same also for SPI-NAND connected via the SNFI controller, and
    use fitblk also for boot from SPI-NOR, eMMC and SD.
    
    Fixes: f9206d1111 ("kernel/mediatek: 6.12: replace downstream files by patches")
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 .../filogic/base-files/lib/upgrade/platform.sh     |   3 +-
 ...ediatek-add-MT7988A-reference-board-devic.patch | 190 +++++++++++++++------
 2 files changed, 139 insertions(+), 54 deletions(-)

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 7d204b9196..bd7501d8da 100755
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -261,7 +261,8 @@ platform_copy_config() {
 	bananapi,bpi-r4|\
 	bananapi,bpi-r4-2g5|\
 	bananapi,bpi-r4-poe|\
-	cmcc,rax3000m)
+	cmcc,rax3000m|\
+	mediatek,mt7988a-rfb)
 		if [ "$CI_METHOD" = "emmc" ]; then
 			emmc_copy_config
 		fi
diff --git a/target/linux/mediatek/patches-6.12/188-arm64-dts-mediatek-add-MT7988A-reference-board-devic.patch b/target/linux/mediatek/patches-6.12/188-arm64-dts-mediatek-add-MT7988A-reference-board-devic.patch
index 6531ad0144..0e0eeb38e1 100644
--- a/target/linux/mediatek/patches-6.12/188-arm64-dts-mediatek-add-MT7988A-reference-board-devic.patch
+++ b/target/linux/mediatek/patches-6.12/188-arm64-dts-mediatek-add-MT7988A-reference-board-devic.patch
@@ -56,7 +56,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt8173-elm-hana.dtb
 --- /dev/null
 +++ b/arch/arm64/boot/dts/mediatek/mt7988a-rfb-emmc.dtso
-@@ -0,0 +1,33 @@
+@@ -0,0 +1,60 @@
 +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 +/*
 + * Copyright (C) 2021 MediaTek Inc.
@@ -87,6 +87,33 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +			no-sd;
 +			no-sdio;
 +			status = "okay";
++
++			card at 0 {
++				compatible = "mmc-card";
++				reg = <0>;
++
++				partitions {
++					compatible = "gpt-partitions";
++
++					block-partition-env {
++						partname = "ubootenv";
++						nvmem-layout {
++							compatible = "u-boot,env-layout";
++						};
++					};
++
++					emmc_root: block-partition-production {
++						partname = "production";
++					};
++				};
++			};
++		};
++	};
++
++	fragment at 1 {
++		target-path = "/chosen";
++		__overlay__ {
++			rootdisk-emmc = <&emmc_root>;
 +		};
 +	};
 +};
@@ -397,7 +424,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +};
 --- /dev/null
 +++ b/arch/arm64/boot/dts/mediatek/mt7988a-rfb-sd.dtso
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,58 @@
 +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 +/*
 + * Copyright (C) 2023 MediaTek Inc.
@@ -412,7 +439,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +/ {
 +	compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a";
 +
-+	fragment at 1 {
++	fragment at 0 {
 +		target-path = <&mmc0>;
 +		__overlay__ {
 +			pinctrl-names = "default", "state_uhs";
@@ -426,12 +453,39 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +			vqmmc-supply = <&reg_3p3v>;
 +			no-mmc;
 +			status = "okay";
++
++			card at 0 {
++				compatible = "mmc-card";
++				reg = <0>;
++
++				partitions {
++					compatible = "gpt-partitions";
++
++					block-partition-env {
++						partname = "ubootenv";
++						nvmem-layout {
++							compatible = "u-boot,env-layout";
++						};
++					};
++
++					sd_root: block-partition-production {
++						partname = "production";
++					};
++				};
++			};
++		};
++	};
++
++	fragment at 1 {
++		target-path = "/chosen";
++		__overlay__ {
++			rootdisk-sd = <&sd_root>;
 +		};
 +	};
 +};
 --- /dev/null
 +++ b/arch/arm64/boot/dts/mediatek/mt7988a-rfb-snfi-nand.dtso
-@@ -0,0 +1,70 @@
+@@ -0,0 +1,81 @@
 +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 +/*
 + * Copyright (C) 2022 MediaTek Inc.
@@ -456,39 +510,38 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +				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";
-+					#address-cells = <1>;
-+					#size-cells = <1>;
-+
 +					partition at 0 {
 +						label = "BL2";
-+						reg = <0x00000 0x0100000>;
++						reg = <0x00000 0x0200000>;
 +						read-only;
 +					};
 +
-+					partition at 100000 {
-+						label = "u-boot-env";
-+						reg = <0x0100000 0x0080000>;
-+					};
-+
-+					partition at 180000 {
-+						label = "Factory";
-+						reg = <0x180000 0x0400000>;
-+					};
-+
-+					partition at 580000 {
-+						label = "FIP";
-+						reg = <0x580000 0x0200000>;
-+					};
-+
-+					partition at 780000 {
++					ubi_part: partition at 200000 {
 +						label = "ubi";
-+						reg = <0x780000 0x7080000>;
++						reg = <0x0200000 0x7e00000>;
++						compatible = "linux,ubi";
++
++						volumes {
++							ubi-volume-ubootenv {
++								volname = "ubootenv";
++								nvmem-layout {
++									compatible = "u-boot,env-redundant-bool";
++								};
++							};
++
++							ubi-volume-ubootenv2 {
++								volname = "ubootenv2";
++								nvmem-layout {
++									compatible = "u-boot,env-redundant-bool";
++								};
++							};
++
++							snfi_root: ubi-volume-fit {
++								volname = "fit";
++							};
++						};
 +					};
 +				};
 +			};
@@ -501,6 +554,18 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +			status = "okay";
 +		};
 +	};
++
++	fragment at 2 {
++		target-path = "/chosen";
++		__overlay__ {
++			/*
++			 * U-Boot currently cannot detect diffrentiate between
++			 * SD and SNFI boot media and always uses rootdisk-sd in
++			 * both cases
++			 */
++			rootdisk-sd = <&snfi_root>;
++		};
++	};
 +};
 --- /dev/null
 +++ b/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand-factory.dtso
@@ -594,7 +659,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +};
 --- /dev/null
 +++ b/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso
-@@ -0,0 +1,66 @@
+@@ -0,0 +1,77 @@
 +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 +/*
 + * Copyright (C) 2022 MediaTek Inc.
@@ -622,9 +687,6 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +				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";
@@ -633,37 +695,51 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +
 +					partition at 0 {
 +						label = "BL2";
-+						reg = <0x00000 0x0100000>;
++						reg = <0x00000 0x0200000>;
 +						read-only;
 +					};
 +
-+					partition at 100000 {
-+						label = "u-boot-env";
-+						reg = <0x0100000 0x0080000>;
-+					};
-+
-+					partition at 180000 {
-+						label = "Factory";
-+						reg = <0x180000 0x0400000>;
-+					};
-+
-+					partition at 580000 {
-+						label = "FIP";
-+						reg = <0x580000 0x0200000>;
-+					};
-+
-+					partition at 780000 {
++					ubi_part: partition at 200000 {
 +						label = "ubi";
-+						reg = <0x780000 0x7080000>;
++						reg = <0x0200000 0x7e00000>;
++						compatible = "linux,ubi";
++
++						volumes {
++							ubi-volume-ubootenv {
++								volname = "ubootenv";
++								nvmem-layout {
++									compatible = "u-boot,env-redundant-bool";
++								};
++							};
++
++							ubi-volume-ubootenv2 {
++								volname = "ubootenv2";
++								nvmem-layout {
++									compatible = "u-boot,env-redundant-bool";
++								};
++							};
++
++							ubi_root: ubi-volume-fit {
++								volname = "fit";
++							};
++
++						};
 +					};
 +				};
 +			};
 +		};
 +	};
++
++	fragment at 1 {
++		target-path = "/chosen";
++		__overlay__ {
++			rootdisk-spim-nand = <&ubi_root>;
++		};
++	};
 +};
 --- /dev/null
 +++ b/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nor.dtso
-@@ -0,0 +1,61 @@
+@@ -0,0 +1,69 @@
 +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 +/*
 + * Copyright (C) 2022 MediaTek Inc.
@@ -717,13 +793,21 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
 +					label = "FIP";
 +					reg = <0x250000 0x80000>;
 +				};
-+				partition at 2D0000 {
++				nor_root: partition at 2D0000 {
 +					label = "firmware";
 +					reg = <0x2d0000 0x1d30000>;
++					compatible = "denx,fit";
 +				};
 +			};
 +		};
 +	};
++
++	fragment at 1 {
++		target-path = "/chosen";
++		__overlay__ {
++			rootdisk-nor = <&nor_root>;
++		};
++	};
 +};
 --- /dev/null
 +++ b/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dts




More information about the lede-commits mailing list