public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Anshul Dalal <anshuld@ti.com>
To: Andrew Davis <afd@ti.com>, Anshul Dalal <anshuld@ti.com>
Cc: <b-liu@ti.com>, <bb@ti.com>, <m-chawdhry@ti.com>,
	<n-francis@ti.com>, <nm@ti.com>, <trini@konsulko.com>,
	<u-boot@lists.denx.de>, <vigneshr@ti.com>
Subject: Re: [PATCH v9 4/8] mach-k3: common: support only MMC in R5 falcon mode
Date: Thu, 30 Oct 2025 21:09:27 +0530	[thread overview]
Message-ID: <DDVRPWB15CPW.P27MXQPUI2FC@ti.com> (raw)
In-Reply-To: <6fe53b09-fe92-4d04-8e51-9084f2b01c77@ti.com>

On Thu Oct 30, 2025 at 7:25 PM IST, Andrew Davis wrote:
> On 10/30/25 12:19 AM, Anshul Dalal wrote:
>> To simplify the boot process and prevent the R5 SPL size from growing,
>> this patch restricts the boot media to load the next stage payload
>> (tifalcon.bin and kernel FIT) from MMC only.
>> 
>
> Is R5 SPL size the only reason? This seems rather restrictive to only
> support one boot mode with all this..

For most non MMC FS boot modes, the raw offsets that U-Boot uses are
common in the non-falcon and falcon mode. And since we need both the
boot flows to first load tifalcon.bin and then fitImage, we can't make
use of the common spl boot flow with those boot media. For MMC FS
however we have two separate configs namely SPL_FS_LOAD_PAYLOAD_NAME and
SPL_FS_LOAD_KERNEL_NAME for each.

This also simplifies the usage where the tiboot3.bin as the intial stage
bootloader can be loaded from any boot media with the catch being that
tifalcon.bin and fitImage both are loaded from MMC FS. Specifically the
boot directory in rootfs, which simplifies the yocto recipes as well.

>
>> Signed-off-by: Anshul Dalal <anshuld@ti.com> ---
>> arch/arm/mach-k3/am62ax/am62a7_init.c |  3 +++
>> arch/arm/mach-k3/am62px/am62p5_init.c |  4 ++++
>> arch/arm/mach-k3/am62x/am625_init.c   |  3 +++
>> arch/arm/mach-k3/common.h             |  1 +
>> arch/arm/mach-k3/r5/common.c          | 17 ++++++++++++++++- 5 files
>> changed, 27 insertions(+), 1 deletion(-)
>> 
>> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c
>> b/arch/arm/mach-k3/am62ax/am62a7_init.c index
>> 48d578e7d6f..1c8a5fd2a35 100644 ---
>> a/arch/arm/mach-k3/am62ax/am62a7_init.c +++
>> b/arch/arm/mach-k3/am62ax/am62a7_init.c @@ -240,5 +240,8 @@ u32
>> spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
>>   
>>   u32 spl_boot_device(void) { +#if
>>   IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) && !IS_ENABLED(CONFIG_ARM64)
>
> The check for CONFIG_ARM64 might not be needed, what if we want to
> falcon boot from A53 SPL right into Linux?

I have a separate series[1] adding support for A53 falcon mode and we
can use all falcon supported boot media from the A53 SPL there so an
k3_r5_falcon_bootmode equivalent is not necessary.

[1]: https://lore.kernel.org/u-boot/20251024081408.1610102-1-anshuld@ti.com/

>
>> +	return k3_r5_falcon_bootmode(); +#endif
>
> This should be an #else capturing the below return call, otherwise
> think about what the function looks like after the preprocessor step
> if the above is true:
>
> u32 spl_boot_device(void) { return k3_r5_falcon_bootmode(); return
> get_boot_device(); }
>
> just seems odd.
>

Will fix in the next revision, Thanks!

Regards,
Anshul

