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

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


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 at 0
  - parent: spi at 58003000
  - driver: jedec_spi_nor
  - path: /soc/spi at 58003000/flash at 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 at 0
  - parent: spi at 58003000
  - driver: jedec_spi_nor
  - path: /soc/spi at 58003000/flash at 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

-- 
2.25.1



More information about the U-Boot mailing list