]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
mediatek: 6.12: mt7988a-rfb: complete conversion to all-UBI fitblk
authorDaniel Golle <daniel@makrotopia.org>
Wed, 25 Jun 2025 23:44:38 +0000 (00:44 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 26 Jun 2025 00:10:18 +0000 (01:10 +0100)
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>
target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
target/linux/mediatek/patches-6.12/188-arm64-dts-mediatek-add-MT7988A-reference-board-devic.patch

index 7d204b919694ce816301c065137ae688e01e373d..bd7501d8daaa0a695b6f37c9d814cabb61c5a80a 100755 (executable)
@@ -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
index 6531ad014466898e56ef59f203d28e1ec70c52d4..0e0eeb38e17c50edb816bcdd2e970fc34e315484 100644 (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