Skip to contentSkip to conversation

configs: stm32mp13: add SPI-NAND UBI boot support

PATCH In review Austin Shirley 2 participants 3 messages May 7 – May 13 Arm STM32

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configs: stm32mp13: add SPI-NAND UBI boot support

The STM32MP13 default environment only handles MMC and serial/USB boot. When TF-A reports BOOT_FLASH_SPINAND the boot_device variable is set to 'spi-nand' but bootcmd_stm32mp never redirects boot_targets to ubifs0, so distro_bootcmd falls through to MMC/USB.

This change mirrors the STM32MP15 logic:
- Add a BOOT_TARGET_UBIFS entry to BOOT_TARGET_DEVICES so that bootcmd_ubifs0 is defined (ubi part UBI; ubifsmount ubi0:boot).
- Add the 'spi-nand' / 'nand' clause to bootcmd_stm32mp so that boot_targets is set to 'ubifs0' when booting from NAND.

Cc Patrick Delaunay <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/configs/stm32mp13_common.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
include/configs/stm32mp13_common.h +12 -1
index 3e3f49abae0..e707b146f90 100644
@@ -33,6 +33,12 @@
 #define BOOT_TARGET_MMC1(func)
 #endif
 
+#ifdef CONFIG_CMD_UBIFS
+#define BOOT_TARGET_UBIFS(func)	func(UBIFS, ubifs, 0, UBI, boot)
+#else
+#define BOOT_TARGET_UBIFS(func)
+#endif
+
 #ifdef CONFIG_CMD_USB
 #define BOOT_TARGET_USB(func)	func(USB, usb, 0)
 #else
@@ -41,12 +47,14 @@
 
 #define BOOT_TARGET_DEVICES(func)	\
 	BOOT_TARGET_MMC1(func)		\
+	BOOT_TARGET_UBIFS(func)		\
 	BOOT_TARGET_MMC0(func)		\
 	BOOT_TARGET_USB(func)
 
 /*
  * default bootcmd for stm32mp13:
  * for serial/usb: execute the stm32prog command
+ * for nand or spi-nand boot, distro boot with ubifs on UBI partition
  * for mmc boot (eMMC, SD card), distro boot on the same mmc device
  */
 #define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
@@ -56,7 +64,10 @@
 	"else " \
 		"run env_check;" \
 		"if test ${boot_device} = mmc;" \
-		"then env set boot_targets \"mmc${boot_instance}\"; fi;" \
+		"then env set boot_targets \"mmc${boot_instance}\"; fi; " \
+		"if test ${boot_device} = nand ||" \
+		  " test ${boot_device} = spi-nand ;" \
+		"then env set boot_targets ubifs0; fi;" \
 		"run distro_bootcmd;" \
 	"fi;\0"
 
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 54 lines · Austin Shirley

The STM32MP13 default environment only handles MMC and serial/USB boot. When TF-A reports BOOT_FLASH_SPINAND the boot_device variable is set to 'spi-nand' but bootcmd_stm32mp never redirects boot_targets to ubifs0, so distro_bootcmd falls through to MMC/USB.

This change mirrors the STM32MP15 logic:
- Add a BOOT_TARGET_UBIFS entry to BOOT_TARGET_DEVICES so that bootcmd_ubifs0 is defined (ubi part UBI; ubifsmount ubi0:boot).
- Add the 'spi-nand' / 'nand' clause to bootcmd_stm32mp so that boot_targets is set to 'ubifs0' when booting from NAND.

Cc Patrick Delaunay <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/configs/stm32mp13_common.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
include/configs/stm32mp13_common.h +8 -0
index 3e3f49abae0..e707b146f90 100644
@@ -33,6 +33,12 @@
 #define BOOT_TARGET_MMC1(func)
 #endif
 
+#ifdef CONFIG_CMD_UBIFS
+#define BOOT_TARGET_UBIFS(func)	func(UBIFS, ubifs, 0, UBI, boot)
+#else
+#define BOOT_TARGET_UBIFS(func)
+#endif
+
 #ifdef CONFIG_CMD_USB
 #define BOOT_TARGET_USB(func)	func(USB, usb, 0)
 #else
@@ -41,12 +47,14 @@
 
 #define BOOT_TARGET_DEVICES(func)	\
 	BOOT_TARGET_MMC1(func)		\
