[PATCH 00/12] stm32mp1: use U-Boot device tree to configure MTD partitions

Add the MTD partitions subnode in U-Boot device tree for all stm32mp13 and stm32mp15 boards and no more rely on mtdids and mtdparts variables or CONFIG_SYS_MTDPARTS_RUNTIME.
When these variables are absent, the required OF fallback is performed in mtd_probe_devices() with commit dc339bf784f0 ("mtd: add support for parsing partitions defined in OF").
To allow dynamically configuration of MTD partitioning for Linux kernel, the MTD partitioning is only defined in U-Boot device tree and copied in Linux kernel device tree.
This serie also disable CMD_MTDPARTS as it is strongly encouraged to no more use this command.
Marek, I modify the dhcom/dhcor boardd in the last patch of the serie but if you prefer I can drop this patch.
For "stm32mp157c-ev1.dts" used by stm32mp15_trusted_defconfig
* nand0 - type: NAND flash - block size: 0x40000 bytes - min I/O: 0x1000 bytes - OOB size: 224 bytes - OOB available: 118 bytes - ECC strength: 8 bits - ECC step size: 512 bytes - bitflip threshold: 6 bits - 0x000000000000-0x000040000000 : "nand0" - 0x000000000000-0x000000200000 : "fsbl" - 0x000000200000-0x000000600000 : "fip1" - 0x000000600000-0x000000a00000 : "fip2" - 0x000000a00000-0x000040000000 : "UBI" * nor0 - device: flash@0 - parent: spi@58003000 - driver: jedec_spi_nor - path: /soc/spi@58003000/flash@0 - type: NOR flash - block size: 0x10000 bytes - min I/O: 0x1 bytes - 0x000000000000-0x000004000000 : "nor0" - 0x000000000000-0x000000040000 : "fsbl1" - 0x000000040000-0x000000080000 : "fsbl2" - 0x000000080000-0x000000480000 : "fip" - 0x000000480000-0x000000500000 : "u-boot-env" - 0x000000500000-0x000004000000 : "nor-user"
For "stm32mp157c-ev1-scmi.dts" the device tree file used by stm32mp15_defconfig, with TF-A BL2 and OP-TEE including a SCMI server for secure resources (when TZEN=1), the default STMicroelectronics configuration.
I align the NOR and NAND layout on EV1 boards with the STMicroelectronics recommendations used in OpenSTLinux V4.0: with support of TF-A BL2 firmware update, required 2 "metadata" partition for redundancy and 2 FIPs for A/B update.
* nand0 - type: NAND flash - block size: 0x40000 bytes - min I/O: 0x1000 bytes - OOB size: 224 bytes - OOB available: 118 bytes - ECC strength: 8 bits - ECC step size: 512 bytes - bitflip threshold: 6 bits - 0x000000000000-0x000040000000 : "nand0" - 0x000000000000-0x000000080000 : "fsbl1" - 0x000000080000-0x000000100000 : "fsbl2" - 0x000000100000-0x000000180000 : "metadata1" - 0x000000180000-0x000000200000 : "metadata2" - 0x000000200000-0x000000600000 : "fip-a1" - 0x000000600000-0x000000a00000 : "fip-a2" - 0x000000a00000-0x000000e00000 : "fip-b1" - 0x000000e00000-0x000001200000 : "fip-b2" - 0x000001200000-0x000040000000 : "UBI" * nor0 - device: flash@0 - parent: spi@58003000 - driver: jedec_spi_nor - path: /soc/spi@58003000/flash@0 - type: NOR flash - block size: 0x10000 bytes - min I/O: 0x1 bytes - 0x000000000000-0x000004000000 : "nor0" - 0x000000000000-0x000000040000 : "fsbl1" - 0x000000040000-0x000000080000 : "fsbl2" - 0x000000080000-0x0000000c0000 : "metadata1" - 0x0000000c0000-0x000000100000 : "metadata2" - 0x000000100000-0x000000500000 : "fip-a" - 0x000000500000-0x000000900000 : "fip-b" - 0x000000900000-0x000000980000 : "u-boot-env" - 0x000000980000-0x000004000000 : "nor-user"
Patrice Chotard (5): stm32mp: stm32prog: Remove usage of "mtdparts" function arm: dts: stm32: Add partitions in flash0 and nand node for stm32mp15xx-ev1 configs: stm32mp: Disable SYS_MTDPARTS_RUNTIME for stm32mp15 and stm32mp13 stm32mp: stm32prog: Remove tee_detected from stm32prog_data struct configs: stm32mp1: disable CMD_MTDPARTS
Patrick Delaunay (7): fdt_support: include dm/ofnode.h fdt_support: add fdt_copy_fixed_partitions function dfu: mtd: remove direct call of mtdparts_init function arm: dts: stm32: Align stm32mp15xx-*-scmi-u-boot.dtsi file board: stm32mp1: use fdt_copy_fixed_partitions board: st: remove board_mtdparts_default arm: dts: stm32: Add partitions in flash0 and nand node for stm32mp15xx-dhcom/dhcor
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi | 7 + arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi | 125 +++++++++++++ arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 98 +++++++++- arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 27 +++ arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 27 +++ .../cmd_stm32prog/cmd_stm32prog.c | 9 - .../mach-stm32mp/cmd_stm32prog/stm32prog.c | 53 ++---- .../mach-stm32mp/cmd_stm32prog/stm32prog.h | 3 - .../arm/mach-stm32mp/include/mach/stm32prog.h | 4 - board/st/common/Kconfig | 66 ------- board/st/common/Makefile | 1 - board/st/common/stm32mp_mtdparts.c | 177 ------------------ board/st/stm32mp1/stm32mp1.c | 16 +- common/fdt_support.c | 75 +++++++- configs/stm32mp13_defconfig | 3 - configs/stm32mp15_basic_defconfig | 3 - configs/stm32mp15_defconfig | 7 +- configs/stm32mp15_dhcom_basic_defconfig | 3 - configs/stm32mp15_dhcor_basic_defconfig | 3 - configs/stm32mp15_trusted_defconfig | 3 - drivers/dfu/Kconfig | 1 - drivers/dfu/dfu_mtd.c | 34 ++-- include/fdt_support.h | 8 + 24 files changed, 407 insertions(+), 347 deletions(-) delete mode 100644 board/st/common/stm32mp_mtdparts.c

This patch is a preliminary patch to use ofnode function is fdt_support to read the U-Boot device tree with livetree compatible functions.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
common/fdt_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c index 2053fe3bad83..ffc59fd8b36a 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -13,6 +13,7 @@ #include <mapmem.h> #include <net.h> #include <stdio_dev.h> +#include <dm/ofnode.h> #include <linux/ctype.h> #include <linux/types.h> #include <asm/global_data.h> @@ -1065,7 +1066,6 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
/* Max address size we deal with */ #define OF_MAX_ADDR_CELLS 4 -#define OF_BAD_ADDR FDT_ADDR_T_NONE #define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \ (ns) > 0)

On 6/8/23 17:16, Patrick Delaunay wrote:
This patch is a preliminary patch to use ofnode function is fdt_support to read the U-Boot device tree with livetree compatible functions.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
common/fdt_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c index 2053fe3bad83..ffc59fd8b36a 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -13,6 +13,7 @@ #include <mapmem.h> #include <net.h> #include <stdio_dev.h> +#include <dm/ofnode.h> #include <linux/ctype.h> #include <linux/types.h> #include <asm/global_data.h> @@ -1065,7 +1066,6 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
/* Max address size we deal with */ #define OF_MAX_ADDR_CELLS 4 -#define OF_BAD_ADDR FDT_ADDR_T_NONE #define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \ (ns) > 0)
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

Hi Patrick,
On Thu, 8 Jun 2023 at 16:16, Patrick Delaunay patrick.delaunay@foss.st.com wrote:
This patch is a preliminary patch to use ofnode function is fdt_support to read the U-Boot device tree with livetree compatible functions.
When will the real patch come?
Reviewed-by: Simon Glass sjg@chromium.org
Regards, Simon
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
common/fdt_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c index 2053fe3bad83..ffc59fd8b36a 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -13,6 +13,7 @@ #include <mapmem.h> #include <net.h> #include <stdio_dev.h> +#include <dm/ofnode.h> #include <linux/ctype.h> #include <linux/types.h> #include <asm/global_data.h> @@ -1065,7 +1066,6 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
/* Max address size we deal with */ #define OF_MAX_ADDR_CELLS 4 -#define OF_BAD_ADDR FDT_ADDR_T_NONE #define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \ (ns) > 0)
-- 2.25.1

