[PATCH 06/12] arm: dts: stm32: Add partitions in flash0 and nand node for stm32mp15xx-ev1

Patrick Delaunay patrick.delaunay at foss.st.com
Thu Jun 8 17:16:42 CEST 2023


From: Patrice Chotard <patrice.chotard at foss.st.com>

Add partitions subnode in flash0 and nand nodes for all stm32mp157xx-ev1
boards. Update only the file stm32mp157c-ev1-*u-boot.dtsi, included by
other files  stm32mp15*-ev1-*-u-boot.dtsi.

For SCMI variant of device tree used with stm32mp15_defconfig
add partitions needed by TF-A firmware update:
- metadata to save the TF-A information: 2 copy
- fip-a / fip-b: two FIP slots, used for system A/B (seamless) update
- the previous "fsbl" partition with 2 copy of TFA is replaced
  by 2 partitions (only one copy in each MTD partition) to simplify
  the update: no need to managed this copy on update, need to update the
  two partition (skip bad block for NAND)
The offset for ENV partition are also updated in stm32mp15_defconfig

Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
---

 arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi | 85 ++++++++++++++++
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi      | 98 ++++++++++++++++++-
 configs/stm32mp15_defconfig                   |  4 +-
 3 files changed, 184 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi
index eef717946b5f..9768db8de9c9 100644
--- a/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi
@@ -23,6 +23,91 @@
 
 &flash0 {
 	bootph-pre-ram;
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		partition at 0 {
+			label = "fsbl1";
+			reg = <0x00000000 0x00040000>;
+		};
+		partition at 40000 {
+			label = "fsbl2";
+			reg = <0x00040000 0x00040000>;
+		};
+		partition at 80000 {
+			label = "metadata1";
+			reg = <0x00080000 0x00040000>;
+		};
+		partition at c0000 {
+			label = "metadata2";
+			reg = <0x000c0000 0x00040000>;
+		};
+		partition at 100000 {
+			label = "fip-a";
+			reg = <0x00100000 0x00400000>;
+		};
+		partition at 500000 {
+			label = "fip-b";
+			reg = <0x00500000 0x00400000>;
+		};
+		partition at 900000 {
+			label = "u-boot-env";
+			reg = <0x00900000 0x00080000>;
+		};
+		partition at 980000 {
+			label = "nor-user";
+			reg = <0x00980000 0x03680000>;
+		};
+	};
+};
+
+&fmc {
+	nand-controller at 4,0 {
+		nand at 0 {
+			partitions {
+				compatible = "fixed-partitions";
+				#address-cells = <1>;
+				#size-cells = <1>;
+				partition at 0 {
+					label = "fsbl1";
+					reg = <0x00000000 0x00080000>;
+				};
+				partition at 80000 {
+					label = "fsbl2";
+					reg = <0x00080000 0x00080000>;
+				};
+				partition at 100000 {
+					label = "metadata1";
+					reg = <0x00100000 0x00080000>;
+				};
+				partition at 180000 {
+					label = "metadata2";
+					reg = <0x00180000 0x00080000>;
+				};
+				partition at 200000 {
+					label = "fip-a1";
+					reg = <0x00200000 0x00400000>;
+				};
+				partition at 600000 {
+					label = "fip-a2";
+					reg = <0x00600000 0x00400000>;
+				};
+				partition at a00000 {
+					label = "fip-b1";
+					reg = <0x00a00000 0x00400000>;
+				};
+				partition at e00000 {
+					label = "fip-b2";
+					reg = <0x00e00000 0x00400000>;
+				};
+				partition at 1200000 {
+					label = "UBI";
+					reg = <0x01200000 0x3ee00000>;
+				};
+			};
+		};
+	};
 };
 
 &qspi {
diff --git a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
index cb32c30431c2..1f7fdbce5304 100644
--- a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
@@ -23,6 +23,103 @@
 
 &flash0 {
 	bootph-pre-ram;
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+#if defined(CONFIG_STM32MP15x_STM32IMAGE) || defined(CONFIG_SPL)
+		partition at 0 {
+			label = "fsbl1";
+			reg = <0x00000000 0x00040000>;
+		};
+		partition at 80000 {
+			label = "fsbl2";
+			reg = <0x00040000 0x00040000>;
+		};
+		partition at 100000 {
+			label = "ssbl";
+			reg = <0x00080000 0x00200000>;
+		};
+		partition at 280000  {
+			label = "u-boot-env";
+			reg = <0x00280000 0x00080000>;
+		};
+		partition at 300000 {
+			label = "nor-user";
+			reg = <0x00300000 0x03d00000>;
+		};
+#else
+		partition at 0 {
+			label = "fsbl1";
+			reg = <0x00000000 0x00040000>;
+		};
+		partition at 40000 {
+			label = "fsbl2";
+			reg = <0x00040000 0x00040000>;
+		};
+		partition at 100000 {
+			label = "fip";
+			reg = <0x00080000 0x00400000>;
+		};
+		partition at 480000 {
+			label = "u-boot-env";
+			reg = <0x00480000 0x00080000>;
+		};
+		partition at 500000 {
+			label = "nor-user";
+			reg = <0x00500000 0x03b00000>;
+		};
+#endif
+	};
+};
+
+&fmc {
+	nand-controller at 4,0 {
+		nand at 0 {
+			partitions {
+				compatible = "fixed-partitions";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+#if defined(CONFIG_STM32MP15x_STM32IMAGE) || defined(CONFIG_SPL)
+				partition at 0 {
+					label = "fsbl";
+					reg = <0x00000000 0x00200000>;
+				};
+				partition at 200000 {
+					label = "ssbl1";
+					reg = <0x00200000 0x00200000>;
+				};
+				partition at 400000 {
+					label = "ssbl2";
+					reg = <0x00400000 0x00200000>;
+				};
+				partition at 600000 {
+					label = "UBI";
+					reg = <0x00600000 0x3fa00000>;
+				};
+#else
+				partition at 0 {
+					label = "fsbl";
+					reg = <0x00000000 0x00200000>;
+				};
+				partition at 200000 {
+					label = "fip1";
+					reg = <0x00200000 0x00400000>;
+				};
+				partition at 600000 {
+					label = "fip2";
+					reg = <0x00600000 0x00400000>;
+				};
+				partition at 1200000 {
+					label = "UBI";
+					reg = <0x00a00000 0x3f600000>;
+				};
+#endif
+			};
+		};
+	};
 };
 
 &qspi {
@@ -55,4 +152,3 @@
 		bootph-pre-ram;
 	};
 };
-
diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig
index 2669aae0f2f4..bad5c32ef808 100644
--- a/configs/stm32mp15_defconfig
+++ b/configs/stm32mp15_defconfig
@@ -3,7 +3,7 @@ CONFIG_ARCH_STM32MP=y
 CONFIG_TFABOOT=y
 CONFIG_SYS_MALLOC_F_LEN=0x80000
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc0100000
-CONFIG_ENV_OFFSET=0x480000
+CONFIG_ENV_OFFSET=0x900000
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_SYS_PROMPT="STM32MP> "
@@ -11,7 +11,7 @@ CONFIG_DDR_CACHEABLE_SIZE=0x10000000
 CONFIG_CMD_STM32KEY=y
 CONFIG_TYPEC_STUSB160X=y
 CONFIG_TARGET_ST_STM32MP15x=y
-CONFIG_ENV_OFFSET_REDUND=0x4C0000
+CONFIG_ENV_OFFSET_REDUND=0x940000
 CONFIG_CMD_STM32PROG=y
 # CONFIG_ARMV7_NONSEC is not set
 CONFIG_SYS_LOAD_ADDR=0xc2000000
-- 
2.25.1



More information about the U-Boot mailing list