+	BOOT_TARGET_UBIFS(func)		\
 	BOOT_TARGET_MMC0(func)		\
 	BOOT_TARGET_USB(func)
 
 /*
  * default bootcmd for stm32mp13:
  * for serial/usb: execute the stm32prog command
+ * for nand or spi-nand boot, distro boot with ubifs on UBI partition
  * for mmc boot (eMMC, SD card), distro boot on the same mmc device
  */
 #define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
@@ -56,7 +64,10 @@
 	"else " \

include/configs/stm32mp13_common.h line 73

Quoted 10 lines
include/configs/stm32mp13_common.h +4 -1
 		"run env_check;" \
 		"if test ${boot_device} = mmc;" \
-		"then env set boot_targets \"mmc${boot_instance}\"; fi;" \
+		"then env set boot_targets \"mmc${boot_instance}\"; fi; " \
+		"if test ${boot_device} = nand ||" \
+		  " test ${boot_device} = spi-nand ;" \
+		"then env set boot_targets ubifs0; fi;" \
 		"run distro_bootcmd;" \
 	"fi;\0"
 

Hi Austin

Thanks
Patrice

#2 lore raw
Quoted 70 lines · Patrice CHOTARD
Quoted 54 lines · Austin Shirley

The STM32MP13 default environment only handles MMC and serial/USB boot. When TF-A reports BOOT_FLASH_SPINAND the boot_device variable is set to 'spi-nand' but bootcmd_stm32mp never redirects boot_targets to ubifs0, so distro_bootcmd falls through to MMC/USB.

This change mirrors the STM32MP15 logic:
- Add a BOOT_TARGET_UBIFS entry to BOOT_TARGET_DEVICES so that bootcmd_ubifs0 is defined (ubi part UBI; ubifsmount ubi0:boot).
- Add the 'spi-nand' / 'nand' clause to bootcmd_stm32mp so that boot_targets is set to 'ubifs0' when booting from NAND.

Cc Patrick Delaunay <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/configs/stm32mp13_common.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
include/configs/stm32mp13_common.h +8 -0
index 3e3f49abae0..e707b146f90 100644
@@ -33,6 +33,12 @@
 #define BOOT_TARGET_MMC1(func)
 #endif
 
+#ifdef CONFIG_CMD_UBIFS
+#define BOOT_TARGET_UBIFS(func)	func(UBIFS, ubifs, 0, UBI, boot)
+#else
+#define BOOT_TARGET_UBIFS(func)
+#endif
+
 #ifdef CONFIG_CMD_USB
 #define BOOT_TARGET_USB(func)	func(USB, usb, 0)
 #else
@@ -41,12 +47,14 @@
 
 #define BOOT_TARGET_DEVICES(func)	\
 	BOOT_TARGET_MMC1(func)		\
+	BOOT_TARGET_UBIFS(func)		\
 	BOOT_TARGET_MMC0(func)		\
 	BOOT_TARGET_USB(func)
 
 /*
  * default bootcmd for stm32mp13:
  * for serial/usb: execute the stm32prog command
+ * for nand or spi-nand boot, distro boot with ubifs on UBI partition
  * for mmc boot (eMMC, SD card), distro boot on the same mmc device
  */
 #define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
@@ -56,7 +64,10 @@
 	"else " \

include/configs/stm32mp13_common.h line 73

Quoted 10 lines
include/configs/stm32mp13_common.h +4 -1
 		"run env_check;" \
 		"if test ${boot_device} = mmc;" \
-		"then env set boot_targets \"mmc${boot_instance}\"; fi;" \
+		"then env set boot_targets \"mmc${boot_instance}\"; fi; " \
+		"if test ${boot_device} = nand ||" \
+		  " test ${boot_device} = spi-nand ;" \
+		"then env set boot_targets ubifs0; fi;" \
 		"run distro_bootcmd;" \
 	"fi;\0"
 

Hi Austin

Quoted 4 lines

Thanks
Patrice

Applied to u-boot-stm32/master

Thanks
Patrice

Quoted 4 lines

_______________________________________________
Uboot-stm32 mailing list
[email protected]
https://st-md-mailman.stormreply.com/mailman/listinfo/uboot-stm32