]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
configs: stm32mp13: add SPI-NAND UBI boot support
authorAustin Shirley <austin@deadband.dev>
Wed, 6 May 2026 22:37:58 +0000 (16:37 -0600)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Tue, 12 May 2026 13:50:47 +0000 (15:50 +0200)
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.

Signed-off-by: Austin Shirley <austin@deadband.dev>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: uboot-stm32@st-md-mailman.stormreply.com
include/configs/stm32mp13_common.h

index 3e3f49abae0660b2f56533d20944b487df7d54dd..e707b146f90b6e21206292d32f15b1319a51f980 100644 (file)
 #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
 
 #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=" \
        "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"