Hi Judith,

On Mon Aug 18, 2025 at 11:10 PM IST, Judith Mendez wrote:
> Currently logic in spl_mmc_boot_mode only lookes at main devstat

Nit: s/lookes/looks

> to determine the bootmode to return. Thus, when using: 'eMMC boot'
> as primary boot mode and 'MMCSD boot from eMMC UDA' as backup
> boot mode, 'eMMC boot' is always selected. Add check for bootindex
> to determine if ROM boot via backup boot mode and return MMCSD_MODE_FS
> which is the only supported backup bootmode with eMMC device.
>
> Signed-off-by: Judith Mendez <j...@ti.com>
> ---
>  arch/arm/mach-k3/am62ax/am62a7_init.c | 22 +++++++++++++---------
>  arch/arm/mach-k3/am62px/am62p5_init.c | 24 ++++++++++++++----------
>  arch/arm/mach-k3/am62x/am625_init.c   | 22 +++++++++++++---------
>  3 files changed, 40 insertions(+), 28 deletions(-)
>
> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c 
> b/arch/arm/mach-k3/am62ax/am62a7_init.c
> index 00173e6836b..fa3570d07ec 100644
> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
> @@ -218,17 +218,21 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 
> boot_device)
>       u32 bootmode_cfg = (devstat & MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_MASK) >>
>                           MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_SHIFT;
>  
> -     switch (bootmode) {
> -     case BOOT_DEVICE_EMMC:
> -             if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT))
> +     if (bootindex == K3_PRIMARY_BOOTMODE) {
> +             switch (bootmode) {
> +             case BOOT_DEVICE_EMMC:
> +                     if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT))
> +                             return MMCSD_MODE_EMMCBOOT;
> +                     if (IS_ENABLED(CONFIG_SPL_FS_FAT) || 
> IS_ENABLED(CONFIG_SPL_FS_EXT4))
> +                             return MMCSD_MODE_FS;
>                       return MMCSD_MODE_EMMCBOOT;
> -             if (IS_ENABLED(CONFIG_SPL_FS_FAT) || 
> IS_ENABLED(CONFIG_SPL_FS_EXT4))
> +             case BOOT_DEVICE_MMC:
> +                     if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
> +                             return MMCSD_MODE_RAW;
> +             default:
>                       return MMCSD_MODE_FS;
> -             return MMCSD_MODE_EMMCBOOT;
> -     case BOOT_DEVICE_MMC:
> -             if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
> -                     return MMCSD_MODE_RAW;
> -     default:
> +             }
> +     } else {
>               return MMCSD_MODE_FS;
>       }
>  }

[snip]

Just having a check for bootindex before the switch block would be more
readable imo, like:

if (bootindex != K3_PRIMARY_BOOTMODE)
        return MMCSD_MODE_FS;

switch (bootmode) {
        <Existing code>
}

Regards,
Anshul

Reply via email to