[PATCH] mach-k3: am62*: Fix backup from eMMC boot mode

Judith Mendez jm at ti.com
Wed Aug 20 20:18:16 CEST 2025


Hi Bryan,

On 8/20/25 8:23 AM, Bryan Brattlof wrote:
> On August 18, 2025 thus sayeth Judith Mendez:
>> Currently logic in spl_mmc_boot_mode only lookes at main devstat
>> 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 <jm at 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;
> 
> Is any warning given to us when we fall back to the UDA partition? How
> do people know their boot partition is dead? Could we bail out early
> with a message:
> 
>      if (bootindex != K3_PRIMARY_BOOTMODE) {
> 	    pr_alert("using MMC backup in UDA\n")
> 	    return MMCSD_MODE_FS;
>      }
> 
>      switch (bootmode) {
>      case BOOT_DEVICE_EMMC:
> 
>      ... bla bla bla ...

Ok, sure will add print, thanks!

~ Judith



More information about the U-Boot mailing list