* [PATCH v2 0/2] Support board-selected raw partitions
@ 2026-09-11 12:05 Carlo Caione
2026-09-11 12:05 ` [PATCH v2 1/2] spl: mmc: select the boot partition after device initialization Carlo Caione
2026-09-11 12:05 ` [PATCH v2 2/2] spl: mmc: support dynamic selection in raw partition mode Carlo Caione
0 siblings, 2 replies; 6+ messages in thread
From: Carlo Caione @ 2026-09-11 12:05 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 an explicit
runtime-selection option within raw partition mode.
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 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: support dynamic selection in raw partition mode
arch/arm/mach-stm32mp/Kconfig | 1 +
arch/arm/mach-stm32mp/stm32mp1/spl.c | 4 ++--
common/spl/Kconfig | 9 +++++++++
common/spl/spl_mmc.c | 22 ++++++++++++++++------
include/spl.h | 21 ++++++++++++++-------
5 files changed, 42 insertions(+), 15 deletions(-)
---
base-commit: 527115ef6783cec49e5610c523c124b399011361
change-id: 20260909-ccaione-upstream-part-dynamic-4c192e2d4bb6
Best regards,
--
Carlo Caione <ccaione@baylibre.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] spl: mmc: select the boot partition after device initialization
2026-09-11 12:05 [PATCH v2 0/2] Support board-selected raw partitions Carlo Caione
@ 2026-09-11 12:05 ` Carlo Caione
2026-09-11 12:05 ` [PATCH v2 2/2] spl: mmc: support dynamic selection in raw partition mode Carlo Caione
1 sibling, 0 replies; 6+ messages in thread
From: Carlo Caione @ 2026-09-11 12:05 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] 6+ messages in thread
* [PATCH v2 2/2] spl: mmc: support dynamic selection in raw partition mode
2026-09-11 12:05 [PATCH v2 0/2] Support board-selected raw partitions Carlo Caione
2026-09-11 12:05 ` [PATCH v2 1/2] spl: mmc: select the boot partition after device initialization Carlo Caione
@ 2026-09-11 12:05 ` Carlo Caione
2026-09-11 17:41 ` Tom Rini
1 sibling, 1 reply; 6+ messages in thread
From: Carlo Caione @ 2026-09-11 12:05 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 to select U-Boot should not need to configure
an unused fixed partition number. Add an explicit runtime-selection
option within the existing partition mode, retaining its loader and
platform dependencies.
A failed dynamic selection must not boot from an unrelated filesystem
partition. Reject an invalid selection for this MMC attempt while keeping
the existing fallback behavior when dynamic selection is disabled.
STM32's existing hook implements fixed partition selection and references
the static partition settings. Restrict it and its MMC2 setting to fixed
mode so dynamic selection can provide its own hook.
The board hook owns hardware-area selection, including access to metadata
and leaving the image area selected.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
---
arch/arm/mach-stm32mp/Kconfig | 1 +
arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +-
common/spl/Kconfig | 9 +++++++++
common/spl/spl_mmc.c | 19 +++++++++++++------
include/spl.h | 14 +++++++++-----
5 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index f45010ddbd0..bea4a1b6aaf 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -175,6 +175,7 @@ config DDR_CACHEABLE_SIZE
config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
hex "Partition on MMC2 to use to load U-Boot from"
depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+ depends on !SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC
default 1
help
Partition on the second MMC to load U-Boot from when the MMC is being
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..9e1c23ea0f4 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -576,6 +576,14 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
endchoice
+config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC
+ bool "Select the raw partition at runtime"
+ depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+ select SPL_PARTITIONS
+ help
+ Select the partition at runtime instead of using a fixed number.
+ The board must implement spl_mmc_boot_partition().
+
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
@@ -609,6 +617,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET
config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
hex "Partition to use to load U-Boot from"
depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+ depends on !SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC
default 1
help
Partition on the MMC to load U-Boot from when the MMC is being
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 3e637f5adbd..d538fbb9c41 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -303,7 +303,11 @@ 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(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
@@ -432,8 +436,15 @@ int spl_mmc_load(struct spl_image_info *spl_image,
#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 == -1) {
raw_part = spl_mmc_boot_partition(mmc, bootdev->boot_device);
+ if (IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC) &&
+ raw_part < 1) {
+ ret = raw_part < 0 ? raw_part : -EINVAL;
+ printf("spl: partition selection failed: %d\n", ret);
+ return ret;
+ }
+ }
ret = mmc_load_image_raw_partition(spl_image, bootdev,
mmc, raw_part,
raw_sect);
@@ -468,11 +479,7 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,
#else
NULL,
#endif
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
- -1,
-#else
- 0,
-#endif
+ IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) ? -1 : 0,
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
#else
diff --git a/include/spl.h b/include/spl.h
index 08a84536f51..2877d120d27 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 partition-number 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 load 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);
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] spl: mmc: support dynamic selection in raw partition mode
2026-09-11 12:05 ` [PATCH v2 2/2] spl: mmc: support dynamic selection in raw partition mode Carlo Caione
@ 2026-09-11 17:41 ` Tom Rini
2026-09-12 10:51 ` Carlo Caione
0 siblings, 1 reply; 6+ messages in thread
From: Tom Rini @ 2026-09-11 17:41 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: 5171 bytes --]
On Fri, Sep 11, 2026 at 02:05:59PM +0200, Carlo Caione wrote:
> Boards using boot metadata to select U-Boot should not need to configure
> an unused fixed partition number. Add an explicit runtime-selection
> option within the existing partition mode, retaining its loader and
> platform dependencies.
>
> A failed dynamic selection must not boot from an unrelated filesystem
> partition. Reject an invalid selection for this MMC attempt while keeping
> the existing fallback behavior when dynamic selection is disabled.
>
> STM32's existing hook implements fixed partition selection and references
> the static partition settings. Restrict it and its MMC2 setting to fixed
> mode so dynamic selection can provide its own hook.
>
> The board hook owns hardware-area selection, including access to metadata
> and leaving the image area selected.
>
> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
> ---
> arch/arm/mach-stm32mp/Kconfig | 1 +
> arch/arm/mach-stm32mp/stm32mp1/spl.c | 2 +-
> common/spl/Kconfig | 9 +++++++++
> common/spl/spl_mmc.c | 19 +++++++++++++------
> include/spl.h | 14 +++++++++-----
> 5 files changed, 33 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
> index f45010ddbd0..bea4a1b6aaf 100644
> --- a/arch/arm/mach-stm32mp/Kconfig
> +++ b/arch/arm/mach-stm32mp/Kconfig
> @@ -175,6 +175,7 @@ config DDR_CACHEABLE_SIZE
> config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
> hex "Partition on MMC2 to use to load U-Boot from"
> depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
> + depends on !SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC
> default 1
> help
> Partition on the second MMC to load U-Boot from when the MMC is being
> 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..9e1c23ea0f4 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -576,6 +576,14 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
>
> endchoice
>
> +config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC
> + bool "Select the raw partition at runtime"
> + depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
> + select SPL_PARTITIONS
> + help
> + Select the partition at runtime instead of using a fixed number.
> + The board must implement spl_mmc_boot_partition().
> +
> 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
> @@ -609,6 +617,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET
> config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
> hex "Partition to use to load U-Boot from"
> depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
> + depends on !SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC
> default 1
> help
> Partition on the MMC to load U-Boot from when the MMC is being
> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
> index 3e637f5adbd..d538fbb9c41 100644
> --- a/common/spl/spl_mmc.c
> +++ b/common/spl/spl_mmc.c
> @@ -303,7 +303,11 @@ 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(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
>
> @@ -432,8 +436,15 @@ int spl_mmc_load(struct spl_image_info *spl_image,
> #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 == -1) {
> raw_part = spl_mmc_boot_partition(mmc, bootdev->boot_device);
> + if (IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_DYNAMIC) &&
> + raw_part < 1) {
> + ret = raw_part < 0 ? raw_part : -EINVAL;
> + printf("spl: partition selection failed: %d\n", ret);
> + return ret;
> + }
> + }
> ret = mmc_load_image_raw_partition(spl_image, bootdev,
> mmc, raw_part,
> raw_sect);
This is better than v1. Did you look in to my suggestion about turning
this in to a choice between hard-coded number, hard-coded type and this
new dynamic option? I do wonder if that would let us get rid of a lot of
the if/else nesting we have in these functions. Thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] spl: mmc: support dynamic selection in raw partition mode
2026-09-11 17:41 ` Tom Rini
@ 2026-09-12 10:51 ` Carlo Caione
2026-09-12 14:41 ` Tom Rini
0 siblings, 1 reply; 6+ messages in thread
From: Carlo Caione @ 2026-09-12 10:51 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 Fri, Sep 11, 2026 at 11:41:22 +0100, Tom Rini wrote:
> On Fri, Sep 11, 2026 at 02:05:59PM +0200, Carlo Caione wrote:
[...]
> This is better than v1. Did you look in to my suggestion about turning
> this in to a choice between hard-coded number, hard-coded type and this
> new dynamic option? I do wonder if that would let us get rid of a lot of
> the if/else nesting we have in these functions. Thanks!
I'll try but I do not promise anything :) The problem is that it is VERY
easy to break things when touching this code and relatek Kconfigs so I'm
basically tiptoeing around it for now, but let me try.
Thanks!
--
Carlo Caione
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] spl: mmc: support dynamic selection in raw partition mode
2026-09-12 10:51 ` Carlo Caione
@ 2026-09-12 14:41 ` Tom Rini
0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2026-09-12 14:41 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: 757 bytes --]
On Sat, Sep 12, 2026 at 12:51:42PM +0200, Carlo Caione wrote:
> On Fri, Sep 11, 2026 at 11:41:22 +0100, Tom Rini wrote:
> > On Fri, Sep 11, 2026 at 02:05:59PM +0200, Carlo Caione wrote:
>
> [...]
> > This is better than v1. Did you look in to my suggestion about turning
> > this in to a choice between hard-coded number, hard-coded type and this
> > new dynamic option? I do wonder if that would let us get rid of a lot of
> > the if/else nesting we have in these functions. Thanks!
>
> I'll try but I do not promise anything :) The problem is that it is VERY
> easy to break things when touching this code and relatek Kconfigs so I'm
> basically tiptoeing around it for now, but let me try.
It is tricky, thanks for trying.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-12 14:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11 12:05 [PATCH v2 0/2] Support board-selected raw partitions Carlo Caione
2026-09-11 12:05 ` [PATCH v2 1/2] spl: mmc: select the boot partition after device initialization Carlo Caione
2026-09-11 12:05 ` [PATCH v2 2/2] spl: mmc: support dynamic selection in raw partition mode Carlo Caione
2026-09-11 17:41 ` Tom Rini
2026-09-12 10:51 ` Carlo Caione
2026-09-12 14:41 ` 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.