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@makrotopia.org>
This commit is contained in:
Daniel Golle 2025-06-26 00:44:38 +01:00
parent 5d266b49ac
commit e46eeb89d7
2 changed files with 139 additions and 54 deletions

View file

@ -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

View file

@ -56,7 +56,7 @@ Signed-off-by: Daniel Golle <daniel@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@makrotopia.org>
+ no-sd;
+ no-sdio;
+ status = "okay";
+
+ card@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@1 {
+ target-path = "/chosen";
+ __overlay__ {
+ rootdisk-emmc = <&emmc_root>;
+ };
+ };
+};
@ -397,7 +424,7 @@ Signed-off-by: Daniel Golle <daniel@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@makrotopia.org>
+/ {
+ compatible = "mediatek,mt7988a-rfb", "mediatek,mt7988a";
+
+ fragment@1 {
+ fragment@0 {
+ target-path = <&mmc0>;
+ __overlay__ {
+ pinctrl-names = "default", "state_uhs";
@ -426,12 +453,39 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+ vqmmc-supply = <&reg_3p3v>;
+ no-mmc;
+ status = "okay";
+
+ card@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@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@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@0 {
+ label = "BL2";
+ reg = <0x00000 0x0100000>;
+ reg = <0x00000 0x0200000>;
+ read-only;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x0100000 0x0080000>;
+ };
+
+ partition@180000 {
+ label = "Factory";
+ reg = <0x180000 0x0400000>;
+ };
+
+ partition@580000 {
+ label = "FIP";
+ reg = <0x580000 0x0200000>;
+ };
+
+ partition@780000 {
+ ubi_part: partition@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@makrotopia.org>
+ status = "okay";
+ };
+ };
+
+ fragment@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@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@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@makrotopia.org>
+
+ partition@0 {
+ label = "BL2";
+ reg = <0x00000 0x0100000>;
+ reg = <0x00000 0x0200000>;
+ read-only;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x0100000 0x0080000>;
+ };
+
+ partition@180000 {
+ label = "Factory";
+ reg = <0x180000 0x0400000>;
+ };
+
+ partition@580000 {
+ label = "FIP";
+ reg = <0x580000 0x0200000>;
+ };
+
+ partition@780000 {
+ ubi_part: partition@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@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@makrotopia.org>
+ label = "FIP";
+ reg = <0x250000 0x80000>;
+ };
+ partition@2D0000 {
+ nor_root: partition@2D0000 {
+ label = "firmware";
+ reg = <0x2d0000 0x1d30000>;
+ compatible = "denx,fit";
+ };
+ };
+ };
+ };
+
+ fragment@1 {
+ target-path = "/chosen";
+ __overlay__ {
+ rootdisk-nor = <&nor_root>;
+ };
+ };
+};
--- /dev/null
+++ b/arch/arm64/boot/dts/mediatek/mt7988a-rfb.dts