> Andrew
>
>>   	return get_boot_device(); } diff --git
>>   	a/arch/arm/mach-k3/am62px/am62p5_init.c
>>   	b/arch/arm/mach-k3/am62px/am62p5_init.c index
>>   	aebd5200b0d..4c215d5cebe 100644 ---
>>   	a/arch/arm/mach-k3/am62px/am62p5_init.c +++
>>   	b/arch/arm/mach-k3/am62px/am62p5_init.c @@ -375,6 +375,10 @@ u32
>>   	spl_boot_device(void) u32 devstat = readl(CTRLMMR_MAIN_DEVSTAT);
>>   	u32 bootmedia;
>>   
>> +#if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) &&
>> !IS_ENABLED(CONFIG_ARM64) +	return k3_r5_falcon_bootmode(); +#endif
>> + if (bootindex == K3_PRIMARY_BOOTMODE) bootmedia =
>> __get_primary_bootmedia(devstat); else diff --git
>> a/arch/arm/mach-k3/am62x/am625_init.c
>> b/arch/arm/mach-k3/am62x/am625_init.c index 14f93ac998f..44b8d2654b2
>> 100644 --- a/arch/arm/mach-k3/am62x/am625_init.c +++
>> b/arch/arm/mach-k3/am62x/am625_init.c @@ -327,5 +327,8 @@ u32
>> spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
>>   
>>   u32 spl_boot_device(void) { +#if
>>   IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) && !IS_ENABLED(CONFIG_ARM64)
>>   +	return k3_r5_falcon_bootmode(); +#endif return
>>   get_boot_device(); } diff --git a/arch/arm/mach-k3/common.h
>>   b/arch/arm/mach-k3/common.h index 5807d358464..cd3e19374dc 100644
>>   --- a/arch/arm/mach-k3/common.h +++ b/arch/arm/mach-k3/common.h @@
>>   -54,6 +54,7 @@ int shutdown_mcu_r5_core1(void);
>>   
>>   #if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) &&
>>   !IS_ENABLED(CONFIG_ARM64) int k3_r5_falcon_bootmode(void); +int
>>   k3_r5_falcon_prep(void); #endif
>>   
>>   #if (IS_ENABLED(CONFIG_K3_QOS)) diff --git
>>   a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c index
>>   439dd92ef54..aa94c0c1956 100644 --- a/arch/arm/mach-k3/r5/common.c
>>   +++ b/arch/arm/mach-k3/r5/common.c @@ -391,6 +391,21 @@ int
>>   spl_start_uboot(void) return 0; }
>>   
>> +int k3_r5_falcon_bootmode(void) +{ +	char *mmcdev =
>> env_get("mmcdev"); + +	if (!mmcdev) +		return
>> BOOT_DEVICE_NOBOOT; + +	if (strncmp(mmcdev, "0", sizeof("0")) ==
>> 0) +		return BOOT_DEVICE_MMC1; +	else if (strncmp(mmcdev,
>> "1", sizeof("1")) == 0) +		return BOOT_DEVICE_MMC2; + else
>> +		return BOOT_DEVICE_NOBOOT; +} + int
>> k3_r5_falcon_prep(void) { struct spl_image_loader *loader, *drv; @@
>> -402,7 +417,7 @@ int k3_r5_falcon_prep(void) memset(&kernel_image,
>> '\0', sizeof(kernel_image)); drv = ll_entry_start(struct
>> spl_image_loader, spl_image_loader); n_ents = ll_entry_count(struct
>> spl_image_loader, spl_image_loader); -	bootdev.boot_device =
>> spl_boot_device(); +	bootdev.boot_device = k3_r5_falcon_bootmode();
>>   
>>   	for (loader = drv; loader != drv + n_ents; loader++) { if
>>   	(bootdev.boot_device != loader->boot_device)


  reply	other threads:[~2025-10-30 15:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30  5:19 [PATCH v9 0/8] Allow falcon boot from R5 SPL on TI's AM62 devices Anshul Dalal
2025-10-30  5:19 ` [PATCH v9 1/8] arch: arm: k3-binman: add fit for falcon boot Anshul Dalal
2025-10-30  5:19 ` [PATCH v9 2/8] configs: add falcon mode fragment for k3 devices Anshul Dalal
2025-10-30  5:19 ` [PATCH v9 3/8] mach-k3: common: enable falcon mode from R5 SPL Anshul Dalal
2025-10-30 13:46   ` Andrew Davis
2025-10-30 15:25     ` Anshul Dalal
2025-10-30 15:35       ` Andrew Goodbody
2025-10-30 18:19       ` Andrew Davis
2025-10-30  5:19 ` [PATCH v9 4/8] mach-k3: common: support only MMC in R5 falcon mode Anshul Dalal
2025-10-30 13:55   ` Andrew Davis
2025-10-30 15:39     ` Anshul Dalal [this message]
2025-10-30  5:19 ` [PATCH v9 5/8] mach-k3: r5: common: add fdt fixups for " Anshul Dalal
2025-10-30  5:19 ` [PATCH v9 6/8] mach-k3: r5: common: add bootargs to kernel's dtb Anshul Dalal
2025-10-30  5:19 ` [PATCH v9 7/8] Makefile: add tifalcon.bin to CLEAN_FILES Anshul Dalal
2025-10-30  5:19 ` [PATCH v9 8/8] doc: ti: document R5 falcon mode for AM62 platforms Anshul Dalal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DDVRPWB15CPW.P27MXQPUI2FC@ti.com \
    --to=anshuld@ti.com \
    --cc=afd@ti.com \
    --cc=b-liu@ti.com \
    --cc=bb@ti.com \
    --cc=m-chawdhry@ti.com \
    --cc=n-francis@ti.com \
    --cc=nm@ti.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox