* [PATCH v3 0/2] Support board-selected raw partitions
@ 2026-09-14 8:31 Carlo Caione
2026-09-14 8:31 ` [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization Carlo Caione
2026-09-14 8:31 ` [PATCH v3 2/2] spl: mmc: make raw partition selection a choice Carlo Caione
0 siblings, 2 replies; 9+ messages in thread
From: Carlo Caione @ 2026-09-14 8:31 UTC (permalink / raw)
To: u-boot, uboot-stm32
Cc: Tom Rini, Peng Fan, Jaehoon Chung, Neil Armstrong,
Bastien Curutchet, Alexey Charkov, Johan Jonker, Richard Genoud,
João Marcos Costa, Miquel Raynal, David Lechner,
Julien Stephan, Ilias Apalodimas, Patrick Delaunay,
Patrice Chotard, Heinrich Schuchardt, Carlo Caione
Boards may need to read on-device metadata before choosing the raw MMC
partition containing the next boot stage. This series makes the existing
partition hook usable after MMC initialization and adds board selection
as an alternative to fixed partition numbers or types.
The board hook owns hardware-area selection. A failed dynamic selection
stops the current MMC load attempt without filesystem fallback; other
configured boot devices may still be tried.
Out-of-tree spl_mmc_boot_partition() overrides must accept the added
struct mmc * argument; the in-tree STM32MP1 override is updated here.
Changes in v3:
- Make dynamic selection a peer of fixed-number and partition-type modes.
- Move selection into a helper with separate branches for each policy.
- Share the partition-loading guard while preserving platform defaults,
explicit loads and existing fallback behavior.
- Link to v2: https://patch.msgid.link/20260911-ccaione-upstream-part-dynamic-v2-0-295fefc9a3c4@baylibre.com
Changes in v2:
- Reuse spl_mmc_boot_partition() instead of adding a second public hook.
- Pass the initialized MMC device and boot-device ID to the hook, and
defer selection until after any raw Falcon boot attempt.
- Keep explicit partition loads independent of next-stage selection,
without splitting the MMC loader into preparation and loading functions.
- Make dynamic selection an option within existing raw partition mode,
select its partition library and hide the unused fixed partition number.
- Restrict STM32's fixed hook and MMC2 partition setting to fixed mode.
- Keep a weak default and diagnose nonpositive dynamic selections before
filesystem fallback, while preserving fixed-mode behavior.
- Link to v1: https://patch.msgid.link/20260910-ccaione-upstream-part-dynamic-v1-1-381414ad9a34@baylibre.com
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
---
Carlo Caione (2):
spl: mmc: select the boot partition after device initialization
spl: mmc: make raw partition selection a choice
arch/arm/mach-k3/r5/Kconfig | 4 +-
arch/arm/mach-stm32mp/stm32mp1/spl.c | 4 +-
common/spl/Kconfig | 13 +++++++
common/spl/spl_mmc.c | 72 ++++++++++++++++++++++++++----------
include/part.h | 3 +-
include/spl.h | 21 +++++++----
6 files changed, 86 insertions(+), 31 deletions(-)
---
base-commit: 527115ef6783cec49e5610c523c124b399011361
change-id: 20260909-ccaione-upstream-part-dynamic-4c192e2d4bb6
Best regards,
--
Carlo Caione <ccaione@baylibre.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization
2026-09-14 8:31 [PATCH v3 0/2] Support board-selected raw partitions Carlo Caione
@ 2026-09-14 8:31 ` Carlo Caione
2026-09-14 16:35 ` Tom Rini
2026-09-14 8:31 ` [PATCH v3 2/2] spl: mmc: make raw partition selection a choice Carlo Caione
1 sibling, 1 reply; 9+ messages in thread
From: Carlo Caione @ 2026-09-14 8:31 UTC (permalink / raw)
To: u-boot, uboot-stm32
Cc: Tom Rini, Peng Fan, Jaehoon Chung, Neil Armstrong,
Bastien Curutchet, Alexey Charkov, Johan Jonker, Richard Genoud,
João Marcos Costa, Miquel Raynal, David Lechner,
Julien Stephan, Ilias Apalodimas, Patrick Delaunay,
Patrice Chotard, Heinrich Schuchardt, Carlo Caione
Boards may need to read boot metadata before choosing the partition
containing U-Boot. The partition hook currently runs before the MMC
device is initialized, so it cannot do this reliably.
Defer selection until the raw partition load and provide the initialized
device to the existing hook. Explicit partition loads keep their supplied
coordinates, and a successful Falcon boot needs no U-Boot selection.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
---
arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +-
common/spl/spl_mmc.c | 7 +++++--
include/spl.h | 15 +++++++++------
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-stm32mp/stm32mp1/spl.c b/arch/arm/mach-stm32mp/stm32mp1/spl.c
index d2e41b8e65f..2229ebf5eeb 100644
--- a/arch/arm/mach-stm32mp/stm32mp1/spl.c
+++ b/arch/arm/mach-stm32mp/stm32mp1/spl.c
@@ -62,7 +62,7 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
}
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
-int spl_mmc_boot_partition(const u32 boot_device)
+int spl_mmc_boot_partition(struct mmc *mmc, const u32 boot_device)
{
switch (boot_device) {
case BOOT_DEVICE_MMC1:
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index cc16709dc9b..3e637f5adbd 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -301,7 +301,7 @@ u32 __weak spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
}
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
-int __weak spl_mmc_boot_partition(const u32 boot_device)
+int __weak spl_mmc_boot_partition(struct mmc *mmc, const u32 boot_device)
{
return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION;
}
@@ -431,6 +431,9 @@ int spl_mmc_load(struct spl_image_info *spl_image,
return 0;
#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE)
+ if (IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) &&
+ raw_part == -1)
+ raw_part = spl_mmc_boot_partition(mmc, bootdev->boot_device);
ret = mmc_load_image_raw_partition(spl_image, bootdev,
mmc, raw_part,
raw_sect);
@@ -466,7 +469,7 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,
NULL,
#endif
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
- spl_mmc_boot_partition(bootdev->boot_device),
+ -1,
#else
0,
#endif
diff --git a/include/spl.h b/include/spl.h
index 5078d7525ab..08a84536f51 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -595,18 +595,20 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device);
/**
* spl_mmc_boot_partition() - MMC partition to load U-Boot from.
+ * @mmc: Initialized MMC device
* @boot_device: ID of the device which the MMC driver wants to load
* U-Boot from.
*
- * This function should return the partition number which the SPL
- * should load U-Boot from (on the given boot_device) when
- * CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is set.
+ * Called before loading U-Boot in raw partition mode, after any Falcon
+ * attempt. The hook may select the hardware area containing the image;
+ * it must leave that area selected. It may run for each MMC load attempt.
*
* If not overridden, it is weakly defined in common/spl/spl_mmc.c.
+ *
+ * Return: Partition number to load U-Boot from.
*/
-int spl_mmc_boot_partition(const u32 boot_device);
+int spl_mmc_boot_partition(struct mmc *mmc, const u32 boot_device);
-struct mmc;
/**
* default_spl_mmc_emmc_boot_partition() - eMMC boot partition to load U-Boot from.
* mmc: Pointer for the mmc device structure
@@ -972,7 +974,8 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,
* @param spl_image Image data filled in by loading process
* @param bootdev Describes which device to load from
* @param filename Name of file to load (in FS mode)
- * @param raw_part Partition to load from (in RAW mode)
+ * @param raw_part Partition to load from (in RAW mode), or -1 to call
+ * spl_mmc_boot_partition() in partition-number mode
* @param raw_sect Sector to load from (in RAW mode)
*
* Return: 0 on success, otherwise error code
--
2.55.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 2/2] spl: mmc: make raw partition selection a choice
2026-09-14 8:31 [PATCH v3 0/2] Support board-selected raw partitions Carlo Caione
2026-09-14 8:31 ` [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization Carlo Caione
@ 2026-09-14 8:31 ` Carlo Caione
2026-09-14 16:40 ` Tom Rini
1 sibling, 1 reply; 9+ messages in thread
From: Carlo Caione @ 2026-09-14 8:31 UTC (permalink / raw)
To: u-boot, uboot-stm32
Cc: Tom Rini, Peng Fan, Jaehoon Chung, Neil Armstrong,
Bastien Curutchet, Alexey Charkov, Johan Jonker, Richard Genoud,
João Marcos Costa, Miquel Raynal, David Lechner,
Julien Stephan, Ilias Apalodimas, Patrick Delaunay,
Patrice Chotard, Heinrich Schuchardt, Carlo Caione
Boards using boot metadata should not have to configure an unused fixed
partition number. Make board-selected partitions an alternative to fixed
numbers and partition types in the existing raw-location choice.
Keep the selection policies together so the MMC loader only has to select
a partition and load it. Selection failures in dynamic mode must stop the
MMC attempt instead of falling back to an unrelated filesystem partition.
Existing fixed-number and partition-type fallback behavior is preserved.
Distinguish shared partition-loading support from settings specific to
partition-number modes. This keeps existing platform defaults and guards
while allowing dynamic selection to use the same partition loader. The
STM32 fixed override remains conditional on its static partition setting.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
---
arch/arm/mach-k3/r5/Kconfig | 4 +-
arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +-
common/spl/Kconfig | 13 +++++++
common/spl/spl_mmc.c | 73 +++++++++++++++++++++++++-----------
include/part.h | 3 +-
include/spl.h | 16 +++++---
6 files changed, 80 insertions(+), 31 deletions(-)
diff --git a/arch/arm/mach-k3/r5/Kconfig b/arch/arm/mach-k3/r5/Kconfig
index 12335880e10..672c8a226df 100644
--- a/arch/arm/mach-k3/r5/Kconfig
+++ b/arch/arm/mach-k3/r5/Kconfig
@@ -35,7 +35,9 @@ config K3_SYSFW_IMAGE_MMCSD_RAW_MODE_SECT
config K3_SYSFW_IMAGE_MMCSD_RAW_MODE_PART
hex "MMC partition to load SYSFW firmware and configuration blob from"
- depends on K3_LOAD_SYSFW && SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+ depends on K3_LOAD_SYSFW
+ depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION || \
+ SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC
default 2
help
Partition on the MMC to the combined System Firmware and configuration
diff --git a/arch/arm/mach-stm32mp/stm32mp1/spl.c b/arch/arm/mach-stm32mp/stm32mp1/spl.c
index 2229ebf5eeb..c1be468cb1d 100644
--- a/arch/arm/mach-stm32mp/stm32mp1/spl.c
+++ b/arch/arm/mach-stm32mp/stm32mp1/spl.c
@@ -61,7 +61,7 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
return MMCSD_MODE_RAW;
}
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
int spl_mmc_boot_partition(struct mmc *mmc, const u32 boot_device)
{
switch (boot_device) {
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 0618f42c941..56375ef287d 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -574,8 +574,21 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
raw mode. U-Boot will be loaded from the first partition of this
type to be found.
+config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC
+ bool "MMC raw mode: by board-selected partition"
+ select SPL_LOAD_BLOCK
+ select SPL_PARTITIONS
+ help
+ Select the partition at runtime instead of using a fixed number.
+ The board must implement spl_mmc_boot_partition().
+
endchoice
+config SYS_MMCSD_RAW_MODE_U_BOOT_USE_ANY_PARTITION
+ def_bool SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION || \
+ SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE || \
+ SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC
+
config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
hex "Address on the MMC to load U-Boot from"
depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 3e637f5adbd..8f4df4104ca 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -106,18 +106,14 @@ static int spl_mmc_find_device(struct mmc **mmcp, int mmc_dev)
return 0;
}
-#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
- defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE)
-static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
- struct spl_boot_device *bootdev,
- struct mmc *mmc, int partition,
- unsigned long sector)
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_ANY_PARTITION
+static int spl_mmc_select_partition(struct mmc *mmc, const u32 boot_device,
+ int *partition)
{
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
struct disk_partition info;
- int ret;
+ int type_part, ret;
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
- int type_part;
/* Only support MBR so DOS_ENTRY_NUMBERS */
for (type_part = 1; type_part <= DOS_ENTRY_NUMBERS; type_part++) {
ret = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
@@ -125,11 +121,40 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
continue;
if (info.sys_ind ==
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE) {
- partition = type_part;
+ *partition = type_part;
break;
}
}
+
+ return 0;
+#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC)
+ int ret;
+
+ if (*partition != -1)
+ return 0;
+
+ *partition = spl_mmc_boot_partition(mmc, boot_device);
+ if (*partition > 0)
+ return 0;
+
+ ret = *partition < 0 ? *partition : -EINVAL;
+ printf("spl: partition selection failed: %d\n", ret);
+ return ret;
+#else
+ if (*partition == -1)
+ *partition = spl_mmc_boot_partition(mmc, boot_device);
+
+ return 0;
#endif
+}
+
+static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev,
+ struct mmc *mmc, int partition,
+ unsigned long sector)
+{
+ struct disk_partition info;
+ int ret;
ret = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
if (ret) {
@@ -300,10 +325,15 @@ u32 __weak spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
return MMCSD_MODE_RAW;
}
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
+ defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC)
int __weak spl_mmc_boot_partition(struct mmc *mmc, const u32 boot_device)
{
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION;
+#else
+ return -ENOSYS;
+#endif
}
#endif
@@ -429,11 +459,10 @@ int spl_mmc_load(struct spl_image_info *spl_image,
spl_mmc_raw_uboot_offset(part));
if (!ret)
return 0;
-#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
- defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE)
- if (IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) &&
- raw_part == -1)
- raw_part = spl_mmc_boot_partition(mmc, bootdev->boot_device);
+#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_ANY_PARTITION)
+ ret = spl_mmc_select_partition(mmc, bootdev->boot_device, &raw_part);
+ if (ret)
+ return ret;
ret = mmc_load_image_raw_partition(spl_image, bootdev,
mmc, raw_part,
raw_sect);
@@ -462,17 +491,19 @@ int spl_mmc_load(struct spl_image_info *spl_image,
int spl_mmc_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
+ int raw_part = 0;
+
+ if (IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) ||
+ IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC))
+ raw_part = -1;
+
return spl_mmc_load(spl_image, bootdev,
#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME,
#else
NULL,
#endif
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
- -1,
-#else
- 0,
-#endif
+ raw_part,
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
#else
diff --git a/include/part.h b/include/part.h
index 15daacd7faa..5268216b46d 100644
--- a/include/part.h
+++ b/include/part.h
@@ -462,8 +462,7 @@ ulong disk_blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt);
# define part_print_ptr(x) NULL
# if defined(CONFIG_SPL_FS_EXT4) || defined(CONFIG_SPL_FS_FAT) || \
defined(CONFIG_SPL_FS_SQUASHFS) || \
- defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
- defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE)
+ defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_ANY_PARTITION)
# define part_get_info_ptr(x) x
# else
# define part_get_info_ptr(x) NULL
diff --git a/include/spl.h b/include/spl.h
index 08a84536f51..d05623caaf6 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -599,13 +599,17 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device);
* @boot_device: ID of the device which the MMC driver wants to load
* U-Boot from.
*
- * Called before loading U-Boot in raw partition mode, after any Falcon
- * attempt. The hook may select the hardware area containing the image;
- * it must leave that area selected. It may run for each MMC load attempt.
+ * Called in fixed-number or dynamic mode after any Falcon attempt. The
+ * incoming hardware area is not necessarily the user area. The hook must
+ * leave the image area selected for loading and any configured filesystem
+ * fallback; the loader does not restore it. It may run for each MMC attempt.
*
- * If not overridden, it is weakly defined in common/spl/spl_mmc.c.
+ * The default returns the configured partition, or -ENOSYS with
+ * CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC. In dynamic mode,
+ * zero or a negative error aborts this MMC attempt without filesystem
+ * fallback; SPL may still try other boot devices.
*
- * Return: Partition number to load U-Boot from.
+ * Return: Partition number (positive in dynamic mode), or a negative error.
*/
int spl_mmc_boot_partition(struct mmc *mmc, const u32 boot_device);
@@ -975,7 +979,7 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,
* @param bootdev Describes which device to load from
* @param filename Name of file to load (in FS mode)
* @param raw_part Partition to load from (in RAW mode), or -1 to call
- * spl_mmc_boot_partition() in partition-number mode
+ * spl_mmc_boot_partition() in fixed-number or dynamic mode
* @param raw_sect Sector to load from (in RAW mode)
*
* Return: 0 on success, otherwise error code
--
2.55.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization
2026-09-14 8:31 ` [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization Carlo Caione
@ 2026-09-14 16:35 ` Tom Rini
2026-09-14 20:56 ` Carlo Caione
0 siblings, 1 reply; 9+ messages in thread
From: Tom Rini @ 2026-09-14 16:35 UTC (permalink / raw)
To: Carlo Caione
Cc: u-boot, uboot-stm32, Peng Fan, Jaehoon Chung, Neil Armstrong,
Bastien Curutchet, Alexey Charkov, Johan Jonker, Richard Genoud,
João Marcos Costa, Miquel Raynal, David Lechner,
Julien Stephan, Ilias Apalodimas, Patrick Delaunay,
Patrice Chotard, Heinrich Schuchardt
[-- Attachment #1: Type: text/plain, Size: 1967 bytes --]
On Mon, Sep 14, 2026 at 10:31:37AM +0200, Carlo Caione wrote:
> Boards may need to read boot metadata before choosing the partition
> containing U-Boot. The partition hook currently runs before the MMC
> device is initialized, so it cannot do this reliably.
>
> Defer selection until the raw partition load and provide the initialized
> device to the existing hook. Explicit partition loads keep their supplied
> coordinates, and a successful Falcon boot needs no U-Boot selection.
>
> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
[snip]
> diff --git a/include/spl.h b/include/spl.h
> index 5078d7525ab..08a84536f51 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -595,18 +595,20 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device);
>
> /**
> * spl_mmc_boot_partition() - MMC partition to load U-Boot from.
> + * @mmc: Initialized MMC device
> * @boot_device: ID of the device which the MMC driver wants to load
> * U-Boot from.
> *
> - * This function should return the partition number which the SPL
> - * should load U-Boot from (on the given boot_device) when
> - * CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is set.
> + * Called before loading U-Boot in raw partition mode, after any Falcon
> + * attempt. The hook may select the hardware area containing the image;
> + * it must leave that area selected. It may run for each MMC load attempt.
> *
> * If not overridden, it is weakly defined in common/spl/spl_mmc.c.
> + *
> + * Return: Partition number to load U-Boot from.
> */
> -int spl_mmc_boot_partition(const u32 boot_device);
> +int spl_mmc_boot_partition(struct mmc *mmc, const u32 boot_device);
>
> -struct mmc;
Have you thrown this through CI? We have that forward declaration
because it's not otherwise defined, and we wanted to avoid pulling in a
big header chain here to declare it. So I worry something is going to
fail to build now.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 2/2] spl: mmc: make raw partition selection a choice
2026-09-14 8:31 ` [PATCH v3 2/2] spl: mmc: make raw partition selection a choice Carlo Caione
@ 2026-09-14 16:40 ` Tom Rini
0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2026-09-14 16:40 UTC (permalink / raw)
To: Carlo Caione
Cc: u-boot, uboot-stm32, Peng Fan, Jaehoon Chung, Neil Armstrong,
Bastien Curutchet, Alexey Charkov, Johan Jonker, Richard Genoud,
João Marcos Costa, Miquel Raynal, David Lechner,
Julien Stephan, Ilias Apalodimas, Patrick Delaunay,
Patrice Chotard, Heinrich Schuchardt
[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]
On Mon, Sep 14, 2026 at 10:31:38AM +0200, Carlo Caione wrote:
> Boards using boot metadata should not have to configure an unused fixed
> partition number. Make board-selected partitions an alternative to fixed
> numbers and partition types in the existing raw-location choice.
>
> Keep the selection policies together so the MMC loader only has to select
> a partition and load it. Selection failures in dynamic mode must stop the
> MMC attempt instead of falling back to an unrelated filesystem partition.
> Existing fixed-number and partition-type fallback behavior is preserved.
>
> Distinguish shared partition-loading support from settings specific to
> partition-number modes. This keeps existing platform defaults and guards
> while allowing dynamic selection to use the same partition loader. The
> STM32 fixed override remains conditional on its static partition setting.
>
> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Overall I think this looks better, thank you.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization
2026-09-14 16:35 ` Tom Rini
@ 2026-09-14 20:56 ` Carlo Caione
2026-09-14 21:33 ` Tom Rini
0 siblings, 1 reply; 9+ messages in thread
From: Carlo Caione @ 2026-09-14 20:56 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, uboot-stm32, Peng Fan, Jaehoon Chung, Neil Armstrong,
Bastien Curutchet, Alexey Charkov, Johan Jonker, Richard Genoud,
João Marcos Costa, Miquel Raynal, David Lechner,
Julien Stephan, Ilias Apalodimas, Patrick Delaunay,
Patrice Chotard, Heinrich Schuchardt
On Mon, Sep 14, 2026 at 10:35:57 +0100, Tom Rini wrote:
> On Mon, Sep 14, 2026 at 10:31:37AM +0200, Carlo Caione wrote:
[...]
> > -struct mmc;
>
> Have you thrown this through CI? We have that forward declaration
> because it's not otherwise defined, and we wanted to avoid pulling in a
> big header chain here to declare it. So I worry something is going to
> fail to build now.
Hi Tom,
yes, the CI is all green. include/spl.h already includes <mmc.h>
unconditionally so struct mmc is defined before these prototypes.
Thanks,
--
Carlo Caione
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization
2026-09-14 20:56 ` Carlo Caione
@ 2026-09-14 21:33 ` Tom Rini
2026-09-21 20:05 ` Carlo Caione
0 siblings, 1 reply; 9+ messages in thread
From: Tom Rini @ 2026-09-14 21:33 UTC (permalink / raw)
To: Carlo Caione
Cc: u-boot, uboot-stm32, Peng Fan, Jaehoon Chung, Neil Armstrong,
Bastien Curutchet, Alexey Charkov, Johan Jonker, Richard Genoud,
João Marcos Costa, Miquel Raynal, David Lechner,
Julien Stephan, Ilias Apalodimas, Patrick Delaunay,
Patrice Chotard, Heinrich Schuchardt
[-- Attachment #1: Type: text/plain, Size: 701 bytes --]
On Mon, Sep 14, 2026 at 10:56:49PM +0200, Carlo Caione wrote:
> On Mon, Sep 14, 2026 at 10:35:57 +0100, Tom Rini wrote:
> > On Mon, Sep 14, 2026 at 10:31:37AM +0200, Carlo Caione wrote:
>
> [...]
> > > -struct mmc;
> >
> > Have you thrown this through CI? We have that forward declaration
> > because it's not otherwise defined, and we wanted to avoid pulling in a
> > big header chain here to declare it. So I worry something is going to
> > fail to build now.
>
> Hi Tom,
> yes, the CI is all green. include/spl.h already includes <mmc.h>
> unconditionally so struct mmc is defined before these prototypes.
Ah thanks!
Reviewed-by: Tom Rini <trini@konsulko.com>
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization
2026-09-14 21:33 ` Tom Rini
@ 2026-09-21 20:05 ` Carlo Caione
2026-09-21 20:32 ` Tom Rini
0 siblings, 1 reply; 9+ messages in thread
From: Carlo Caione @ 2026-09-21 20:05 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, uboot-stm32, Peng Fan, Jaehoon Chung, Neil Armstrong,
Bastien Curutchet, Alexey Charkov, Johan Jonker, Richard Genoud,
João Marcos Costa, Miquel Raynal, David Lechner,
Julien Stephan, Ilias Apalodimas, Patrick Delaunay,
Patrice Chotard, Heinrich Schuchardt
On Mon, Sep 14, 2026 at 15:33:07 +0100, Tom Rini wrote:
[...]
> Reviewed-by: Tom Rini <trini@konsulko.com>
Hi Tom,
who should pick this up?
Thanks,
--
Carlo Caione
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization
2026-09-21 20:05 ` Carlo Caione
@ 2026-09-21 20:32 ` Tom Rini
0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2026-09-21 20:32 UTC (permalink / raw)
To: Carlo Caione
Cc: u-boot, uboot-stm32, Peng Fan, Jaehoon Chung, Neil Armstrong,
Bastien Curutchet, Alexey Charkov, Johan Jonker, Richard Genoud,
João Marcos Costa, Miquel Raynal, David Lechner,
Julien Stephan, Ilias Apalodimas, Patrick Delaunay,
Patrice Chotard, Heinrich Schuchardt
[-- Attachment #1: Type: text/plain, Size: 303 bytes --]
On Mon, Sep 21, 2026 at 10:05:15PM +0200, Carlo Caione wrote:
> On Mon, Sep 14, 2026 at 15:33:07 +0100, Tom Rini wrote:
>
> [...]
> > Reviewed-by: Tom Rini <trini@konsulko.com>
>
> Hi Tom,
> who should pick this up?
I think I handed this to Peng in patchwork, for the MMC tree.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-09-21 20:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 8:31 [PATCH v3 0/2] Support board-selected raw partitions Carlo Caione
2026-09-14 8:31 ` [PATCH v3 1/2] spl: mmc: select the boot partition after device initialization Carlo Caione
2026-09-14 16:35 ` Tom Rini
2026-09-14 20:56 ` Carlo Caione
2026-09-14 21:33 ` Tom Rini
2026-09-21 20:05 ` Carlo Caione
2026-09-21 20:32 ` Tom Rini
2026-09-14 8:31 ` [PATCH v3 2/2] spl: mmc: make raw partition selection a choice Carlo Caione
2026-09-14 16:40 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.