Add a new function fdt_copy_fixed_partitions to copy the fixed partition nodes from U-Boot device tree to Linux kernel device tree and to dynamically configure the MTD partitions.
This function fdt_copy_fixed_partitions is only based on device tree with livetree compatible function and replace the function fdt_fixup_mtdparts based on mtdparts variable.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
common/fdt_support.c | 73 +++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 8 +++++ 2 files changed, 81 insertions(+)
diff --git a/common/fdt_support.c b/common/fdt_support.c index ffc59fd8b36a..5e49078f8c35 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -1051,6 +1051,79 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info, } #endif
+int fdt_copy_fixed_partitions(void *blob) +{ + ofnode node, subnode; + int off, suboff, res; + char path[256]; + int address_cells, size_cells; + u8 i, j, child_count; + + node = ofnode_by_compatible(ofnode_null(), "fixed-partitions"); + while (ofnode_valid(node)) { + /* copy the U-Boot fixed partition */ + address_cells = ofnode_read_simple_addr_cells(node); + size_cells = ofnode_read_simple_size_cells(node); + + res = ofnode_get_path(ofnode_get_parent(node), path, sizeof(path)); + if (res) + return res; + + off = fdt_path_offset(blob, path); + if (off < 0) + return -ENODEV; + + off = fdt_find_or_add_subnode(blob, off, "partitions"); + res = fdt_setprop_string(blob, off, "compatible", "fixed-partitions"); + if (res) + return res; + + res = fdt_setprop_u32(blob, off, "#address-cells", address_cells); + if (res) + return res; + + res = fdt_setprop_u32(blob, off, "#size-cells", size_cells); + if (res) + return res; + + /* + * parse partition in reverse order as fdt_find_or_add_subnode() only + * insert the new node after the parent's properties + */ + child_count = ofnode_get_child_count(node); + for (i = child_count; i > 0 ; i--) { + subnode = ofnode_first_subnode(node); + if (!ofnode_valid(subnode)) + break; + + for (j = 0; (j < i - 1); j++) + subnode = ofnode_next_subnode(subnode); + + if (!ofnode_valid(subnode)) + break; + + const u32 *reg; + int len; + + suboff = fdt_find_or_add_subnode(blob, off, ofnode_get_name(subnode)); + res = fdt_setprop_string(blob, suboff, "label", + ofnode_read_string(subnode, "label")); + if (res) + return res; + + reg = ofnode_get_property(subnode, "reg", &len); + res = fdt_setprop(blob, suboff, "reg", reg, len); + if (res) + return res; + } + + /* go to next fixed-partitions node */ + node = ofnode_by_compatible(node, "fixed-partitions"); + } + + return 0; +} + void fdt_del_node_and_alias(void *blob, const char *alias) { int off = fdt_path_offset(blob, alias); diff --git a/include/fdt_support.h b/include/fdt_support.h index eeb83e6251d3..2cd836689821 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -256,6 +256,14 @@ static inline void fdt_fixup_mtdparts(void *fdt, } #endif
+/** + * copy the fixed-partition nodes from U-Boot device tree to external blob + * + * @param blob FDT blob to update + * Return: 0 if ok, or non-zero on error + */ +int fdt_copy_fixed_partitions(void *blob); + void fdt_del_node_and_alias(void *blob, const char *alias);
/**

On 6/8/23 17:16, Patrick Delaunay wrote:
Add a new function fdt_copy_fixed_partitions to copy the fixed partition nodes from U-Boot device tree to Linux kernel device tree and to dynamically configure the MTD partitions.
This function fdt_copy_fixed_partitions is only based on device tree with livetree compatible function and replace the function fdt_fixup_mtdparts based on mtdparts variable.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
common/fdt_support.c | 73 +++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 8 +++++ 2 files changed, 81 insertions(+)
diff --git a/common/fdt_support.c b/common/fdt_support.c index ffc59fd8b36a..5e49078f8c35 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -1051,6 +1051,79 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info, } #endif
+int fdt_copy_fixed_partitions(void *blob) +{
- ofnode node, subnode;
- int off, suboff, res;
- char path[256];
- int address_cells, size_cells;
- u8 i, j, child_count;
- node = ofnode_by_compatible(ofnode_null(), "fixed-partitions");
- while (ofnode_valid(node)) {
/* copy the U-Boot fixed partition */
address_cells = ofnode_read_simple_addr_cells(node);
size_cells = ofnode_read_simple_size_cells(node);
res = ofnode_get_path(ofnode_get_parent(node), path, sizeof(path));
if (res)
return res;
off = fdt_path_offset(blob, path);
if (off < 0)
return -ENODEV;
off = fdt_find_or_add_subnode(blob, off, "partitions");
res = fdt_setprop_string(blob, off, "compatible", "fixed-partitions");
if (res)
return res;
res = fdt_setprop_u32(blob, off, "#address-cells", address_cells);
if (res)
return res;
res = fdt_setprop_u32(blob, off, "#size-cells", size_cells);
if (res)
return res;
/*
* parse partition in reverse order as fdt_find_or_add_subnode() only
* insert the new node after the parent's properties
*/
child_count = ofnode_get_child_count(node);
for (i = child_count; i > 0 ; i--) {
subnode = ofnode_first_subnode(node);
if (!ofnode_valid(subnode))
break;
for (j = 0; (j < i - 1); j++)
subnode = ofnode_next_subnode(subnode);
if (!ofnode_valid(subnode))
break;
const u32 *reg;
int len;
suboff = fdt_find_or_add_subnode(blob, off, ofnode_get_name(subnode));
res = fdt_setprop_string(blob, suboff, "label",
ofnode_read_string(subnode, "label"));
if (res)
return res;
reg = ofnode_get_property(subnode, "reg", &len);
res = fdt_setprop(blob, suboff, "reg", reg, len);
if (res)
return res;
}
/* go to next fixed-partitions node */
node = ofnode_by_compatible(node, "fixed-partitions");
- }
- return 0;
+}
void fdt_del_node_and_alias(void *blob, const char *alias) { int off = fdt_path_offset(blob, alias); diff --git a/include/fdt_support.h b/include/fdt_support.h index eeb83e6251d3..2cd836689821 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -256,6 +256,14 @@ static inline void fdt_fixup_mtdparts(void *fdt, } #endif
+/**
- copy the fixed-partition nodes from U-Boot device tree to external blob
- @param blob FDT blob to update
- Return: 0 if ok, or non-zero on error
- */
+int fdt_copy_fixed_partitions(void *blob);
void fdt_del_node_and_alias(void *blob, const char *alias);
/**
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

Hi Patrick,
On Thu, 8 Jun 2023 at 16:16, Patrick Delaunay patrick.delaunay@foss.st.com wrote:
Add a new function fdt_copy_fixed_partitions to copy the fixed partition nodes from U-Boot device tree to Linux kernel device tree and to dynamically configure the MTD partitions.
This function fdt_copy_fixed_partitions is only based on device tree with livetree compatible function and replace the function fdt_fixup_mtdparts based on mtdparts variable.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
common/fdt_support.c | 73 +++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 8 +++++ 2 files changed, 81 insertions(+)
diff --git a/common/fdt_support.c b/common/fdt_support.c index ffc59fd8b36a..5e49078f8c35 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -1051,6 +1051,79 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info, } #endif
+int fdt_copy_fixed_partitions(void *blob) +{
ofnode node, subnode;
int off, suboff, res;
char path[256];
int address_cells, size_cells;
u8 i, j, child_count;
node = ofnode_by_compatible(ofnode_null(), "fixed-partitions");
while (ofnode_valid(node)) {
/* copy the U-Boot fixed partition */
address_cells = ofnode_read_simple_addr_cells(node);
size_cells = ofnode_read_simple_size_cells(node);
res = ofnode_get_path(ofnode_get_parent(node), path, sizeof(path));
if (res)
return res;
off = fdt_path_offset(blob, path);
if (off < 0)
return -ENODEV;
It should be possible to use livetree to write to the blob. E.g.:
oftree tree = oftree_from_fdt(blob); ofnode node = oftree_path(tree, "/...");
That would be more future-proof than using this API. I'd like to move DT fixup to the ofnode API eventually.
off = fdt_find_or_add_subnode(blob, off, "partitions");
res = fdt_setprop_string(blob, off, "compatible", "fixed-partitions");
if (res)
return res;
res = fdt_setprop_u32(blob, off, "#address-cells", address_cells);
if (res)
return res;
res = fdt_setprop_u32(blob, off, "#size-cells", size_cells);
if (res)
return res;
/*
* parse partition in reverse order as fdt_find_or_add_subnode() only
* insert the new node after the parent's properties
*/
child_count = ofnode_get_child_count(node);
for (i = child_count; i > 0 ; i--) {
subnode = ofnode_first_subnode(node);
if (!ofnode_valid(subnode))
break;
for (j = 0; (j < i - 1); j++)
subnode = ofnode_next_subnode(subnode);
if (!ofnode_valid(subnode))
break;
const u32 *reg;
int len;
suboff = fdt_find_or_add_subnode(blob, off, ofnode_get_name(subnode));
res = fdt_setprop_string(blob, suboff, "label",
ofnode_read_string(subnode, "label"));
if (res)
return res;
reg = ofnode_get_property(subnode, "reg", &len);
res = fdt_setprop(blob, suboff, "reg", reg, len);
if (res)
return res;
}
/* go to next fixed-partitions node */
node = ofnode_by_compatible(node, "fixed-partitions");
}
return 0;
+}
void fdt_del_node_and_alias(void *blob, const char *alias) { int off = fdt_path_offset(blob, alias); diff --git a/include/fdt_support.h b/include/fdt_support.h index eeb83e6251d3..2cd836689821 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -256,6 +256,14 @@ static inline void fdt_fixup_mtdparts(void *fdt, } #endif
+/**
- copy the fixed-partition nodes from U-Boot device tree to external blob
- @param blob FDT blob to update
- Return: 0 if ok, or non-zero on error
- */
+int fdt_copy_fixed_partitions(void *blob);
void fdt_del_node_and_alias(void *blob, const char *alias);
/**
2.25.1
Regards, Simon

With MTD support in driver model, the direct call of mtdparts_init should be avoided and replaced by mtd_probe_devices.
With the modificaton when MTDIDS/MTDPARTS are empty the OF fallback with partition describe in device tree is correctly performed, introduced by commit dc339bf784f0 ("mtd: add support for parsing partitions defined in OF"). With this patch the dependency with CONFIG_CMD_MTDPARTS is removed.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
drivers/dfu/Kconfig | 1 - drivers/dfu/dfu_mtd.c | 34 +++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index 8d7f13dcb0b5..c3a0b93b25e0 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -41,7 +41,6 @@ config DFU_MMC config DFU_MTD bool "MTD back end for DFU" depends on DM_MTD - depends on CMD_MTDPARTS help This option enables using DFU to read and write to on any MTD device.
diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c index c7075f12eca9..75e2f6a42151 100644 --- a/drivers/dfu/dfu_mtd.c +++ b/drivers/dfu/dfu_mtd.c @@ -10,7 +10,6 @@ #include <common.h> #include <dfu.h> #include <mtd.h> -#include <jffs2/load_kernel.h> #include <linux/err.h> #include <linux/ctype.h>
@@ -275,7 +274,7 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char **argv, int a { char *s; struct mtd_info *mtd; - int ret, part; + int part;
mtd = get_mtd_device_nm(devstr); if (IS_ERR_OR_NULL(mtd)) @@ -299,10 +298,9 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char **argv, int a if (*s) return -EINVAL; } else if ((!strcmp(argv[0], "part")) || (!strcmp(argv[0], "partubi"))) { - char mtd_id[32]; - struct mtd_device *mtd_dev; - u8 part_num; - struct part_info *pi; + struct mtd_info *partition; + int partnum = 0; + bool part_found = false;
if (argc != 2) return -EINVAL; @@ -313,19 +311,25 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char **argv, int a if (*s) return -EINVAL;
- sprintf(mtd_id, "%s,%d", devstr, part - 1); - printf("using id '%s'\n", mtd_id); + /* register partitions with MTDIDS/MTDPARTS or OF fallback */ + mtd_probe_devices();
- mtdparts_init(); - - ret = find_dev_and_part(mtd_id, &mtd_dev, &part_num, &pi); - if (ret != 0) { - printf("Could not locate '%s'\n", mtd_id); + partnum = 0; + list_for_each_entry(partition, &mtd->partitions, node) { + partnum++; + if (partnum == part) { + part_found = true; + break; + } + } + if (!part_found) { + printf("No partition %d in %s\n", part, mtd->name); return -1; } + log_debug("partition %d:%s in %s\n", partnum, partition->name, mtd->name);
- dfu->data.mtd.start = pi->offset; - dfu->data.mtd.size = pi->size; + dfu->data.mtd.start = partition->offset; + dfu->data.mtd.size = partition->size; if (!strcmp(argv[0], "partubi")) dfu->data.mtd.ubi = 1; } else {

On 6/8/23 17:16, Patrick Delaunay wrote:
With MTD support in driver model, the direct call of mtdparts_init should be avoided and replaced by mtd_probe_devices.
With the modificaton when MTDIDS/MTDPARTS are empty the OF fallback with partition describe in device tree is correctly performed, introduced by commit dc339bf784f0 ("mtd: add support for parsing partitions defined in OF"). With this patch the dependency with CONFIG_CMD_MTDPARTS is removed.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
drivers/dfu/Kconfig | 1 - drivers/dfu/dfu_mtd.c | 34 +++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index 8d7f13dcb0b5..c3a0b93b25e0 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -41,7 +41,6 @@ config DFU_MMC config DFU_MTD bool "MTD back end for DFU" depends on DM_MTD
- depends on CMD_MTDPARTS help This option enables using DFU to read and write to on any MTD device.
diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c index c7075f12eca9..75e2f6a42151 100644 --- a/drivers/dfu/dfu_mtd.c +++ b/drivers/dfu/dfu_mtd.c @@ -10,7 +10,6 @@ #include <common.h> #include <dfu.h> #include <mtd.h> -#include <jffs2/load_kernel.h> #include <linux/err.h> #include <linux/ctype.h>
@@ -275,7 +274,7 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char **argv, int a { char *s; struct mtd_info *mtd;
- int ret, part;
int part;
mtd = get_mtd_device_nm(devstr); if (IS_ERR_OR_NULL(mtd))
@@ -299,10 +298,9 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char **argv, int a if (*s) return -EINVAL; } else if ((!strcmp(argv[0], "part")) || (!strcmp(argv[0], "partubi"))) {
char mtd_id[32];
struct mtd_device *mtd_dev;
u8 part_num;
struct part_info *pi;
struct mtd_info *partition;
int partnum = 0;
bool part_found = false;
if (argc != 2) return -EINVAL;
@@ -313,19 +311,25 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char **argv, int a if (*s) return -EINVAL;
sprintf(mtd_id, "%s,%d", devstr, part - 1);
printf("using id '%s'\n", mtd_id);
/* register partitions with MTDIDS/MTDPARTS or OF fallback */
mtd_probe_devices();
mtdparts_init();
ret = find_dev_and_part(mtd_id, &mtd_dev, &part_num, &pi);
if (ret != 0) {
printf("Could not locate '%s'\n", mtd_id);
partnum = 0;
list_for_each_entry(partition, &mtd->partitions, node) {
partnum++;
if (partnum == part) {
part_found = true;
break;
}
}
if (!part_found) {
}printf("No partition %d in %s\n", part, mtd->name); return -1;
log_debug("partition %d:%s in %s\n", partnum, partition->name, mtd->name);
dfu->data.mtd.start = pi->offset;
dfu->data.mtd.size = pi->size;
dfu->data.mtd.start = partition->offset;
if (!strcmp(argv[0], "partubi")) dfu->data.mtd.ubi = 1; } else {dfu->data.mtd.size = partition->size;
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

From: Patrice Chotard patrice.chotard@foss.st.com
Motivation for this patch is to remove usage of function define in cmd/mtdparts.c interface, based on env variables mtdids and mtdparts: mtdparts_init() and find_dev_and_part(). See commit 938db6fe5da3 ("cmd: mtdparts: describe as legacy")
Now, all MTD devices are populated with their partition's information found in DT, accessible in MTD devices. Use these information to find the wanted partitions, no more need of find_dev_and_part() usage.
Signed-off-by: Patrice Chotard patrice.chotard@foss.st.com Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
.../mach-stm32mp/cmd_stm32prog/stm32prog.c | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index 6f3641ccf57b..241ad40abb7c 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -208,11 +208,6 @@ static int optee_ta_invoke(struct stm32prog_data *data, int cmd, int type, return rc; }
-/* partition handling routines : CONFIG_CMD_MTDPARTS */ -int mtdparts_init(void); -int find_dev_and_part(const char *id, struct mtd_device **dev, - u8 *part_num, struct part_info **part); - char *stm32prog_get_error(struct stm32prog_data *data) { static const char error_msg[] = "Unspecified"; @@ -741,6 +736,7 @@ static int init_device(struct stm32prog_data *data, struct mmc *mmc = NULL; struct blk_desc *block_dev = NULL; struct mtd_info *mtd = NULL; + struct mtd_info *partition; char mtd_id[16]; int part_id; int ret; @@ -749,6 +745,7 @@ static int init_device(struct stm32prog_data *data, u64 part_addr, part_size; bool part_found; const char *part_name; + u8 i;
switch (dev->target) { case STM32PROG_MMC: @@ -793,10 +790,11 @@ static int init_device(struct stm32prog_data *data, stm32prog_err("unknown device type = %d", dev->target); return -ENODEV; } + /* register partitions with MTDIDS/MTDPARTS or OF fallback */ + mtd_probe_devices(); get_mtd_by_target(mtd_id, dev->target, dev->dev_id); log_debug("%s\n", mtd_id);
- mtdparts_init(); mtd = get_mtd_device_nm(mtd_id); if (IS_ERR(mtd)) { stm32prog_err("MTD device %s not found", mtd_id); @@ -943,25 +941,23 @@ static int init_device(struct stm32prog_data *data, }
if (IS_ENABLED(CONFIG_MTD) && mtd) { - char mtd_part_id[32]; - struct part_info *mtd_part; - struct mtd_device *mtd_dev; - u8 part_num; - - sprintf(mtd_part_id, "%s,%d", mtd_id, - part->part_id - 1); - ret = find_dev_and_part(mtd_part_id, &mtd_dev, - &part_num, &mtd_part); - if (ret != 0) { - stm32prog_err("%s (0x%x): Invalid MTD partition %s", - part->name, part->id, - mtd_part_id); + i = 0; + list_for_each_entry(partition, &mtd->partitions, node) { + if ((part->part_id - 1) == i) { + part_found = true; + break; + } + i++; + } + if (part_found) { + part_addr = partition->offset; + part_size = partition->size; + part_name = partition->name; + } else { + stm32prog_err("%s (0x%x):Couldn't find part %d on device mtd %s", + part->name, part->id, part->part_id, mtd_id); return -ENODEV; } - part_addr = mtd_part->offset; - part_size = mtd_part->size; - part_name = mtd_part->name; - part_found = true; }
/* no partition for this device */

On 6/8/23 17:16, Patrick Delaunay wrote:
From: Patrice Chotard patrice.chotard@foss.st.com
Motivation for this patch is to remove usage of function define in cmd/mtdparts.c interface, based on env variables mtdids and mtdparts: mtdparts_init() and find_dev_and_part(). See commit 938db6fe5da3 ("cmd: mtdparts: describe as legacy")
Now, all MTD devices are populated with their partition's information found in DT, accessible in MTD devices. Use these information to find the wanted partitions, no more need of find_dev_and_part() usage.
Signed-off-by: Patrice Chotard patrice.chotard@foss.st.com Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
.../mach-stm32mp/cmd_stm32prog/stm32prog.c | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index 6f3641ccf57b..241ad40abb7c 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -208,11 +208,6 @@ static int optee_ta_invoke(struct stm32prog_data *data, int cmd, int type, return rc; }
-/* partition handling routines : CONFIG_CMD_MTDPARTS */ -int mtdparts_init(void); -int find_dev_and_part(const char *id, struct mtd_device **dev,
u8 *part_num, struct part_info **part);
char *stm32prog_get_error(struct stm32prog_data *data) { static const char error_msg[] = "Unspecified"; @@ -741,6 +736,7 @@ static int init_device(struct stm32prog_data *data, struct mmc *mmc = NULL; struct blk_desc *block_dev = NULL; struct mtd_info *mtd = NULL;
- struct mtd_info *partition; char mtd_id[16]; int part_id; int ret;
@@ -749,6 +745,7 @@ static int init_device(struct stm32prog_data *data, u64 part_addr, part_size; bool part_found; const char *part_name;
u8 i;
switch (dev->target) { case STM32PROG_MMC:
@@ -793,10 +790,11 @@ static int init_device(struct stm32prog_data *data, stm32prog_err("unknown device type = %d", dev->target); return -ENODEV; }
/* register partitions with MTDIDS/MTDPARTS or OF fallback */
get_mtd_by_target(mtd_id, dev->target, dev->dev_id); log_debug("%s\n", mtd_id);mtd_probe_devices();
mtd = get_mtd_device_nm(mtd_id); if (IS_ERR(mtd)) { stm32prog_err("MTD device %s not found", mtd_id);mtdparts_init();
@@ -943,25 +941,23 @@ static int init_device(struct stm32prog_data *data, }
if (IS_ENABLED(CONFIG_MTD) && mtd) {
char mtd_part_id[32];
struct part_info *mtd_part;
struct mtd_device *mtd_dev;
u8 part_num;
sprintf(mtd_part_id, "%s,%d", mtd_id,
part->part_id - 1);
ret = find_dev_and_part(mtd_part_id, &mtd_dev,
&part_num, &mtd_part);
if (ret != 0) {
stm32prog_err("%s (0x%x): Invalid MTD partition %s",
part->name, part->id,
mtd_part_id);
i = 0;
list_for_each_entry(partition, &mtd->partitions, node) {
if ((part->part_id - 1) == i) {
part_found = true;
break;
}
i++;
}
if (part_found) {
part_addr = partition->offset;
part_size = partition->size;
part_name = partition->name;
} else {
stm32prog_err("%s (0x%x):Couldn't find part %d on device mtd %s",
part->name, part->id, part->part_id, mtd_id); return -ENODEV; }
part_addr = mtd_part->offset;
part_size = mtd_part->size;
part_name = mtd_part->name;
part_found = true;
}
/* no partition for this device */
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

Update "secure" version of STM32 boards based on SCMI when RCC_TZCR.TZEN=1 stm32mp15xx-*-scmi-u-boot.dtsi with latest patches on files stm32mp15xx-*-u-boot.dtsi.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi | 7 ++++ arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi | 40 +++++++++++++++++++ 3 files changed, 48 insertions(+)
diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index cff3f49948e4..2623cebf21a4 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -12,6 +12,7 @@ i2c3 = &i2c4; usb0 = &usbotg_hs; }; + config { u-boot,boot-led = "heartbeat"; u-boot,error-led = "error"; diff --git a/arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi index 5a8fc15ab2b7..ae93497cd5a8 100644 --- a/arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi @@ -4,3 +4,10 @@ */
#include "stm32mp157a-dk1-scmi-u-boot.dtsi" + +/ { + fwu-mdata { + compatible = "u-boot,fwu-mdata-gpt"; + fwu-mdata-store = <&sdmmc1>; + }; +}; diff --git a/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi index 71a94f9130a6..eef717946b5f 100644 --- a/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi @@ -14,4 +14,44 @@ spi0 = &qspi; usb0 = &usbotg_hs; }; + + fwu-mdata { + compatible = "u-boot,fwu-mdata-gpt"; + fwu-mdata-store = <&sdmmc1>; + }; +}; + +&flash0 { + bootph-pre-ram; +}; + +&qspi { + bootph-pre-ram; +}; + +&qspi_clk_pins_a { + bootph-pre-ram; + pins { + bootph-pre-ram; + }; +}; + +&qspi_bk1_pins_a { + bootph-pre-ram; + pins1 { + bootph-pre-ram; + }; + pins2 { + bootph-pre-ram; + }; +}; + +&qspi_bk2_pins_a { + bootph-pre-ram; + pins1 { + bootph-pre-ram; + }; + pins2 { + bootph-pre-ram; + }; };

On 6/8/23 17:16, Patrick Delaunay wrote:
Update "secure" version of STM32 boards based on SCMI when RCC_TZCR.TZEN=1 stm32mp15xx-*-scmi-u-boot.dtsi with latest patches on files stm32mp15xx-*-u-boot.dtsi.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi | 7 ++++ arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi | 40 +++++++++++++++++++ 3 files changed, 48 insertions(+)
diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index cff3f49948e4..2623cebf21a4 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -12,6 +12,7 @@ i2c3 = &i2c4; usb0 = &usbotg_hs; };
- config { u-boot,boot-led = "heartbeat"; u-boot,error-led = "error";
diff --git a/arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi index 5a8fc15ab2b7..ae93497cd5a8 100644 --- a/arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi @@ -4,3 +4,10 @@ */
#include "stm32mp157a-dk1-scmi-u-boot.dtsi"
+/ {
- fwu-mdata {
compatible = "u-boot,fwu-mdata-gpt";
fwu-mdata-store = <&sdmmc1>;
- };
+}; diff --git a/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi index 71a94f9130a6..eef717946b5f 100644 --- a/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi @@ -14,4 +14,44 @@ spi0 = &qspi; usb0 = &usbotg_hs; };
- fwu-mdata {
compatible = "u-boot,fwu-mdata-gpt";
fwu-mdata-store = <&sdmmc1>;
- };
+};
+&flash0 {
- bootph-pre-ram;
+};
+&qspi {
- bootph-pre-ram;
+};
+&qspi_clk_pins_a {
- bootph-pre-ram;
- pins {
bootph-pre-ram;
- };
+};
+&qspi_bk1_pins_a {
- bootph-pre-ram;
- pins1 {
bootph-pre-ram;
- };
- pins2 {
bootph-pre-ram;
- };
+};
+&qspi_bk2_pins_a {
- bootph-pre-ram;
- pins1 {
bootph-pre-ram;
- };
- pins2 {
bootph-pre-ram;
- };
};
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

From: Patrice Chotard patrice.chotard@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@foss.st.com Signed-off-by: Patrice Chotard patrice.chotard@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@0 { + label = "fsbl1"; + reg = <0x00000000 0x00040000>; + }; + partition@40000 { + label = "fsbl2"; + reg = <0x00040000 0x00040000>; + }; + partition@80000 { + label = "metadata1"; + reg = <0x00080000 0x00040000>; + }; + partition@c0000 { + label = "metadata2"; + reg = <0x000c0000 0x00040000>; + }; + partition@100000 { + label = "fip-a"; + reg = <0x00100000 0x00400000>; + }; + partition@500000 { + label = "fip-b"; + reg = <0x00500000 0x00400000>; + }; + partition@900000 { + label = "u-boot-env"; + reg = <0x00900000 0x00080000>; + }; + partition@980000 { + label = "nor-user"; + reg = <0x00980000 0x03680000>; + }; + }; +}; + +&fmc { + nand-controller@4,0 { + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + label = "fsbl1"; + reg = <0x00000000 0x00080000>; + }; + partition@80000 { + label = "fsbl2"; + reg = <0x00080000 0x00080000>; + }; + partition@100000 { + label = "metadata1"; + reg = <0x00100000 0x00080000>; + }; + partition@180000 { + label = "metadata2"; + reg = <0x00180000 0x00080000>; + }; + partition@200000 { + label = "fip-a1"; + reg = <0x00200000 0x00400000>; + }; + partition@600000 { + label = "fip-a2"; + reg = <0x00600000 0x00400000>; + }; + partition@a00000 { + label = "fip-b1"; + reg = <0x00a00000 0x00400000>; + }; + partition@e00000 { + label = "fip-b2"; + reg = <0x00e00000 0x00400000>; + }; + partition@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@0 { + label = "fsbl1"; + reg = <0x00000000 0x00040000>; + }; + partition@80000 { + label = "fsbl2"; + reg = <0x00040000 0x00040000>; + }; + partition@100000 { + label = "ssbl"; + reg = <0x00080000 0x00200000>; + }; + partition@280000 { + label = "u-boot-env"; + reg = <0x00280000 0x00080000>; + }; + partition@300000 { + label = "nor-user"; + reg = <0x00300000 0x03d00000>; + }; +#else + partition@0 { + label = "fsbl1"; + reg = <0x00000000 0x00040000>; + }; + partition@40000 { + label = "fsbl2"; + reg = <0x00040000 0x00040000>; + }; + partition@100000 { + label = "fip"; + reg = <0x00080000 0x00400000>; + }; + partition@480000 { + label = "u-boot-env"; + reg = <0x00480000 0x00080000>; + }; + partition@500000 { + label = "nor-user"; + reg = <0x00500000 0x03b00000>; + }; +#endif + }; +}; + +&fmc { + nand-controller@4,0 { + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + +#if defined(CONFIG_STM32MP15x_STM32IMAGE) || defined(CONFIG_SPL) + partition@0 { + label = "fsbl"; + reg = <0x00000000 0x00200000>; + }; + partition@200000 { + label = "ssbl1"; + reg = <0x00200000 0x00200000>; + }; + partition@400000 { + label = "ssbl2"; + reg = <0x00400000 0x00200000>; + }; + partition@600000 { + label = "UBI"; + reg = <0x00600000 0x3fa00000>; + }; +#else + partition@0 { + label = "fsbl"; + reg = <0x00000000 0x00200000>; + }; + partition@200000 { + label = "fip1"; + reg = <0x00200000 0x00400000>; + }; + partition@600000 { + label = "fip2"; + reg = <0x00600000 0x00400000>; + }; + partition@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

On 6/8/23 17:16, Patrick Delaunay wrote:
From: Patrice Chotard patrice.chotard@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@foss.st.com Signed-off-by: Patrice Chotard patrice.chotard@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@0 {
label = "fsbl1";
reg = <0x00000000 0x00040000>;
};
partition@40000 {
label = "fsbl2";
reg = <0x00040000 0x00040000>;
};
partition@80000 {
label = "metadata1";
reg = <0x00080000 0x00040000>;
};
partition@c0000 {
label = "metadata2";
reg = <0x000c0000 0x00040000>;
};
partition@100000 {
label = "fip-a";
reg = <0x00100000 0x00400000>;
};
partition@500000 {
label = "fip-b";
reg = <0x00500000 0x00400000>;
};
partition@900000 {
label = "u-boot-env";
reg = <0x00900000 0x00080000>;
};
partition@980000 {
label = "nor-user";
reg = <0x00980000 0x03680000>;
};
- };
+};
+&fmc {
- nand-controller@4,0 {
nand@0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "fsbl1";
reg = <0x00000000 0x00080000>;
};
partition@80000 {
label = "fsbl2";
reg = <0x00080000 0x00080000>;
};
partition@100000 {
label = "metadata1";
reg = <0x00100000 0x00080000>;
};
partition@180000 {
label = "metadata2";
reg = <0x00180000 0x00080000>;
};
partition@200000 {
label = "fip-a1";
reg = <0x00200000 0x00400000>;
};
partition@600000 {
label = "fip-a2";
reg = <0x00600000 0x00400000>;
};
partition@a00000 {
label = "fip-b1";
reg = <0x00a00000 0x00400000>;
};
partition@e00000 {
label = "fip-b2";
reg = <0x00e00000 0x00400000>;
};
partition@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@0 {
label = "fsbl1";
reg = <0x00000000 0x00040000>;
};
partition@80000 {
label = "fsbl2";
reg = <0x00040000 0x00040000>;
};
partition@100000 {
label = "ssbl";
reg = <0x00080000 0x00200000>;
};
partition@280000 {
label = "u-boot-env";
reg = <0x00280000 0x00080000>;
};
partition@300000 {
label = "nor-user";
reg = <0x00300000 0x03d00000>;
};
+#else
partition@0 {
label = "fsbl1";
reg = <0x00000000 0x00040000>;
};
partition@40000 {
label = "fsbl2";
reg = <0x00040000 0x00040000>;
};
partition@100000 {
label = "fip";
reg = <0x00080000 0x00400000>;
};
partition@480000 {
label = "u-boot-env";
reg = <0x00480000 0x00080000>;
};
partition@500000 {
label = "nor-user";
reg = <0x00500000 0x03b00000>;
};
+#endif
- };
+};
+&fmc {
- nand-controller@4,0 {
nand@0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
+#if defined(CONFIG_STM32MP15x_STM32IMAGE) || defined(CONFIG_SPL)
partition@0 {
label = "fsbl";
reg = <0x00000000 0x00200000>;
};
partition@200000 {
label = "ssbl1";
reg = <0x00200000 0x00200000>;
};
partition@400000 {
label = "ssbl2";
reg = <0x00400000 0x00200000>;
};
partition@600000 {
label = "UBI";
reg = <0x00600000 0x3fa00000>;
};
+#else
partition@0 {
label = "fsbl";
reg = <0x00000000 0x00200000>;
};
partition@200000 {
label = "fip1";
reg = <0x00200000 0x00400000>;
};
partition@600000 {
label = "fip2";
reg = <0x00600000 0x00400000>;
};
partition@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
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

From: Patrice Chotard patrice.chotard@foss.st.com
As we don't use anymore MTDPARTS_xx Kconfig variables (MTDPARTS_NAND0_BOOT, MTDPARTS_NOR0_BOOT...), disable SYS_MTDPARTS_RUNTIME.
Signed-off-by: Patrice Chotard patrice.chotard@foss.st.com Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
configs/stm32mp13_defconfig | 1 - configs/stm32mp15_basic_defconfig | 1 - configs/stm32mp15_defconfig | 1 - configs/stm32mp15_trusted_defconfig | 1 - 4 files changed, 4 deletions(-)
diff --git a/configs/stm32mp13_defconfig b/configs/stm32mp13_defconfig index b076573c450f..02a29cd9f03a 100644 --- a/configs/stm32mp13_defconfig +++ b/configs/stm32mp13_defconfig @@ -59,7 +59,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_DM_MTD=y -CONFIG_SYS_MTDPARTS_RUNTIME=y CONFIG_PINCONF=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 13355ebb4692..273b72fdaf0a 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -125,7 +125,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_DM_MTD=y -CONFIG_SYS_MTDPARTS_RUNTIME=y CONFIG_MTD_RAW_NAND=y CONFIG_NAND_STM32_FMC2=y CONFIG_SYS_NAND_ONFI_DETECTION=y diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig index bad5c32ef808..b1f0f2f7c784 100644 --- a/configs/stm32mp15_defconfig +++ b/configs/stm32mp15_defconfig @@ -98,7 +98,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_DM_MTD=y -CONFIG_SYS_MTDPARTS_RUNTIME=y CONFIG_MTD_RAW_NAND=y CONFIG_NAND_STM32_FMC2=y CONFIG_SYS_NAND_ONFI_DETECTION=y diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index 5f0fb4565105..bcfd60e5a85a 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -99,7 +99,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_DM_MTD=y -CONFIG_SYS_MTDPARTS_RUNTIME=y CONFIG_MTD_RAW_NAND=y CONFIG_NAND_STM32_FMC2=y CONFIG_SYS_NAND_ONFI_DETECTION=y

On 6/8/23 17:16, Patrick Delaunay wrote:
From: Patrice Chotard patrice.chotard@foss.st.com
As we don't use anymore MTDPARTS_xx Kconfig variables (MTDPARTS_NAND0_BOOT, MTDPARTS_NOR0_BOOT...), disable SYS_MTDPARTS_RUNTIME.
Signed-off-by: Patrice Chotard patrice.chotard@foss.st.com Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
configs/stm32mp13_defconfig | 1 - configs/stm32mp15_basic_defconfig | 1 - configs/stm32mp15_defconfig | 1 - configs/stm32mp15_trusted_defconfig | 1 - 4 files changed, 4 deletions(-)
diff --git a/configs/stm32mp13_defconfig b/configs/stm32mp13_defconfig index b076573c450f..02a29cd9f03a 100644 --- a/configs/stm32mp13_defconfig +++ b/configs/stm32mp13_defconfig @@ -59,7 +59,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_DM_MTD=y -CONFIG_SYS_MTDPARTS_RUNTIME=y CONFIG_PINCONF=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 13355ebb4692..273b72fdaf0a 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -125,7 +125,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_DM_MTD=y -CONFIG_SYS_MTDPARTS_RUNTIME=y CONFIG_MTD_RAW_NAND=y CONFIG_NAND_STM32_FMC2=y CONFIG_SYS_NAND_ONFI_DETECTION=y diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig index bad5c32ef808..b1f0f2f7c784 100644 --- a/configs/stm32mp15_defconfig +++ b/configs/stm32mp15_defconfig @@ -98,7 +98,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_DM_MTD=y -CONFIG_SYS_MTDPARTS_RUNTIME=y CONFIG_MTD_RAW_NAND=y CONFIG_NAND_STM32_FMC2=y CONFIG_SYS_NAND_ONFI_DETECTION=y diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index 5f0fb4565105..bcfd60e5a85a 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -99,7 +99,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_STM32_SDMMC2=y CONFIG_MTD=y CONFIG_DM_MTD=y -CONFIG_SYS_MTDPARTS_RUNTIME=y CONFIG_MTD_RAW_NAND=y CONFIG_NAND_STM32_FMC2=y CONFIG_SYS_NAND_ONFI_DETECTION=y
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

Copy the fixed partition nodes from U-Boot device tree to Linux kernel device tree to dynamically configure the MTD partitions.
fdt_copy_fixed_partitions is only based on device tree and replace the function fdt_fixup_mtdparts based on mtdparts variable; the variable mtdid and mtdparts are not more required.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
board/st/stm32mp1/stm32mp1.c | 16 +--------------- configs/stm32mp13_defconfig | 1 - configs/stm32mp15_basic_defconfig | 1 - configs/stm32mp15_defconfig | 1 - configs/stm32mp15_trusted_defconfig | 1 - 5 files changed, 1 insertion(+), 19 deletions(-)
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 1a1b1844c8c0..be850151e5fc 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -25,7 +25,6 @@ #include <log.h> #include <malloc.h> #include <misc.h> -#include <mtd_node.h> #include <net.h> #include <netdev.h> #include <phy.h> @@ -915,20 +914,7 @@ int mmc_get_env_dev(void) #if defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, struct bd_info *bd) { - static const struct node_info nodes[] = { - { "jedec,spi-nor", MTD_DEV_TYPE_NOR, }, - { "spi-nand", MTD_DEV_TYPE_SPINAND}, - { "st,stm32mp15-fmc2", MTD_DEV_TYPE_NAND, }, - { "st,stm32mp1-fmc2-nfc", MTD_DEV_TYPE_NAND, }, - }; - char *boot_device; - - /* Check the boot-source and don't update MTD for serial or usb boot */ - boot_device = env_get("boot_device"); - if (!boot_device || - (strcmp(boot_device, "serial") && strcmp(boot_device, "usb"))) - if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS)) - fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); + fdt_copy_fixed_partitions(blob);
if (IS_ENABLED(CONFIG_FDT_SIMPLEFB)) fdt_simplefb_enable_and_mem_rsv(blob); diff --git a/configs/stm32mp13_defconfig b/configs/stm32mp13_defconfig index 02a29cd9f03a..a9cc7e4d0353 100644 --- a/configs/stm32mp13_defconfig +++ b/configs/stm32mp13_defconfig @@ -74,7 +74,6 @@ CONFIG_TEE=y CONFIG_OPTEE=y # CONFIG_OPTEE_TA_AVB is not set CONFIG_ERRNO_STR=y -CONFIG_FDT_FIXUP_PARTITIONS=y # CONFIG_LMB_USE_MAX_REGIONS is not set CONFIG_LMB_MEMORY_REGIONS=2 CONFIG_LMB_RESERVED_REGIONS=16 diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 273b72fdaf0a..7661159110e5 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -188,7 +188,6 @@ CONFIG_WDT=y CONFIG_WDT_STM32MP=y # CONFIG_BINMAN_FDT is not set CONFIG_ERRNO_STR=y -CONFIG_FDT_FIXUP_PARTITIONS=y # CONFIG_LMB_USE_MAX_REGIONS is not set CONFIG_LMB_MEMORY_REGIONS=2 CONFIG_LMB_RESERVED_REGIONS=16 diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig index b1f0f2f7c784..1ff9f73730d3 100644 --- a/configs/stm32mp15_defconfig +++ b/configs/stm32mp15_defconfig @@ -164,7 +164,6 @@ CONFIG_WDT=y CONFIG_WDT_STM32MP=y # CONFIG_BINMAN_FDT is not set CONFIG_ERRNO_STR=y -CONFIG_FDT_FIXUP_PARTITIONS=y # CONFIG_LMB_USE_MAX_REGIONS is not set CONFIG_LMB_MEMORY_REGIONS=2 CONFIG_LMB_RESERVED_REGIONS=16 diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index bcfd60e5a85a..e7bf2e171ace 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -164,7 +164,6 @@ CONFIG_WDT=y CONFIG_WDT_STM32MP=y # CONFIG_BINMAN_FDT is not set CONFIG_ERRNO_STR=y -CONFIG_FDT_FIXUP_PARTITIONS=y # CONFIG_LMB_USE_MAX_REGIONS is not set CONFIG_LMB_MEMORY_REGIONS=2 CONFIG_LMB_RESERVED_REGIONS=16

On 6/8/23 17:16, Patrick Delaunay wrote:
Copy the fixed partition nodes from U-Boot device tree to Linux kernel device tree to dynamically configure the MTD partitions.
fdt_copy_fixed_partitions is only based on device tree and replace the function fdt_fixup_mtdparts based on mtdparts variable; the variable mtdid and mtdparts are not more required.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
board/st/stm32mp1/stm32mp1.c | 16 +--------------- configs/stm32mp13_defconfig | 1 - configs/stm32mp15_basic_defconfig | 1 - configs/stm32mp15_defconfig | 1 - configs/stm32mp15_trusted_defconfig | 1 - 5 files changed, 1 insertion(+), 19 deletions(-)
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 1a1b1844c8c0..be850151e5fc 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -25,7 +25,6 @@ #include <log.h> #include <malloc.h> #include <misc.h> -#include <mtd_node.h> #include <net.h> #include <netdev.h> #include <phy.h> @@ -915,20 +914,7 @@ int mmc_get_env_dev(void) #if defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, struct bd_info *bd) {
- static const struct node_info nodes[] = {
{ "jedec,spi-nor", MTD_DEV_TYPE_NOR, },
{ "spi-nand", MTD_DEV_TYPE_SPINAND},
{ "st,stm32mp15-fmc2", MTD_DEV_TYPE_NAND, },
{ "st,stm32mp1-fmc2-nfc", MTD_DEV_TYPE_NAND, },
- };
- char *boot_device;
- /* Check the boot-source and don't update MTD for serial or usb boot */
- boot_device = env_get("boot_device");
- if (!boot_device ||
(strcmp(boot_device, "serial") && strcmp(boot_device, "usb")))
if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS))
fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
fdt_copy_fixed_partitions(blob);
if (IS_ENABLED(CONFIG_FDT_SIMPLEFB)) fdt_simplefb_enable_and_mem_rsv(blob);
diff --git a/configs/stm32mp13_defconfig b/configs/stm32mp13_defconfig index 02a29cd9f03a..a9cc7e4d0353 100644 --- a/configs/stm32mp13_defconfig +++ b/configs/stm32mp13_defconfig @@ -74,7 +74,6 @@ CONFIG_TEE=y CONFIG_OPTEE=y # CONFIG_OPTEE_TA_AVB is not set CONFIG_ERRNO_STR=y -CONFIG_FDT_FIXUP_PARTITIONS=y # CONFIG_LMB_USE_MAX_REGIONS is not set CONFIG_LMB_MEMORY_REGIONS=2 CONFIG_LMB_RESERVED_REGIONS=16 diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 273b72fdaf0a..7661159110e5 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -188,7 +188,6 @@ CONFIG_WDT=y CONFIG_WDT_STM32MP=y # CONFIG_BINMAN_FDT is not set CONFIG_ERRNO_STR=y -CONFIG_FDT_FIXUP_PARTITIONS=y # CONFIG_LMB_USE_MAX_REGIONS is not set CONFIG_LMB_MEMORY_REGIONS=2 CONFIG_LMB_RESERVED_REGIONS=16 diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig index b1f0f2f7c784..1ff9f73730d3 100644 --- a/configs/stm32mp15_defconfig +++ b/configs/stm32mp15_defconfig @@ -164,7 +164,6 @@ CONFIG_WDT=y CONFIG_WDT_STM32MP=y # CONFIG_BINMAN_FDT is not set CONFIG_ERRNO_STR=y -CONFIG_FDT_FIXUP_PARTITIONS=y # CONFIG_LMB_USE_MAX_REGIONS is not set CONFIG_LMB_MEMORY_REGIONS=2 CONFIG_LMB_RESERVED_REGIONS=16 diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index bcfd60e5a85a..e7bf2e171ace 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -164,7 +164,6 @@ CONFIG_WDT=y CONFIG_WDT_STM32MP=y # CONFIG_BINMAN_FDT is not set CONFIG_ERRNO_STR=y -CONFIG_FDT_FIXUP_PARTITIONS=y # CONFIG_LMB_USE_MAX_REGIONS is not set CONFIG_LMB_MEMORY_REGIONS=2 CONFIG_LMB_RESERVED_REGIONS=16
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

Remove the function board_mtdparts_default and the associated file or configs, only used by the CONFIG_SYS_MTDPARTS_RUNTIME now removed.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
board/st/common/Kconfig | 66 ----------- board/st/common/Makefile | 1 - board/st/common/stm32mp_mtdparts.c | 177 ----------------------------- 3 files changed, 244 deletions(-) delete mode 100644 board/st/common/stm32mp_mtdparts.c
diff --git a/board/st/common/Kconfig b/board/st/common/Kconfig index aba3590866e0..c1c254d07354 100644 --- a/board/st/common/Kconfig +++ b/board/st/common/Kconfig @@ -6,72 +6,6 @@ config CMD_STBOARD This compile the stboard command to read and write the board in the OTP.
-config MTDPARTS_NAND0_BOOT - string "mtd boot partitions for nand0" - default "2m(fsbl),2m(ssbl1),2m(ssbl2)" if STM32MP15x_STM32IMAGE || \ - !TFABOOT - default "2m(fsbl),4m(fip1),4m(fip2)" - depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP - help - This define the partitions of nand0 used to build mtparts dynamically - for boot from nand0. - Each partition need to be aligned with the device erase block size, - 512KB is the max size for the NAND supported by stm32mp1 platform. - The fsbl partition support multiple copy of the same binary, one by - erase block. - -config MTDPARTS_NAND0_TEE - string "mtd tee partitions for nand0" - default "512k(teeh),512k(teed),512k(teex)" - depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP && STM32MP15x_STM32IMAGE - help - This define the tee partitions added in mtparts dynamically - when tee is supported with boot from nand0. - Each partition need to be aligned with the device erase block size, - 512KB is the max size for the NAND supported by stm32mp1 platform. - -config MTDPARTS_NOR0_BOOT - string "mtd boot partitions for nor0" - default "256k(fsbl1),256k(fsbl2),2m(ssbl),512k(u-boot-env)" if STM32MP15x_STM32IMAGE || \ - !TFABOOT - default "256k(fsbl1),256k(fsbl2),4m(fip),512k(u-boot-env)" - depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP - help - This define the partitions of nand0 used to build mtparts dynamically - for boot from nor0. - Each partition need to be aligned with the device erase block size, - with 256KB we support all the NOR. - U-Boot env partition (512kB) use 2 erase block for redundancy. - -config MTDPARTS_NOR0_TEE - string "mtd tee partitions for nor0" - default "256k(teeh),512k(teed),256k(teex)" - depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP && STM32MP15x_STM32IMAGE - help - This define the tee partitions added in mtparts dynamically - when tee is supported with boot from nor0. - -config MTDPARTS_SPINAND0_BOOT - string "mtd boot partitions for spi-nand0" - default "2m(fsbl),2m(ssbl1),2m(ssbl2)" if STM32MP15x_STM32IMAGE || !TFABOOT - default "2m(fsbl),4m(fip1),4m(fip2)" - depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP - help - This define the partitions of nand0 used to build mtparts dynamically - for boot from spi-nand0, - 512KB is the max size for the NAND supported by stm32mp1 platform. - The fsbl partition support multiple copy of the same binary, one by - erase block. - -config MTDPARTS_SPINAND0_TEE - string "mtd tee partitions for spi-nand0" - default "512k(teeh),512k(teed),512k(teex)" - depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP && STM32MP15x_STM32IMAGE - help - This define the tee partitions added in mtparts dynamically - when tee is supported with boot from spi-nand0, - 512KB is the max size for the NAND supported by stm32mp1 platform. - config DFU_ALT_RAM0 string "dfu for ram0" default "uImage ram 0xc2000000 0x2000000;devicetree.dtb ram 0xc4000000 0x100000;uramdisk.image.gz ram 0xc4400000 0x10000000" diff --git a/board/st/common/Makefile b/board/st/common/Makefile index 65bbebd6abc3..c9608297261a 100644 --- a/board/st/common/Makefile +++ b/board/st/common/Makefile @@ -7,7 +7,6 @@ obj-$(CONFIG_CMD_STBOARD) += cmd_stboard.o obj-$(CONFIG_PMIC_STPMIC1) += stpmic1.o
ifeq ($(CONFIG_ARCH_STM32MP),y) -obj-$(CONFIG_SYS_MTDPARTS_RUNTIME) += stm32mp_mtdparts.o obj-$(CONFIG_SET_DFU_ALT_INFO) += stm32mp_dfu.o endif
diff --git a/board/st/common/stm32mp_mtdparts.c b/board/st/common/stm32mp_mtdparts.c deleted file mode 100644 index 67a56a2623a1..000000000000 --- a/board/st/common/stm32mp_mtdparts.c +++ /dev/null @@ -1,177 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause -/* - * Copyright (C) 2020, STMicroelectronics - All Rights Reserved - */ - -#include <common.h> -#include <dfu.h> -#include <dm.h> -#include <env.h> -#include <env_internal.h> -#include <log.h> -#include <mtd.h> -#include <mtd_node.h> -#ifdef CONFIG_STM32MP15x_STM32IMAGE -#include <tee.h> -#endif -#include <asm/arch/stm32prog.h> -#include <asm/arch/sys_proto.h> -#include <asm/global_data.h> - -#define MTDPARTS_LEN 256 -#define MTDIDS_LEN 128 - -/* - * Get a global data pointer - */ -DECLARE_GLOBAL_DATA_PTR; - -/** - * update the variables "mtdids" and "mtdparts" with boot, tee and user strings - */ -static void board_set_mtdparts(const char *dev, - char *mtdids, - char *mtdparts, - const char *boot, -#ifdef CONFIG_STM32MP15x_STM32IMAGE - const char *tee, -#endif - const char *user) -{ - /* mtdids: "<dev>=<dev>, ...." */ - if (mtdids[0] != '\0') - strcat(mtdids, ","); - strcat(mtdids, dev); - strcat(mtdids, "="); - strcat(mtdids, dev); - - /* mtdparts: "mtdparts=<dev>:<mtdparts_<dev>>;..." */ - if (mtdparts[0] != '\0') - strncat(mtdparts, ";", MTDPARTS_LEN); - else - strcat(mtdparts, "mtdparts="); - - strncat(mtdparts, dev, MTDPARTS_LEN); - strncat(mtdparts, ":", MTDPARTS_LEN); - - if (boot) { - strncat(mtdparts, boot, MTDPARTS_LEN); - strncat(mtdparts, ",", MTDPARTS_LEN); - } - -#ifdef CONFIG_STM32MP15x_STM32IMAGE - if (tee) { - strncat(mtdparts, tee, MTDPARTS_LEN); - strncat(mtdparts, ",", MTDPARTS_LEN); - } -#endif - - strncat(mtdparts, user, MTDPARTS_LEN); -} - -void board_mtdparts_default(const char **mtdids, const char **mtdparts) -{ - struct mtd_info *mtd; - struct udevice *dev; - static char parts[3 * MTDPARTS_LEN + 1]; - static char ids[MTDIDS_LEN + 1]; - static bool mtd_initialized; - bool nor, nand, spinand, serial; -#ifdef CONFIG_STM32MP15x_STM32IMAGE - bool tee = false; -#endif - - if (mtd_initialized) { - *mtdids = ids; - *mtdparts = parts; - return; - } - - nor = false; - nand = false; - spinand = false; - serial = false; - - switch (get_bootmode() & TAMP_BOOT_DEVICE_MASK) { - case BOOT_SERIAL_UART: - case BOOT_SERIAL_USB: - serial = true; - if (IS_ENABLED(CONFIG_CMD_STM32PROG)) { -#ifdef CONFIG_STM32MP15x_STM32IMAGE - tee = stm32prog_get_tee_partitions(); -#endif - nor = stm32prog_get_fsbl_nor(); - } - nand = true; - spinand = true; - break; - case BOOT_FLASH_NAND: - nand = true; - break; - case BOOT_FLASH_SPINAND: - spinand = true; - break; - case BOOT_FLASH_NOR: - nor = true; - break; - default: - break; - } - -#ifdef CONFIG_STM32MP15x_STM32IMAGE - if (!serial && tee_find_device(NULL, NULL, NULL, NULL)) - tee = true; -#endif - - memset(parts, 0, sizeof(parts)); - memset(ids, 0, sizeof(ids)); - - /* probe all MTD devices */ - for (uclass_first_device(UCLASS_MTD, &dev); - dev; - uclass_next_device(&dev)) { - log_debug("mtd device = %s\n", dev->name); - } - - if (nand) { - mtd = get_mtd_device_nm("nand0"); - if (!IS_ERR_OR_NULL(mtd)) { - board_set_mtdparts("nand0", ids, parts, - CONFIG_MTDPARTS_NAND0_BOOT, -#ifdef CONFIG_STM32MP15x_STM32IMAGE - !nor && tee ? CONFIG_MTDPARTS_NAND0_TEE : NULL, -#endif - "-(UBI)"); - put_mtd_device(mtd); - } - } - - if (spinand) { - mtd = get_mtd_device_nm("spi-nand0"); - if (!IS_ERR_OR_NULL(mtd)) { - board_set_mtdparts("spi-nand0", ids, parts, - CONFIG_MTDPARTS_SPINAND0_BOOT, -#ifdef CONFIG_STM32MP15x_STM32IMAGE - !nor && tee ? CONFIG_MTDPARTS_SPINAND0_TEE : NULL, -#endif - "-(UBI)"); - put_mtd_device(mtd); - } - } - - if (nor) { - if (!uclass_get_device(UCLASS_SPI_FLASH, 0, &dev)) { - board_set_mtdparts("nor0", ids, parts, - CONFIG_MTDPARTS_NOR0_BOOT, -#ifdef CONFIG_STM32MP15x_STM32IMAGE - tee ? CONFIG_MTDPARTS_NOR0_TEE : NULL, -#endif - "-(nor_user)"); - } - } - - mtd_initialized = true; - *mtdids = ids; - *mtdparts = parts; - log_debug("mtdids=%s & mtdparts=%s\n", ids, parts); -}

On 6/8/23 17:16, Patrick Delaunay wrote:
Remove the function board_mtdparts_default and the associated file or configs, only used by the CONFIG_SYS_MTDPARTS_RUNTIME now removed.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
board/st/common/Kconfig | 66 ----------- board/st/common/Makefile | 1 - board/st/common/stm32mp_mtdparts.c | 177 ----------------------------- 3 files changed, 244 deletions(-) delete mode 100644 board/st/common/stm32mp_mtdparts.c
diff --git a/board/st/common/Kconfig b/board/st/common/Kconfig index aba3590866e0..c1c254d07354 100644 --- a/board/st/common/Kconfig +++ b/board/st/common/Kconfig @@ -6,72 +6,6 @@ config CMD_STBOARD This compile the stboard command to read and write the board in the OTP.
-config MTDPARTS_NAND0_BOOT
- string "mtd boot partitions for nand0"
- default "2m(fsbl),2m(ssbl1),2m(ssbl2)" if STM32MP15x_STM32IMAGE || \
!TFABOOT
- default "2m(fsbl),4m(fip1),4m(fip2)"
- depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP
- help
This define the partitions of nand0 used to build mtparts dynamically
for boot from nand0.
Each partition need to be aligned with the device erase block size,
512KB is the max size for the NAND supported by stm32mp1 platform.
The fsbl partition support multiple copy of the same binary, one by
erase block.
-config MTDPARTS_NAND0_TEE
- string "mtd tee partitions for nand0"
- default "512k(teeh),512k(teed),512k(teex)"
- depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP && STM32MP15x_STM32IMAGE
- help
This define the tee partitions added in mtparts dynamically
when tee is supported with boot from nand0.
Each partition need to be aligned with the device erase block size,
512KB is the max size for the NAND supported by stm32mp1 platform.
-config MTDPARTS_NOR0_BOOT
- string "mtd boot partitions for nor0"
- default "256k(fsbl1),256k(fsbl2),2m(ssbl),512k(u-boot-env)" if STM32MP15x_STM32IMAGE || \
!TFABOOT
- default "256k(fsbl1),256k(fsbl2),4m(fip),512k(u-boot-env)"
- depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP
- help
This define the partitions of nand0 used to build mtparts dynamically
for boot from nor0.
Each partition need to be aligned with the device erase block size,
with 256KB we support all the NOR.
U-Boot env partition (512kB) use 2 erase block for redundancy.
-config MTDPARTS_NOR0_TEE
- string "mtd tee partitions for nor0"
- default "256k(teeh),512k(teed),256k(teex)"
- depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP && STM32MP15x_STM32IMAGE
- help
This define the tee partitions added in mtparts dynamically
when tee is supported with boot from nor0.
-config MTDPARTS_SPINAND0_BOOT
- string "mtd boot partitions for spi-nand0"
- default "2m(fsbl),2m(ssbl1),2m(ssbl2)" if STM32MP15x_STM32IMAGE || !TFABOOT
- default "2m(fsbl),4m(fip1),4m(fip2)"
- depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP
- help
This define the partitions of nand0 used to build mtparts dynamically
for boot from spi-nand0,
512KB is the max size for the NAND supported by stm32mp1 platform.
The fsbl partition support multiple copy of the same binary, one by
erase block.
-config MTDPARTS_SPINAND0_TEE
- string "mtd tee partitions for spi-nand0"
- default "512k(teeh),512k(teed),512k(teex)"
- depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP && STM32MP15x_STM32IMAGE
- help
This define the tee partitions added in mtparts dynamically
when tee is supported with boot from spi-nand0,
512KB is the max size for the NAND supported by stm32mp1 platform.
config DFU_ALT_RAM0 string "dfu for ram0" default "uImage ram 0xc2000000 0x2000000;devicetree.dtb ram 0xc4000000 0x100000;uramdisk.image.gz ram 0xc4400000 0x10000000" diff --git a/board/st/common/Makefile b/board/st/common/Makefile index 65bbebd6abc3..c9608297261a 100644 --- a/board/st/common/Makefile +++ b/board/st/common/Makefile @@ -7,7 +7,6 @@ obj-$(CONFIG_CMD_STBOARD) += cmd_stboard.o obj-$(CONFIG_PMIC_STPMIC1) += stpmic1.o
ifeq ($(CONFIG_ARCH_STM32MP),y) -obj-$(CONFIG_SYS_MTDPARTS_RUNTIME) += stm32mp_mtdparts.o obj-$(CONFIG_SET_DFU_ALT_INFO) += stm32mp_dfu.o endif
diff --git a/board/st/common/stm32mp_mtdparts.c b/board/st/common/stm32mp_mtdparts.c deleted file mode 100644 index 67a56a2623a1..000000000000 --- a/board/st/common/stm32mp_mtdparts.c +++ /dev/null @@ -1,177 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause -/*
- Copyright (C) 2020, STMicroelectronics - All Rights Reserved
- */
-#include <common.h> -#include <dfu.h> -#include <dm.h> -#include <env.h> -#include <env_internal.h> -#include <log.h> -#include <mtd.h> -#include <mtd_node.h> -#ifdef CONFIG_STM32MP15x_STM32IMAGE -#include <tee.h> -#endif -#include <asm/arch/stm32prog.h> -#include <asm/arch/sys_proto.h> -#include <asm/global_data.h>
-#define MTDPARTS_LEN 256 -#define MTDIDS_LEN 128
-/*
- Get a global data pointer
- */
-DECLARE_GLOBAL_DATA_PTR;
-/**
- update the variables "mtdids" and "mtdparts" with boot, tee and user strings
- */
-static void board_set_mtdparts(const char *dev,
char *mtdids,
char *mtdparts,
const char *boot,
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
const char *tee,
-#endif
const char *user)
-{
- /* mtdids: "<dev>=<dev>, ...." */
- if (mtdids[0] != '\0')
strcat(mtdids, ",");
- strcat(mtdids, dev);
- strcat(mtdids, "=");
- strcat(mtdids, dev);
- /* mtdparts: "mtdparts=<dev>:<mtdparts_<dev>>;..." */
- if (mtdparts[0] != '\0')
strncat(mtdparts, ";", MTDPARTS_LEN);
- else
strcat(mtdparts, "mtdparts=");
- strncat(mtdparts, dev, MTDPARTS_LEN);
- strncat(mtdparts, ":", MTDPARTS_LEN);
- if (boot) {
strncat(mtdparts, boot, MTDPARTS_LEN);
strncat(mtdparts, ",", MTDPARTS_LEN);
- }
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
- if (tee) {
strncat(mtdparts, tee, MTDPARTS_LEN);
strncat(mtdparts, ",", MTDPARTS_LEN);
- }
-#endif
- strncat(mtdparts, user, MTDPARTS_LEN);
-}
-void board_mtdparts_default(const char **mtdids, const char **mtdparts) -{
- struct mtd_info *mtd;
- struct udevice *dev;
- static char parts[3 * MTDPARTS_LEN + 1];
- static char ids[MTDIDS_LEN + 1];
- static bool mtd_initialized;
- bool nor, nand, spinand, serial;
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
- bool tee = false;
-#endif
- if (mtd_initialized) {
*mtdids = ids;
*mtdparts = parts;
return;
- }
- nor = false;
- nand = false;
- spinand = false;
- serial = false;
- switch (get_bootmode() & TAMP_BOOT_DEVICE_MASK) {
- case BOOT_SERIAL_UART:
- case BOOT_SERIAL_USB:
serial = true;
if (IS_ENABLED(CONFIG_CMD_STM32PROG)) {
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
tee = stm32prog_get_tee_partitions();
-#endif
nor = stm32prog_get_fsbl_nor();
}
nand = true;
spinand = true;
break;
- case BOOT_FLASH_NAND:
nand = true;
break;
- case BOOT_FLASH_SPINAND:
spinand = true;
break;
- case BOOT_FLASH_NOR:
nor = true;
break;
- default:
break;
- }
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
- if (!serial && tee_find_device(NULL, NULL, NULL, NULL))
tee = true;
-#endif
- memset(parts, 0, sizeof(parts));
- memset(ids, 0, sizeof(ids));
- /* probe all MTD devices */
- for (uclass_first_device(UCLASS_MTD, &dev);
dev;
uclass_next_device(&dev)) {
log_debug("mtd device = %s\n", dev->name);
- }
- if (nand) {
mtd = get_mtd_device_nm("nand0");
if (!IS_ERR_OR_NULL(mtd)) {
board_set_mtdparts("nand0", ids, parts,
CONFIG_MTDPARTS_NAND0_BOOT,
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
!nor && tee ? CONFIG_MTDPARTS_NAND0_TEE : NULL,
-#endif
"-(UBI)");
put_mtd_device(mtd);
}
- }
- if (spinand) {
mtd = get_mtd_device_nm("spi-nand0");
if (!IS_ERR_OR_NULL(mtd)) {
board_set_mtdparts("spi-nand0", ids, parts,
CONFIG_MTDPARTS_SPINAND0_BOOT,
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
!nor && tee ? CONFIG_MTDPARTS_SPINAND0_TEE : NULL,
-#endif
"-(UBI)");
put_mtd_device(mtd);
}
- }
- if (nor) {
if (!uclass_get_device(UCLASS_SPI_FLASH, 0, &dev)) {
board_set_mtdparts("nor0", ids, parts,
CONFIG_MTDPARTS_NOR0_BOOT,
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
tee ? CONFIG_MTDPARTS_NOR0_TEE : NULL,
-#endif
"-(nor_user)");
}
- }
- mtd_initialized = true;
- *mtdids = ids;
- *mtdparts = parts;
- log_debug("mtdids=%s & mtdparts=%s\n", ids, parts);
-}
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

From: Patrice Chotard patrice.chotard@foss.st.com
As stm32prog_get_tee_partitions() is no more used, remove tee_detected boolean from stm32prog_data struct and all code using it.
Signed-off-by: Patrice Chotard patrice.chotard@foss.st.com Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 9 --------- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 11 ----------- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h | 3 --- arch/arm/mach-stm32mp/include/mach/stm32prog.h | 4 ---- 4 files changed, 27 deletions(-)
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index cfafa539aeb9..c695cc11232b 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -180,15 +180,6 @@ U_BOOT_CMD(stm32prog, 5, 0, do_stm32prog, " <size> = size of flashlayout (optional for image with STM32 header)\n" );
-#ifdef CONFIG_STM32MP15x_STM32IMAGE -bool stm32prog_get_tee_partitions(void) -{ - if (stm32prog_data) - return stm32prog_data->tee_detected; - - return false; -} -#endif
bool stm32prog_get_fsbl_nor(void) { diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index 241ad40abb7c..0cdc14dd5bc8 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -995,9 +995,6 @@ static int treat_partition_list(struct stm32prog_data *data) INIT_LIST_HEAD(&data->dev[j].part_list); }
-#ifdef CONFIG_STM32MP15x_STM32IMAGE - data->tee_detected = false; -#endif data->fsbl_nor_detected = false; for (i = 0; i < data->part_nb; i++) { part = &data->part_array[i]; @@ -1049,14 +1046,6 @@ static int treat_partition_list(struct stm32prog_data *data) !strncmp(part->name, "fsbl", 4)) data->fsbl_nor_detected = true; /* fallthrough */ - case STM32PROG_NAND: - case STM32PROG_SPI_NAND: -#ifdef CONFIG_STM32MP15x_STM32IMAGE - if (!data->tee_detected && - !strncmp(part->name, "tee", 3)) - data->tee_detected = true; - break; -#endif default: break; } diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h index 58f4b96fa752..04a899ee1184 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h @@ -149,9 +149,6 @@ struct stm32prog_data { struct stm32prog_dev_t dev[STM32PROG_MAX_DEV]; /* array of device */ int part_nb; /* nb of partition */ struct stm32prog_part_t *part_array; /* array of partition */ -#ifdef CONFIG_STM32MP15x_STM32IMAGE - bool tee_detected; -#endif bool fsbl_nor_detected;
/* command internal information */ diff --git a/arch/arm/mach-stm32mp/include/mach/stm32prog.h b/arch/arm/mach-stm32mp/include/mach/stm32prog.h index 99be4e1d656b..23d1adfbad92 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32prog.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32prog.h @@ -11,8 +11,4 @@ int stm32prog_read_medium_virt(struct dfu_entity *dfu, u64 offset, void *buf, long *len); int stm32prog_get_medium_size_virt(struct dfu_entity *dfu, u64 *size);
-#ifdef CONFIG_STM32MP15x_STM32IMAGE -bool stm32prog_get_tee_partitions(void); -#endif - bool stm32prog_get_fsbl_nor(void);

On 6/8/23 17:16, Patrick Delaunay wrote:
From: Patrice Chotard patrice.chotard@foss.st.com
As stm32prog_get_tee_partitions() is no more used, remove tee_detected boolean from stm32prog_data struct and all code using it.
Signed-off-by: Patrice Chotard patrice.chotard@foss.st.com Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 9 --------- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 11 ----------- arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h | 3 --- arch/arm/mach-stm32mp/include/mach/stm32prog.h | 4 ---- 4 files changed, 27 deletions(-)
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c index cfafa539aeb9..c695cc11232b 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c @@ -180,15 +180,6 @@ U_BOOT_CMD(stm32prog, 5, 0, do_stm32prog, " <size> = size of flashlayout (optional for image with STM32 header)\n" );
-#ifdef CONFIG_STM32MP15x_STM32IMAGE -bool stm32prog_get_tee_partitions(void) -{
- if (stm32prog_data)
return stm32prog_data->tee_detected;
- return false;
-} -#endif
bool stm32prog_get_fsbl_nor(void) { diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index 241ad40abb7c..0cdc14dd5bc8 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -995,9 +995,6 @@ static int treat_partition_list(struct stm32prog_data *data) INIT_LIST_HEAD(&data->dev[j].part_list); }
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
- data->tee_detected = false;
-#endif data->fsbl_nor_detected = false; for (i = 0; i < data->part_nb; i++) { part = &data->part_array[i]; @@ -1049,14 +1046,6 @@ static int treat_partition_list(struct stm32prog_data *data) !strncmp(part->name, "fsbl", 4)) data->fsbl_nor_detected = true; /* fallthrough */
case STM32PROG_NAND:
case STM32PROG_SPI_NAND:
-#ifdef CONFIG_STM32MP15x_STM32IMAGE
if (!data->tee_detected &&
!strncmp(part->name, "tee", 3))
data->tee_detected = true;
break;
-#endif default: break; } diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h index 58f4b96fa752..04a899ee1184 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h @@ -149,9 +149,6 @@ struct stm32prog_data { struct stm32prog_dev_t dev[STM32PROG_MAX_DEV]; /* array of device */ int part_nb; /* nb of partition */ struct stm32prog_part_t *part_array; /* array of partition */ -#ifdef CONFIG_STM32MP15x_STM32IMAGE
- bool tee_detected;
-#endif bool fsbl_nor_detected;
/* command internal information */ diff --git a/arch/arm/mach-stm32mp/include/mach/stm32prog.h b/arch/arm/mach-stm32mp/include/mach/stm32prog.h index 99be4e1d656b..23d1adfbad92 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32prog.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32prog.h @@ -11,8 +11,4 @@ int stm32prog_read_medium_virt(struct dfu_entity *dfu, u64 offset, void *buf, long *len); int stm32prog_get_medium_size_virt(struct dfu_entity *dfu, u64 *size);
-#ifdef CONFIG_STM32MP15x_STM32IMAGE -bool stm32prog_get_tee_partitions(void); -#endif
bool stm32prog_get_fsbl_nor(void);
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

From: Patrice Chotard patrice.chotard@foss.st.com
Disable CMD_MTDPARTS as it's no more needed and it is strongly encouraged to avoid using this command anymore. (see comments in ./cmd/Kconfig:2422).
Signed-off-by: Patrice Chotard patrice.chotard@foss.st.com Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
configs/stm32mp13_defconfig | 1 - configs/stm32mp15_basic_defconfig | 1 - configs/stm32mp15_defconfig | 1 - configs/stm32mp15_trusted_defconfig | 1 - 4 files changed, 4 deletions(-)
diff --git a/configs/stm32mp13_defconfig b/configs/stm32mp13_defconfig index a9cc7e4d0353..5e9abc5e2625 100644 --- a/configs/stm32mp13_defconfig +++ b/configs/stm32mp13_defconfig @@ -39,7 +39,6 @@ CONFIG_CMD_RNG=y CONFIG_CMD_TIMER=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y CONFIG_CMD_UBI=y CONFIG_OF_LIVE=y diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 7661159110e5..94f4dbd4c32b 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -75,7 +75,6 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y CONFIG_CMD_UBI=y # CONFIG_SPL_DOS_PARTITION is not set diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig index 1ff9f73730d3..37b6d4a7b4ac 100644 --- a/configs/stm32mp15_defconfig +++ b/configs/stm32mp15_defconfig @@ -51,7 +51,6 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y CONFIG_CMD_UBI=y CONFIG_OF_LIVE=y diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index e7bf2e171ace..9c5446d6d4a2 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -52,7 +52,6 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y CONFIG_CMD_UBI=y CONFIG_OF_LIVE=y

On 6/8/23 17:16, Patrick Delaunay wrote:
From: Patrice Chotard patrice.chotard@foss.st.com
Disable CMD_MTDPARTS as it's no more needed and it is strongly encouraged to avoid using this command anymore. (see comments in ./cmd/Kconfig:2422).
Signed-off-by: Patrice Chotard patrice.chotard@foss.st.com Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
configs/stm32mp13_defconfig | 1 - configs/stm32mp15_basic_defconfig | 1 - configs/stm32mp15_defconfig | 1 - configs/stm32mp15_trusted_defconfig | 1 - 4 files changed, 4 deletions(-)
diff --git a/configs/stm32mp13_defconfig b/configs/stm32mp13_defconfig index a9cc7e4d0353..5e9abc5e2625 100644 --- a/configs/stm32mp13_defconfig +++ b/configs/stm32mp13_defconfig @@ -39,7 +39,6 @@ CONFIG_CMD_RNG=y CONFIG_CMD_TIMER=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y CONFIG_CMD_UBI=y CONFIG_OF_LIVE=y diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 7661159110e5..94f4dbd4c32b 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -75,7 +75,6 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y CONFIG_CMD_UBI=y # CONFIG_SPL_DOS_PARTITION is not set diff --git a/configs/stm32mp15_defconfig b/configs/stm32mp15_defconfig index 1ff9f73730d3..37b6d4a7b4ac 100644 --- a/configs/stm32mp15_defconfig +++ b/configs/stm32mp15_defconfig @@ -51,7 +51,6 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y CONFIG_CMD_UBI=y CONFIG_OF_LIVE=y diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig index e7bf2e171ace..9c5446d6d4a2 100644 --- a/configs/stm32mp15_trusted_defconfig +++ b/configs/stm32mp15_trusted_defconfig @@ -52,7 +52,6 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y CONFIG_CMD_LOG=y CONFIG_CMD_UBI=y CONFIG_OF_LIVE=y
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

Add partitions subnode in flash0 for stm32mp157xx-dhcom/dhcor boards.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 27 ++++++++++++++++++++++ arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 27 ++++++++++++++++++++++ configs/stm32mp15_dhcom_basic_defconfig | 3 --- configs/stm32mp15_dhcor_basic_defconfig | 3 --- 4 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi index bc0730cf2bd0..a808620e1219 100644 --- a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi @@ -92,6 +92,33 @@
&flash0 { bootph-pre-ram; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fsbl1"; + reg = <0x00000000 0x00040000>; + }; + partition@40000 { + label = "fsbl2"; + reg = <0x00040000 0x00040000>; + }; + partition@500000 { + label = "uboot"; + reg = <0x00080000 0x00160000>; + }; + partition@900000 { + label = "env1"; + reg = <0x001E0000 0x00010000>; + }; + partition@980000 { + label = "env2"; + reg = <0x001F0000 0x00010000>; + }; + }; };
&qspi { diff --git a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi index 804c66283e08..eb905ad28201 100644 --- a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi @@ -28,6 +28,33 @@
&flash0 { bootph-pre-ram; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fsbl1"; + reg = <0x00000000 0x00040000>; + }; + partition@40000 { + label = "fsbl2"; + reg = <0x00040000 0x00040000>; + }; + partition@500000 { + label = "uboot"; + reg = <0x00080000 0x00160000>; + }; + partition@900000 { + label = "env1"; + reg = <0x001E0000 0x00010000>; + }; + partition@980000 { + label = "env2"; + reg = <0x001F0000 0x00010000>; + }; + }; };
&i2c4 { diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig index 430d0bccc9a7..77f0fafc5c71 100644 --- a/configs/stm32mp15_dhcom_basic_defconfig +++ b/configs/stm32mp15_dhcom_basic_defconfig @@ -85,9 +85,6 @@ CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_BTRFS=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y -CONFIG_MTDIDS_DEFAULT="nor0=nor0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(fsbl1),256k(fsbl2),1408k(uboot),64k(env1),64k(env2)" # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_ISO_PARTITION is not set # CONFIG_SPL_PARTITION_UUIDS is not set diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig index f23875fb84fe..4151ad64a4be 100644 --- a/configs/stm32mp15_dhcor_basic_defconfig +++ b/configs/stm32mp15_dhcor_basic_defconfig @@ -83,9 +83,6 @@ CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_BTRFS=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y -CONFIG_MTDIDS_DEFAULT="nor0=nor0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(fsbl1),256k(fsbl2),1408k(uboot),64k(env1),64k(env2)" # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_ISO_PARTITION is not set # CONFIG_SPL_PARTITION_UUIDS is not set

On 6/8/23 17:16, Patrick Delaunay wrote:
Add partitions subnode in flash0 for stm32mp157xx-dhcom/dhcor boards.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 27 ++++++++++++++++++++++ arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 27 ++++++++++++++++++++++ configs/stm32mp15_dhcom_basic_defconfig | 3 --- configs/stm32mp15_dhcor_basic_defconfig | 3 --- 4 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi index bc0730cf2bd0..a808620e1219 100644 --- a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi @@ -92,6 +92,33 @@
&flash0 { bootph-pre-ram;
- partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "fsbl1";
reg = <0x00000000 0x00040000>;
};
partition@40000 {
label = "fsbl2";
reg = <0x00040000 0x00040000>;
};
partition@500000 {
label = "uboot";
reg = <0x00080000 0x00160000>;
};
partition@900000 {
label = "env1";
reg = <0x001E0000 0x00010000>;
};
partition@980000 {
label = "env2";
reg = <0x001F0000 0x00010000>;
};
- };
};
&qspi { diff --git a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi index 804c66283e08..eb905ad28201 100644 --- a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi @@ -28,6 +28,33 @@
&flash0 { bootph-pre-ram;
- partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "fsbl1";
reg = <0x00000000 0x00040000>;
};
partition@40000 {
label = "fsbl2";
reg = <0x00040000 0x00040000>;
};
partition@500000 {
label = "uboot";
reg = <0x00080000 0x00160000>;
};
partition@900000 {
label = "env1";
reg = <0x001E0000 0x00010000>;
};
partition@980000 {
label = "env2";
reg = <0x001F0000 0x00010000>;
};
- };
};
&i2c4 { diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig index 430d0bccc9a7..77f0fafc5c71 100644 --- a/configs/stm32mp15_dhcom_basic_defconfig +++ b/configs/stm32mp15_dhcom_basic_defconfig @@ -85,9 +85,6 @@ CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_BTRFS=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y -CONFIG_MTDIDS_DEFAULT="nor0=nor0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(fsbl1),256k(fsbl2),1408k(uboot),64k(env1),64k(env2)" # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_ISO_PARTITION is not set # CONFIG_SPL_PARTITION_UUIDS is not set diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig index f23875fb84fe..4151ad64a4be 100644 --- a/configs/stm32mp15_dhcor_basic_defconfig +++ b/configs/stm32mp15_dhcor_basic_defconfig @@ -83,9 +83,6 @@ CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_BTRFS=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_MTDPARTS=y -CONFIG_MTDIDS_DEFAULT="nor0=nor0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(fsbl1),256k(fsbl2),1408k(uboot),64k(env1),64k(env2)" # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_ISO_PARTITION is not set # CONFIG_SPL_PARTITION_UUIDS is not set
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

On 6/8/23 17:16, Patrick Delaunay wrote:
Add the MTD partitions subnode in U-Boot device tree for all stm32mp13 and stm32mp15 boards and no more rely on mtdids and mtdparts variables or CONFIG_SYS_MTDPARTS_RUNTIME.
When these variables are absent, the required OF fallback is performed in mtd_probe_devices() with commit dc339bf784f0 ("mtd: add support for parsing partitions defined in OF").
To allow dynamically configuration of MTD partitioning for Linux kernel, the MTD partitioning is only defined in U-Boot device tree and copied in Linux kernel device tree.
This serie also disable CMD_MTDPARTS as it is strongly encouraged to no more use this command.
Marek, I modify the dhcom/dhcor boardd in the last patch of the serie but if you prefer I can drop this patch.
For "stm32mp157c-ev1.dts" used by stm32mp15_trusted_defconfig
- nand0
- type: NAND flash
- block size: 0x40000 bytes
- min I/O: 0x1000 bytes
- OOB size: 224 bytes
- OOB available: 118 bytes
- ECC strength: 8 bits
- ECC step size: 512 bytes
- bitflip threshold: 6 bits
- 0x000000000000-0x000040000000 : "nand0"
- 0x000000000000-0x000000200000 : "fsbl"
- 0x000000200000-0x000000600000 : "fip1"
- 0x000000600000-0x000000a00000 : "fip2"
- 0x000000a00000-0x000040000000 : "UBI"
- nor0
- device: flash@0
- parent: spi@58003000
- driver: jedec_spi_nor
- path: /soc/spi@58003000/flash@0
- type: NOR flash
- block size: 0x10000 bytes
- min I/O: 0x1 bytes
- 0x000000000000-0x000004000000 : "nor0"
- 0x000000000000-0x000000040000 : "fsbl1"
- 0x000000040000-0x000000080000 : "fsbl2"
- 0x000000080000-0x000000480000 : "fip"
- 0x000000480000-0x000000500000 : "u-boot-env"
- 0x000000500000-0x000004000000 : "nor-user"
For "stm32mp157c-ev1-scmi.dts" the device tree file used by stm32mp15_defconfig, with TF-A BL2 and OP-TEE including a SCMI server for secure resources (when TZEN=1), the default STMicroelectronics configuration.
I align the NOR and NAND layout on EV1 boards with the STMicroelectronics recommendations used in OpenSTLinux V4.0: with support of TF-A BL2 firmware update, required 2 "metadata" partition for redundancy and 2 FIPs for A/B update.
- nand0
- type: NAND flash
- block size: 0x40000 bytes
- min I/O: 0x1000 bytes
- OOB size: 224 bytes
- OOB available: 118 bytes
- ECC strength: 8 bits
- ECC step size: 512 bytes
- bitflip threshold: 6 bits
- 0x000000000000-0x000040000000 : "nand0"
- 0x000000000000-0x000000080000 : "fsbl1"
- 0x000000080000-0x000000100000 : "fsbl2"
- 0x000000100000-0x000000180000 : "metadata1"
- 0x000000180000-0x000000200000 : "metadata2"
- 0x000000200000-0x000000600000 : "fip-a1"
- 0x000000600000-0x000000a00000 : "fip-a2"
- 0x000000a00000-0x000000e00000 : "fip-b1"
- 0x000000e00000-0x000001200000 : "fip-b2"
- 0x000001200000-0x000040000000 : "UBI"
- nor0
- device: flash@0
- parent: spi@58003000
- driver: jedec_spi_nor
- path: /soc/spi@58003000/flash@0
- type: NOR flash
- block size: 0x10000 bytes
- min I/O: 0x1 bytes
- 0x000000000000-0x000004000000 : "nor0"
- 0x000000000000-0x000000040000 : "fsbl1"
- 0x000000040000-0x000000080000 : "fsbl2"
- 0x000000080000-0x0000000c0000 : "metadata1"
- 0x0000000c0000-0x000000100000 : "metadata2"
- 0x000000100000-0x000000500000 : "fip-a"
- 0x000000500000-0x000000900000 : "fip-b"
- 0x000000900000-0x000000980000 : "u-boot-env"
- 0x000000980000-0x000004000000 : "nor-user"
Patrice Chotard (5): stm32mp: stm32prog: Remove usage of "mtdparts" function arm: dts: stm32: Add partitions in flash0 and nand node for stm32mp15xx-ev1 configs: stm32mp: Disable SYS_MTDPARTS_RUNTIME for stm32mp15 and stm32mp13 stm32mp: stm32prog: Remove tee_detected from stm32prog_data struct configs: stm32mp1: disable CMD_MTDPARTS
Patrick Delaunay (7): fdt_support: include dm/ofnode.h fdt_support: add fdt_copy_fixed_partitions function dfu: mtd: remove direct call of mtdparts_init function arm: dts: stm32: Align stm32mp15xx-*-scmi-u-boot.dtsi file board: stm32mp1: use fdt_copy_fixed_partitions board: st: remove board_mtdparts_default arm: dts: stm32: Add partitions in flash0 and nand node for stm32mp15xx-dhcom/dhcor
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + arch/arm/dts/stm32mp157c-dk2-scmi-u-boot.dtsi | 7 + arch/arm/dts/stm32mp157c-ev1-scmi-u-boot.dtsi | 125 +++++++++++++ arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 98 +++++++++- arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 27 +++ arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 27 +++ .../cmd_stm32prog/cmd_stm32prog.c | 9 - .../mach-stm32mp/cmd_stm32prog/stm32prog.c | 53 ++---- .../mach-stm32mp/cmd_stm32prog/stm32prog.h | 3 - .../arm/mach-stm32mp/include/mach/stm32prog.h | 4 - board/st/common/Kconfig | 66 ------- board/st/common/Makefile | 1 - board/st/common/stm32mp_mtdparts.c | 177 ------------------ board/st/stm32mp1/stm32mp1.c | 16 +- common/fdt_support.c | 75 +++++++- configs/stm32mp13_defconfig | 3 - configs/stm32mp15_basic_defconfig | 3 - configs/stm32mp15_defconfig | 7 +- configs/stm32mp15_dhcom_basic_defconfig | 3 - configs/stm32mp15_dhcor_basic_defconfig | 3 - configs/stm32mp15_trusted_defconfig | 3 - drivers/dfu/Kconfig | 1 - drivers/dfu/dfu_mtd.c | 34 ++-- include/fdt_support.h | 8 + 24 files changed, 407 insertions(+), 347 deletions(-) delete mode 100644 board/st/common/stm32mp_mtdparts.c
For the whole series:
Applied to u-boot-stm/next
Thanks
Patrice
participants (3)
-
Patrice CHOTARD
-
Patrick Delaunay
-
Simon Glass