[PATCH v1 1/2] spl: make args file optional in falcon mode

Tom Rini trini at konsulko.com
Wed Oct 8 18:38:20 CEST 2025


On Wed, Oct 08, 2025 at 05:06:03PM +0530, Anshul Dalal wrote:
> Falcon mode loads a kernel file and an args file which is the
> device-tree. However in the case of kernel file being a FIT that
> contains the device-tree within it, loading the args file is not
> required.
> 
> Therefore, this patch introduces a new SPL_OS_BOOT_ARGS config options
> that allows us to enable or disable loading of the args file in falcon
> mode.
> 
> Signed-off-by: Anshul Dalal <anshuld at ti.com>
[snip]
> @@ -1266,7 +1273,8 @@ config SYS_MMCSD_RAW_MODE_ARGS_SECTOR
>  
>  config SYS_MMCSD_RAW_MODE_ARGS_SECTORS
>  	hex "Falcon mode: Number of sectors to load for 'args' from MMC"
> -	depends on SPL_FALCON_BOOT_MMCSD && SYS_MMCSD_RAW_MODE_ARGS_SECTOR != 0x0
> +	depends on SPL_FALCON_BOOT_MMCSD && SYS_MMCSD_RAW_MODE_ARGS_SECTOR != 0x0 \
> +		&& SPL_OS_BOOT_ARGS

In this case now that SYS_MMCSD_RAW_MODE_ARGS_SECTOR would only be set
when "args" is being used (the 0x0 value was the workaround for "Using
FIT, this doesn't exist"), we can just depend on 'SPL_FALCON_BOOT_MMCSD
&& SPL_OS_BOOT_ARGS' here.

> diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
> index 93ef2d1c02c..f1cdbb6dbc4 100644
> --- a/common/spl/spl_nand.c
> +++ b/common/spl/spl_nand.c
> @@ -79,7 +79,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
>  static int spl_nand_load_image_os(struct spl_image_info *spl_image,
>  				  struct spl_boot_device *bootdev)
>  {
> -	int *src, *dst, err;
> +	__maybe_unused int *src, *dst, err;
>  	struct legacy_img_hdr *header = spl_get_load_buffer(0, sizeof(*header));
>  
>  	/* load linux */
> @@ -101,6 +101,7 @@ static int spl_nand_load_image_os(struct spl_image_info *spl_image,
>  	if (err)
>  		return err;
>  
> +#if IS_ENABLED(CONFIG_SPL_OS_BOOT_ARGS)
>  	/*
>  	 * load parameter image load to temp position since nand_spl_load_image
>  	 * reads a whole block which is typically larger than
> @@ -116,6 +117,7 @@ static int spl_nand_load_image_os(struct spl_image_info *spl_image,
>  	     src++, dst++) {
>  		writel(readl(src), dst);
>  	}
> +#endif
>  
>  	return 0;
>  }

I think we could rework this to:
	if (IS_ENABLED(CONFIG_SPL_OS_BOOT_ARGS)) {
		/*
		 * load ...
		 */
		int *src, *dst;
		...
	}

Instead. Especially since err will be used but src/dst not, in the
no-args case. Or no, we can't because CONFIG_SPL_PAYLOAD_ARGS_ADDR will
be undefined and fail to build? If so, we should still split the
__maybe_unused line.

> diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
> index 6f9ff91bef7..77c77ce6809 100644
> --- a/common/spl/spl_nor.c
> +++ b/common/spl/spl_nor.c
> @@ -69,7 +69,7 @@ static int spl_nor_load_image_os(struct spl_image_info *spl_image,
>  	       (void *)(CONFIG_SYS_OS_BASE + sizeof(struct legacy_img_hdr)),
>  	       spl_image->size);
>  
> -#ifdef CONFIG_SPL_PAYLOAD_ARGS_ADDR
> +#if IS_ENABLED(CONFIG_SPL_OS_BOOT_ARGS)
>  	spl_image->arg = (void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR;
>  #endif

We can drop this hunk I think.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20251008/4afe122a/attachment.sig>


More information about the U-Boot mailing list