* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-10 21:45 ` [PATCH 1/4] arm: mach-k3: Fix MMC macros Judith Mendez
@ 2025-09-11 4:38 ` Kumar, Udit
2025-09-11 14:48 ` Judith Mendez
2025-09-11 5:11 ` Anshul Dalal
` (2 subsequent siblings)
3 siblings, 1 reply; 28+ messages in thread
From: Kumar, Udit @ 2025-09-11 4:38 UTC (permalink / raw)
To: Judith Mendez, Tom Rini, u-kumar1
Cc: Manorit Chawdhry, Vignesh Raghavendra, Bryan Brattlof,
Moteen Shah, Andrew Davis, u-boot
On 9/11/2025 3:15 AM, Judith Mendez wrote:
> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The macros
> however, mix MMC device with the two bootmodes. Decouple the two types
> of macros so that bootmodes can be identified with:
> - BOOT_DEVICE_MMCSD
> - BOOT_DEVICE_EMMC
Few devices already (kind of have this )
arch/arm/mach-k3/include/mach/j722s_spl.h
#define BOOT_DEVICE_MMC 0x08
#define BOOT_DEVICE_EMMC 0x09
can we use in same way, BOOT_DEVICE_MMC as SD instead of adding SD as
postfix and
and add BOOT_DEVICE_EMMC, on devices where this is missing
> according to devstat parsed boot mode values and on-board devices can be
> identified with:
> - BOOT_DEVICE_MMC1
> - BOOT_DEVICE_MMC2
> - BOOT_DEVICE_MMC2_2
Why you need to change
#define for BOOT_DEVICE_MMC1 and and BOOT_DEVICE_MMC2
> according to arbitrary numbers mainly used to differentiate between eMMC
> and SD card.
Please check subject line, this is not a fix
> Signed-off-by: Judith Mendez <jm@ti.com>
> ---
> arch/arm/mach-k3/am62ax/am62a7_init.c | 4 ++--
> arch/arm/mach-k3/am62ax/boot.c | 8 ++++----
> arch/arm/mach-k3/am62px/am62p5_init.c | 12 ++++++------
> arch/arm/mach-k3/am62x/am625_init.c | 4 ++--
> arch/arm/mach-k3/am62x/boot.c | 8 ++++----
> arch/arm/mach-k3/am64x/boot.c | 8 ++++----
> arch/arm/mach-k3/am65x/am654_init.c | 18 ++++++++++--------
> arch/arm/mach-k3/include/mach/am62_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am62_spl.h | 10 +++++-----
> arch/arm/mach-k3/include/mach/am62a_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am62a_spl.h | 10 +++++-----
> arch/arm/mach-k3/include/mach/am62p_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am62p_spl.h | 10 +++++-----
> arch/arm/mach-k3/include/mach/am64_hardware.h | 4 ++--
> arch/arm/mach-k3/include/mach/am64_spl.h | 13 +++++++------
> arch/arm/mach-k3/include/mach/am6_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am6_spl.h | 13 +++++++++----
> arch/arm/mach-k3/include/mach/j721e_hardware.h | 6 +++---
> arch/arm/mach-k3/include/mach/j721e_spl.h | 14 ++++++++++----
> .../arm/mach-k3/include/mach/j721s2_hardware.h | 6 +++---
> arch/arm/mach-k3/include/mach/j721s2_spl.h | 13 +++++++++----
> arch/arm/mach-k3/include/mach/j722s_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/j722s_spl.h | 10 +++++-----
> .../arm/mach-k3/include/mach/j784s4_hardware.h | 6 +++---
> arch/arm/mach-k3/include/mach/j784s4_spl.h | 13 +++++++++----
> arch/arm/mach-k3/j721e/j721e_init.c | 14 +++++++++-----
> arch/arm/mach-k3/j721s2/j721s2_init.c | 14 +++++++++-----
> arch/arm/mach-k3/j722s/j722s_init.c | 12 ++++++------
> arch/arm/mach-k3/j784s4/j784s4_init.c | 14 +++++++++-----
> 29 files changed, 160 insertions(+), 124 deletions(-)
>
> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/am62ax/am62a7_init.c
> index 00173e6836b..1fd466bbdfc 100644
> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
> @@ -225,8 +225,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
> if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4))
> return MMCSD_MODE_FS;
> return MMCSD_MODE_EMMCBOOT;
> [..]
>
> + if (bootmode == BOOT_DEVICE_EMMC)
> + bootmode = BOOT_DEVICE_MMC1;
> +
Could you test once, eMMC on J784s4
> return bootmode;
> }
>
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-11 4:38 ` Kumar, Udit
@ 2025-09-11 14:48 ` Judith Mendez
2025-09-15 11:35 ` Moteen Shah
0 siblings, 1 reply; 28+ messages in thread
From: Judith Mendez @ 2025-09-11 14:48 UTC (permalink / raw)
To: Kumar, Udit, Tom Rini, Moteen Shah
Cc: Manorit Chawdhry, Vignesh Raghavendra, Bryan Brattlof,
Moteen Shah, Andrew Davis, u-boot
Hi Udit, Moteen,
On 9/10/25 11:38 PM, Kumar, Udit wrote:
>
> On 9/11/2025 3:15 AM, Judith Mendez wrote:
>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The macros
>> however, mix MMC device with the two bootmodes. Decouple the two types
>> of macros so that bootmodes can be identified with:
>> - BOOT_DEVICE_MMCSD
>> - BOOT_DEVICE_EMMC
>
> Few devices already (kind of have this )
>
> arch/arm/mach-k3/include/mach/j722s_spl.h
>
> #define BOOT_DEVICE_MMC 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> can we use in same way, BOOT_DEVICE_MMC as SD instead of adding SD as
> postfix and
>
> and add BOOT_DEVICE_EMMC, on devices where this is missing
No, there are two boot modes. MMCSD boot and EMMC boot. That is what I
am trying to make clear with switching:
> #define BOOT_DEVICE_MMC 0x08
> #define BOOT_DEVICE_EMMC 0x09
To:
> #define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
When we say: BOOT_DEVICE_MMC, it is not obvious it is from am62x/j722s
TRM:
MMCSD Boot (SD Card Boot or eMMC Boot using UDA). The goal of these
two specific macros is to mimic the supported boot modes.
>
>
>> according to devstat parsed boot mode values and on-board devices can be
>> identified with:
>> - BOOT_DEVICE_MMC1
>> - BOOT_DEVICE_MMC2
>> - BOOT_DEVICE_MMC2_2
>
> Why you need to change
>
> #define for BOOT_DEVICE_MMC1 and and BOOT_DEVICE_MMC2
Because the goals is to decouple the bootmodes from the macros used to
distinguish eMMC and SD card devices.
>
>
>
>> according to arbitrary numbers mainly used to differentiate between eMMC
>> and SD card.
>
> Please check subject line, this is not a fix
>
>> Signed-off-by: Judith Mendez <jm@ti.com>
>> ---
>> arch/arm/mach-k3/am62ax/am62a7_init.c | 4 ++--
>> arch/arm/mach-k3/am62ax/boot.c | 8 ++++----
>> arch/arm/mach-k3/am62px/am62p5_init.c | 12 ++++++------
>> arch/arm/mach-k3/am62x/am625_init.c | 4 ++--
>> arch/arm/mach-k3/am62x/boot.c | 8 ++++----
>> arch/arm/mach-k3/am64x/boot.c | 8 ++++----
>> arch/arm/mach-k3/am65x/am654_init.c | 18 ++++++++++--------
>> arch/arm/mach-k3/include/mach/am62_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/am62_spl.h | 10 +++++-----
>> arch/arm/mach-k3/include/mach/am62a_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/am62a_spl.h | 10 +++++-----
>> arch/arm/mach-k3/include/mach/am62p_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/am62p_spl.h | 10 +++++-----
>> arch/arm/mach-k3/include/mach/am64_hardware.h | 4 ++--
>> arch/arm/mach-k3/include/mach/am64_spl.h | 13 +++++++------
>> arch/arm/mach-k3/include/mach/am6_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/am6_spl.h | 13 +++++++++----
>> arch/arm/mach-k3/include/mach/j721e_hardware.h | 6 +++---
>> arch/arm/mach-k3/include/mach/j721e_spl.h | 14 ++++++++++----
>> .../arm/mach-k3/include/mach/j721s2_hardware.h | 6 +++---
>> arch/arm/mach-k3/include/mach/j721s2_spl.h | 13 +++++++++----
>> arch/arm/mach-k3/include/mach/j722s_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/j722s_spl.h | 10 +++++-----
>> .../arm/mach-k3/include/mach/j784s4_hardware.h | 6 +++---
>> arch/arm/mach-k3/include/mach/j784s4_spl.h | 13 +++++++++----
>> arch/arm/mach-k3/j721e/j721e_init.c | 14 +++++++++-----
>> arch/arm/mach-k3/j721s2/j721s2_init.c | 14 +++++++++-----
>> arch/arm/mach-k3/j722s/j722s_init.c | 12 ++++++------
>> arch/arm/mach-k3/j784s4/j784s4_init.c | 14 +++++++++-----
>> 29 files changed, 160 insertions(+), 124 deletions(-)
>>
>> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/
>> am62ax/am62a7_init.c
>> index 00173e6836b..1fd466bbdfc 100644
>> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
>> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
>> @@ -225,8 +225,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32
>> boot_device)
>> if (IS_ENABLED(CONFIG_SPL_FS_FAT) ||
>> IS_ENABLED(CONFIG_SPL_FS_EXT4))
>> return MMCSD_MODE_FS;
>> return MMCSD_MODE_EMMCBOOT;
>> [..]
>> + if (bootmode == BOOT_DEVICE_EMMC)
>> + bootmode = BOOT_DEVICE_MMC1;
>> +
>
> Could you test once, eMMC on J784s4
I do not have J784s4, Moteen, would you be able to test?
~ Judith
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-11 14:48 ` Judith Mendez
@ 2025-09-15 11:35 ` Moteen Shah
2025-09-15 18:31 ` Judith Mendez
0 siblings, 1 reply; 28+ messages in thread
From: Moteen Shah @ 2025-09-15 11:35 UTC (permalink / raw)
To: Judith Mendez, Kumar, Udit, Tom Rini
Cc: Manorit Chawdhry, Vignesh Raghavendra, Bryan Brattlof,
Andrew Davis, u-boot
Hey Judith,
On 11/09/25 20:18, Judith Mendez wrote:
> Hi Udit, Moteen,
>
> On 9/10/25 11:38 PM, Kumar, Udit wrote:
>>
>> On 9/11/2025 3:15 AM, Judith Mendez wrote:
>>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The
>>> macros
>>> however, mix MMC device with the two bootmodes. Decouple the two types
>>> of macros so that bootmodes can be identified with:
>>> - BOOT_DEVICE_MMCSD
>>> - BOOT_DEVICE_EMMC
>>
>> Few devices already (kind of have this )
>>
>> arch/arm/mach-k3/include/mach/j722s_spl.h
>>
>> #define BOOT_DEVICE_MMC 0x08
>> #define BOOT_DEVICE_EMMC 0x09
>>
>> can we use in same way, BOOT_DEVICE_MMC as SD instead of adding SD
>> as postfix and
>>
>> and add BOOT_DEVICE_EMMC, on devices where this is missing
>
> No, there are two boot modes. MMCSD boot and EMMC boot. That is what I
> am trying to make clear with switching:
>
> > #define BOOT_DEVICE_MMC 0x08
> > #define BOOT_DEVICE_EMMC 0x09
> To:
>
> > #define BOOT_DEVICE_MMCSD 0x08
> > #define BOOT_DEVICE_EMMC 0x09
>
> When we say: BOOT_DEVICE_MMC, it is not obvious it is from am62x/j722s
> TRM:
>
> MMCSD Boot (SD Card Boot or eMMC Boot using UDA). The goal of these
> two specific macros is to mimic the supported boot modes.
>
>>
>>
>>> according to devstat parsed boot mode values and on-board devices
>>> can be
>>> identified with:
>>> - BOOT_DEVICE_MMC1
>>> - BOOT_DEVICE_MMC2
>>> - BOOT_DEVICE_MMC2_2
>>
>> Why you need to change
>>
>> #define for BOOT_DEVICE_MMC1 and and BOOT_DEVICE_MMC2
>
> Because the goals is to decouple the bootmodes from the macros used to
> distinguish eMMC and SD card devices.
Isn't MMC1=eMMC and MMC2=MMCSD u-boot's own notation? In which case
there already is a clear distinction.
With the case with am62x/j722s, I agree that there needs to be a clarity
with the modes, BOOT_DEVICE_MMC is vague.
>
>>
>>
>>
>>> according to arbitrary numbers mainly used to differentiate between
>>> eMMC
>>> and SD card.
>>
>> Please check subject line, this is not a fix
>>
>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>> ---
>>> arch/arm/mach-k3/am62ax/am62a7_init.c | 4 ++--
>>> arch/arm/mach-k3/am62ax/boot.c | 8 ++++----
>>> arch/arm/mach-k3/am62px/am62p5_init.c | 12 ++++++------
>>> arch/arm/mach-k3/am62x/am625_init.c | 4 ++--
>>> arch/arm/mach-k3/am62x/boot.c | 8 ++++----
>>> arch/arm/mach-k3/am64x/boot.c | 8 ++++----
>>> arch/arm/mach-k3/am65x/am654_init.c | 18
>>> ++++++++++--------
>>> arch/arm/mach-k3/include/mach/am62_hardware.h | 8 ++++----
>>> arch/arm/mach-k3/include/mach/am62_spl.h | 10 +++++-----
>>> arch/arm/mach-k3/include/mach/am62a_hardware.h | 8 ++++----
>>> arch/arm/mach-k3/include/mach/am62a_spl.h | 10 +++++-----
>>> arch/arm/mach-k3/include/mach/am62p_hardware.h | 8 ++++----
>>> arch/arm/mach-k3/include/mach/am62p_spl.h | 10 +++++-----
>>> arch/arm/mach-k3/include/mach/am64_hardware.h | 4 ++--
>>> arch/arm/mach-k3/include/mach/am64_spl.h | 13 +++++++------
>>> arch/arm/mach-k3/include/mach/am6_hardware.h | 8 ++++----
>>> arch/arm/mach-k3/include/mach/am6_spl.h | 13 +++++++++----
>>> arch/arm/mach-k3/include/mach/j721e_hardware.h | 6 +++---
>>> arch/arm/mach-k3/include/mach/j721e_spl.h | 14 ++++++++++----
>>> .../arm/mach-k3/include/mach/j721s2_hardware.h | 6 +++---
>>> arch/arm/mach-k3/include/mach/j721s2_spl.h | 13 +++++++++----
>>> arch/arm/mach-k3/include/mach/j722s_hardware.h | 8 ++++----
>>> arch/arm/mach-k3/include/mach/j722s_spl.h | 10 +++++-----
>>> .../arm/mach-k3/include/mach/j784s4_hardware.h | 6 +++---
>>> arch/arm/mach-k3/include/mach/j784s4_spl.h | 13 +++++++++----
>>> arch/arm/mach-k3/j721e/j721e_init.c | 14 +++++++++-----
>>> arch/arm/mach-k3/j721s2/j721s2_init.c | 14 +++++++++-----
>>> arch/arm/mach-k3/j722s/j722s_init.c | 12 ++++++------
>>> arch/arm/mach-k3/j784s4/j784s4_init.c | 14 +++++++++-----
>>> 29 files changed, 160 insertions(+), 124 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c
>>> b/arch/arm/mach-k3/ am62ax/am62a7_init.c
>>> index 00173e6836b..1fd466bbdfc 100644
>>> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
>>> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
>>> @@ -225,8 +225,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32
>>> boot_device)
>>> if (IS_ENABLED(CONFIG_SPL_FS_FAT) ||
>>> IS_ENABLED(CONFIG_SPL_FS_EXT4))
>>> return MMCSD_MODE_FS;
>>> return MMCSD_MODE_EMMCBOOT;
>>> [..]
>>> + if (bootmode == BOOT_DEVICE_EMMC)
>>> + bootmode = BOOT_DEVICE_MMC1;
>>> +
>>
>> Could you test once, eMMC on J784s4
>
> I do not have J784s4, Moteen, would you be able to test?
I tested this series on J784s4, MMCSD boot and eMMC boot 0 boot works fine.
Regards,
Moteen
>
> ~ Judith
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-15 11:35 ` Moteen Shah
@ 2025-09-15 18:31 ` Judith Mendez
0 siblings, 0 replies; 28+ messages in thread
From: Judith Mendez @ 2025-09-15 18:31 UTC (permalink / raw)
To: Moteen Shah, Kumar, Udit, Tom Rini
Cc: Manorit Chawdhry, Vignesh Raghavendra, Bryan Brattlof,
Andrew Davis, u-boot
Hi Moteen,
On 9/15/25 6:35 AM, Moteen Shah wrote:
> Hey Judith,
>
> On 11/09/25 20:18, Judith Mendez wrote:
>> Hi Udit, Moteen,
>>
>> On 9/10/25 11:38 PM, Kumar, Udit wrote:
>>>
>>> On 9/11/2025 3:15 AM, Judith Mendez wrote:
>>>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The
>>>> macros
>>>> however, mix MMC device with the two bootmodes. Decouple the two types
>>>> of macros so that bootmodes can be identified with:
>>>> - BOOT_DEVICE_MMCSD
>>>> - BOOT_DEVICE_EMMC
>>>
>>> Few devices already (kind of have this )
>>>
>>> arch/arm/mach-k3/include/mach/j722s_spl.h
>>>
>>> #define BOOT_DEVICE_MMC 0x08
>>> #define BOOT_DEVICE_EMMC 0x09
>>>
>>> can we use in same way, BOOT_DEVICE_MMC as SD instead of adding SD
>>> as postfix and
>>>
>>> and add BOOT_DEVICE_EMMC, on devices where this is missing
>>
>> No, there are two boot modes. MMCSD boot and EMMC boot. That is what I
>> am trying to make clear with switching:
>>
>> > #define BOOT_DEVICE_MMC 0x08
>> > #define BOOT_DEVICE_EMMC 0x09
>> To:
>>
>> > #define BOOT_DEVICE_MMCSD 0x08
>> > #define BOOT_DEVICE_EMMC 0x09
>>
>> When we say: BOOT_DEVICE_MMC, it is not obvious it is from am62x/j722s
>> TRM:
>>
>> MMCSD Boot (SD Card Boot or eMMC Boot using UDA). The goal of these
>> two specific macros is to mimic the supported boot modes.
>>
>>>
>>>
>>>> according to devstat parsed boot mode values and on-board devices
>>>> can be
>>>> identified with:
>>>> - BOOT_DEVICE_MMC1
>>>> - BOOT_DEVICE_MMC2
>>>> - BOOT_DEVICE_MMC2_2
>>>
>>> Why you need to change
>>>
>>> #define for BOOT_DEVICE_MMC1 and and BOOT_DEVICE_MMC2
>>
>> Because the goals is to decouple the bootmodes from the macros used to
>> distinguish eMMC and SD card devices.
>
> Isn't MMC1=eMMC and MMC2=MMCSD u-boot's own notation? In which case
> there already is a clear distinction.
> With the case with am62x/j722s, I agree that there needs to be a clarity
> with the modes, BOOT_DEVICE_MMC is vague.
Firstly, MMC1=eMMC device and MMC2=SD card for K3.
Secondly, when we say we need a better distinction, it is for
distinguishing the boot modes from the BOOT_DEVICE_MMC1 and
BOOT_DEVICE_MMC2 devices. Both of which may be used interchangeably
in spl_mmc_boot_mode() but they are not the same.
~ Judith
>
>>
>>>
>>>
>>>
>>>> according to arbitrary numbers mainly used to differentiate between
>>>> eMMC
>>>> and SD card.
>>>
>>> Please check subject line, this is not a fix
>>>
>>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>>> ---
>>>> arch/arm/mach-k3/am62ax/am62a7_init.c | 4 ++--
>>>> arch/arm/mach-k3/am62ax/boot.c | 8 ++++----
>>>> arch/arm/mach-k3/am62px/am62p5_init.c | 12 ++++++------
>>>> arch/arm/mach-k3/am62x/am625_init.c | 4 ++--
>>>> arch/arm/mach-k3/am62x/boot.c | 8 ++++----
>>>> arch/arm/mach-k3/am64x/boot.c | 8 ++++----
>>>> arch/arm/mach-k3/am65x/am654_init.c | 18 +++++++++
>>>> +--------
>>>> arch/arm/mach-k3/include/mach/am62_hardware.h | 8 ++++----
>>>> arch/arm/mach-k3/include/mach/am62_spl.h | 10 +++++-----
>>>> arch/arm/mach-k3/include/mach/am62a_hardware.h | 8 ++++----
>>>> arch/arm/mach-k3/include/mach/am62a_spl.h | 10 +++++-----
>>>> arch/arm/mach-k3/include/mach/am62p_hardware.h | 8 ++++----
>>>> arch/arm/mach-k3/include/mach/am62p_spl.h | 10 +++++-----
>>>> arch/arm/mach-k3/include/mach/am64_hardware.h | 4 ++--
>>>> arch/arm/mach-k3/include/mach/am64_spl.h | 13 +++++++------
>>>> arch/arm/mach-k3/include/mach/am6_hardware.h | 8 ++++----
>>>> arch/arm/mach-k3/include/mach/am6_spl.h | 13 +++++++++----
>>>> arch/arm/mach-k3/include/mach/j721e_hardware.h | 6 +++---
>>>> arch/arm/mach-k3/include/mach/j721e_spl.h | 14 ++++++++++----
>>>> .../arm/mach-k3/include/mach/j721s2_hardware.h | 6 +++---
>>>> arch/arm/mach-k3/include/mach/j721s2_spl.h | 13 +++++++++----
>>>> arch/arm/mach-k3/include/mach/j722s_hardware.h | 8 ++++----
>>>> arch/arm/mach-k3/include/mach/j722s_spl.h | 10 +++++-----
>>>> .../arm/mach-k3/include/mach/j784s4_hardware.h | 6 +++---
>>>> arch/arm/mach-k3/include/mach/j784s4_spl.h | 13 +++++++++----
>>>> arch/arm/mach-k3/j721e/j721e_init.c | 14 +++++++++-----
>>>> arch/arm/mach-k3/j721s2/j721s2_init.c | 14 +++++++++-----
>>>> arch/arm/mach-k3/j722s/j722s_init.c | 12 ++++++------
>>>> arch/arm/mach-k3/j784s4/j784s4_init.c | 14 +++++++++-----
>>>> 29 files changed, 160 insertions(+), 124 deletions(-)
>>>>
>>>> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-
>>>> k3/ am62ax/am62a7_init.c
>>>> index 00173e6836b..1fd466bbdfc 100644
>>>> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
>>>> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
>>>> @@ -225,8 +225,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32
>>>> boot_device)
>>>> if (IS_ENABLED(CONFIG_SPL_FS_FAT) ||
>>>> IS_ENABLED(CONFIG_SPL_FS_EXT4))
>>>> return MMCSD_MODE_FS;
>>>> return MMCSD_MODE_EMMCBOOT;
>>>> [..]
>>>> + if (bootmode == BOOT_DEVICE_EMMC)
>>>> + bootmode = BOOT_DEVICE_MMC1;
>>>> +
>>>
>>> Could you test once, eMMC on J784s4
>>
>> I do not have J784s4, Moteen, would you be able to test?
>
> I tested this series on J784s4, MMCSD boot and eMMC boot 0 boot works fine.
>
> Regards,
> Moteen
>
>>
>> ~ Judith
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-10 21:45 ` [PATCH 1/4] arm: mach-k3: Fix MMC macros Judith Mendez
2025-09-11 4:38 ` Kumar, Udit
@ 2025-09-11 5:11 ` Anshul Dalal
2025-09-11 14:59 ` Judith Mendez
2025-09-15 11:40 ` Moteen Shah
2025-09-15 14:22 ` Wadim Egorov
3 siblings, 1 reply; 28+ messages in thread
From: Anshul Dalal @ 2025-09-11 5:11 UTC (permalink / raw)
To: Judith Mendez, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Andrew Davis, Udit Kumar, u-boot
On Thu Sep 11, 2025 at 3:15 AM IST, Judith Mendez wrote:
> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The macros
> however, mix MMC device with the two bootmodes. Decouple the two types
> of macros so that bootmodes can be identified with:
> - BOOT_DEVICE_MMCSD
> - BOOT_DEVICE_EMMC
> according to devstat parsed boot mode values and on-board devices can be
> identified with:
> - BOOT_DEVICE_MMC1
> - BOOT_DEVICE_MMC2
> - BOOT_DEVICE_MMC2_2
> according to arbitrary numbers mainly used to differentiate between eMMC
> and SD card.
>
> Signed-off-by: Judith Mendez <jm@ti.com>
> ---
I guess the confusion here is how we are calling boot modes from devstat
as well as the boot device as BOOT_DEVICE_*. Perhaps we should rename
the former to DEVSTAT_BOOT_MODE_* or something along those lines.
That would make the difference between a boot *mode* and a boot *device*
more clear, DEVSTAT_BOOT_MODE_MMCSD or DEVSTATE_BOOT_MODE_EMMC would
distinguish between SD or EMMC boot modes with BOOT_DEVICE_MMC*
indicating the MMC port used.
This would also allow use to only have the respective
DEVSTAT_BOOT_MODE_* defined in each soc's headers with BOOT_DEVICE_*
coming from arch/arm/include/asm/spl.h.
Regards,
Anshul
> arch/arm/mach-k3/am62ax/am62a7_init.c | 4 ++--
> arch/arm/mach-k3/am62ax/boot.c | 8 ++++----
> arch/arm/mach-k3/am62px/am62p5_init.c | 12 ++++++------
> arch/arm/mach-k3/am62x/am625_init.c | 4 ++--
> arch/arm/mach-k3/am62x/boot.c | 8 ++++----
> arch/arm/mach-k3/am64x/boot.c | 8 ++++----
> arch/arm/mach-k3/am65x/am654_init.c | 18 ++++++++++--------
> arch/arm/mach-k3/include/mach/am62_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am62_spl.h | 10 +++++-----
> arch/arm/mach-k3/include/mach/am62a_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am62a_spl.h | 10 +++++-----
> arch/arm/mach-k3/include/mach/am62p_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am62p_spl.h | 10 +++++-----
> arch/arm/mach-k3/include/mach/am64_hardware.h | 4 ++--
> arch/arm/mach-k3/include/mach/am64_spl.h | 13 +++++++------
> arch/arm/mach-k3/include/mach/am6_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am6_spl.h | 13 +++++++++----
> arch/arm/mach-k3/include/mach/j721e_hardware.h | 6 +++---
> arch/arm/mach-k3/include/mach/j721e_spl.h | 14 ++++++++++----
> .../arm/mach-k3/include/mach/j721s2_hardware.h | 6 +++---
> arch/arm/mach-k3/include/mach/j721s2_spl.h | 13 +++++++++----
> arch/arm/mach-k3/include/mach/j722s_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/j722s_spl.h | 10 +++++-----
> .../arm/mach-k3/include/mach/j784s4_hardware.h | 6 +++---
> arch/arm/mach-k3/include/mach/j784s4_spl.h | 13 +++++++++----
> arch/arm/mach-k3/j721e/j721e_init.c | 14 +++++++++-----
> arch/arm/mach-k3/j721s2/j721s2_init.c | 14 +++++++++-----
> arch/arm/mach-k3/j722s/j722s_init.c | 12 ++++++------
> arch/arm/mach-k3/j784s4/j784s4_init.c | 14 +++++++++-----
> 29 files changed, 160 insertions(+), 124 deletions(-)
>
> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/am62ax/am62a7_init.c
> index 00173e6836b..1fd466bbdfc 100644
> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
> @@ -225,8 +225,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
> if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4))
> return MMCSD_MODE_FS;
> return MMCSD_MODE_EMMCBOOT;
> - case BOOT_DEVICE_MMC:
> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
> + case BOOT_DEVICE_MMCSD:
> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
> return MMCSD_MODE_RAW;
> default:
> return MMCSD_MODE_FS;
> diff --git a/arch/arm/mach-k3/am62ax/boot.c b/arch/arm/mach-k3/am62ax/boot.c
> index af7fce1e5e9..808224108b9 100644
> --- a/arch/arm/mach-k3/am62ax/boot.c
> +++ b/arch/arm/mach-k3/am62ax/boot.c
> @@ -21,7 +21,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
>
> - case BACKUP_BOOT_DEVICE_MMC:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> if (bkup_bootmode_cfg)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
> @@ -69,9 +69,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
> case BOOT_DEVICE_SPI_NAND:
> return BOOT_DEVICE_SPINAND;
>
> - case BOOT_DEVICE_MMC:
> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
> + case BOOT_DEVICE_MMCSD:
> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
>
> diff --git a/arch/arm/mach-k3/am62px/am62p5_init.c b/arch/arm/mach-k3/am62px/am62p5_init.c
> index 44a2d445d24..9574089325c 100644
> --- a/arch/arm/mach-k3/am62px/am62p5_init.c
> +++ b/arch/arm/mach-k3/am62px/am62p5_init.c
> @@ -271,8 +271,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
> if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4))
> return MMCSD_MODE_FS;
> return MMCSD_MODE_EMMCBOOT;
> - case BOOT_DEVICE_MMC:
> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
> + case BOOT_DEVICE_MMCSD:
> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
> return MMCSD_MODE_RAW;
> fallthrough;
> default:
> @@ -298,7 +298,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
>
> - case BACKUP_BOOT_DEVICE_MMC:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> if (bkup_bootmode_cfg)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
> @@ -346,9 +346,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
> case BOOT_DEVICE_SPI_NAND:
> return BOOT_DEVICE_SPINAND;
>
> - case BOOT_DEVICE_MMC:
> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
> + case BOOT_DEVICE_MMCSD:
> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
>
> diff --git a/arch/arm/mach-k3/am62x/am625_init.c b/arch/arm/mach-k3/am62x/am625_init.c
> index 8f4ddf59753..46da9ba8850 100644
> --- a/arch/arm/mach-k3/am62x/am625_init.c
> +++ b/arch/arm/mach-k3/am62x/am625_init.c
> @@ -312,8 +312,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
> if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4))
> return MMCSD_MODE_FS;
> return MMCSD_MODE_EMMCBOOT;
> - case BOOT_DEVICE_MMC:
> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
> + case BOOT_DEVICE_MMCSD:
> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
> return MMCSD_MODE_RAW;
> default:
> return MMCSD_MODE_FS;
> diff --git a/arch/arm/mach-k3/am62x/boot.c b/arch/arm/mach-k3/am62x/boot.c
> index a3a6cda6bdb..c5f6dcea2b9 100644
> --- a/arch/arm/mach-k3/am62x/boot.c
> +++ b/arch/arm/mach-k3/am62x/boot.c
> @@ -21,7 +21,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
>
> - case BACKUP_BOOT_DEVICE_MMC:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> if (bkup_bootmode_cfg)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
> @@ -66,9 +66,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
> case BOOT_DEVICE_EMMC:
> return BOOT_DEVICE_MMC1;
>
> - case BOOT_DEVICE_MMC:
> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
> + case BOOT_DEVICE_MMCSD:
> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
>
> diff --git a/arch/arm/mach-k3/am64x/boot.c b/arch/arm/mach-k3/am64x/boot.c
> index ce8ae941be6..6145c09bab5 100644
> --- a/arch/arm/mach-k3/am64x/boot.c
> +++ b/arch/arm/mach-k3/am64x/boot.c
> @@ -24,7 +24,7 @@ static u32 __get_backup_bootmedia(u32 main_devstat)
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
>
> - case BACKUP_BOOT_DEVICE_MMC:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> if (bkup_bootmode_cfg)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
> @@ -68,9 +68,9 @@ static u32 __get_primary_bootmedia(u32 main_devstat)
> case BOOT_DEVICE_NAND:
> return BOOT_DEVICE_NAND;
>
> - case BOOT_DEVICE_MMC:
> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
> + case BOOT_DEVICE_MMCSD:
> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
>
> diff --git a/arch/arm/mach-k3/am65x/am654_init.c b/arch/arm/mach-k3/am65x/am654_init.c
> index a4f038029d7..9fcea12d243 100644
> --- a/arch/arm/mach-k3/am65x/am654_init.c
> +++ b/arch/arm/mach-k3/am65x/am654_init.c
> @@ -272,7 +272,7 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
>
> /* eMMC boot0 mode is only supported for primary boot */
> if (bootindex == K3_PRIMARY_BOOTMODE &&
> - bootmode == BOOT_DEVICE_MMC1)
> + bootmode == BOOT_DEVICE_EMMC)
> return MMCSD_MODE_EMMCBOOT;
> #endif
>
> @@ -296,10 +296,10 @@ static u32 __get_backup_bootmedia(u32 devstat)
> return BOOT_DEVICE_UART;
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
> - case BACKUP_BOOT_DEVICE_MMC2:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> {
> - u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >>
> - CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT;
> + u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK) >>
> + CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT;
> if (port == 0x0)
> return BOOT_DEVICE_MMC1;
> return BOOT_DEVICE_MMC2;
> @@ -323,12 +323,14 @@ static u32 __get_primary_bootmedia(u32 devstat)
> if (bootmode == BOOT_DEVICE_OSPI || bootmode == BOOT_DEVICE_QSPI)
> bootmode = BOOT_DEVICE_SPI;
>
> - if (bootmode == BOOT_DEVICE_MMC2) {
> - u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_MMC_PORT_MASK) >>
> - CTRLMMR_MAIN_DEVSTAT_MMC_PORT_SHIFT;
> + if (bootmode == BOOT_DEVICE_MMCSD) {
> + bootmode = BOOT_DEVICE_MMC2;
> + u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_MASK) >>
> + CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_SHIFT;
> if (port == 0x0)
> bootmode = BOOT_DEVICE_MMC1;
> - } else if (bootmode == BOOT_DEVICE_MMC1) {
> + } else if (bootmode == BOOT_DEVICE_EMMC) {
> + bootmode = BOOT_DEVICE_MMC1;
> u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_MASK) >>
> CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT;
> if (port == 0x1)
> diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h
> index 2f5655bf24a..94f2208cf52 100644
> --- a/arch/arm/mach-k3/include/mach/am62_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h
> @@ -58,10 +58,10 @@
> #define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK (~BIT(17))
>
> /* Primary Bootmode MMC Config macros */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>
> /* Primary Bootmode USB Config macros */
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> diff --git a/arch/arm/mach-k3/include/mach/am62_spl.h b/arch/arm/mach-k3/include/mach/am62_spl.h
> index 2c9139d2cc0..8df53ac38bb 100644
> --- a/arch/arm/mach-k3/include/mach/am62_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am62_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -29,16 +29,16 @@
>
> /* U-Boot used aliases */
> #define BOOT_DEVICE_ETHERNET 0x04
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> /* Invalid */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/am62a_hardware.h b/arch/arm/mach-k3/include/mach/am62a_hardware.h
> index f3fd736f31b..7f715d6a7ab 100644
> --- a/arch/arm/mach-k3/include/mach/am62a_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am62a_hardware.h
> @@ -30,10 +30,10 @@
> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>
> /* Primary Bootmode MMC Config macros */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>
> /* Primary Bootmode USB Config macros */
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> diff --git a/arch/arm/mach-k3/include/mach/am62a_spl.h b/arch/arm/mach-k3/include/mach/am62a_spl.h
> index dd0f57714f5..323b9d404aa 100644
> --- a/arch/arm/mach-k3/include/mach/am62a_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am62a_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -30,16 +30,16 @@
> /* U-Boot used aliases */
> #define BOOT_DEVICE_ETHERNET 0x04
> #define BOOT_DEVICE_SPINAND 0x10
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> /* Invalid */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/am62p_hardware.h b/arch/arm/mach-k3/include/mach/am62p_hardware.h
> index a310b52b45d..984c10719e1 100644
> --- a/arch/arm/mach-k3/include/mach/am62p_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am62p_hardware.h
> @@ -46,10 +46,10 @@
> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>
> /* Primary Bootmode MMC Config macros */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>
> /* Primary Bootmode USB Config macros */
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> diff --git a/arch/arm/mach-k3/include/mach/am62p_spl.h b/arch/arm/mach-k3/include/mach/am62p_spl.h
> index db145a7bc83..0ddcacd912b 100644
> --- a/arch/arm/mach-k3/include/mach/am62p_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am62p_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -30,16 +30,16 @@
> /* U-Boot used aliases */
> #define BOOT_DEVICE_ETHERNET 0x04
> #define BOOT_DEVICE_SPINAND 0x10
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> /* Invalid */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/am64_hardware.h b/arch/arm/mach-k3/include/mach/am64_hardware.h
> index 105b42986de..67dc4eeb82f 100644
> --- a/arch/arm/mach-k3/include/mach/am64_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am64_hardware.h
> @@ -33,8 +33,8 @@
> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>
> /* After the cfg mask and shifts have been applied */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x04
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x04
>
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_MASK 0x02
> diff --git a/arch/arm/mach-k3/include/mach/am64_spl.h b/arch/arm/mach-k3/include/mach/am64_spl.h
> index a0a517019cb..9bd14d3679d 100644
> --- a/arch/arm/mach-k3/include/mach/am64_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am64_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -29,16 +29,17 @@
>
> #define BOOT_DEVICE_NOBOOT 0x0F
>
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> -/* INVALID */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +/* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> +/* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/am6_hardware.h b/arch/arm/mach-k3/include/mach/am6_hardware.h
> index 8169584a372..008f80ae526 100644
> --- a/arch/arm/mach-k3/include/mach/am6_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am6_hardware.h
> @@ -21,12 +21,12 @@
> #define CTRLMMR_MAIN_DEVSTAT_BOOTMODE_SHIFT 0
> #define CTRLMMR_MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(6, 4)
> #define CTRLMMR_MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 4
> -#define CTRLMMR_MAIN_DEVSTAT_MMC_PORT_MASK GENMASK(12, 12)
> -#define CTRLMMR_MAIN_DEVSTAT_MMC_PORT_SHIFT 12
> +#define CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_MASK GENMASK(12, 12)
> +#define CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_SHIFT 12
> #define CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_MASK GENMASK(14, 14)
> #define CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT 14
> -#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_MASK GENMASK(17, 17)
> -#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 12
> +#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK GENMASK(17, 17)
> +#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 12
> #define CTRLMMR_MAIN_DEVSTAT_USB_MODE_SHIFT 9
> #define CTRLMMR_MAIN_DEVSTAT_USB_MODE_MASK GENMASK(10, 9)
>
> diff --git a/arch/arm/mach-k3/include/mach/am6_spl.h b/arch/arm/mach-k3/include/mach/am6_spl.h
> index 4c6950ff2b7..b7fa2f8d8b9 100644
> --- a/arch/arm/mach-k3/include/mach/am6_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am6_spl.h
> @@ -12,21 +12,26 @@
> #define BOOT_DEVICE_HYPERFLASH 0x03
> #define BOOT_DEVICE_SPI 0x04
> #define BOOT_DEVICE_I2C 0x05
> -#define BOOT_DEVICE_MMC2 0x06
> +#define BOOT_DEVICE_MMCSD 0x06
> #define BOOT_DEVICE_ETHERNET 0x07
> #define BOOT_DEVICE_DFU 0x08
> #define BOOT_DEVICE_USB 0x408
> #define BOOT_DEVICE_PCIE 0x09
> #define BOOT_DEVICE_UART 0x0a
> #define BOOT_DEVICE_NAND 0x0c
> -#define BOOT_DEVICE_MMC1 0x0d
> -#define BOOT_DEVICE_MMC2_2 0x0e
> +#define BOOT_DEVICE_EMMC 0x0d
> +
> +/* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> +/* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> #define BACKUP_BOOT_DEVICE_RAM 0x0
> #define BACKUP_BOOT_DEVICE_USB 0x1
> #define BACKUP_BOOT_DEVICE_UART 0x2
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x3
> -#define BACKUP_BOOT_DEVICE_MMC2 0x4
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x4
> #define BACKUP_BOOT_DEVICE_SPI 0x5
> #define BACKUP_BOOT_DEVICE_HYPERFLASH 0x6
> #define BACKUP_BOOT_DEVICE_I2C 0x7
> diff --git a/arch/arm/mach-k3/include/mach/j721e_hardware.h b/arch/arm/mach-k3/include/mach/j721e_hardware.h
> index 5bef309af0a..341e9c28d81 100644
> --- a/arch/arm/mach-k3/include/mach/j721e_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/j721e_hardware.h
> @@ -20,10 +20,10 @@
> #define MAIN_DEVSTAT_BOOT_MODE_B_SHIFT 0
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(3, 1)
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1
> -#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6)
> +#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK BIT(6)
> #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7)
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK BIT(7)
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 7
>
> #define CTRLMMR_WKUP_DEVSTAT (WKUP_CTRL_MMR0_BASE + 0x30)
> #define WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(5, 3)
> diff --git a/arch/arm/mach-k3/include/mach/j721e_spl.h b/arch/arm/mach-k3/include/mach/j721e_spl.h
> index aaee6535376..008595b7f26 100644
> --- a/arch/arm/mach-k3/include/mach/j721e_spl.h
> +++ b/arch/arm/mach-k3/include/mach/j721e_spl.h
> @@ -18,22 +18,28 @@
> #define BOOT_DEVICE_NOR BOOT_DEVICE_HYPERFLASH
>
> /* With BootMode B = 1 */
> -#define BOOT_DEVICE_MMC2 0x10
> -#define BOOT_DEVICE_MMC1 0x11
> +#define BOOT_DEVICE_MMCSD 0x10
> +#define BOOT_DEVICE_EMMC 0x11
> #define BOOT_DEVICE_DFU 0x12
> #define BOOT_DEVICE_UFS 0x13
> #define BOOT_DEVIE_GPMC 0x14
> #define BOOT_DEVICE_PCIE 0x15
> #define BOOT_DEVICE_XSPI 0x16
> #define BOOT_DEVICE_RAM 0x17
> -#define BOOT_DEVICE_MMC2_2 0xFF /* Invalid value */
> +
> + /* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> + /* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
> +
>
> /* Backup boot modes with MCU Only = 0 */
> #define BACKUP_BOOT_DEVICE_RAM 0x0
> #define BACKUP_BOOT_DEVICE_USB 0x1
> #define BACKUP_BOOT_DEVICE_UART 0x3
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x4
> -#define BACKUP_BOOT_DEVICE_MMC2 0x5
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x5
> #define BACKUP_BOOT_DEVICE_SPI 0x6
> #define BACKUP_BOOT_DEVICE_I2C 0x7
>
> diff --git a/arch/arm/mach-k3/include/mach/j721s2_hardware.h b/arch/arm/mach-k3/include/mach/j721s2_hardware.h
> index 82f076a45e0..f2a3140e0b6 100644
> --- a/arch/arm/mach-k3/include/mach/j721s2_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/j721s2_hardware.h
> @@ -20,10 +20,10 @@
> #define MAIN_DEVSTAT_BOOT_MODE_B_SHIFT 0
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(3, 1)
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1
> -#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6)
> +#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK BIT(6)
> #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7)
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK BIT(7)
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 7
>
> #define CTRLMMR_WKUP_DEVSTAT (WKUP_CTRL_MMR0_BASE + 0x30)
> #define WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(5, 3)
> diff --git a/arch/arm/mach-k3/include/mach/j721s2_spl.h b/arch/arm/mach-k3/include/mach/j721s2_spl.h
> index 47a61281d94..5ede79b6744 100644
> --- a/arch/arm/mach-k3/include/mach/j721s2_spl.h
> +++ b/arch/arm/mach-k3/include/mach/j721s2_spl.h
> @@ -19,22 +19,27 @@
> #define BOOT_DEVICE_NOR BOOT_DEVICE_HYPERFLASH
>
> /* With BootMode B = 1 */
> -#define BOOT_DEVICE_MMC2 0x10
> -#define BOOT_DEVICE_MMC1 0x11
> +#define BOOT_DEVICE_MMCSD 0x10
> +#define BOOT_DEVICE_EMMC 0x11
> #define BOOT_DEVICE_DFU 0x12
> #define BOOT_DEVICE_UFS 0x13
> #define BOOT_DEVIE_GPMC 0x14
> #define BOOT_DEVICE_PCIE 0x15
> #define BOOT_DEVICE_XSPI 0x16
> #define BOOT_DEVICE_RAM 0x17
> -#define BOOT_DEVICE_MMC2_2 0xFF /* Invalid value */
> +
> +/* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> +/* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup boot modes with MCU Only = 0 */
> #define BACKUP_BOOT_DEVICE_RAM 0x0
> #define BACKUP_BOOT_DEVICE_USB 0x1
> #define BACKUP_BOOT_DEVICE_UART 0x3
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x4
> -#define BACKUP_BOOT_DEVICE_MMC2 0x5
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x5
> #define BACKUP_BOOT_DEVICE_SPI 0x6
> #define BACKUP_BOOT_DEVICE_I2C 0x7
>
> diff --git a/arch/arm/mach-k3/include/mach/j722s_hardware.h b/arch/arm/mach-k3/include/mach/j722s_hardware.h
> index 0c695134c28..77b455af09a 100644
> --- a/arch/arm/mach-k3/include/mach/j722s_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/j722s_hardware.h
> @@ -30,10 +30,10 @@
> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>
> /* Primary Bootmode MMC Config macros */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>
> /* Primary Bootmode USB Config macros */
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> diff --git a/arch/arm/mach-k3/include/mach/j722s_spl.h b/arch/arm/mach-k3/include/mach/j722s_spl.h
> index a91cc82448f..aea43eeb23c 100644
> --- a/arch/arm/mach-k3/include/mach/j722s_spl.h
> +++ b/arch/arm/mach-k3/include/mach/j722s_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -31,16 +31,16 @@
> /* U-Boot used aliases */
> #define BOOT_DEVICE_ETHERNET 0x04
> #define BOOT_DEVICE_SPINAND 0x10
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> /* Invalid */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/j784s4_hardware.h b/arch/arm/mach-k3/include/mach/j784s4_hardware.h
> index 29a894baed3..e8e2037f804 100644
> --- a/arch/arm/mach-k3/include/mach/j784s4_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/j784s4_hardware.h
> @@ -20,10 +20,10 @@
> #define MAIN_DEVSTAT_BOOT_MODE_B_SHIFT 0
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(3, 1)
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1
> -#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6)
> +#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK BIT(6)
> #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7)
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK BIT(7)
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 7
>
> #define CTRLMMR_WKUP_DEVSTAT (WKUP_CTRL_MMR0_BASE + 0x30)
> #define WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(5, 3)
> diff --git a/arch/arm/mach-k3/include/mach/j784s4_spl.h b/arch/arm/mach-k3/include/mach/j784s4_spl.h
> index 3814dc95d01..0871a85d0c5 100644
> --- a/arch/arm/mach-k3/include/mach/j784s4_spl.h
> +++ b/arch/arm/mach-k3/include/mach/j784s4_spl.h
> @@ -19,22 +19,27 @@
> #define BOOT_DEVICE_NOR BOOT_DEVICE_HYPERFLASH
>
> /* With BootMode B = 1 */
> -#define BOOT_DEVICE_MMC2 0x10
> -#define BOOT_DEVICE_MMC1 0x11
> +#define BOOT_DEVICE_MMCSD 0x10
> +#define BOOT_DEVICE_EMMC 0x11
> #define BOOT_DEVICE_DFU 0x12
> #define BOOT_DEVICE_UFS 0x13
> #define BOOT_DEVIE_GPMC 0x14
> #define BOOT_DEVICE_PCIE 0x15
> #define BOOT_DEVICE_XSPI 0x16
> #define BOOT_DEVICE_RAM 0x17
> -#define BOOT_DEVICE_MMC2_2 0xFF /* Invalid value */
> +
> +/* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> +/* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup boot modes with MCU Only = 0 */
> #define BACKUP_BOOT_DEVICE_RAM 0x0
> #define BACKUP_BOOT_DEVICE_USB 0x1
> #define BACKUP_BOOT_DEVICE_UART 0x3
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x4
> -#define BACKUP_BOOT_DEVICE_MMC2 0x5
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x5
> #define BACKUP_BOOT_DEVICE_SPI 0x6
> #define BACKUP_BOOT_DEVICE_I2C 0x7
>
> diff --git a/arch/arm/mach-k3/j721e/j721e_init.c b/arch/arm/mach-k3/j721e/j721e_init.c
> index f9af0288cf6..30087705334 100644
> --- a/arch/arm/mach-k3/j721e/j721e_init.c
> +++ b/arch/arm/mach-k3/j721e/j721e_init.c
> @@ -450,10 +450,10 @@ static u32 __get_backup_bootmedia(u32 main_devstat)
> return BOOT_DEVICE_UART;
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
> - case BACKUP_BOOT_DEVICE_MMC2:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> {
> - u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT;
> + u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT;
> if (port == 0x0)
> return BOOT_DEVICE_MMC1;
> return BOOT_DEVICE_MMC2;
> @@ -480,14 +480,18 @@ static u32 __get_primary_bootmedia(u32 main_devstat, u32 wkup_devstat)
> bootmode == BOOT_DEVICE_XSPI)
> bootmode = BOOT_DEVICE_SPI;
>
> - if (bootmode == BOOT_DEVICE_MMC2) {
> + if (bootmode == BOOT_DEVICE_MMCSD) {
> + bootmode = BOOT_DEVICE_MMC2;
> u32 port = (main_devstat &
> - MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK) >>
> MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT;
> if (port == 0x0)
> bootmode = BOOT_DEVICE_MMC1;
> }
>
> + if (bootmode == BOOT_DEVICE_EMMC)
> + bootmode = BOOT_DEVICE_MMC1;
> +
> return bootmode;
> }
>
> diff --git a/arch/arm/mach-k3/j721s2/j721s2_init.c b/arch/arm/mach-k3/j721s2/j721s2_init.c
> index eee3d0440ac..407040a4c0e 100644
> --- a/arch/arm/mach-k3/j721s2/j721s2_init.c
> +++ b/arch/arm/mach-k3/j721s2/j721s2_init.c
> @@ -373,10 +373,10 @@ static u32 __get_backup_bootmedia(u32 main_devstat)
> return BOOT_DEVICE_UART;
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
> - case BACKUP_BOOT_DEVICE_MMC2:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> {
> - u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT;
> + u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT;
> if (port == 0x0)
> return BOOT_DEVICE_MMC1;
> return BOOT_DEVICE_MMC2;
> @@ -402,14 +402,18 @@ static u32 __get_primary_bootmedia(u32 main_devstat, u32 wkup_devstat)
> bootmode == BOOT_DEVICE_XSPI)
> bootmode = BOOT_DEVICE_SPI;
>
> - if (bootmode == BOOT_DEVICE_MMC2) {
> + if (bootmode == BOOT_DEVICE_MMCSD) {
> + bootmode = BOOT_DEVICE_MMC2;
> u32 port = (main_devstat &
> - MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK) >>
> MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT;
> if (port == 0x0)
> bootmode = BOOT_DEVICE_MMC1;
> }
>
> + if (bootmode == BOOT_DEVICE_EMMC)
> + bootmode = BOOT_DEVICE_MMC1;
> +
> return bootmode;
> }
>
> diff --git a/arch/arm/mach-k3/j722s/j722s_init.c b/arch/arm/mach-k3/j722s/j722s_init.c
> index 1180c75f551..86e1d29aea4 100644
> --- a/arch/arm/mach-k3/j722s/j722s_init.c
> +++ b/arch/arm/mach-k3/j722s/j722s_init.c
> @@ -224,7 +224,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
>
> - case BACKUP_BOOT_DEVICE_MMC:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> if (bkup_bootmode_cfg)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
> @@ -274,9 +274,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
> case BOOT_DEVICE_SPI_NAND:
> return BOOT_DEVICE_SPINAND;
>
> - case BOOT_DEVICE_MMC:
> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
> + case BOOT_DEVICE_MMCSD:
> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
>
> @@ -319,8 +319,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
> switch (bootmode) {
> case BOOT_DEVICE_EMMC:
> return MMCSD_MODE_EMMCBOOT;
> - case BOOT_DEVICE_MMC:
> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
> + case BOOT_DEVICE_MMCSD:
> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
> return MMCSD_MODE_RAW;
> default:
> return MMCSD_MODE_FS;
> diff --git a/arch/arm/mach-k3/j784s4/j784s4_init.c b/arch/arm/mach-k3/j784s4/j784s4_init.c
> index 53f152ccd9c..a1cef72bec3 100644
> --- a/arch/arm/mach-k3/j784s4/j784s4_init.c
> +++ b/arch/arm/mach-k3/j784s4/j784s4_init.c
> @@ -352,10 +352,10 @@ static u32 __get_backup_bootmedia(u32 main_devstat)
> return BOOT_DEVICE_UART;
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
> - case BACKUP_BOOT_DEVICE_MMC2:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> {
> - u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT;
> + u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT;
> if (port == 0x0)
> return BOOT_DEVICE_MMC1;
> return BOOT_DEVICE_MMC2;
> @@ -381,14 +381,18 @@ static u32 __get_primary_bootmedia(u32 main_devstat, u32 wkup_devstat)
> bootmode == BOOT_DEVICE_XSPI)
> bootmode = BOOT_DEVICE_SPI;
>
> - if (bootmode == BOOT_DEVICE_MMC2) {
> + if (bootmode == BOOT_DEVICE_MMCSD) {
> + bootmode = BOOT_DEVICE_MMC2;
> u32 port = (main_devstat &
> - MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK) >>
> MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT;
> if (port == 0x0)
> bootmode = BOOT_DEVICE_MMC1;
> }
>
> + if (bootmode == BOOT_DEVICE_EMMC)
> + bootmode = BOOT_DEVICE_MMC1;
> +
> return bootmode;
> }
>
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-11 5:11 ` Anshul Dalal
@ 2025-09-11 14:59 ` Judith Mendez
2025-09-16 16:22 ` Andrew Davis
0 siblings, 1 reply; 28+ messages in thread
From: Judith Mendez @ 2025-09-11 14:59 UTC (permalink / raw)
To: Anshul Dalal, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Andrew Davis, Udit Kumar, u-boot
Hi Anshul,
On 9/11/25 12:11 AM, Anshul Dalal wrote:
> On Thu Sep 11, 2025 at 3:15 AM IST, Judith Mendez wrote:
>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The macros
>> however, mix MMC device with the two bootmodes. Decouple the two types
>> of macros so that bootmodes can be identified with:
>> - BOOT_DEVICE_MMCSD
>> - BOOT_DEVICE_EMMC
>> according to devstat parsed boot mode values and on-board devices can be
>> identified with:
>> - BOOT_DEVICE_MMC1
>> - BOOT_DEVICE_MMC2
>> - BOOT_DEVICE_MMC2_2
>> according to arbitrary numbers mainly used to differentiate between eMMC
>> and SD card.
>>
>> Signed-off-by: Judith Mendez <jm@ti.com>
>> ---
>
> I guess the confusion here is how we are calling boot modes from devstat
> as well as the boot device as BOOT_DEVICE_*. Perhaps we should rename
> the former to DEVSTAT_BOOT_MODE_* or something along those lines.
>
> That would make the difference between a boot *mode* and a boot *device*
> more clear, DEVSTAT_BOOT_MODE_MMCSD or DEVSTATE_BOOT_MODE_EMMC would
> distinguish between SD or EMMC boot modes with BOOT_DEVICE_MMC*
> indicating the MMC port used.
>
> This would also allow use to only have the respective
> DEVSTAT_BOOT_MODE_* defined in each soc's headers with BOOT_DEVICE_*
> coming from arch/arm/include/asm/spl.h.
Right, I guess if
BOOT_DEVICE_MMCSD
BOOT_DEVICE_EMMC
Is still not clear enough, it would be a good idea to use:
DEVSTAT_BOOT_MODE_MMCSD
DEVSTAT_BOOT_MODE_EMMC
Its only a real problem for MMC since we have the confusion with eMMC
boot and MMCSD boot and we mix the two as a result in
spl_mmc_boot_mode() and spl_boot_device().
Its not really an issue for other boot modes to warrant renaming all the
bootmodes, but I would like to make these macros as clear as possible in
this series since I plan to refactor spl_mmc_boot_mode() next.
So lets hear if any one else has a strong opinion on this before
deciding on:
DEVSTAT_BOOT_MODE_MMCSD
DEVSTAT_BOOT_MODE_EMMC
~ Judith
...
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-11 14:59 ` Judith Mendez
@ 2025-09-16 16:22 ` Andrew Davis
2025-09-16 17:11 ` Judith Mendez
2025-09-16 22:35 ` Judith Mendez
0 siblings, 2 replies; 28+ messages in thread
From: Andrew Davis @ 2025-09-16 16:22 UTC (permalink / raw)
To: Judith Mendez, Anshul Dalal, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Udit Kumar, u-boot
On 9/11/25 9:59 AM, Judith Mendez wrote:
> Hi Anshul,
>
> On 9/11/25 12:11 AM, Anshul Dalal wrote:
>> On Thu Sep 11, 2025 at 3:15 AM IST, Judith Mendez wrote:
>>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The macros
>>> however, mix MMC device with the two bootmodes. Decouple the two types
>>> of macros so that bootmodes can be identified with:
>>> - BOOT_DEVICE_MMCSD
>>> - BOOT_DEVICE_EMMC
>>> according to devstat parsed boot mode values and on-board devices can be
>>> identified with:
>>> - BOOT_DEVICE_MMC1
>>> - BOOT_DEVICE_MMC2
>>> - BOOT_DEVICE_MMC2_2
>>> according to arbitrary numbers mainly used to differentiate between eMMC
>>> and SD card.
>>>
>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>> ---
>>
>> I guess the confusion here is how we are calling boot modes from devstat
>> as well as the boot device as BOOT_DEVICE_*. Perhaps we should rename
>> the former to DEVSTAT_BOOT_MODE_* or something along those lines.
>>
>> That would make the difference between a boot *mode* and a boot *device*
>> more clear, DEVSTAT_BOOT_MODE_MMCSD or DEVSTATE_BOOT_MODE_EMMC would
>> distinguish between SD or EMMC boot modes with BOOT_DEVICE_MMC*
>> indicating the MMC port used.
>>
>> This would also allow use to only have the respective
>> DEVSTAT_BOOT_MODE_* defined in each soc's headers with BOOT_DEVICE_*
>> coming from arch/arm/include/asm/spl.h.
>
>
> Right, I guess if
>
> BOOT_DEVICE_MMCSD
> BOOT_DEVICE_EMMC
>
> Is still not clear enough, it would be a good idea to use:
> DEVSTAT_BOOT_MODE_MMCSD
> DEVSTAT_BOOT_MODE_EMMC
>
> Its only a real problem for MMC since we have the confusion with eMMC
> boot and MMCSD boot and we mix the two as a result in
> spl_mmc_boot_mode() and spl_boot_device().
>
>
> Its not really an issue for other boot modes to warrant renaming all the
> bootmodes, but I would like to make these macros as clear as possible in
> this series since I plan to refactor spl_mmc_boot_mode() next.
>
> So lets hear if any one else has a strong opinion on this before
> deciding on:
>
> DEVSTAT_BOOT_MODE_MMCSD
> DEVSTAT_BOOT_MODE_EMMC
This looks like the correct way to label these as they are the content
of the DEVSTAT register, this would also keep them from being confused
with the U-Boot internal definitions for BOOT_MODE_* and BOOT_DEVICE_*.
But you should do it for all the DEVSTAT register defines, not just
MMC and not just for Sitara, do it for all our K3 boards. It should
be a simple rename patch to start. Then you can work to detangle
"mode" from "device" for the MMC case as you are doing here.
Andrew
>
> ~ Judith
> ...
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-16 16:22 ` Andrew Davis
@ 2025-09-16 17:11 ` Judith Mendez
2025-09-16 22:35 ` Judith Mendez
1 sibling, 0 replies; 28+ messages in thread
From: Judith Mendez @ 2025-09-16 17:11 UTC (permalink / raw)
To: Andrew Davis, Anshul Dalal, Tom Rini
Cc: Manorit Chawdhry, Vignesh Raghavendra, Bryan Brattlof,
Jayesh Choudhary, Moteen Shah, Udit Kumar, u-boot
Hi Andrew,
On 9/16/25 11:22 AM, Andrew Davis wrote:
> On 9/11/25 9:59 AM, Judith Mendez wrote:
>> Hi Anshul,
>>
>> On 9/11/25 12:11 AM, Anshul Dalal wrote:
>>> On Thu Sep 11, 2025 at 3:15 AM IST, Judith Mendez wrote:
>>>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The
>>>> macros
>>>> however, mix MMC device with the two bootmodes. Decouple the two types
>>>> of macros so that bootmodes can be identified with:
>>>> - BOOT_DEVICE_MMCSD
>>>> - BOOT_DEVICE_EMMC
>>>> according to devstat parsed boot mode values and on-board devices
>>>> can be
>>>> identified with:
>>>> - BOOT_DEVICE_MMC1
>>>> - BOOT_DEVICE_MMC2
>>>> - BOOT_DEVICE_MMC2_2
>>>> according to arbitrary numbers mainly used to differentiate between
>>>> eMMC
>>>> and SD card.
>>>>
>>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>>> ---
>>>
>>> I guess the confusion here is how we are calling boot modes from devstat
>>> as well as the boot device as BOOT_DEVICE_*. Perhaps we should rename
>>> the former to DEVSTAT_BOOT_MODE_* or something along those lines.
>>>
>>> That would make the difference between a boot *mode* and a boot *device*
>>> more clear, DEVSTAT_BOOT_MODE_MMCSD or DEVSTATE_BOOT_MODE_EMMC would
>>> distinguish between SD or EMMC boot modes with BOOT_DEVICE_MMC*
>>> indicating the MMC port used.
>>>
>>> This would also allow use to only have the respective
>>> DEVSTAT_BOOT_MODE_* defined in each soc's headers with BOOT_DEVICE_*
>>> coming from arch/arm/include/asm/spl.h.
>>
>>
>> Right, I guess if
>>
>> BOOT_DEVICE_MMCSD
>> BOOT_DEVICE_EMMC
>>
>> Is still not clear enough, it would be a good idea to use:
>> DEVSTAT_BOOT_MODE_MMCSD
>> DEVSTAT_BOOT_MODE_EMMC
>>
>> Its only a real problem for MMC since we have the confusion with eMMC
>> boot and MMCSD boot and we mix the two as a result in
>> spl_mmc_boot_mode() and spl_boot_device().
>>
>>
>> Its not really an issue for other boot modes to warrant renaming all the
>> bootmodes, but I would like to make these macros as clear as possible in
>> this series since I plan to refactor spl_mmc_boot_mode() next.
>>
>> So lets hear if any one else has a strong opinion on this before
>> deciding on:
>>
>> DEVSTAT_BOOT_MODE_MMCSD
>> DEVSTAT_BOOT_MODE_EMMC
>
> This looks like the correct way to label these as they are the content
> of the DEVSTAT register, this would also keep them from being confused
> with the U-Boot internal definitions for BOOT_MODE_* and BOOT_DEVICE_*.
>
> But you should do it for all the DEVSTAT register defines, not just
> MMC and not just for Sitara, do it for all our K3 boards. It should
> be a simple rename patch to start. Then you can work to detangle
> "mode" from "device" for the MMC case as you are doing here.
If more than one person says it then it must be true. (:
Will send out v2 with that change.
~ Judith
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-16 16:22 ` Andrew Davis
2025-09-16 17:11 ` Judith Mendez
@ 2025-09-16 22:35 ` Judith Mendez
2025-09-17 3:41 ` Anshul Dalal
1 sibling, 1 reply; 28+ messages in thread
From: Judith Mendez @ 2025-09-16 22:35 UTC (permalink / raw)
To: Andrew Davis, Anshul Dalal, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Udit Kumar, u-boot
Hi Andrew, Anshul,
On 9/16/25 11:22 AM, Andrew Davis wrote:
> On 9/11/25 9:59 AM, Judith Mendez wrote:
>> Hi Anshul,
>>
>> On 9/11/25 12:11 AM, Anshul Dalal wrote:
>>> On Thu Sep 11, 2025 at 3:15 AM IST, Judith Mendez wrote:
>>>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The
>>>> macros
>>>> however, mix MMC device with the two bootmodes. Decouple the two types
>>>> of macros so that bootmodes can be identified with:
>>>> - BOOT_DEVICE_MMCSD
>>>> - BOOT_DEVICE_EMMC
>>>> according to devstat parsed boot mode values and on-board devices
>>>> can be
>>>> identified with:
>>>> - BOOT_DEVICE_MMC1
>>>> - BOOT_DEVICE_MMC2
>>>> - BOOT_DEVICE_MMC2_2
>>>> according to arbitrary numbers mainly used to differentiate between
>>>> eMMC
>>>> and SD card.
>>>>
>>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>>> ---
>>>
>>> I guess the confusion here is how we are calling boot modes from devstat
>>> as well as the boot device as BOOT_DEVICE_*. Perhaps we should rename
>>> the former to DEVSTAT_BOOT_MODE_* or something along those lines.
>>>
>>> That would make the difference between a boot *mode* and a boot *device*
>>> more clear, DEVSTAT_BOOT_MODE_MMCSD or DEVSTATE_BOOT_MODE_EMMC would
>>> distinguish between SD or EMMC boot modes with BOOT_DEVICE_MMC*
>>> indicating the MMC port used.
>>>
>>> This would also allow use to only have the respective
>>> DEVSTAT_BOOT_MODE_* defined in each soc's headers with BOOT_DEVICE_*
>>> coming from arch/arm/include/asm/spl.h.
>>
>>
>> Right, I guess if
>>
>> BOOT_DEVICE_MMCSD
>> BOOT_DEVICE_EMMC
>>
>> Is still not clear enough, it would be a good idea to use:
>> DEVSTAT_BOOT_MODE_MMCSD
>> DEVSTAT_BOOT_MODE_EMMC
>>
>> Its only a real problem for MMC since we have the confusion with eMMC
>> boot and MMCSD boot and we mix the two as a result in
>> spl_mmc_boot_mode() and spl_boot_device().
>>
>>
>> Its not really an issue for other boot modes to warrant renaming all the
>> bootmodes, but I would like to make these macros as clear as possible in
>> this series since I plan to refactor spl_mmc_boot_mode() next.
>>
>> So lets hear if any one else has a strong opinion on this before
>> deciding on:
>>
>> DEVSTAT_BOOT_MODE_MMCSD
>> DEVSTAT_BOOT_MODE_EMMC
>
> This looks like the correct way to label these as they are the content
> of the DEVSTAT register, this would also keep them from being confused
> with the U-Boot internal definitions for BOOT_MODE_* and BOOT_DEVICE_*.
>
> But you should do it for all the DEVSTAT register defines, not just
> MMC and not just for Sitara, do it for all our K3 boards. It should
> be a simple rename patch to start. Then you can work to detangle
> "mode" from "device" for the MMC case as you are doing here.
I take it back, seems like this cannot be done, u-boot source requires
all the macros:
BOOT_DEVICE_SPI
BOOT_DEVICE_RAM
BOOT_DEVICE_UART
etc...
in order to even build.
Simply renaming the macros to style:
DEVSTAT_BOOT_MODE_SPI
DEVSTAT_BOOT_MODE_RAM
DEVSTAT_BOOT_MODE_UART
will not work without creating a duplicate:
#define BOOT_DEVICE_SPI DEVSTAT_BOOT_MODE_SPI
#define BOOT_DEVICE_RAM DEVSTAT_BOOT_MODE_RAM
#define BOOT_DEVICE_UART DEVSTAT_BOOT_MODE_UART
or similar logic
So basically we would be doubling the size of all spl.h files.
In reality there is only confusion with MMC device/bootmodes,
we do not to rename every single boot modes/boot device since
there is no real confusion there.
~ Judith
-
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-16 22:35 ` Judith Mendez
@ 2025-09-17 3:41 ` Anshul Dalal
2025-09-17 16:06 ` Judith Mendez
0 siblings, 1 reply; 28+ messages in thread
From: Anshul Dalal @ 2025-09-17 3:41 UTC (permalink / raw)
To: Judith Mendez, Andrew Davis, Anshul Dalal, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Udit Kumar, u-boot
Hi Judith,
On Wed Sep 17, 2025 at 4:05 AM IST, Judith Mendez wrote:
> Hi Andrew, Anshul,
>
> On 9/16/25 11:22 AM, Andrew Davis wrote:
>> On 9/11/25 9:59 AM, Judith Mendez wrote:
>>> Hi Anshul,
>>>
>>> On 9/11/25 12:11 AM, Anshul Dalal wrote:
>>>> On Thu Sep 11, 2025 at 3:15 AM IST, Judith Mendez wrote:
>>>>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The
>>>>> macros
>>>>> however, mix MMC device with the two bootmodes. Decouple the two types
>>>>> of macros so that bootmodes can be identified with:
>>>>> - BOOT_DEVICE_MMCSD
>>>>> - BOOT_DEVICE_EMMC
>>>>> according to devstat parsed boot mode values and on-board devices
>>>>> can be
>>>>> identified with:
>>>>> - BOOT_DEVICE_MMC1
>>>>> - BOOT_DEVICE_MMC2
>>>>> - BOOT_DEVICE_MMC2_2
>>>>> according to arbitrary numbers mainly used to differentiate between
>>>>> eMMC
>>>>> and SD card.
>>>>>
>>>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>>>> ---
>>>>
>>>> I guess the confusion here is how we are calling boot modes from devstat
>>>> as well as the boot device as BOOT_DEVICE_*. Perhaps we should rename
>>>> the former to DEVSTAT_BOOT_MODE_* or something along those lines.
>>>>
>>>> That would make the difference between a boot *mode* and a boot *device*
>>>> more clear, DEVSTAT_BOOT_MODE_MMCSD or DEVSTATE_BOOT_MODE_EMMC would
>>>> distinguish between SD or EMMC boot modes with BOOT_DEVICE_MMC*
>>>> indicating the MMC port used.
>>>>
>>>> This would also allow use to only have the respective
>>>> DEVSTAT_BOOT_MODE_* defined in each soc's headers with BOOT_DEVICE_*
>>>> coming from arch/arm/include/asm/spl.h.
>>>
>>>
>>> Right, I guess if
>>>
>>> BOOT_DEVICE_MMCSD
>>> BOOT_DEVICE_EMMC
>>>
>>> Is still not clear enough, it would be a good idea to use:
>>> DEVSTAT_BOOT_MODE_MMCSD
>>> DEVSTAT_BOOT_MODE_EMMC
>>>
>>> Its only a real problem for MMC since we have the confusion with eMMC
>>> boot and MMCSD boot and we mix the two as a result in
>>> spl_mmc_boot_mode() and spl_boot_device().
>>>
>>>
>>> Its not really an issue for other boot modes to warrant renaming all the
>>> bootmodes, but I would like to make these macros as clear as possible in
>>> this series since I plan to refactor spl_mmc_boot_mode() next.
>>>
>>> So lets hear if any one else has a strong opinion on this before
>>> deciding on:
>>>
>>> DEVSTAT_BOOT_MODE_MMCSD
>>> DEVSTAT_BOOT_MODE_EMMC
>>
>> This looks like the correct way to label these as they are the content
>> of the DEVSTAT register, this would also keep them from being confused
>> with the U-Boot internal definitions for BOOT_MODE_* and BOOT_DEVICE_*.
>>
>> But you should do it for all the DEVSTAT register defines, not just
>> MMC and not just for Sitara, do it for all our K3 boards. It should
>> be a simple rename patch to start. Then you can work to detangle
>> "mode" from "device" for the MMC case as you are doing here.
>
> I take it back, seems like this cannot be done, u-boot source requires
> all the macros:
> BOOT_DEVICE_SPI
> BOOT_DEVICE_RAM
> BOOT_DEVICE_UART
> etc...
>
> in order to even build.
>
> Simply renaming the macros to style:
> DEVSTAT_BOOT_MODE_SPI
> DEVSTAT_BOOT_MODE_RAM
> DEVSTAT_BOOT_MODE_UART
>
> will not work without creating a duplicate:
> #define BOOT_DEVICE_SPI DEVSTAT_BOOT_MODE_SPI
> #define BOOT_DEVICE_RAM DEVSTAT_BOOT_MODE_RAM
> #define BOOT_DEVICE_UART DEVSTAT_BOOT_MODE_UART
> or similar logic
>
> So basically we would be doubling the size of all spl.h files.
>
> In reality there is only confusion with MMC device/bootmodes,
> we do not to rename every single boot modes/boot device since
> there is no real confusion there.
>
Correct me if I'm wrong here but BOOT_DEVICE_* should only be used
within the common u-boot source. Our job is to just the return the
correct macro from the SoC's boot.c file and ensure they are all unique
values.
If that's true, can we make use of BOOT_DEVICE_* defines from
arch/arm/include/asm/spl.h?
That should avoid duplication since we would just rename the existing
BOOT_DEVICE_* macros to DEVSTAT_BOOT_MODE_* in our board's spl.h while
relying on BOOT_DEVICE_* from arm's spl.h.
Regards,
Anshul
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-17 3:41 ` Anshul Dalal
@ 2025-09-17 16:06 ` Judith Mendez
2025-09-17 16:48 ` Andrew Davis
0 siblings, 1 reply; 28+ messages in thread
From: Judith Mendez @ 2025-09-17 16:06 UTC (permalink / raw)
To: Anshul Dalal, Andrew Davis, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Udit Kumar, u-boot
On 9/16/25 10:41 PM, Anshul Dalal wrote:
> Hi Judith,
>
> On Wed Sep 17, 2025 at 4:05 AM IST, Judith Mendez wrote:
>> Hi Andrew, Anshul,
>>
>> On 9/16/25 11:22 AM, Andrew Davis wrote:
>>> On 9/11/25 9:59 AM, Judith Mendez wrote:
>>>> Hi Anshul,
>>>>
>>>> On 9/11/25 12:11 AM, Anshul Dalal wrote:
>>>>> On Thu Sep 11, 2025 at 3:15 AM IST, Judith Mendez wrote:
>>>>>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The
>>>>>> macros
>>>>>> however, mix MMC device with the two bootmodes. Decouple the two types
>>>>>> of macros so that bootmodes can be identified with:
>>>>>> - BOOT_DEVICE_MMCSD
>>>>>> - BOOT_DEVICE_EMMC
>>>>>> according to devstat parsed boot mode values and on-board devices
>>>>>> can be
>>>>>> identified with:
>>>>>> - BOOT_DEVICE_MMC1
>>>>>> - BOOT_DEVICE_MMC2
>>>>>> - BOOT_DEVICE_MMC2_2
>>>>>> according to arbitrary numbers mainly used to differentiate between
>>>>>> eMMC
>>>>>> and SD card.
>>>>>>
>>>>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>>>>> ---
>>>>>
>>>>> I guess the confusion here is how we are calling boot modes from devstat
>>>>> as well as the boot device as BOOT_DEVICE_*. Perhaps we should rename
>>>>> the former to DEVSTAT_BOOT_MODE_* or something along those lines.
>>>>>
>>>>> That would make the difference between a boot *mode* and a boot *device*
>>>>> more clear, DEVSTAT_BOOT_MODE_MMCSD or DEVSTATE_BOOT_MODE_EMMC would
>>>>> distinguish between SD or EMMC boot modes with BOOT_DEVICE_MMC*
>>>>> indicating the MMC port used.
>>>>>
>>>>> This would also allow use to only have the respective
>>>>> DEVSTAT_BOOT_MODE_* defined in each soc's headers with BOOT_DEVICE_*
>>>>> coming from arch/arm/include/asm/spl.h.
>>>>
>>>>
>>>> Right, I guess if
>>>>
>>>> BOOT_DEVICE_MMCSD
>>>> BOOT_DEVICE_EMMC
>>>>
>>>> Is still not clear enough, it would be a good idea to use:
>>>> DEVSTAT_BOOT_MODE_MMCSD
>>>> DEVSTAT_BOOT_MODE_EMMC
>>>>
>>>> Its only a real problem for MMC since we have the confusion with eMMC
>>>> boot and MMCSD boot and we mix the two as a result in
>>>> spl_mmc_boot_mode() and spl_boot_device().
>>>>
>>>>
>>>> Its not really an issue for other boot modes to warrant renaming all the
>>>> bootmodes, but I would like to make these macros as clear as possible in
>>>> this series since I plan to refactor spl_mmc_boot_mode() next.
>>>>
>>>> So lets hear if any one else has a strong opinion on this before
>>>> deciding on:
>>>>
>>>> DEVSTAT_BOOT_MODE_MMCSD
>>>> DEVSTAT_BOOT_MODE_EMMC
>>>
>>> This looks like the correct way to label these as they are the content
>>> of the DEVSTAT register, this would also keep them from being confused
>>> with the U-Boot internal definitions for BOOT_MODE_* and BOOT_DEVICE_*.
>>>
>>> But you should do it for all the DEVSTAT register defines, not just
>>> MMC and not just for Sitara, do it for all our K3 boards. It should
>>> be a simple rename patch to start. Then you can work to detangle
>>> "mode" from "device" for the MMC case as you are doing here.
>>
>> I take it back, seems like this cannot be done, u-boot source requires
>> all the macros:
>> BOOT_DEVICE_SPI
>> BOOT_DEVICE_RAM
>> BOOT_DEVICE_UART
>> etc...
>>
>> in order to even build.
>>
>> Simply renaming the macros to style:
>> DEVSTAT_BOOT_MODE_SPI
>> DEVSTAT_BOOT_MODE_RAM
>> DEVSTAT_BOOT_MODE_UART
>>
>> will not work without creating a duplicate:
>> #define BOOT_DEVICE_SPI DEVSTAT_BOOT_MODE_SPI
>> #define BOOT_DEVICE_RAM DEVSTAT_BOOT_MODE_RAM
>> #define BOOT_DEVICE_UART DEVSTAT_BOOT_MODE_UART
>> or similar logic
>>
>> So basically we would be doubling the size of all spl.h files.
>>
>> In reality there is only confusion with MMC device/bootmodes,
>> we do not to rename every single boot modes/boot device since
>> there is no real confusion there.
>>
>
> Correct me if I'm wrong here but BOOT_DEVICE_* should only be used
> within the common u-boot source. Our job is to just the return the
> correct macro from the SoC's boot.c file and ensure they are all unique
> values.
>
> If that's true, can we make use of BOOT_DEVICE_* defines from
> arch/arm/include/asm/spl.h?
>
> That should avoid duplication since we would just rename the existing
> BOOT_DEVICE_* macros to DEVSTAT_BOOT_MODE_* in our board's spl.h while
> relying on BOOT_DEVICE_* from arm's spl.h.
Then we come back in a circle to the first real problem which is
untangling MMC bootmodes from MMC boot devices.
Why are we trying to refactor all the MMC_DEVICE_* ? There is no
real problem for those bootmodes / boot devices since boot device =
boot mode for those. It is only a real problem for MMC since boot device
DOES NOT equal boot mode for MMC.
~ Judith
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-17 16:06 ` Judith Mendez
@ 2025-09-17 16:48 ` Andrew Davis
2025-09-18 18:00 ` Judith Mendez
0 siblings, 1 reply; 28+ messages in thread
From: Andrew Davis @ 2025-09-17 16:48 UTC (permalink / raw)
To: Judith Mendez, Anshul Dalal, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Udit Kumar, u-boot
On 9/17/25 11:06 AM, Judith Mendez wrote:
> On 9/16/25 10:41 PM, Anshul Dalal wrote:
>> Hi Judith,
>>
>> On Wed Sep 17, 2025 at 4:05 AM IST, Judith Mendez wrote:
>>> Hi Andrew, Anshul,
>>>
>>> On 9/16/25 11:22 AM, Andrew Davis wrote:
>>>> On 9/11/25 9:59 AM, Judith Mendez wrote:
>>>>> Hi Anshul,
>>>>>
>>>>> On 9/11/25 12:11 AM, Anshul Dalal wrote:
>>>>>> On Thu Sep 11, 2025 at 3:15 AM IST, Judith Mendez wrote:
>>>>>>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The
>>>>>>> macros
>>>>>>> however, mix MMC device with the two bootmodes. Decouple the two types
>>>>>>> of macros so that bootmodes can be identified with:
>>>>>>> - BOOT_DEVICE_MMCSD
>>>>>>> - BOOT_DEVICE_EMMC
>>>>>>> according to devstat parsed boot mode values and on-board devices
>>>>>>> can be
>>>>>>> identified with:
>>>>>>> - BOOT_DEVICE_MMC1
>>>>>>> - BOOT_DEVICE_MMC2
>>>>>>> - BOOT_DEVICE_MMC2_2
>>>>>>> according to arbitrary numbers mainly used to differentiate between
>>>>>>> eMMC
>>>>>>> and SD card.
>>>>>>>
>>>>>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>>>>>> ---
>>>>>>
>>>>>> I guess the confusion here is how we are calling boot modes from devstat
>>>>>> as well as the boot device as BOOT_DEVICE_*. Perhaps we should rename
>>>>>> the former to DEVSTAT_BOOT_MODE_* or something along those lines.
>>>>>>
>>>>>> That would make the difference between a boot *mode* and a boot *device*
>>>>>> more clear, DEVSTAT_BOOT_MODE_MMCSD or DEVSTATE_BOOT_MODE_EMMC would
>>>>>> distinguish between SD or EMMC boot modes with BOOT_DEVICE_MMC*
>>>>>> indicating the MMC port used.
>>>>>>
>>>>>> This would also allow use to only have the respective
>>>>>> DEVSTAT_BOOT_MODE_* defined in each soc's headers with BOOT_DEVICE_*
>>>>>> coming from arch/arm/include/asm/spl.h.
>>>>>
>>>>>
>>>>> Right, I guess if
>>>>>
>>>>> BOOT_DEVICE_MMCSD
>>>>> BOOT_DEVICE_EMMC
>>>>>
>>>>> Is still not clear enough, it would be a good idea to use:
>>>>> DEVSTAT_BOOT_MODE_MMCSD
>>>>> DEVSTAT_BOOT_MODE_EMMC
>>>>>
>>>>> Its only a real problem for MMC since we have the confusion with eMMC
>>>>> boot and MMCSD boot and we mix the two as a result in
>>>>> spl_mmc_boot_mode() and spl_boot_device().
>>>>>
>>>>>
>>>>> Its not really an issue for other boot modes to warrant renaming all the
>>>>> bootmodes, but I would like to make these macros as clear as possible in
>>>>> this series since I plan to refactor spl_mmc_boot_mode() next.
>>>>>
>>>>> So lets hear if any one else has a strong opinion on this before
>>>>> deciding on:
>>>>>
>>>>> DEVSTAT_BOOT_MODE_MMCSD
>>>>> DEVSTAT_BOOT_MODE_EMMC
>>>>
>>>> This looks like the correct way to label these as they are the content
>>>> of the DEVSTAT register, this would also keep them from being confused
>>>> with the U-Boot internal definitions for BOOT_MODE_* and BOOT_DEVICE_*.
>>>>
>>>> But you should do it for all the DEVSTAT register defines, not just
>>>> MMC and not just for Sitara, do it for all our K3 boards. It should
>>>> be a simple rename patch to start. Then you can work to detangle
>>>> "mode" from "device" for the MMC case as you are doing here.
>>>
>>> I take it back, seems like this cannot be done, u-boot source requires
>>> all the macros:
>>> BOOT_DEVICE_SPI
>>> BOOT_DEVICE_RAM
>>> BOOT_DEVICE_UART
>>> etc...
>>>
>>> in order to even build.
>>>
>>> Simply renaming the macros to style:
>>> DEVSTAT_BOOT_MODE_SPI
>>> DEVSTAT_BOOT_MODE_RAM
>>> DEVSTAT_BOOT_MODE_UART
>>>
>>> will not work without creating a duplicate:
>>> #define BOOT_DEVICE_SPI DEVSTAT_BOOT_MODE_SPI
>>> #define BOOT_DEVICE_RAM DEVSTAT_BOOT_MODE_RAM
>>> #define BOOT_DEVICE_UART DEVSTAT_BOOT_MODE_UART
>>> or similar logic
>>>
>>> So basically we would be doubling the size of all spl.h files.
>>>
>>> In reality there is only confusion with MMC device/bootmodes,
>>> we do not to rename every single boot modes/boot device since
>>> there is no real confusion there.
>>>
>>
>> Correct me if I'm wrong here but BOOT_DEVICE_* should only be used
>> within the common u-boot source. Our job is to just the return the
>> correct macro from the SoC's boot.c file and ensure they are all unique
>> values.
>>
>> If that's true, can we make use of BOOT_DEVICE_* defines from
>> arch/arm/include/asm/spl.h?
>>
>> That should avoid duplication since we would just rename the existing
>> BOOT_DEVICE_* macros to DEVSTAT_BOOT_MODE_* in our board's spl.h while
>> relying on BOOT_DEVICE_* from arm's spl.h.
>
> Then we come back in a circle to the first real problem which is
> untangling MMC bootmodes from MMC boot devices.
>
> Why are we trying to refactor all the MMC_DEVICE_* ? There is no
> real problem for those bootmodes / boot devices since boot device =
> boot mode for those. It is only a real problem for MMC since boot device
> DOES NOT equal boot mode for MMC.
>
Boot mode does not equal boot device, even though we sometimes
mix the two. For example, a UART boot "device" implies a ymodem
boot "mode". Our ROM also conflates the two concepts as most
boot devices support one mode each. U-Boot is more flexible and
"device" is split from "mode".
Our DEVSTAT register gives us the combination, not just the
"device". So the defines that we use to match against content
of the DEVSTAT register should not be same as those returned
by spl_boot_device() and other U-Boot functions for "device".
They should have their own definitions.
Andrew
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-17 16:48 ` Andrew Davis
@ 2025-09-18 18:00 ` Judith Mendez
0 siblings, 0 replies; 28+ messages in thread
From: Judith Mendez @ 2025-09-18 18:00 UTC (permalink / raw)
To: Andrew Davis, Anshul Dalal, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Udit Kumar, u-boot
Hi Andrew,
On 9/17/25 11:48 AM, Andrew Davis wrote:
> On 9/17/25 11:06 AM, Judith Mendez wrote:
>> On 9/16/25 10:41 PM, Anshul Dalal wrote:
>>> Hi Judith,
>>>
>>> On Wed Sep 17, 2025 at 4:05 AM IST, Judith Mendez wrote:
>>>> Hi Andrew, Anshul,
>>>>
>>>> On 9/16/25 11:22 AM, Andrew Davis wrote:
>>>>> On 9/11/25 9:59 AM, Judith Mendez wrote:
>>>>>> Hi Anshul,
>>>>>>
>>>>>> On 9/11/25 12:11 AM, Anshul Dalal wrote:
>>>>>>> On Thu Sep 11, 2025 at 3:15 AM IST, Judith Mendez wrote:
>>>>>>>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The
>>>>>>>> macros
>>>>>>>> however, mix MMC device with the two bootmodes. Decouple the two
>>>>>>>> types
>>>>>>>> of macros so that bootmodes can be identified with:
>>>>>>>> - BOOT_DEVICE_MMCSD
>>>>>>>> - BOOT_DEVICE_EMMC
>>>>>>>> according to devstat parsed boot mode values and on-board devices
>>>>>>>> can be
>>>>>>>> identified with:
>>>>>>>> - BOOT_DEVICE_MMC1
>>>>>>>> - BOOT_DEVICE_MMC2
>>>>>>>> - BOOT_DEVICE_MMC2_2
>>>>>>>> according to arbitrary numbers mainly used to differentiate between
>>>>>>>> eMMC
>>>>>>>> and SD card.
>>>>>>>>
>>>>>>>> Signed-off-by: Judith Mendez <jm@ti.com>
>>>>>>>> ---
>>>>>>>
>>>>>>> I guess the confusion here is how we are calling boot modes from
>>>>>>> devstat
>>>>>>> as well as the boot device as BOOT_DEVICE_*. Perhaps we should
>>>>>>> rename
>>>>>>> the former to DEVSTAT_BOOT_MODE_* or something along those lines.
>>>>>>>
>>>>>>> That would make the difference between a boot *mode* and a boot
>>>>>>> *device*
>>>>>>> more clear, DEVSTAT_BOOT_MODE_MMCSD or DEVSTATE_BOOT_MODE_EMMC would
>>>>>>> distinguish between SD or EMMC boot modes with BOOT_DEVICE_MMC*
>>>>>>> indicating the MMC port used.
>>>>>>>
>>>>>>> This would also allow use to only have the respective
>>>>>>> DEVSTAT_BOOT_MODE_* defined in each soc's headers with BOOT_DEVICE_*
>>>>>>> coming from arch/arm/include/asm/spl.h.
>>>>>>
>>>>>>
>>>>>> Right, I guess if
>>>>>>
>>>>>> BOOT_DEVICE_MMCSD
>>>>>> BOOT_DEVICE_EMMC
>>>>>>
>>>>>> Is still not clear enough, it would be a good idea to use:
>>>>>> DEVSTAT_BOOT_MODE_MMCSD
>>>>>> DEVSTAT_BOOT_MODE_EMMC
>>>>>>
>>>>>> Its only a real problem for MMC since we have the confusion with eMMC
>>>>>> boot and MMCSD boot and we mix the two as a result in
>>>>>> spl_mmc_boot_mode() and spl_boot_device().
>>>>>>
>>>>>>
>>>>>> Its not really an issue for other boot modes to warrant renaming
>>>>>> all the
>>>>>> bootmodes, but I would like to make these macros as clear as
>>>>>> possible in
>>>>>> this series since I plan to refactor spl_mmc_boot_mode() next.
>>>>>>
>>>>>> So lets hear if any one else has a strong opinion on this before
>>>>>> deciding on:
>>>>>>
>>>>>> DEVSTAT_BOOT_MODE_MMCSD
>>>>>> DEVSTAT_BOOT_MODE_EMMC
>>>>>
>>>>> This looks like the correct way to label these as they are the content
>>>>> of the DEVSTAT register, this would also keep them from being confused
>>>>> with the U-Boot internal definitions for BOOT_MODE_* and
>>>>> BOOT_DEVICE_*.
>>>>>
>>>>> But you should do it for all the DEVSTAT register defines, not just
>>>>> MMC and not just for Sitara, do it for all our K3 boards. It should
>>>>> be a simple rename patch to start. Then you can work to detangle
>>>>> "mode" from "device" for the MMC case as you are doing here.
>>>>
>>>> I take it back, seems like this cannot be done, u-boot source requires
>>>> all the macros:
>>>> BOOT_DEVICE_SPI
>>>> BOOT_DEVICE_RAM
>>>> BOOT_DEVICE_UART
>>>> etc...
>>>>
>>>> in order to even build.
>>>>
>>>> Simply renaming the macros to style:
>>>> DEVSTAT_BOOT_MODE_SPI
>>>> DEVSTAT_BOOT_MODE_RAM
>>>> DEVSTAT_BOOT_MODE_UART
>>>>
>>>> will not work without creating a duplicate:
>>>> #define BOOT_DEVICE_SPI DEVSTAT_BOOT_MODE_SPI
>>>> #define BOOT_DEVICE_RAM DEVSTAT_BOOT_MODE_RAM
>>>> #define BOOT_DEVICE_UART DEVSTAT_BOOT_MODE_UART
>>>> or similar logic
>>>>
>>>> So basically we would be doubling the size of all spl.h files.
>>>>
>>>> In reality there is only confusion with MMC device/bootmodes,
>>>> we do not to rename every single boot modes/boot device since
>>>> there is no real confusion there.
>>>>
>>>
>>> Correct me if I'm wrong here but BOOT_DEVICE_* should only be used
>>> within the common u-boot source. Our job is to just the return the
>>> correct macro from the SoC's boot.c file and ensure they are all unique
>>> values.
>>>
>>> If that's true, can we make use of BOOT_DEVICE_* defines from
>>> arch/arm/include/asm/spl.h?
>>>
>>> That should avoid duplication since we would just rename the existing
>>> BOOT_DEVICE_* macros to DEVSTAT_BOOT_MODE_* in our board's spl.h while
>>> relying on BOOT_DEVICE_* from arm's spl.h.
>>
>> Then we come back in a circle to the first real problem which is
>> untangling MMC bootmodes from MMC boot devices.
>>
>> Why are we trying to refactor all the MMC_DEVICE_* ? There is no
>> real problem for those bootmodes / boot devices since boot device =
>> boot mode for those. It is only a real problem for MMC since boot device
>> DOES NOT equal boot mode for MMC.
>>
>
> Boot mode does not equal boot device, even though we sometimes
> mix the two. For example, a UART boot "device" implies a ymodem
> boot "mode". Our ROM also conflates the two concepts as most
> boot devices support one mode each. U-Boot is more flexible and
> "device" is split from "mode".
>
> Our DEVSTAT register gives us the combination, not just the
> "device". So the defines that we use to match against content
> of the DEVSTAT register should not be same as those returned
> by spl_boot_device() and other U-Boot functions for "device".
> They should have their own definitions.
True. Ok, will split the two for k3 then.
~ Judith
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-10 21:45 ` [PATCH 1/4] arm: mach-k3: Fix MMC macros Judith Mendez
2025-09-11 4:38 ` Kumar, Udit
2025-09-11 5:11 ` Anshul Dalal
@ 2025-09-15 11:40 ` Moteen Shah
2025-09-15 18:02 ` Judith Mendez
2025-09-15 14:22 ` Wadim Egorov
3 siblings, 1 reply; 28+ messages in thread
From: Moteen Shah @ 2025-09-15 11:40 UTC (permalink / raw)
To: Judith Mendez, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Andrew Davis,
Udit Kumar, u-boot
Hey Judith,
On 11/09/25 03:15, Judith Mendez wrote:
> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The macros
> however, mix MMC device with the two bootmodes. Decouple the two types
> of macros so that bootmodes can be identified with:
> - BOOT_DEVICE_MMCSD
> - BOOT_DEVICE_EMMC
> according to devstat parsed boot mode values and on-board devices can be
> identified with:
> - BOOT_DEVICE_MMC1
> - BOOT_DEVICE_MMC2
> - BOOT_DEVICE_MMC2_2
> according to arbitrary numbers mainly used to differentiate between eMMC
> and SD card.
>
> Signed-off-by: Judith Mendez <jm@ti.com>
> ---
> arch/arm/mach-k3/am62ax/am62a7_init.c | 4 ++--
> arch/arm/mach-k3/am62ax/boot.c | 8 ++++----
> arch/arm/mach-k3/am62px/am62p5_init.c | 12 ++++++------
> arch/arm/mach-k3/am62x/am625_init.c | 4 ++--
> arch/arm/mach-k3/am62x/boot.c | 8 ++++----
> arch/arm/mach-k3/am64x/boot.c | 8 ++++----
> arch/arm/mach-k3/am65x/am654_init.c | 18 ++++++++++--------
> arch/arm/mach-k3/include/mach/am62_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am62_spl.h | 10 +++++-----
> arch/arm/mach-k3/include/mach/am62a_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am62a_spl.h | 10 +++++-----
> arch/arm/mach-k3/include/mach/am62p_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am62p_spl.h | 10 +++++-----
> arch/arm/mach-k3/include/mach/am64_hardware.h | 4 ++--
> arch/arm/mach-k3/include/mach/am64_spl.h | 13 +++++++------
> arch/arm/mach-k3/include/mach/am6_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/am6_spl.h | 13 +++++++++----
> arch/arm/mach-k3/include/mach/j721e_hardware.h | 6 +++---
> arch/arm/mach-k3/include/mach/j721e_spl.h | 14 ++++++++++----
> .../arm/mach-k3/include/mach/j721s2_hardware.h | 6 +++---
> arch/arm/mach-k3/include/mach/j721s2_spl.h | 13 +++++++++----
> arch/arm/mach-k3/include/mach/j722s_hardware.h | 8 ++++----
> arch/arm/mach-k3/include/mach/j722s_spl.h | 10 +++++-----
> .../arm/mach-k3/include/mach/j784s4_hardware.h | 6 +++---
> arch/arm/mach-k3/include/mach/j784s4_spl.h | 13 +++++++++----
> arch/arm/mach-k3/j721e/j721e_init.c | 14 +++++++++-----
> arch/arm/mach-k3/j721s2/j721s2_init.c | 14 +++++++++-----
> arch/arm/mach-k3/j722s/j722s_init.c | 12 ++++++------
> arch/arm/mach-k3/j784s4/j784s4_init.c | 14 +++++++++-----
> 29 files changed, 160 insertions(+), 124 deletions(-)
>
> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/am62ax/am62a7_init.c
> index 00173e6836b..1fd466bbdfc 100644
> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
> @@ -225,8 +225,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
> if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4))
> return MMCSD_MODE_FS;
> return MMCSD_MODE_EMMCBOOT;
> - case BOOT_DEVICE_MMC:
> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
> + case BOOT_DEVICE_MMCSD:
> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
> return MMCSD_MODE_RAW;
> default:
> return MMCSD_MODE_FS;
> diff --git a/arch/arm/mach-k3/am62ax/boot.c b/arch/arm/mach-k3/am62ax/boot.c
> index af7fce1e5e9..808224108b9 100644
> --- a/arch/arm/mach-k3/am62ax/boot.c
> +++ b/arch/arm/mach-k3/am62ax/boot.c
> @@ -21,7 +21,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
>
> - case BACKUP_BOOT_DEVICE_MMC:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> if (bkup_bootmode_cfg)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
> @@ -69,9 +69,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
> case BOOT_DEVICE_SPI_NAND:
> return BOOT_DEVICE_SPINAND;
>
> - case BOOT_DEVICE_MMC:
> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
> + case BOOT_DEVICE_MMCSD:
> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
>
> diff --git a/arch/arm/mach-k3/am62px/am62p5_init.c b/arch/arm/mach-k3/am62px/am62p5_init.c
> index 44a2d445d24..9574089325c 100644
> --- a/arch/arm/mach-k3/am62px/am62p5_init.c
> +++ b/arch/arm/mach-k3/am62px/am62p5_init.c
> @@ -271,8 +271,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
> if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4))
> return MMCSD_MODE_FS;
> return MMCSD_MODE_EMMCBOOT;
> - case BOOT_DEVICE_MMC:
> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
> + case BOOT_DEVICE_MMCSD:
> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
> return MMCSD_MODE_RAW;
> fallthrough;
> default:
> @@ -298,7 +298,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
>
> - case BACKUP_BOOT_DEVICE_MMC:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> if (bkup_bootmode_cfg)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
> @@ -346,9 +346,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
> case BOOT_DEVICE_SPI_NAND:
> return BOOT_DEVICE_SPINAND;
>
> - case BOOT_DEVICE_MMC:
> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
> + case BOOT_DEVICE_MMCSD:
> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
>
> diff --git a/arch/arm/mach-k3/am62x/am625_init.c b/arch/arm/mach-k3/am62x/am625_init.c
> index 8f4ddf59753..46da9ba8850 100644
> --- a/arch/arm/mach-k3/am62x/am625_init.c
> +++ b/arch/arm/mach-k3/am62x/am625_init.c
> @@ -312,8 +312,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
> if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4))
> return MMCSD_MODE_FS;
> return MMCSD_MODE_EMMCBOOT;
> - case BOOT_DEVICE_MMC:
> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
> + case BOOT_DEVICE_MMCSD:
> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
> return MMCSD_MODE_RAW;
> default:
> return MMCSD_MODE_FS;
> diff --git a/arch/arm/mach-k3/am62x/boot.c b/arch/arm/mach-k3/am62x/boot.c
> index a3a6cda6bdb..c5f6dcea2b9 100644
> --- a/arch/arm/mach-k3/am62x/boot.c
> +++ b/arch/arm/mach-k3/am62x/boot.c
> @@ -21,7 +21,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
>
> - case BACKUP_BOOT_DEVICE_MMC:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> if (bkup_bootmode_cfg)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
> @@ -66,9 +66,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
> case BOOT_DEVICE_EMMC:
> return BOOT_DEVICE_MMC1;
>
> - case BOOT_DEVICE_MMC:
> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
> + case BOOT_DEVICE_MMCSD:
> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
>
> diff --git a/arch/arm/mach-k3/am64x/boot.c b/arch/arm/mach-k3/am64x/boot.c
> index ce8ae941be6..6145c09bab5 100644
> --- a/arch/arm/mach-k3/am64x/boot.c
> +++ b/arch/arm/mach-k3/am64x/boot.c
> @@ -24,7 +24,7 @@ static u32 __get_backup_bootmedia(u32 main_devstat)
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
>
> - case BACKUP_BOOT_DEVICE_MMC:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> if (bkup_bootmode_cfg)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
> @@ -68,9 +68,9 @@ static u32 __get_primary_bootmedia(u32 main_devstat)
> case BOOT_DEVICE_NAND:
> return BOOT_DEVICE_NAND;
>
> - case BOOT_DEVICE_MMC:
> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
> + case BOOT_DEVICE_MMCSD:
> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
> return BOOT_DEVICE_MMC2;
> return BOOT_DEVICE_MMC1;
>
> diff --git a/arch/arm/mach-k3/am65x/am654_init.c b/arch/arm/mach-k3/am65x/am654_init.c
> index a4f038029d7..9fcea12d243 100644
> --- a/arch/arm/mach-k3/am65x/am654_init.c
> +++ b/arch/arm/mach-k3/am65x/am654_init.c
> @@ -272,7 +272,7 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
>
> /* eMMC boot0 mode is only supported for primary boot */
> if (bootindex == K3_PRIMARY_BOOTMODE &&
> - bootmode == BOOT_DEVICE_MMC1)
> + bootmode == BOOT_DEVICE_EMMC)
> return MMCSD_MODE_EMMCBOOT;
> #endif
>
> @@ -296,10 +296,10 @@ static u32 __get_backup_bootmedia(u32 devstat)
> return BOOT_DEVICE_UART;
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
> - case BACKUP_BOOT_DEVICE_MMC2:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> {
> - u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >>
> - CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT;
> + u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK) >>
> + CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT;
> if (port == 0x0)
> return BOOT_DEVICE_MMC1;
> return BOOT_DEVICE_MMC2;
> @@ -323,12 +323,14 @@ static u32 __get_primary_bootmedia(u32 devstat)
> if (bootmode == BOOT_DEVICE_OSPI || bootmode == BOOT_DEVICE_QSPI)
> bootmode = BOOT_DEVICE_SPI;
>
> - if (bootmode == BOOT_DEVICE_MMC2) {
> - u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_MMC_PORT_MASK) >>
> - CTRLMMR_MAIN_DEVSTAT_MMC_PORT_SHIFT;
> + if (bootmode == BOOT_DEVICE_MMCSD) {
> + bootmode = BOOT_DEVICE_MMC2;
> + u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_MASK) >>
> + CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_SHIFT;
> if (port == 0x0)
> bootmode = BOOT_DEVICE_MMC1;
> - } else if (bootmode == BOOT_DEVICE_MMC1) {
> + } else if (bootmode == BOOT_DEVICE_EMMC) {
> + bootmode = BOOT_DEVICE_MMC1;
> u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_MASK) >>
> CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT;
> if (port == 0x1)
> diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h
> index 2f5655bf24a..94f2208cf52 100644
> --- a/arch/arm/mach-k3/include/mach/am62_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h
> @@ -58,10 +58,10 @@
> #define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK (~BIT(17))
>
> /* Primary Bootmode MMC Config macros */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>
> /* Primary Bootmode USB Config macros */
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> diff --git a/arch/arm/mach-k3/include/mach/am62_spl.h b/arch/arm/mach-k3/include/mach/am62_spl.h
> index 2c9139d2cc0..8df53ac38bb 100644
> --- a/arch/arm/mach-k3/include/mach/am62_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am62_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -29,16 +29,16 @@
>
> /* U-Boot used aliases */
> #define BOOT_DEVICE_ETHERNET 0x04
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> /* Invalid */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/am62a_hardware.h b/arch/arm/mach-k3/include/mach/am62a_hardware.h
> index f3fd736f31b..7f715d6a7ab 100644
> --- a/arch/arm/mach-k3/include/mach/am62a_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am62a_hardware.h
> @@ -30,10 +30,10 @@
> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>
> /* Primary Bootmode MMC Config macros */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>
> /* Primary Bootmode USB Config macros */
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> diff --git a/arch/arm/mach-k3/include/mach/am62a_spl.h b/arch/arm/mach-k3/include/mach/am62a_spl.h
> index dd0f57714f5..323b9d404aa 100644
> --- a/arch/arm/mach-k3/include/mach/am62a_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am62a_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -30,16 +30,16 @@
> /* U-Boot used aliases */
> #define BOOT_DEVICE_ETHERNET 0x04
> #define BOOT_DEVICE_SPINAND 0x10
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> /* Invalid */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/am62p_hardware.h b/arch/arm/mach-k3/include/mach/am62p_hardware.h
> index a310b52b45d..984c10719e1 100644
> --- a/arch/arm/mach-k3/include/mach/am62p_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am62p_hardware.h
> @@ -46,10 +46,10 @@
> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>
> /* Primary Bootmode MMC Config macros */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>
> /* Primary Bootmode USB Config macros */
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> diff --git a/arch/arm/mach-k3/include/mach/am62p_spl.h b/arch/arm/mach-k3/include/mach/am62p_spl.h
> index db145a7bc83..0ddcacd912b 100644
> --- a/arch/arm/mach-k3/include/mach/am62p_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am62p_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -30,16 +30,16 @@
> /* U-Boot used aliases */
> #define BOOT_DEVICE_ETHERNET 0x04
> #define BOOT_DEVICE_SPINAND 0x10
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> /* Invalid */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/am64_hardware.h b/arch/arm/mach-k3/include/mach/am64_hardware.h
> index 105b42986de..67dc4eeb82f 100644
> --- a/arch/arm/mach-k3/include/mach/am64_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am64_hardware.h
> @@ -33,8 +33,8 @@
> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>
> /* After the cfg mask and shifts have been applied */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x04
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x04
>
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_MASK 0x02
> diff --git a/arch/arm/mach-k3/include/mach/am64_spl.h b/arch/arm/mach-k3/include/mach/am64_spl.h
> index a0a517019cb..9bd14d3679d 100644
> --- a/arch/arm/mach-k3/include/mach/am64_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am64_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -29,16 +29,17 @@
>
> #define BOOT_DEVICE_NOBOOT 0x0F
>
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> -/* INVALID */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +/* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> +/* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/am6_hardware.h b/arch/arm/mach-k3/include/mach/am6_hardware.h
> index 8169584a372..008f80ae526 100644
> --- a/arch/arm/mach-k3/include/mach/am6_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/am6_hardware.h
> @@ -21,12 +21,12 @@
> #define CTRLMMR_MAIN_DEVSTAT_BOOTMODE_SHIFT 0
> #define CTRLMMR_MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(6, 4)
> #define CTRLMMR_MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 4
> -#define CTRLMMR_MAIN_DEVSTAT_MMC_PORT_MASK GENMASK(12, 12)
> -#define CTRLMMR_MAIN_DEVSTAT_MMC_PORT_SHIFT 12
> +#define CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_MASK GENMASK(12, 12)
> +#define CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_SHIFT 12
> #define CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_MASK GENMASK(14, 14)
> #define CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT 14
> -#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_MASK GENMASK(17, 17)
> -#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 12
> +#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK GENMASK(17, 17)
> +#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 12
> #define CTRLMMR_MAIN_DEVSTAT_USB_MODE_SHIFT 9
> #define CTRLMMR_MAIN_DEVSTAT_USB_MODE_MASK GENMASK(10, 9)
>
> diff --git a/arch/arm/mach-k3/include/mach/am6_spl.h b/arch/arm/mach-k3/include/mach/am6_spl.h
> index 4c6950ff2b7..b7fa2f8d8b9 100644
> --- a/arch/arm/mach-k3/include/mach/am6_spl.h
> +++ b/arch/arm/mach-k3/include/mach/am6_spl.h
> @@ -12,21 +12,26 @@
> #define BOOT_DEVICE_HYPERFLASH 0x03
> #define BOOT_DEVICE_SPI 0x04
> #define BOOT_DEVICE_I2C 0x05
> -#define BOOT_DEVICE_MMC2 0x06
> +#define BOOT_DEVICE_MMCSD 0x06
> #define BOOT_DEVICE_ETHERNET 0x07
> #define BOOT_DEVICE_DFU 0x08
> #define BOOT_DEVICE_USB 0x408
> #define BOOT_DEVICE_PCIE 0x09
> #define BOOT_DEVICE_UART 0x0a
> #define BOOT_DEVICE_NAND 0x0c
> -#define BOOT_DEVICE_MMC1 0x0d
> -#define BOOT_DEVICE_MMC2_2 0x0e
> +#define BOOT_DEVICE_EMMC 0x0d
> +
> +/* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> +/* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> #define BACKUP_BOOT_DEVICE_RAM 0x0
> #define BACKUP_BOOT_DEVICE_USB 0x1
> #define BACKUP_BOOT_DEVICE_UART 0x2
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x3
> -#define BACKUP_BOOT_DEVICE_MMC2 0x4
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x4
> #define BACKUP_BOOT_DEVICE_SPI 0x5
> #define BACKUP_BOOT_DEVICE_HYPERFLASH 0x6
> #define BACKUP_BOOT_DEVICE_I2C 0x7
> diff --git a/arch/arm/mach-k3/include/mach/j721e_hardware.h b/arch/arm/mach-k3/include/mach/j721e_hardware.h
> index 5bef309af0a..341e9c28d81 100644
> --- a/arch/arm/mach-k3/include/mach/j721e_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/j721e_hardware.h
> @@ -20,10 +20,10 @@
> #define MAIN_DEVSTAT_BOOT_MODE_B_SHIFT 0
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(3, 1)
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1
> -#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6)
> +#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK BIT(6)
> #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7)
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK BIT(7)
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 7
>
> #define CTRLMMR_WKUP_DEVSTAT (WKUP_CTRL_MMR0_BASE + 0x30)
> #define WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(5, 3)
> diff --git a/arch/arm/mach-k3/include/mach/j721e_spl.h b/arch/arm/mach-k3/include/mach/j721e_spl.h
> index aaee6535376..008595b7f26 100644
> --- a/arch/arm/mach-k3/include/mach/j721e_spl.h
> +++ b/arch/arm/mach-k3/include/mach/j721e_spl.h
> @@ -18,22 +18,28 @@
> #define BOOT_DEVICE_NOR BOOT_DEVICE_HYPERFLASH
>
> /* With BootMode B = 1 */
> -#define BOOT_DEVICE_MMC2 0x10
> -#define BOOT_DEVICE_MMC1 0x11
> +#define BOOT_DEVICE_MMCSD 0x10
> +#define BOOT_DEVICE_EMMC 0x11
> #define BOOT_DEVICE_DFU 0x12
> #define BOOT_DEVICE_UFS 0x13
> #define BOOT_DEVIE_GPMC 0x14
> #define BOOT_DEVICE_PCIE 0x15
> #define BOOT_DEVICE_XSPI 0x16
> #define BOOT_DEVICE_RAM 0x17
> -#define BOOT_DEVICE_MMC2_2 0xFF /* Invalid value */
> +
> + /* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> + /* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
> +
>
> /* Backup boot modes with MCU Only = 0 */
> #define BACKUP_BOOT_DEVICE_RAM 0x0
> #define BACKUP_BOOT_DEVICE_USB 0x1
> #define BACKUP_BOOT_DEVICE_UART 0x3
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x4
> -#define BACKUP_BOOT_DEVICE_MMC2 0x5
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x5
> #define BACKUP_BOOT_DEVICE_SPI 0x6
> #define BACKUP_BOOT_DEVICE_I2C 0x7
>
> diff --git a/arch/arm/mach-k3/include/mach/j721s2_hardware.h b/arch/arm/mach-k3/include/mach/j721s2_hardware.h
> index 82f076a45e0..f2a3140e0b6 100644
> --- a/arch/arm/mach-k3/include/mach/j721s2_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/j721s2_hardware.h
> @@ -20,10 +20,10 @@
> #define MAIN_DEVSTAT_BOOT_MODE_B_SHIFT 0
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(3, 1)
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1
> -#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6)
> +#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK BIT(6)
> #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7)
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK BIT(7)
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 7
>
> #define CTRLMMR_WKUP_DEVSTAT (WKUP_CTRL_MMR0_BASE + 0x30)
> #define WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(5, 3)
> diff --git a/arch/arm/mach-k3/include/mach/j721s2_spl.h b/arch/arm/mach-k3/include/mach/j721s2_spl.h
> index 47a61281d94..5ede79b6744 100644
> --- a/arch/arm/mach-k3/include/mach/j721s2_spl.h
> +++ b/arch/arm/mach-k3/include/mach/j721s2_spl.h
> @@ -19,22 +19,27 @@
> #define BOOT_DEVICE_NOR BOOT_DEVICE_HYPERFLASH
>
> /* With BootMode B = 1 */
> -#define BOOT_DEVICE_MMC2 0x10
> -#define BOOT_DEVICE_MMC1 0x11
> +#define BOOT_DEVICE_MMCSD 0x10
> +#define BOOT_DEVICE_EMMC 0x11
> #define BOOT_DEVICE_DFU 0x12
> #define BOOT_DEVICE_UFS 0x13
> #define BOOT_DEVIE_GPMC 0x14
> #define BOOT_DEVICE_PCIE 0x15
> #define BOOT_DEVICE_XSPI 0x16
> #define BOOT_DEVICE_RAM 0x17
> -#define BOOT_DEVICE_MMC2_2 0xFF /* Invalid value */
> +
> +/* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> +/* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup boot modes with MCU Only = 0 */
> #define BACKUP_BOOT_DEVICE_RAM 0x0
> #define BACKUP_BOOT_DEVICE_USB 0x1
> #define BACKUP_BOOT_DEVICE_UART 0x3
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x4
> -#define BACKUP_BOOT_DEVICE_MMC2 0x5
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x5
> #define BACKUP_BOOT_DEVICE_SPI 0x6
> #define BACKUP_BOOT_DEVICE_I2C 0x7
>
> diff --git a/arch/arm/mach-k3/include/mach/j722s_hardware.h b/arch/arm/mach-k3/include/mach/j722s_hardware.h
> index 0c695134c28..77b455af09a 100644
> --- a/arch/arm/mach-k3/include/mach/j722s_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/j722s_hardware.h
> @@ -30,10 +30,10 @@
> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>
> /* Primary Bootmode MMC Config macros */
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>
> /* Primary Bootmode USB Config macros */
> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
> diff --git a/arch/arm/mach-k3/include/mach/j722s_spl.h b/arch/arm/mach-k3/include/mach/j722s_spl.h
> index a91cc82448f..aea43eeb23c 100644
> --- a/arch/arm/mach-k3/include/mach/j722s_spl.h
> +++ b/arch/arm/mach-k3/include/mach/j722s_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -31,16 +31,16 @@
> /* U-Boot used aliases */
> #define BOOT_DEVICE_ETHERNET 0x04
> #define BOOT_DEVICE_SPINAND 0x10
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> /* Invalid */
> -#define BOOT_DEVICE_MMC2_2 0x1F
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup BootMode devices */
> #define BACKUP_BOOT_DEVICE_DFU 0x01
> #define BACKUP_BOOT_DEVICE_UART 0x03
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
> -#define BACKUP_BOOT_DEVICE_MMC 0x05
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
> #define BACKUP_BOOT_DEVICE_SPI 0x06
> #define BACKUP_BOOT_DEVICE_I2C 0x07
> #define BACKUP_BOOT_DEVICE_USB 0x09
> diff --git a/arch/arm/mach-k3/include/mach/j784s4_hardware.h b/arch/arm/mach-k3/include/mach/j784s4_hardware.h
> index 29a894baed3..e8e2037f804 100644
> --- a/arch/arm/mach-k3/include/mach/j784s4_hardware.h
> +++ b/arch/arm/mach-k3/include/mach/j784s4_hardware.h
> @@ -20,10 +20,10 @@
> #define MAIN_DEVSTAT_BOOT_MODE_B_SHIFT 0
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(3, 1)
> #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1
> -#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6)
> +#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK BIT(6)
> #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7)
> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK BIT(7)
> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 7
>
> #define CTRLMMR_WKUP_DEVSTAT (WKUP_CTRL_MMR0_BASE + 0x30)
> #define WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(5, 3)
> diff --git a/arch/arm/mach-k3/include/mach/j784s4_spl.h b/arch/arm/mach-k3/include/mach/j784s4_spl.h
> index 3814dc95d01..0871a85d0c5 100644
> --- a/arch/arm/mach-k3/include/mach/j784s4_spl.h
> +++ b/arch/arm/mach-k3/include/mach/j784s4_spl.h
> @@ -19,22 +19,27 @@
> #define BOOT_DEVICE_NOR BOOT_DEVICE_HYPERFLASH
>
> /* With BootMode B = 1 */
> -#define BOOT_DEVICE_MMC2 0x10
> -#define BOOT_DEVICE_MMC1 0x11
> +#define BOOT_DEVICE_MMCSD 0x10
> +#define BOOT_DEVICE_EMMC 0x11
> #define BOOT_DEVICE_DFU 0x12
> #define BOOT_DEVICE_UFS 0x13
> #define BOOT_DEVIE_GPMC 0x14
> #define BOOT_DEVICE_PCIE 0x15
> #define BOOT_DEVICE_XSPI 0x16
> #define BOOT_DEVICE_RAM 0x17
> -#define BOOT_DEVICE_MMC2_2 0xFF /* Invalid value */
> +
> +/* U-Boot used aliases */
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
> +/* Invalid */
> +#define BOOT_DEVICE_MMC2_2 0xFF2
>
> /* Backup boot modes with MCU Only = 0 */
> #define BACKUP_BOOT_DEVICE_RAM 0x0
> #define BACKUP_BOOT_DEVICE_USB 0x1
> #define BACKUP_BOOT_DEVICE_UART 0x3
> #define BACKUP_BOOT_DEVICE_ETHERNET 0x4
> -#define BACKUP_BOOT_DEVICE_MMC2 0x5
> +#define BACKUP_BOOT_DEVICE_MMCSD 0x5
> #define BACKUP_BOOT_DEVICE_SPI 0x6
> #define BACKUP_BOOT_DEVICE_I2C 0x7
>
> diff --git a/arch/arm/mach-k3/j721e/j721e_init.c b/arch/arm/mach-k3/j721e/j721e_init.c
> index f9af0288cf6..30087705334 100644
> --- a/arch/arm/mach-k3/j721e/j721e_init.c
> +++ b/arch/arm/mach-k3/j721e/j721e_init.c
> @@ -450,10 +450,10 @@ static u32 __get_backup_bootmedia(u32 main_devstat)
> return BOOT_DEVICE_UART;
> case BACKUP_BOOT_DEVICE_ETHERNET:
> return BOOT_DEVICE_ETHERNET;
> - case BACKUP_BOOT_DEVICE_MMC2:
> + case BACKUP_BOOT_DEVICE_MMCSD:
> {
> - u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >>
> - MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT;
> + u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK) >>
> + MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT;
> if (port == 0x0)
> return BOOT_DEVICE_MMC1;
> return BOOT_DEVICE_MMC2;
> @@ -480,14 +480,18 @@ static u32 __get_primary_bootmedia(u32 main_devstat, u32 wkup_devstat)
> bootmode == BOOT_DEVICE_XSPI)
> bootmode = BOOT_DEVICE_SPI;
>
> - if (bootmode == BOOT_DEVICE_MMC2) {
> + if (bootmode == BOOT_DEVICE_MMCSD) {
> + bootmode = BOOT_DEVICE_MMC2;
> u32 port = (main_devstat &
> - MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK) >>
> + MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK) >>
> MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT;
> if (port == 0x0)
> bootmode = BOOT_DEVICE_MMC1;
> }
>
> + if (bootmode == BOOT_DEVICE_EMMC)
> + bootmode = BOOT_DEVICE_MMC1;
> +
Are the above two lines redundant as eMMC is selected based on the port
being 0x0?
Regards,
Moteen
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-15 11:40 ` Moteen Shah
@ 2025-09-15 18:02 ` Judith Mendez
0 siblings, 0 replies; 28+ messages in thread
From: Judith Mendez @ 2025-09-15 18:02 UTC (permalink / raw)
To: Moteen Shah, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Andrew Davis,
Udit Kumar, u-boot
Hi Moteen,
On 9/15/25 6:40 AM, Moteen Shah wrote:
> Hey Judith,
>
> On 11/09/25 03:15, Judith Mendez wrote:
>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The macros
>> however, mix MMC device with the two bootmodes. Decouple the two types
>> of macros so that bootmodes can be identified with:
>> - BOOT_DEVICE_MMCSD
>> - BOOT_DEVICE_EMMC
>> according to devstat parsed boot mode values and on-board devices can be
>> identified with:
>> - BOOT_DEVICE_MMC1
>> - BOOT_DEVICE_MMC2
>> - BOOT_DEVICE_MMC2_2
>> according to arbitrary numbers mainly used to differentiate between eMMC
>> and SD card.
>>
>> Signed-off-by: Judith Mendez <jm@ti.com>
>> ---
>> arch/arm/mach-k3/am62ax/am62a7_init.c | 4 ++--
>> arch/arm/mach-k3/am62ax/boot.c | 8 ++++----
>> arch/arm/mach-k3/am62px/am62p5_init.c | 12 ++++++------
>> arch/arm/mach-k3/am62x/am625_init.c | 4 ++--
>> arch/arm/mach-k3/am62x/boot.c | 8 ++++----
>> arch/arm/mach-k3/am64x/boot.c | 8 ++++----
>> arch/arm/mach-k3/am65x/am654_init.c | 18 ++++++++++--------
>> arch/arm/mach-k3/include/mach/am62_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/am62_spl.h | 10 +++++-----
>> arch/arm/mach-k3/include/mach/am62a_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/am62a_spl.h | 10 +++++-----
>> arch/arm/mach-k3/include/mach/am62p_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/am62p_spl.h | 10 +++++-----
>> arch/arm/mach-k3/include/mach/am64_hardware.h | 4 ++--
>> arch/arm/mach-k3/include/mach/am64_spl.h | 13 +++++++------
>> arch/arm/mach-k3/include/mach/am6_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/am6_spl.h | 13 +++++++++----
>> arch/arm/mach-k3/include/mach/j721e_hardware.h | 6 +++---
>> arch/arm/mach-k3/include/mach/j721e_spl.h | 14 ++++++++++----
>> .../arm/mach-k3/include/mach/j721s2_hardware.h | 6 +++---
>> arch/arm/mach-k3/include/mach/j721s2_spl.h | 13 +++++++++----
>> arch/arm/mach-k3/include/mach/j722s_hardware.h | 8 ++++----
>> arch/arm/mach-k3/include/mach/j722s_spl.h | 10 +++++-----
>> .../arm/mach-k3/include/mach/j784s4_hardware.h | 6 +++---
>> arch/arm/mach-k3/include/mach/j784s4_spl.h | 13 +++++++++----
>> arch/arm/mach-k3/j721e/j721e_init.c | 14 +++++++++-----
>> arch/arm/mach-k3/j721s2/j721s2_init.c | 14 +++++++++-----
>> arch/arm/mach-k3/j722s/j722s_init.c | 12 ++++++------
>> arch/arm/mach-k3/j784s4/j784s4_init.c | 14 +++++++++-----
>> 29 files changed, 160 insertions(+), 124 deletions(-)
>>
>> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/
>> am62ax/am62a7_init.c
>> index 00173e6836b..1fd466bbdfc 100644
>> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
>> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
>> @@ -225,8 +225,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32
>> boot_device)
>> if (IS_ENABLED(CONFIG_SPL_FS_FAT) ||
>> IS_ENABLED(CONFIG_SPL_FS_EXT4))
>> return MMCSD_MODE_FS;
>> return MMCSD_MODE_EMMCBOOT;
>> - case BOOT_DEVICE_MMC:
>> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
>> + case BOOT_DEVICE_MMCSD:
>> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
>> return MMCSD_MODE_RAW;
>> default:
>> return MMCSD_MODE_FS;
>> diff --git a/arch/arm/mach-k3/am62ax/boot.c b/arch/arm/mach-k3/am62ax/
>> boot.c
>> index af7fce1e5e9..808224108b9 100644
>> --- a/arch/arm/mach-k3/am62ax/boot.c
>> +++ b/arch/arm/mach-k3/am62ax/boot.c
>> @@ -21,7 +21,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
>> case BACKUP_BOOT_DEVICE_ETHERNET:
>> return BOOT_DEVICE_ETHERNET;
>> - case BACKUP_BOOT_DEVICE_MMC:
>> + case BACKUP_BOOT_DEVICE_MMCSD:
>> if (bkup_bootmode_cfg)
>> return BOOT_DEVICE_MMC2;
>> return BOOT_DEVICE_MMC1;
>> @@ -69,9 +69,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
>> case BOOT_DEVICE_SPI_NAND:
>> return BOOT_DEVICE_SPINAND;
>> - case BOOT_DEVICE_MMC:
>> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
>> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
>> + case BOOT_DEVICE_MMCSD:
>> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
>> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
>> return BOOT_DEVICE_MMC2;
>> return BOOT_DEVICE_MMC1;
>> diff --git a/arch/arm/mach-k3/am62px/am62p5_init.c b/arch/arm/mach-k3/
>> am62px/am62p5_init.c
>> index 44a2d445d24..9574089325c 100644
>> --- a/arch/arm/mach-k3/am62px/am62p5_init.c
>> +++ b/arch/arm/mach-k3/am62px/am62p5_init.c
>> @@ -271,8 +271,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32
>> boot_device)
>> if (IS_ENABLED(CONFIG_SPL_FS_FAT) ||
>> IS_ENABLED(CONFIG_SPL_FS_EXT4))
>> return MMCSD_MODE_FS;
>> return MMCSD_MODE_EMMCBOOT;
>> - case BOOT_DEVICE_MMC:
>> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
>> + case BOOT_DEVICE_MMCSD:
>> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
>> return MMCSD_MODE_RAW;
>> fallthrough;
>> default:
>> @@ -298,7 +298,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
>> case BACKUP_BOOT_DEVICE_ETHERNET:
>> return BOOT_DEVICE_ETHERNET;
>> - case BACKUP_BOOT_DEVICE_MMC:
>> + case BACKUP_BOOT_DEVICE_MMCSD:
>> if (bkup_bootmode_cfg)
>> return BOOT_DEVICE_MMC2;
>> return BOOT_DEVICE_MMC1;
>> @@ -346,9 +346,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
>> case BOOT_DEVICE_SPI_NAND:
>> return BOOT_DEVICE_SPINAND;
>> - case BOOT_DEVICE_MMC:
>> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
>> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
>> + case BOOT_DEVICE_MMCSD:
>> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
>> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
>> return BOOT_DEVICE_MMC2;
>> return BOOT_DEVICE_MMC1;
>> diff --git a/arch/arm/mach-k3/am62x/am625_init.c b/arch/arm/mach-k3/
>> am62x/am625_init.c
>> index 8f4ddf59753..46da9ba8850 100644
>> --- a/arch/arm/mach-k3/am62x/am625_init.c
>> +++ b/arch/arm/mach-k3/am62x/am625_init.c
>> @@ -312,8 +312,8 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32
>> boot_device)
>> if (IS_ENABLED(CONFIG_SPL_FS_FAT) ||
>> IS_ENABLED(CONFIG_SPL_FS_EXT4))
>> return MMCSD_MODE_FS;
>> return MMCSD_MODE_EMMCBOOT;
>> - case BOOT_DEVICE_MMC:
>> - if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
>> + case BOOT_DEVICE_MMCSD:
>> + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK)
>> return MMCSD_MODE_RAW;
>> default:
>> return MMCSD_MODE_FS;
>> diff --git a/arch/arm/mach-k3/am62x/boot.c b/arch/arm/mach-k3/am62x/
>> boot.c
>> index a3a6cda6bdb..c5f6dcea2b9 100644
>> --- a/arch/arm/mach-k3/am62x/boot.c
>> +++ b/arch/arm/mach-k3/am62x/boot.c
>> @@ -21,7 +21,7 @@ static u32 __get_backup_bootmedia(u32 devstat)
>> case BACKUP_BOOT_DEVICE_ETHERNET:
>> return BOOT_DEVICE_ETHERNET;
>> - case BACKUP_BOOT_DEVICE_MMC:
>> + case BACKUP_BOOT_DEVICE_MMCSD:
>> if (bkup_bootmode_cfg)
>> return BOOT_DEVICE_MMC2;
>> return BOOT_DEVICE_MMC1;
>> @@ -66,9 +66,9 @@ static u32 __get_primary_bootmedia(u32 devstat)
>> case BOOT_DEVICE_EMMC:
>> return BOOT_DEVICE_MMC1;
>> - case BOOT_DEVICE_MMC:
>> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
>> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
>> + case BOOT_DEVICE_MMCSD:
>> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
>> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
>> return BOOT_DEVICE_MMC2;
>> return BOOT_DEVICE_MMC1;
>> diff --git a/arch/arm/mach-k3/am64x/boot.c b/arch/arm/mach-k3/am64x/
>> boot.c
>> index ce8ae941be6..6145c09bab5 100644
>> --- a/arch/arm/mach-k3/am64x/boot.c
>> +++ b/arch/arm/mach-k3/am64x/boot.c
>> @@ -24,7 +24,7 @@ static u32 __get_backup_bootmedia(u32 main_devstat)
>> case BACKUP_BOOT_DEVICE_ETHERNET:
>> return BOOT_DEVICE_ETHERNET;
>> - case BACKUP_BOOT_DEVICE_MMC:
>> + case BACKUP_BOOT_DEVICE_MMCSD:
>> if (bkup_bootmode_cfg)
>> return BOOT_DEVICE_MMC2;
>> return BOOT_DEVICE_MMC1;
>> @@ -68,9 +68,9 @@ static u32 __get_primary_bootmedia(u32 main_devstat)
>> case BOOT_DEVICE_NAND:
>> return BOOT_DEVICE_NAND;
>> - case BOOT_DEVICE_MMC:
>> - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
>> - MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
>> + case BOOT_DEVICE_MMCSD:
>> + if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK) >>
>> + MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT)
>> return BOOT_DEVICE_MMC2;
>> return BOOT_DEVICE_MMC1;
>> diff --git a/arch/arm/mach-k3/am65x/am654_init.c b/arch/arm/mach-k3/
>> am65x/am654_init.c
>> index a4f038029d7..9fcea12d243 100644
>> --- a/arch/arm/mach-k3/am65x/am654_init.c
>> +++ b/arch/arm/mach-k3/am65x/am654_init.c
>> @@ -272,7 +272,7 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32
>> boot_device)
>> /* eMMC boot0 mode is only supported for primary boot */
>> if (bootindex == K3_PRIMARY_BOOTMODE &&
>> - bootmode == BOOT_DEVICE_MMC1)
>> + bootmode == BOOT_DEVICE_EMMC)
>> return MMCSD_MODE_EMMCBOOT;
>> #endif
>> @@ -296,10 +296,10 @@ static u32 __get_backup_bootmedia(u32 devstat)
>> return BOOT_DEVICE_UART;
>> case BACKUP_BOOT_DEVICE_ETHERNET:
>> return BOOT_DEVICE_ETHERNET;
>> - case BACKUP_BOOT_DEVICE_MMC2:
>> + case BACKUP_BOOT_DEVICE_MMCSD:
>> {
>> - u32 port = (devstat &
>> CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >>
>> - CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT;
>> + u32 port = (devstat &
>> CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK) >>
>> + CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT;
>> if (port == 0x0)
>> return BOOT_DEVICE_MMC1;
>> return BOOT_DEVICE_MMC2;
>> @@ -323,12 +323,14 @@ static u32 __get_primary_bootmedia(u32 devstat)
>> if (bootmode == BOOT_DEVICE_OSPI || bootmode ==
>> BOOT_DEVICE_QSPI)
>> bootmode = BOOT_DEVICE_SPI;
>> - if (bootmode == BOOT_DEVICE_MMC2) {
>> - u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_MMC_PORT_MASK) >>
>> - CTRLMMR_MAIN_DEVSTAT_MMC_PORT_SHIFT;
>> + if (bootmode == BOOT_DEVICE_MMCSD) {
>> + bootmode = BOOT_DEVICE_MMC2;
>> + u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_MASK) >>
>> + CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_SHIFT;
>> if (port == 0x0)
>> bootmode = BOOT_DEVICE_MMC1;
>> - } else if (bootmode == BOOT_DEVICE_MMC1) {
>> + } else if (bootmode == BOOT_DEVICE_EMMC) {
>> + bootmode = BOOT_DEVICE_MMC1;
>> u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_MASK) >>
>> CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT;
>> if (port == 0x1)
>> diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/
>> mach-k3/include/mach/am62_hardware.h
>> index 2f5655bf24a..94f2208cf52 100644
>> --- a/arch/arm/mach-k3/include/mach/am62_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h
>> @@ -58,10 +58,10 @@
>> #define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK (~BIT(17))
>> /* Primary Bootmode MMC Config macros */
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>> /* Primary Bootmode USB Config macros */
>> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
>> diff --git a/arch/arm/mach-k3/include/mach/am62_spl.h b/arch/arm/mach-
>> k3/include/mach/am62_spl.h
>> index 2c9139d2cc0..8df53ac38bb 100644
>> --- a/arch/arm/mach-k3/include/mach/am62_spl.h
>> +++ b/arch/arm/mach-k3/include/mach/am62_spl.h
>> @@ -17,7 +17,7 @@
>> #define BOOT_DEVICE_ETHERNET_RMII 0x05
>> #define BOOT_DEVICE_I2C 0x06
>> #define BOOT_DEVICE_UART 0x07
>> -#define BOOT_DEVICE_MMC 0x08
>> +#define BOOT_DEVICE_MMCSD 0x08
>> #define BOOT_DEVICE_EMMC 0x09
>> #define BOOT_DEVICE_USB 0x2A
>> @@ -29,16 +29,16 @@
>> /* U-Boot used aliases */
>> #define BOOT_DEVICE_ETHERNET 0x04
>> -#define BOOT_DEVICE_MMC2 0x08
>> -#define BOOT_DEVICE_MMC1 0x09
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>> /* Invalid */
>> -#define BOOT_DEVICE_MMC2_2 0x1F
>> +#define BOOT_DEVICE_MMC2_2 0xFF2
>> /* Backup BootMode devices */
>> #define BACKUP_BOOT_DEVICE_DFU 0x01
>> #define BACKUP_BOOT_DEVICE_UART 0x03
>> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
>> -#define BACKUP_BOOT_DEVICE_MMC 0x05
>> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
>> #define BACKUP_BOOT_DEVICE_SPI 0x06
>> #define BACKUP_BOOT_DEVICE_I2C 0x07
>> #define BACKUP_BOOT_DEVICE_USB 0x09
>> diff --git a/arch/arm/mach-k3/include/mach/am62a_hardware.h b/arch/
>> arm/mach-k3/include/mach/am62a_hardware.h
>> index f3fd736f31b..7f715d6a7ab 100644
>> --- a/arch/arm/mach-k3/include/mach/am62a_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/am62a_hardware.h
>> @@ -30,10 +30,10 @@
>> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>> /* Primary Bootmode MMC Config macros */
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>> /* Primary Bootmode USB Config macros */
>> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
>> diff --git a/arch/arm/mach-k3/include/mach/am62a_spl.h b/arch/arm/
>> mach-k3/include/mach/am62a_spl.h
>> index dd0f57714f5..323b9d404aa 100644
>> --- a/arch/arm/mach-k3/include/mach/am62a_spl.h
>> +++ b/arch/arm/mach-k3/include/mach/am62a_spl.h
>> @@ -17,7 +17,7 @@
>> #define BOOT_DEVICE_ETHERNET_RMII 0x05
>> #define BOOT_DEVICE_I2C 0x06
>> #define BOOT_DEVICE_UART 0x07
>> -#define BOOT_DEVICE_MMC 0x08
>> +#define BOOT_DEVICE_MMCSD 0x08
>> #define BOOT_DEVICE_EMMC 0x09
>> #define BOOT_DEVICE_USB 0x2A
>> @@ -30,16 +30,16 @@
>> /* U-Boot used aliases */
>> #define BOOT_DEVICE_ETHERNET 0x04
>> #define BOOT_DEVICE_SPINAND 0x10
>> -#define BOOT_DEVICE_MMC2 0x08
>> -#define BOOT_DEVICE_MMC1 0x09
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>> /* Invalid */
>> -#define BOOT_DEVICE_MMC2_2 0x1F
>> +#define BOOT_DEVICE_MMC2_2 0xFF2
>> /* Backup BootMode devices */
>> #define BACKUP_BOOT_DEVICE_DFU 0x01
>> #define BACKUP_BOOT_DEVICE_UART 0x03
>> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
>> -#define BACKUP_BOOT_DEVICE_MMC 0x05
>> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
>> #define BACKUP_BOOT_DEVICE_SPI 0x06
>> #define BACKUP_BOOT_DEVICE_I2C 0x07
>> #define BACKUP_BOOT_DEVICE_USB 0x09
>> diff --git a/arch/arm/mach-k3/include/mach/am62p_hardware.h b/arch/
>> arm/mach-k3/include/mach/am62p_hardware.h
>> index a310b52b45d..984c10719e1 100644
>> --- a/arch/arm/mach-k3/include/mach/am62p_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/am62p_hardware.h
>> @@ -46,10 +46,10 @@
>> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>> /* Primary Bootmode MMC Config macros */
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>> /* Primary Bootmode USB Config macros */
>> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
>> diff --git a/arch/arm/mach-k3/include/mach/am62p_spl.h b/arch/arm/
>> mach-k3/include/mach/am62p_spl.h
>> index db145a7bc83..0ddcacd912b 100644
>> --- a/arch/arm/mach-k3/include/mach/am62p_spl.h
>> +++ b/arch/arm/mach-k3/include/mach/am62p_spl.h
>> @@ -17,7 +17,7 @@
>> #define BOOT_DEVICE_ETHERNET_RMII 0x05
>> #define BOOT_DEVICE_I2C 0x06
>> #define BOOT_DEVICE_UART 0x07
>> -#define BOOT_DEVICE_MMC 0x08
>> +#define BOOT_DEVICE_MMCSD 0x08
>> #define BOOT_DEVICE_EMMC 0x09
>> #define BOOT_DEVICE_USB 0x2A
>> @@ -30,16 +30,16 @@
>> /* U-Boot used aliases */
>> #define BOOT_DEVICE_ETHERNET 0x04
>> #define BOOT_DEVICE_SPINAND 0x10
>> -#define BOOT_DEVICE_MMC2 0x08
>> -#define BOOT_DEVICE_MMC1 0x09
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>> /* Invalid */
>> -#define BOOT_DEVICE_MMC2_2 0x1F
>> +#define BOOT_DEVICE_MMC2_2 0xFF2
>> /* Backup BootMode devices */
>> #define BACKUP_BOOT_DEVICE_DFU 0x01
>> #define BACKUP_BOOT_DEVICE_UART 0x03
>> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
>> -#define BACKUP_BOOT_DEVICE_MMC 0x05
>> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
>> #define BACKUP_BOOT_DEVICE_SPI 0x06
>> #define BACKUP_BOOT_DEVICE_I2C 0x07
>> #define BACKUP_BOOT_DEVICE_USB 0x09
>> diff --git a/arch/arm/mach-k3/include/mach/am64_hardware.h b/arch/arm/
>> mach-k3/include/mach/am64_hardware.h
>> index 105b42986de..67dc4eeb82f 100644
>> --- a/arch/arm/mach-k3/include/mach/am64_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/am64_hardware.h
>> @@ -33,8 +33,8 @@
>> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>> /* After the cfg mask and shifts have been applied */
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x04
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x04
>> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
>> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_MASK 0x02
>> diff --git a/arch/arm/mach-k3/include/mach/am64_spl.h b/arch/arm/mach-
>> k3/include/mach/am64_spl.h
>> index a0a517019cb..9bd14d3679d 100644
>> --- a/arch/arm/mach-k3/include/mach/am64_spl.h
>> +++ b/arch/arm/mach-k3/include/mach/am64_spl.h
>> @@ -17,7 +17,7 @@
>> #define BOOT_DEVICE_ETHERNET_RMII 0x05
>> #define BOOT_DEVICE_I2C 0x06
>> #define BOOT_DEVICE_UART 0x07
>> -#define BOOT_DEVICE_MMC 0x08
>> +#define BOOT_DEVICE_MMCSD 0x08
>> #define BOOT_DEVICE_EMMC 0x09
>> #define BOOT_DEVICE_USB 0x2A
>> @@ -29,16 +29,17 @@
>> #define BOOT_DEVICE_NOBOOT 0x0F
>> -#define BOOT_DEVICE_MMC2 0x08
>> -#define BOOT_DEVICE_MMC1 0x09
>> -/* INVALID */
>> -#define BOOT_DEVICE_MMC2_2 0x1F
>> +/* U-Boot used aliases */
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>> +/* Invalid */
>> +#define BOOT_DEVICE_MMC2_2 0xFF2
>> /* Backup BootMode devices */
>> #define BACKUP_BOOT_DEVICE_DFU 0x01
>> #define BACKUP_BOOT_DEVICE_UART 0x03
>> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
>> -#define BACKUP_BOOT_DEVICE_MMC 0x05
>> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
>> #define BACKUP_BOOT_DEVICE_SPI 0x06
>> #define BACKUP_BOOT_DEVICE_I2C 0x07
>> #define BACKUP_BOOT_DEVICE_USB 0x09
>> diff --git a/arch/arm/mach-k3/include/mach/am6_hardware.h b/arch/arm/
>> mach-k3/include/mach/am6_hardware.h
>> index 8169584a372..008f80ae526 100644
>> --- a/arch/arm/mach-k3/include/mach/am6_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/am6_hardware.h
>> @@ -21,12 +21,12 @@
>> #define CTRLMMR_MAIN_DEVSTAT_BOOTMODE_SHIFT 0
>> #define CTRLMMR_MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(6, 4)
>> #define CTRLMMR_MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 4
>> -#define CTRLMMR_MAIN_DEVSTAT_MMC_PORT_MASK GENMASK(12, 12)
>> -#define CTRLMMR_MAIN_DEVSTAT_MMC_PORT_SHIFT 12
>> +#define CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_MASK GENMASK(12, 12)
>> +#define CTRLMMR_MAIN_DEVSTAT_MMCSD_PORT_SHIFT 12
>> #define CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_MASK GENMASK(14, 14)
>> #define CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT 14
>> -#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_MASK GENMASK(17, 17)
>> -#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 12
>> +#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK GENMASK(17, 17)
>> +#define CTRLMMR_MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 12
>> #define CTRLMMR_MAIN_DEVSTAT_USB_MODE_SHIFT 9
>> #define CTRLMMR_MAIN_DEVSTAT_USB_MODE_MASK GENMASK(10, 9)
>> diff --git a/arch/arm/mach-k3/include/mach/am6_spl.h b/arch/arm/mach-
>> k3/include/mach/am6_spl.h
>> index 4c6950ff2b7..b7fa2f8d8b9 100644
>> --- a/arch/arm/mach-k3/include/mach/am6_spl.h
>> +++ b/arch/arm/mach-k3/include/mach/am6_spl.h
>> @@ -12,21 +12,26 @@
>> #define BOOT_DEVICE_HYPERFLASH 0x03
>> #define BOOT_DEVICE_SPI 0x04
>> #define BOOT_DEVICE_I2C 0x05
>> -#define BOOT_DEVICE_MMC2 0x06
>> +#define BOOT_DEVICE_MMCSD 0x06
>> #define BOOT_DEVICE_ETHERNET 0x07
>> #define BOOT_DEVICE_DFU 0x08
>> #define BOOT_DEVICE_USB 0x408
>> #define BOOT_DEVICE_PCIE 0x09
>> #define BOOT_DEVICE_UART 0x0a
>> #define BOOT_DEVICE_NAND 0x0c
>> -#define BOOT_DEVICE_MMC1 0x0d
>> -#define BOOT_DEVICE_MMC2_2 0x0e
>> +#define BOOT_DEVICE_EMMC 0x0d
>> +
>> +/* U-Boot used aliases */
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>> +/* Invalid */
>> +#define BOOT_DEVICE_MMC2_2 0xFF2
>> #define BACKUP_BOOT_DEVICE_RAM 0x0
>> #define BACKUP_BOOT_DEVICE_USB 0x1
>> #define BACKUP_BOOT_DEVICE_UART 0x2
>> #define BACKUP_BOOT_DEVICE_ETHERNET 0x3
>> -#define BACKUP_BOOT_DEVICE_MMC2 0x4
>> +#define BACKUP_BOOT_DEVICE_MMCSD 0x4
>> #define BACKUP_BOOT_DEVICE_SPI 0x5
>> #define BACKUP_BOOT_DEVICE_HYPERFLASH 0x6
>> #define BACKUP_BOOT_DEVICE_I2C 0x7
>> diff --git a/arch/arm/mach-k3/include/mach/j721e_hardware.h b/arch/
>> arm/mach-k3/include/mach/j721e_hardware.h
>> index 5bef309af0a..341e9c28d81 100644
>> --- a/arch/arm/mach-k3/include/mach/j721e_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/j721e_hardware.h
>> @@ -20,10 +20,10 @@
>> #define MAIN_DEVSTAT_BOOT_MODE_B_SHIFT 0
>> #define MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(3, 1)
>> #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1
>> -#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6)
>> +#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK BIT(6)
>> #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6
>> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7)
>> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7
>> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK BIT(7)
>> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 7
>> #define CTRLMMR_WKUP_DEVSTAT (WKUP_CTRL_MMR0_BASE + 0x30)
>> #define WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(5, 3)
>> diff --git a/arch/arm/mach-k3/include/mach/j721e_spl.h b/arch/arm/
>> mach-k3/include/mach/j721e_spl.h
>> index aaee6535376..008595b7f26 100644
>> --- a/arch/arm/mach-k3/include/mach/j721e_spl.h
>> +++ b/arch/arm/mach-k3/include/mach/j721e_spl.h
>> @@ -18,22 +18,28 @@
>> #define BOOT_DEVICE_NOR BOOT_DEVICE_HYPERFLASH
>> /* With BootMode B = 1 */
>> -#define BOOT_DEVICE_MMC2 0x10
>> -#define BOOT_DEVICE_MMC1 0x11
>> +#define BOOT_DEVICE_MMCSD 0x10
>> +#define BOOT_DEVICE_EMMC 0x11
>> #define BOOT_DEVICE_DFU 0x12
>> #define BOOT_DEVICE_UFS 0x13
>> #define BOOT_DEVIE_GPMC 0x14
>> #define BOOT_DEVICE_PCIE 0x15
>> #define BOOT_DEVICE_XSPI 0x16
>> #define BOOT_DEVICE_RAM 0x17
>> -#define BOOT_DEVICE_MMC2_2 0xFF /* Invalid value */
>> +
>> + /* U-Boot used aliases */
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>> + /* Invalid */
>> +#define BOOT_DEVICE_MMC2_2 0xFF2
>> +
>> /* Backup boot modes with MCU Only = 0 */
>> #define BACKUP_BOOT_DEVICE_RAM 0x0
>> #define BACKUP_BOOT_DEVICE_USB 0x1
>> #define BACKUP_BOOT_DEVICE_UART 0x3
>> #define BACKUP_BOOT_DEVICE_ETHERNET 0x4
>> -#define BACKUP_BOOT_DEVICE_MMC2 0x5
>> +#define BACKUP_BOOT_DEVICE_MMCSD 0x5
>> #define BACKUP_BOOT_DEVICE_SPI 0x6
>> #define BACKUP_BOOT_DEVICE_I2C 0x7
>> diff --git a/arch/arm/mach-k3/include/mach/j721s2_hardware.h b/arch/
>> arm/mach-k3/include/mach/j721s2_hardware.h
>> index 82f076a45e0..f2a3140e0b6 100644
>> --- a/arch/arm/mach-k3/include/mach/j721s2_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/j721s2_hardware.h
>> @@ -20,10 +20,10 @@
>> #define MAIN_DEVSTAT_BOOT_MODE_B_SHIFT 0
>> #define MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(3, 1)
>> #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1
>> -#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6)
>> +#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK BIT(6)
>> #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6
>> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7)
>> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7
>> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK BIT(7)
>> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 7
>> #define CTRLMMR_WKUP_DEVSTAT (WKUP_CTRL_MMR0_BASE +
>> 0x30)
>> #define WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(5, 3)
>> diff --git a/arch/arm/mach-k3/include/mach/j721s2_spl.h b/arch/arm/
>> mach-k3/include/mach/j721s2_spl.h
>> index 47a61281d94..5ede79b6744 100644
>> --- a/arch/arm/mach-k3/include/mach/j721s2_spl.h
>> +++ b/arch/arm/mach-k3/include/mach/j721s2_spl.h
>> @@ -19,22 +19,27 @@
>> #define BOOT_DEVICE_NOR BOOT_DEVICE_HYPERFLASH
>> /* With BootMode B = 1 */
>> -#define BOOT_DEVICE_MMC2 0x10
>> -#define BOOT_DEVICE_MMC1 0x11
>> +#define BOOT_DEVICE_MMCSD 0x10
>> +#define BOOT_DEVICE_EMMC 0x11
>> #define BOOT_DEVICE_DFU 0x12
>> #define BOOT_DEVICE_UFS 0x13
>> #define BOOT_DEVIE_GPMC 0x14
>> #define BOOT_DEVICE_PCIE 0x15
>> #define BOOT_DEVICE_XSPI 0x16
>> #define BOOT_DEVICE_RAM 0x17
>> -#define BOOT_DEVICE_MMC2_2 0xFF /* Invalid value */
>> +
>> +/* U-Boot used aliases */
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>> +/* Invalid */
>> +#define BOOT_DEVICE_MMC2_2 0xFF2
>> /* Backup boot modes with MCU Only = 0 */
>> #define BACKUP_BOOT_DEVICE_RAM 0x0
>> #define BACKUP_BOOT_DEVICE_USB 0x1
>> #define BACKUP_BOOT_DEVICE_UART 0x3
>> #define BACKUP_BOOT_DEVICE_ETHERNET 0x4
>> -#define BACKUP_BOOT_DEVICE_MMC2 0x5
>> +#define BACKUP_BOOT_DEVICE_MMCSD 0x5
>> #define BACKUP_BOOT_DEVICE_SPI 0x6
>> #define BACKUP_BOOT_DEVICE_I2C 0x7
>> diff --git a/arch/arm/mach-k3/include/mach/j722s_hardware.h b/arch/
>> arm/mach-k3/include/mach/j722s_hardware.h
>> index 0c695134c28..77b455af09a 100644
>> --- a/arch/arm/mach-k3/include/mach/j722s_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/j722s_hardware.h
>> @@ -30,10 +30,10 @@
>> #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13
>> /* Primary Bootmode MMC Config macros */
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT 2
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK 0x1
>> -#define MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT 0
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_MASK 0x4
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_PORT_SHIFT 2
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_MASK 0x1
>> +#define MAIN_DEVSTAT_PRIMARY_MMCSD_FS_RAW_SHIFT 0
>> /* Primary Bootmode USB Config macros */
>> #define MAIN_DEVSTAT_PRIMARY_USB_MODE_SHIFT 1
>> diff --git a/arch/arm/mach-k3/include/mach/j722s_spl.h b/arch/arm/
>> mach-k3/include/mach/j722s_spl.h
>> index a91cc82448f..aea43eeb23c 100644
>> --- a/arch/arm/mach-k3/include/mach/j722s_spl.h
>> +++ b/arch/arm/mach-k3/include/mach/j722s_spl.h
>> @@ -17,7 +17,7 @@
>> #define BOOT_DEVICE_ETHERNET_RMII 0x05
>> #define BOOT_DEVICE_I2C 0x06
>> #define BOOT_DEVICE_UART 0x07
>> -#define BOOT_DEVICE_MMC 0x08
>> +#define BOOT_DEVICE_MMCSD 0x08
>> #define BOOT_DEVICE_EMMC 0x09
>> #define BOOT_DEVICE_USB 0x2A
>> @@ -31,16 +31,16 @@
>> /* U-Boot used aliases */
>> #define BOOT_DEVICE_ETHERNET 0x04
>> #define BOOT_DEVICE_SPINAND 0x10
>> -#define BOOT_DEVICE_MMC2 0x08
>> -#define BOOT_DEVICE_MMC1 0x09
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>> /* Invalid */
>> -#define BOOT_DEVICE_MMC2_2 0x1F
>> +#define BOOT_DEVICE_MMC2_2 0xFF2
>> /* Backup BootMode devices */
>> #define BACKUP_BOOT_DEVICE_DFU 0x01
>> #define BACKUP_BOOT_DEVICE_UART 0x03
>> #define BACKUP_BOOT_DEVICE_ETHERNET 0x04
>> -#define BACKUP_BOOT_DEVICE_MMC 0x05
>> +#define BACKUP_BOOT_DEVICE_MMCSD 0x05
>> #define BACKUP_BOOT_DEVICE_SPI 0x06
>> #define BACKUP_BOOT_DEVICE_I2C 0x07
>> #define BACKUP_BOOT_DEVICE_USB 0x09
>> diff --git a/arch/arm/mach-k3/include/mach/j784s4_hardware.h b/arch/
>> arm/mach-k3/include/mach/j784s4_hardware.h
>> index 29a894baed3..e8e2037f804 100644
>> --- a/arch/arm/mach-k3/include/mach/j784s4_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/j784s4_hardware.h
>> @@ -20,10 +20,10 @@
>> #define MAIN_DEVSTAT_BOOT_MODE_B_SHIFT 0
>> #define MAIN_DEVSTAT_BKUP_BOOTMODE_MASK GENMASK(3, 1)
>> #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1
>> -#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6)
>> +#define MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK BIT(6)
>> #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6
>> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7)
>> -#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7
>> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK BIT(7)
>> +#define MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT 7
>> #define CTRLMMR_WKUP_DEVSTAT (WKUP_CTRL_MMR0_BASE +
>> 0x30)
>> #define WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(5, 3)
>> diff --git a/arch/arm/mach-k3/include/mach/j784s4_spl.h b/arch/arm/
>> mach-k3/include/mach/j784s4_spl.h
>> index 3814dc95d01..0871a85d0c5 100644
>> --- a/arch/arm/mach-k3/include/mach/j784s4_spl.h
>> +++ b/arch/arm/mach-k3/include/mach/j784s4_spl.h
>> @@ -19,22 +19,27 @@
>> #define BOOT_DEVICE_NOR BOOT_DEVICE_HYPERFLASH
>> /* With BootMode B = 1 */
>> -#define BOOT_DEVICE_MMC2 0x10
>> -#define BOOT_DEVICE_MMC1 0x11
>> +#define BOOT_DEVICE_MMCSD 0x10
>> +#define BOOT_DEVICE_EMMC 0x11
>> #define BOOT_DEVICE_DFU 0x12
>> #define BOOT_DEVICE_UFS 0x13
>> #define BOOT_DEVIE_GPMC 0x14
>> #define BOOT_DEVICE_PCIE 0x15
>> #define BOOT_DEVICE_XSPI 0x16
>> #define BOOT_DEVICE_RAM 0x17
>> -#define BOOT_DEVICE_MMC2_2 0xFF /* Invalid value */
>> +
>> +/* U-Boot used aliases */
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>> +/* Invalid */
>> +#define BOOT_DEVICE_MMC2_2 0xFF2
>> /* Backup boot modes with MCU Only = 0 */
>> #define BACKUP_BOOT_DEVICE_RAM 0x0
>> #define BACKUP_BOOT_DEVICE_USB 0x1
>> #define BACKUP_BOOT_DEVICE_UART 0x3
>> #define BACKUP_BOOT_DEVICE_ETHERNET 0x4
>> -#define BACKUP_BOOT_DEVICE_MMC2 0x5
>> +#define BACKUP_BOOT_DEVICE_MMCSD 0x5
>> #define BACKUP_BOOT_DEVICE_SPI 0x6
>> #define BACKUP_BOOT_DEVICE_I2C 0x7
>> diff --git a/arch/arm/mach-k3/j721e/j721e_init.c b/arch/arm/mach-k3/
>> j721e/j721e_init.c
>> index f9af0288cf6..30087705334 100644
>> --- a/arch/arm/mach-k3/j721e/j721e_init.c
>> +++ b/arch/arm/mach-k3/j721e/j721e_init.c
>> @@ -450,10 +450,10 @@ static u32 __get_backup_bootmedia(u32 main_devstat)
>> return BOOT_DEVICE_UART;
>> case BACKUP_BOOT_DEVICE_ETHERNET:
>> return BOOT_DEVICE_ETHERNET;
>> - case BACKUP_BOOT_DEVICE_MMC2:
>> + case BACKUP_BOOT_DEVICE_MMCSD:
>> {
>> - u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >>
>> - MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT;
>> + u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMCSD_PORT_MASK) >>
>> + MAIN_DEVSTAT_BKUP_MMCSD_PORT_SHIFT;
>> if (port == 0x0)
>> return BOOT_DEVICE_MMC1;
>> return BOOT_DEVICE_MMC2;
>> @@ -480,14 +480,18 @@ static u32 __get_primary_bootmedia(u32
>> main_devstat, u32 wkup_devstat)
>> bootmode == BOOT_DEVICE_XSPI)
>> bootmode = BOOT_DEVICE_SPI;
>> - if (bootmode == BOOT_DEVICE_MMC2) {
>> + if (bootmode == BOOT_DEVICE_MMCSD) {
>> + bootmode = BOOT_DEVICE_MMC2;
>> u32 port = (main_devstat &
>> - MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK) >>
>> + MAIN_DEVSTAT_PRIM_BOOTMODE_MMCSD_PORT_MASK) >>
>> MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT;
>> if (port == 0x0)
>> bootmode = BOOT_DEVICE_MMC1;
>> }
>> + if (bootmode == BOOT_DEVICE_EMMC)
>> + bootmode = BOOT_DEVICE_MMC1;
>> +
>
> Are the above two lines redundant as eMMC is selected based on the port
> being 0x0?
No they are not redundant.
The first BOOT_DEVICE_MMC1 is returned on MMCSD boot, second is returned
on eMMC boot.
~ Judith
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-10 21:45 ` [PATCH 1/4] arm: mach-k3: Fix MMC macros Judith Mendez
` (2 preceding siblings ...)
2025-09-15 11:40 ` Moteen Shah
@ 2025-09-15 14:22 ` Wadim Egorov
2025-09-15 18:09 ` Judith Mendez
3 siblings, 1 reply; 28+ messages in thread
From: Wadim Egorov @ 2025-09-15 14:22 UTC (permalink / raw)
To: Judith Mendez, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Andrew Davis, Udit Kumar, u-boot
Hi Judith,
On 9/11/25 12:45 AM, Judith Mendez wrote:
> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The macros
> however, mix MMC device with the two bootmodes. Decouple the two types
> of macros so that bootmodes can be identified with:
> - BOOT_DEVICE_MMCSD
> - BOOT_DEVICE_EMMC
> according to devstat parsed boot mode values and on-board devices can be
> identified with:
> - BOOT_DEVICE_MMC1
> - BOOT_DEVICE_MMC2
> - BOOT_DEVICE_MMC2_2
> according to arbitrary numbers mainly used to differentiate between eMMC
> and SD card.
>
> Signed-off-by: Judith Mendez <jm@ti.com>
> ---
<snip>
> +++ b/arch/arm/mach-k3/include/mach/am62_spl.h
> @@ -17,7 +17,7 @@
> #define BOOT_DEVICE_ETHERNET_RMII 0x05
> #define BOOT_DEVICE_I2C 0x06
> #define BOOT_DEVICE_UART 0x07
> -#define BOOT_DEVICE_MMC 0x08
> +#define BOOT_DEVICE_MMCSD 0x08
> #define BOOT_DEVICE_EMMC 0x09
>
> #define BOOT_DEVICE_USB 0x2A
> @@ -29,16 +29,16 @@
>
> /* U-Boot used aliases */
> #define BOOT_DEVICE_ETHERNET 0x04
> -#define BOOT_DEVICE_MMC2 0x08
> -#define BOOT_DEVICE_MMC1 0x09
> +#define BOOT_DEVICE_MMC1 0xFF0
> +#define BOOT_DEVICE_MMC2 0xFF1
How did you end up using 0xFF0? Is it simply to make the difference
between modes more clear? It probably does not matter because it is a
u-boot-only representation.
Regards,
Wadim
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros
2025-09-15 14:22 ` Wadim Egorov
@ 2025-09-15 18:09 ` Judith Mendez
0 siblings, 0 replies; 28+ messages in thread
From: Judith Mendez @ 2025-09-15 18:09 UTC (permalink / raw)
To: Wadim Egorov, Tom Rini
Cc: Manorit Chawdhry, Apurva Nandan, Vignesh Raghavendra,
Bryan Brattlof, Vaishnav Achath, Jayesh Choudhary, Moteen Shah,
Andrew Davis, Udit Kumar, u-boot
On 9/15/25 9:22 AM, Wadim Egorov wrote:
> Hi Judith,
>
> On 9/11/25 12:45 AM, Judith Mendez wrote:
>> For all K3 SoC's eMMC boot and MMCSD boot modes are supported. The macros
>> however, mix MMC device with the two bootmodes. Decouple the two types
>> of macros so that bootmodes can be identified with:
>> - BOOT_DEVICE_MMCSD
>> - BOOT_DEVICE_EMMC
>> according to devstat parsed boot mode values and on-board devices can be
>> identified with:
>> - BOOT_DEVICE_MMC1
>> - BOOT_DEVICE_MMC2
>> - BOOT_DEVICE_MMC2_2
>> according to arbitrary numbers mainly used to differentiate between eMMC
>> and SD card.
>>
>> Signed-off-by: Judith Mendez <jm@ti.com>
>> ---
>
> <snip>
>
>> +++ b/arch/arm/mach-k3/include/mach/am62_spl.h
>> @@ -17,7 +17,7 @@
>> #define BOOT_DEVICE_ETHERNET_RMII 0x05
>> #define BOOT_DEVICE_I2C 0x06
>> #define BOOT_DEVICE_UART 0x07
>> -#define BOOT_DEVICE_MMC 0x08
>> +#define BOOT_DEVICE_MMCSD 0x08
>> #define BOOT_DEVICE_EMMC 0x09
>> #define BOOT_DEVICE_USB 0x2A
>> @@ -29,16 +29,16 @@
>> /* U-Boot used aliases */
>> #define BOOT_DEVICE_ETHERNET 0x04
>> -#define BOOT_DEVICE_MMC2 0x08
>> -#define BOOT_DEVICE_MMC1 0x09
>> +#define BOOT_DEVICE_MMC1 0xFF0
>> +#define BOOT_DEVICE_MMC2 0xFF1
>
> How did you end up using 0xFF0? Is it simply to make the difference
> between modes more clear? It probably does not matter because it is a u-
> boot-only representation.
Yes to differentiate. So it it does not matter then why does it matter
to change to 0xFF0? My opinion here is that switching to 0xFF0 helps\
when debugging.
This method is the same way we were doing with BOOT_DEVICE_MMC2_2 which
also had an arbitrary number because the macro is required by u-boot.
But now::
BOOT_DEVICE_MMC2 -> 0xFF0 instead of using MMCSD boot value
BOOT_DEVICE_MMC1 -> 0xFF1 instead of using eMMC boot value
and just modified:
BOOT_DEVICE_MMC2_2 -> 0xFF2 instead of 0xFF or other arbitrary numbers.
~ Judith
^ permalink raw reply [flat|nested] 28+ messages in thread