Skip to contentSkip to conversation

General MMC fixes for K3

PATCH In review Judith Mendez 6 participants 28 messages Sep 10, 2025 – Sep 18, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover General MMC fixes for K3

This patch series includes some general fixes for MMC on K3 devices.

The first patch fixes the MMC macros used for booting with eMMC boot, and MMCSD boot.

Subsequent patches fix eMMC boot on AM62P device and fixing eMMC HS400 configs for am62p/j722s devices.

The patch series has been tested with SD boot and eMMC boot on:
- am62ax SK
- am62px SK
- am62x SK
- am64x EVM
- am654 IDK

and only build tested for: J7 platforms.

Judith Mendez (4):
arm: mach-k3: Fix MMC macros
configs: am62px_evm_r5_defconfig: Add support eMMC boot config
configs: am62px/j722s: Remove non-spl HS400 support at r5 stage
configs: j722s_evm_a53_defconfig: Disable eMMC HS400

 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 +++++++++-----
 configs/am62px_evm_r5_defconfig                |  2 +-
 configs/j722s_evm_a53_defconfig                |  4 ++--
 configs/j722s_evm_r5_defconfig                 |  1 -
 32 files changed, 163 insertions(+), 128 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/4 arm: mach-k3: Fix MMC macros

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.

---
 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(-)
arch/arm/mach-k3/am62ax/am62a7_init.c +2 -2
index 00173e6836b..1fd466bbdfc 100644
@@ -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;
arch/arm/mach-k3/am62ax/boot.c +4 -4
index af7fce1e5e9..808224108b9 100644
@@ -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;
 
arch/arm/mach-k3/am62px/am62p5_init.c +6 -6
index 44a2d445d24..9574089325c 100644
@@ -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;
 
arch/arm/mach-k3/am62x/am625_init.c +2 -2
index 8f4ddf59753..46da9ba8850 100644
@@ -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;
arch/arm/mach-k3/am62x/boot.c +4 -4
index a3a6cda6bdb..c5f6dcea2b9 100644
@@ -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;
 
arch/arm/mach-k3/am64x/boot.c +4 -4
index ce8ae941be6..6145c09bab5 100644
@@ -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;
 
arch/arm/mach-k3/am65x/am654_init.c +10 -8
index a4f038029d7..9fcea12d243 100644
@@ -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)
arch/arm/mach-k3/include/mach/am62_hardware.h +4 -4
index 2f5655bf24a..94f2208cf52 100644
@@ -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
arch/arm/mach-k3/include/mach/am62_spl.h +5 -5
index 2c9139d2cc0..8df53ac38bb 100644
@@ -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
arch/arm/mach-k3/include/mach/am62a_hardware.h +4 -4
index f3fd736f31b..7f715d6a7ab 100644
@@ -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
arch/arm/mach-k3/include/mach/am62a_spl.h +5 -5
index dd0f57714f5..323b9d404aa 100644
@@ -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
arch/arm/mach-k3/include/mach/am62p_hardware.h +4 -4
index a310b52b45d..984c10719e1 100644
@@ -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
arch/arm/mach-k3/include/mach/am62p_spl.h +5 -5
index db145a7bc83..0ddcacd912b 100644
@@ -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
arch/arm/mach-k3/include/mach/am64_hardware.h +2 -2
index 105b42986de..67dc4eeb82f 100644
@@ -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
arch/arm/mach-k3/include/mach/am64_spl.h +7 -6
index a0a517019cb..9bd14d3679d 100644
@@ -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
arch/arm/mach-k3/include/mach/am6_hardware.h +4 -4
index 8169584a372..008f80ae526 100644
@@ -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)
 
arch/arm/mach-k3/include/mach/am6_spl.h +9 -4
index 4c6950ff2b7..b7fa2f8d8b9 100644
@@ -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
arch/arm/mach-k3/include/mach/j721e_hardware.h +3 -3
index 5bef309af0a..341e9c28d81 100644
@@ -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)
arch/arm/mach-k3/include/mach/j721e_spl.h +10 -4
index aaee6535376..008595b7f26 100644
@@ -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
 
arch/arm/mach-k3/include/mach/j721s2_hardware.h +3 -3
index 82f076a45e0..f2a3140e0b6 100644
@@ -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)
arch/arm/mach-k3/include/mach/j721s2_spl.h +9 -4
index 47a61281d94..5ede79b6744 100644
@@ -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
 
arch/arm/mach-k3/include/mach/j722s_hardware.h +4 -4
index 0c695134c28..77b455af09a 100644
@@ -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
arch/arm/mach-k3/include/mach/j722s_spl.h +5 -5
index a91cc82448f..aea43eeb23c 100644
@@ -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
arch/arm/mach-k3/include/mach/j784s4_hardware.h +3 -3
index 29a894baed3..e8e2037f804 100644
@@ -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)
arch/arm/mach-k3/include/mach/j784s4_spl.h +9 -4
index 3814dc95d01..0871a85d0c5 100644
@@ -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
 
arch/arm/mach-k3/j721e/j721e_init.c +9 -5
index f9af0288cf6..30087705334 100644
@@ -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;
 }
 
arch/arm/mach-k3/j721s2/j721s2_init.c +9 -5
index eee3d0440ac..407040a4c0e 100644
@@ -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;
 }
 
arch/arm/mach-k3/j722s/j722s_init.c +6 -6
index 1180c75f551..86e1d29aea4 100644
@@ -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;
arch/arm/mach-k3/j784s4/j784s4_init.c +9 -5
index 53f152ccd9c..a1cef72bec3 100644
@@ -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;
 }
 
Signature · 1 line
2.51.0
#2 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Quoted 5 lines · Judith Mendez

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

Quoted 5 lines

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

Quoted 2 lines

according to arbitrary numbers mainly used to differentiate between eMMC and SD card.

Please check subject line, this is not a fix

Quoted 38 lines
---
  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(-)
arch/arm/mach-k3/am62ax/am62a7_init.c +0 -0
index 00173e6836b..1fd466bbdfc 100644

arch/arm/mach-k3/am62ax/am62a7_init.c u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)

Quoted 8 lines
arch/arm/mach-k3/am62ax/am62a7_init.c +3 -0
@@ -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

Quoted 3 lines
  	return bootmode;
  }
#3 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Hi Udit, Moteen,

Quoted 10 lines · Udit
Quoted 5 lines · Judith Mendez

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 )

Quoted 8 lines

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:

Quoted 2 lines

#define BOOT_DEVICE_MMC 0x08
#define BOOT_DEVICE_EMMC 0x09

To:

Quoted 2 lines

#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.

Quoted 11 lines
Quoted 7 lines

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.

Quoted 41 lines
Quoted 5 lines

according to arbitrary numbers mainly used to differentiate between eMMC and SD card.

Please check subject line, this is not a fix

Quoted 33 lines

---
  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(-)
Quoted 15 lines

arch/arm/mach-k3/am62ax/am62a7_init.c u32 spl_mmc_boot_mode(struct mmc *mmc, const u32

Quoted 13 lines
arch/arm/mach-k3/am62ax/am62a7_init.c +3 -0
index 00173e6836b..1fd466bbdfc 100644
@@ -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

#4 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Hey Judith,

Quoted 46 lines · Judith Mendez

Hi Udit, Moteen,

Quoted 10 lines · Udit
Quoted 5 lines · Judith Mendez

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 )

Quoted 8 lines

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:

Quoted 2 lines

#define BOOT_DEVICE_MMC                 0x08
#define BOOT_DEVICE_EMMC                0x09

To:

Quoted 2 lines

#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.

Quoted 8 lines
Quoted 7 lines

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

Quoted 6 lines
Quoted 3 lines

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.

Quoted 59 lines
Quoted 43 lines
Quoted 6 lines

according to arbitrary numbers mainly used to differentiate between eMMC and SD card.

Please check subject line, this is not a fix

Quoted 34 lines

---
  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(-)
Quoted 15 lines

arch/arm/mach-k3/am62ax/am62a7_init.c u32 spl_mmc_boot_mode(struct mmc *mmc, const u32

Quoted 13 lines
arch/arm/mach-k3/am62ax/am62a7_init.c +3 -0
index 00173e6836b..1fd466bbdfc 100644
@@ -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

Quoted 1 line

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

Quoted 2 lines

~ Judith

#5 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Hi Moteen,

Quoted 51 lines · Moteen Shah

Hey Judith,

Quoted 48 lines · Judith Mendez

Hi Udit, Moteen,

Quoted 10 lines · Udit
Quoted 5 lines · Judith Mendez

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 )

Quoted 8 lines

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:

Quoted 2 lines

#define BOOT_DEVICE_MMC                 0x08
#define BOOT_DEVICE_EMMC                0x09

To:

Quoted 2 lines

#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.

Quoted 10 lines
Quoted 7 lines

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

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

#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

Quoted 69 lines
Quoted 60 lines
Quoted 44 lines
Quoted 7 lines

according to arbitrary numbers mainly used to differentiate between eMMC and SD card.

Please check subject line, this is not a fix

Quoted 34 lines

---
  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(-)
Quoted 15 lines

arch/arm/mach-k3/am62ax/am62a7_init.c u32 spl_mmc_boot_mode(struct mmc *mmc, const u32

Quoted 13 lines
arch/arm/mach-k3/am62ax/am62a7_init.c +3 -0
index 00173e6836b..1fd466bbdfc 100644
@@ -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

Quoted 1 line

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

Quoted 2 lines

~ Judith

#6 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

In reply to Judith Mendez
Quoted 13 lines · Judith Mendez

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.

Quoted 2 lines

---

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

Quoted 858 lines
 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(-)
arch/arm/mach-k3/am62ax/am62a7_init.c +2 -2
index 00173e6836b..1fd466bbdfc 100644
@@ -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;
arch/arm/mach-k3/am62ax/boot.c +4 -4
index af7fce1e5e9..808224108b9 100644
@@ -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;
 
arch/arm/mach-k3/am62px/am62p5_init.c +6 -6
index 44a2d445d24..9574089325c 100644
@@ -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;
 
arch/arm/mach-k3/am62x/am625_init.c +2 -2
index 8f4ddf59753..46da9ba8850 100644
@@ -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;
arch/arm/mach-k3/am62x/boot.c +4 -4
index a3a6cda6bdb..c5f6dcea2b9 100644
@@ -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;
 
arch/arm/mach-k3/am64x/boot.c +4 -4
index ce8ae941be6..6145c09bab5 100644
@@ -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;
 
arch/arm/mach-k3/am65x/am654_init.c +10 -8
index a4f038029d7..9fcea12d243 100644
@@ -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)
arch/arm/mach-k3/include/mach/am62_hardware.h +4 -4
index 2f5655bf24a..94f2208cf52 100644
@@ -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
arch/arm/mach-k3/include/mach/am62_spl.h +5 -5
index 2c9139d2cc0..8df53ac38bb 100644
@@ -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
arch/arm/mach-k3/include/mach/am62a_hardware.h +4 -4
index f3fd736f31b..7f715d6a7ab 100644
@@ -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
arch/arm/mach-k3/include/mach/am62a_spl.h +5 -5
index dd0f57714f5..323b9d404aa 100644
@@ -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
arch/arm/mach-k3/include/mach/am62p_hardware.h +4 -4
index a310b52b45d..984c10719e1 100644
@@ -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
arch/arm/mach-k3/include/mach/am62p_spl.h +5 -5
index db145a7bc83..0ddcacd912b 100644
@@ -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
arch/arm/mach-k3/include/mach/am64_hardware.h +2 -2
index 105b42986de..67dc4eeb82f 100644
@@ -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
arch/arm/mach-k3/include/mach/am64_spl.h +7 -6
index a0a517019cb..9bd14d3679d 100644
@@ -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
arch/arm/mach-k3/include/mach/am6_hardware.h +4 -4
index 8169584a372..008f80ae526 100644
@@ -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)
 
arch/arm/mach-k3/include/mach/am6_spl.h +9 -4
index 4c6950ff2b7..b7fa2f8d8b9 100644
@@ -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
arch/arm/mach-k3/include/mach/j721e_hardware.h +3 -3
index 5bef309af0a..341e9c28d81 100644
@@ -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)
arch/arm/mach-k3/include/mach/j721e_spl.h +10 -4
index aaee6535376..008595b7f26 100644
@@ -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
 
arch/arm/mach-k3/include/mach/j721s2_hardware.h +3 -3
index 82f076a45e0..f2a3140e0b6 100644
@@ -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)
arch/arm/mach-k3/include/mach/j721s2_spl.h +9 -4
index 47a61281d94..5ede79b6744 100644
@@ -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
 
arch/arm/mach-k3/include/mach/j722s_hardware.h +4 -4
index 0c695134c28..77b455af09a 100644
@@ -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
arch/arm/mach-k3/include/mach/j722s_spl.h +5 -5
index a91cc82448f..aea43eeb23c 100644
@@ -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
arch/arm/mach-k3/include/mach/j784s4_hardware.h +3 -3
index 29a894baed3..e8e2037f804 100644
@@ -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)
arch/arm/mach-k3/include/mach/j784s4_spl.h +9 -4
index 3814dc95d01..0871a85d0c5 100644
@@ -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
 
arch/arm/mach-k3/j721e/j721e_init.c +9 -5
index f9af0288cf6..30087705334 100644
@@ -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;
 }
 
arch/arm/mach-k3/j721s2/j721s2_init.c +9 -5
index eee3d0440ac..407040a4c0e 100644
@@ -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;
 }
 
arch/arm/mach-k3/j722s/j722s_init.c +6 -6
index 1180c75f551..86e1d29aea4 100644
@@ -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;
arch/arm/mach-k3/j784s4/j784s4_init.c +9 -5
index 53f152ccd9c..a1cef72bec3 100644
@@ -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;
 }
 
#7 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Hi Anshul,

Quoted 21 lines · Anshul Dalal
Quoted 13 lines · Judith Mendez

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.

Quoted 2 lines

---

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.

Quoted 8 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
...

#8 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Quoted 52 lines · Judith Mendez

Hi Anshul,

Quoted 21 lines · Anshul Dalal
Quoted 13 lines · Judith Mendez

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.

Quoted 2 lines

---

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.

Quoted 8 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.

Quoted 5 lines

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

Quoted 4 lines

~ Judith
...

#9 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Hi Andrew,

Quoted 59 lines · Andrew Davis
Quoted 52 lines · Judith Mendez

Hi Anshul,

Quoted 21 lines · Anshul Dalal
Quoted 13 lines · Judith Mendez

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.

Quoted 2 lines

---

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.

Quoted 8 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.

Quoted 5 lines

So lets hear if any one else has a strong opinion on this before deciding on:

DEVSTAT_BOOT_MODE_MMCSD
DEVSTAT_BOOT_MODE_EMMC

Quoted 8 lines

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

#10 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

In reply to Andrew Davis

Hi Andrew, Anshul,

Quoted 59 lines · Andrew Davis
Quoted 52 lines · Judith Mendez

Hi Anshul,

Quoted 21 lines · Anshul Dalal
Quoted 13 lines · Judith Mendez

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.

Quoted 2 lines

---

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.

Quoted 8 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.

Quoted 5 lines

So lets hear if any one else has a strong opinion on this before deciding on:

DEVSTAT_BOOT_MODE_MMCSD
DEVSTAT_BOOT_MODE_EMMC

Quoted 8 lines

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

-

#11 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Hi Judith,

Quoted 94 lines · Judith Mendez

Hi Andrew, Anshul,

Quoted 62 lines · Andrew Davis
Quoted 55 lines · Judith Mendez

Hi Anshul,

Quoted 24 lines · Anshul Dalal
Quoted 16 lines · Judith Mendez

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.

Quoted 2 lines

---

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.

Quoted 8 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.

Quoted 5 lines

So lets hear if any one else has a strong opinion on this before deciding on:

DEVSTAT_BOOT_MODE_MMCSD
DEVSTAT_BOOT_MODE_EMMC

Quoted 8 lines

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

Quoted 6 lines

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

#12 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Quoted 109 lines · Anshul Dalal

Hi Judith,

Quoted 94 lines · Judith Mendez

Hi Andrew, Anshul,

Quoted 62 lines · Andrew Davis
Quoted 55 lines · Judith Mendez

Hi Anshul,

Quoted 24 lines · Anshul Dalal
Quoted 16 lines · Judith Mendez

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.

Quoted 2 lines

---

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.

Quoted 8 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.

Quoted 5 lines

So lets hear if any one else has a strong opinion on this before deciding on:

DEVSTAT_BOOT_MODE_MMCSD
DEVSTAT_BOOT_MODE_EMMC

Quoted 8 lines

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

Quoted 6 lines

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.

Quoted 6 lines

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

#13 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Quoted 117 lines · Judith Mendez
Quoted 109 lines · Anshul Dalal

Hi Judith,

Quoted 94 lines · Judith Mendez

Hi Andrew, Anshul,

Quoted 62 lines · Andrew Davis
Quoted 55 lines · Judith Mendez

Hi Anshul,

Quoted 24 lines · Anshul Dalal
Quoted 16 lines · Judith Mendez

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.

Quoted 2 lines

---

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.

Quoted 8 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.

Quoted 5 lines

So lets hear if any one else has a strong opinion on this before deciding on:

DEVSTAT_BOOT_MODE_MMCSD
DEVSTAT_BOOT_MODE_EMMC

Quoted 8 lines

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

Quoted 6 lines

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.

Quoted 6 lines

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.

Quoted 8 lines

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

#14 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Hi Andrew,

Quoted 133 lines · Andrew Davis
Quoted 117 lines · Judith Mendez
Quoted 109 lines · Anshul Dalal

Hi Judith,

Quoted 94 lines · Judith Mendez

Hi Andrew, Anshul,

Quoted 62 lines · Andrew Davis
Quoted 55 lines · Judith Mendez

Hi Anshul,

Quoted 24 lines · Anshul Dalal
Quoted 16 lines · Judith Mendez

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.

Quoted 2 lines

---

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.

Quoted 8 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.

Quoted 5 lines

So lets hear if any one else has a strong opinion on this before deciding on:

DEVSTAT_BOOT_MODE_MMCSD
DEVSTAT_BOOT_MODE_EMMC

Quoted 8 lines

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

Quoted 6 lines

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.

Quoted 6 lines

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.

Quoted 8 lines

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".

Quoted 5 lines

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

#15 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

In reply to Judith Mendez

Hey Judith,

Quoted 745 lines · Judith Mendez

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.

---
  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(-)
arch/arm/mach-k3/am62ax/am62a7_init.c +2 -2
index 00173e6836b..1fd466bbdfc 100644
@@ -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;
arch/arm/mach-k3/am62ax/boot.c +4 -4
index af7fce1e5e9..808224108b9 100644
@@ -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;
 
arch/arm/mach-k3/am62px/am62p5_init.c +6 -6
index 44a2d445d24..9574089325c 100644
@@ -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;
 
arch/arm/mach-k3/am62x/am625_init.c +2 -2
index 8f4ddf59753..46da9ba8850 100644
@@ -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;
arch/arm/mach-k3/am62x/boot.c +4 -4
index a3a6cda6bdb..c5f6dcea2b9 100644
@@ -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;
 
arch/arm/mach-k3/am64x/boot.c +4 -4
index ce8ae941be6..6145c09bab5 100644
@@ -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;
 
arch/arm/mach-k3/am65x/am654_init.c +10 -8
index a4f038029d7..9fcea12d243 100644
@@ -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)
arch/arm/mach-k3/include/mach/am62_hardware.h +4 -4
index 2f5655bf24a..94f2208cf52 100644
@@ -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
arch/arm/mach-k3/include/mach/am62_spl.h +5 -5
index 2c9139d2cc0..8df53ac38bb 100644
@@ -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
arch/arm/mach-k3/include/mach/am62a_hardware.h +4 -4
index f3fd736f31b..7f715d6a7ab 100644
@@ -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
arch/arm/mach-k3/include/mach/am62a_spl.h +5 -5
index dd0f57714f5..323b9d404aa 100644
@@ -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
arch/arm/mach-k3/include/mach/am62p_hardware.h +4 -4
index a310b52b45d..984c10719e1 100644
@@ -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
arch/arm/mach-k3/include/mach/am62p_spl.h +5 -5
index db145a7bc83..0ddcacd912b 100644
@@ -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
arch/arm/mach-k3/include/mach/am64_hardware.h +2 -2
index 105b42986de..67dc4eeb82f 100644
@@ -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
arch/arm/mach-k3/include/mach/am64_spl.h +7 -6
index a0a517019cb..9bd14d3679d 100644
@@ -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
arch/arm/mach-k3/include/mach/am6_hardware.h +4 -4
index 8169584a372..008f80ae526 100644
@@ -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)
 
arch/arm/mach-k3/include/mach/am6_spl.h +9 -4
index 4c6950ff2b7..b7fa2f8d8b9 100644
@@ -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
arch/arm/mach-k3/include/mach/j721e_hardware.h +3 -3
index 5bef309af0a..341e9c28d81 100644
@@ -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)
arch/arm/mach-k3/include/mach/j721e_spl.h +10 -4
index aaee6535376..008595b7f26 100644
@@ -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
 
arch/arm/mach-k3/include/mach/j721s2_hardware.h +3 -3
index 82f076a45e0..f2a3140e0b6 100644
@@ -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)
arch/arm/mach-k3/include/mach/j721s2_spl.h +9 -4
index 47a61281d94..5ede79b6744 100644
@@ -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
 
arch/arm/mach-k3/include/mach/j722s_hardware.h +4 -4
index 0c695134c28..77b455af09a 100644
@@ -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
arch/arm/mach-k3/include/mach/j722s_spl.h +5 -5
index a91cc82448f..aea43eeb23c 100644
@@ -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
arch/arm/mach-k3/include/mach/j784s4_hardware.h +3 -3
index 29a894baed3..e8e2037f804 100644
@@ -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)
arch/arm/mach-k3/include/mach/j784s4_spl.h +9 -4
index 3814dc95d01..0871a85d0c5 100644
@@ -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
 
arch/arm/mach-k3/j721e/j721e_init.c +5 -4
index f9af0288cf6..30087705334 100644
@@ -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 &

arch/arm/mach-k3/j721e/j721e_init.c static u32 __get_primary_bootmedia(u32 main_devstat, u32 wkup_devstat) · line 494

Quoted 10 lines
arch/arm/mach-k3/j721e/j721e_init.c +4 -1
-			    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

#16 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Hi Moteen,

Quoted 705 lines · Moteen Shah

Hey Judith,

Quoted 702 lines · Judith Mendez

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.

---
  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(-)
arch/arm/mach-k3/am62ax/am62a7_init.c +2 -2
index 00173e6836b..1fd466bbdfc 100644
@@ -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;

arch/arm/mach-k3/am62ax/boot.c +0 -0
index af7fce1e5e9..808224108b9 100644
@@ -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;

arch/arm/mach-k3/am62ax/boot.c +0 -0
@@ -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;

arch/arm/mach-k3/am62px/am62p5_init.c +2 -2
index 44a2d445d24..9574089325c 100644
@@ -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:

arch/arm/mach-k3/am62px/am62p5_init.c +0 -0
@@ -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;

arch/arm/mach-k3/am62px/am62p5_init.c +0 -0
@@ -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;

arch/arm/mach-k3/am62x/am625_init.c +2 -2
index 8f4ddf59753..46da9ba8850 100644
@@ -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;

arch/arm/mach-k3/am62x/boot.c +0 -0
index a3a6cda6bdb..c5f6dcea2b9 100644
@@ -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;

arch/arm/mach-k3/am62x/boot.c +0 -0
@@ -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;

arch/arm/mach-k3/am64x/boot.c +0 -0
index ce8ae941be6..6145c09bab5 100644
@@ -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;

arch/arm/mach-k3/am64x/boot.c +0 -0
@@ -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;

arch/arm/mach-k3/am65x/am654_init.c +0 -0
index a4f038029d7..9fcea12d243 100644
@@ -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

arch/arm/mach-k3/am65x/am654_init.c +0 -0
@@ -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;

arch/arm/mach-k3/am65x/am654_init.c +6 -4
@@ -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)

arch/arm/mach-k3/include/mach/am62_hardware.h +4 -4
index 2f5655bf24a..94f2208cf52 100644
@@ -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
arch/arm/mach-k3/include/mach/am62_spl.h +5 -5
index 2c9139d2cc0..8df53ac38bb 100644
@@ -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
arch/arm/mach-k3/include/mach/am62a_hardware.h +4 -4
index f3fd736f31b..7f715d6a7ab 100644
@@ -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
arch/arm/mach-k3/include/mach/am62a_spl.h +5 -5
index dd0f57714f5..323b9d404aa 100644
@@ -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
arch/arm/mach-k3/include/mach/am62p_hardware.h +4 -4
index a310b52b45d..984c10719e1 100644
@@ -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
arch/arm/mach-k3/include/mach/am62p_spl.h +5 -5
index db145a7bc83..0ddcacd912b 100644
@@ -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
arch/arm/mach-k3/include/mach/am64_hardware.h +2 -2
index 105b42986de..67dc4eeb82f 100644
@@ -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
arch/arm/mach-k3/include/mach/am64_spl.h +7 -6
index a0a517019cb..9bd14d3679d 100644
@@ -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
arch/arm/mach-k3/include/mach/am6_hardware.h +4 -4
index 8169584a372..008f80ae526 100644
@@ -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)
arch/arm/mach-k3/include/mach/am6_spl.h +9 -4
index 4c6950ff2b7..b7fa2f8d8b9 100644
@@ -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
arch/arm/mach-k3/include/mach/j721e_hardware.h +3 -3
index 5bef309af0a..341e9c28d81 100644
@@ -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)
arch/arm/mach-k3/include/mach/j721e_spl.h +10 -4
index aaee6535376..008595b7f26 100644
@@ -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
arch/arm/mach-k3/include/mach/j721s2_hardware.h +3 -3
index 82f076a45e0..f2a3140e0b6 100644
@@ -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)
arch/arm/mach-k3/include/mach/j721s2_spl.h +9 -4
index 47a61281d94..5ede79b6744 100644
@@ -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
arch/arm/mach-k3/include/mach/j722s_hardware.h +4 -4
index 0c695134c28..77b455af09a 100644
@@ -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
arch/arm/mach-k3/include/mach/j722s_spl.h +5 -5
index a91cc82448f..aea43eeb23c 100644
@@ -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
arch/arm/mach-k3/include/mach/j784s4_hardware.h +3 -3
index 29a894baed3..e8e2037f804 100644
@@ -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)
arch/arm/mach-k3/include/mach/j784s4_spl.h +9 -4
index 3814dc95d01..0871a85d0c5 100644
@@ -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
arch/arm/mach-k3/j721e/j721e_init.c +0 -0
index f9af0288cf6..30087705334 100644
@@ -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;

arch/arm/mach-k3/j721e/j721e_init.c +2 -1
@@ -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;

Quoted 8 lines
Quoted 6 lines

          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

#17 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

In reply to Judith Mendez

Hi Judith,

Quoted 15 lines · Judith Mendez

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.

---

<snip>

Quoted 11 lines

+++ b/arch/arm/mach-k3/include/mach/am62_spl.h

arch/arm/mach-k3/include/mach/am62_spl.h +1 -1
@@ -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

arch/arm/mach-k3/include/mach/am62_spl.h line 33

Quoted 7 lines
arch/arm/mach-k3/include/mach/am62_spl.h +2 -2
@@ -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

#18 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix MMC macros

Quoted 31 lines · Wadim Egorov

Hi Judith,

Quoted 15 lines · Judith Mendez

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.

---

<snip>

Quoted 10 lines

+++ b/arch/arm/mach-k3/include/mach/am62_spl.h

arch/arm/mach-k3/include/mach/am62_spl.h +1 -1
@@ -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 @@
Quoted 8 lines

arch/arm/mach-k3/include/mach/am62_spl.h line 33

Quoted 6 lines
arch/arm/mach-k3/include/mach/am62_spl.h +2 -2
   /* 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

#19 lore raw

PATCH 2/4 configs: am62px_evm_r5_defconfig: Add support eMMC boot config

In reply to Judith Mendez

Due to the logic in spl_mmc_boot_mode() for am62p device. Support for eMMC boot depends on this config option, so enable the config for now at r5 stage.

---
 configs/am62px_evm_r5_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/am62px_evm_r5_defconfig +1 -0
index c9592d7b6c4..cf4282eac02 100644
@@ -87,6 +87,7 @@ CONFIG_SYS_I2C_OMAP24XX=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_ESM_K3=y
+CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
Signature · 1 line
2.51.0
#20 lore raw

PATCH 3/4 configs: am62px/j722s: Remove non-spl HS400 support at r5 stage

In reply to Judith Mendez

MMC_HS400_SUPPORT config does not enable eMMC HS400 support in R5 SPL stage, therefore cleanup from r5 defconfig file.

---
 configs/am62px_evm_r5_defconfig | 1 -
 configs/j722s_evm_r5_defconfig  | 1 -
 2 files changed, 2 deletions(-)
configs/am62px_evm_r5_defconfig +0 -1
index cf4282eac02..80c15981d84 100644
@@ -88,7 +88,6 @@ CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_ESM_K3=y
 CONFIG_SUPPORT_EMMC_BOOT=y
-CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
configs/j722s_evm_r5_defconfig +0 -1
index 8e2741c8d42..8e981ff48c2 100644
@@ -92,7 +92,6 @@ CONFIG_SYS_I2C_OMAP24XX=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_ESM_K3=y
-CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
Signature · 1 line
2.51.0
Reviewed-by on v1 3/4
#21 lore raw

Re: [PATCH 3/4] configs: am62px/j722s: Remove non-spl HS400 support at r5 stage

Quoted 26 lines · Judith Mendez

MMC_HS400_SUPPORT config does not enable eMMC HS400 support in R5 SPL stage, therefore cleanup from r5 defconfig file.

---
  configs/am62px_evm_r5_defconfig | 1 -
  configs/j722s_evm_r5_defconfig  | 1 -
  2 files changed, 2 deletions(-)
configs/am62px_evm_r5_defconfig +0 -1
index cf4282eac02..80c15981d84 100644
@@ -88,7 +88,6 @@ CONFIG_DM_MAILBOX=y
  CONFIG_K3_SEC_PROXY=y
  CONFIG_ESM_K3=y
  CONFIG_SUPPORT_EMMC_BOOT=y
-CONFIG_MMC_HS400_SUPPORT=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ADMA=y
  CONFIG_SPL_MMC_SDHCI_ADMA=y
configs/j722s_evm_r5_defconfig +0 -0
index 8e2741c8d42..8e981ff48c2 100644

configs/j722s_evm_r5_defconfig CONFIG_SYS_I2C_OMAP24XX=y · line 97

Quoted 7 lines
configs/j722s_evm_r5_defconfig +0 -1
@@ -92,7 +92,6 @@ CONFIG_SYS_I2C_OMAP24XX=y
  CONFIG_DM_MAILBOX=y
  CONFIG_K3_SEC_PROXY=y
  CONFIG_ESM_K3=y
-CONFIG_MMC_HS400_SUPPORT=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ADMA=y
  CONFIG_SPL_MMC_SDHCI_ADMA=y

Regards,
Moteen

#22 lore raw

PATCH 4/4 configs: j722s_evm_a53_defconfig: Disable eMMC HS400

In reply to Judith Mendez

This patch addresses silicon errata i2478 [0] "MMCSD0: HS400 Mode not supported". Where, eMMC HS400 mode is not supported due to bus timing limitations. As per workaround, use HS200 mode instead.

[0] https://www.ti.com/lit/pdf/sprz575

---
 configs/j722s_evm_a53_defconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configs/j722s_evm_a53_defconfig +2 -2
index 83ac99c922a..a7ab78a367a 100644
@@ -101,8 +101,8 @@ CONFIG_FS_LOADER=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_MMC_IO_VOLTAGE=y
 CONFIG_SPL_MMC_IO_VOLTAGE=y
-CONFIG_MMC_HS400_SUPPORT=y
-CONFIG_SPL_MMC_HS400_SUPPORT=y
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_SPL_MMC_HS200_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
Signature · 1 line
2.51.0
#23 lore raw

Re: [PATCH 4/4] configs: j722s_evm_a53_defconfig: Disable eMMC HS400

Quoted 9 lines · Judith Mendez

This patch addresses silicon errata i2478 [0] "MMCSD0: HS400 Mode not supported". Where, eMMC HS400 mode is not supported due to bus timing limitations. As per workaround, use HS200 mode instead.

[0] https://www.ti.com/lit/pdf/sprz575

---
  configs/j722s_evm_a53_defconfig | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

I think you should disable HS400 for am62px_evm_a53_defconfig as well

Quoted 15 lines
configs/j722s_evm_a53_defconfig +2 -2
index 83ac99c922a..a7ab78a367a 100644
@@ -101,8 +101,8 @@ CONFIG_FS_LOADER=y
  CONFIG_SUPPORT_EMMC_BOOT=y
  CONFIG_MMC_IO_VOLTAGE=y
  CONFIG_SPL_MMC_IO_VOLTAGE=y
-CONFIG_MMC_HS400_SUPPORT=y
-CONFIG_SPL_MMC_HS400_SUPPORT=y
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_SPL_MMC_HS200_SUPPORT=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ADMA=y
  CONFIG_SPL_MMC_SDHCI_ADMA=y
#24 lore raw

Re: [PATCH 4/4] configs: j722s_evm_a53_defconfig: Disable eMMC HS400

Hi Udit,

Quoted 6 lines · Udit
Quoted 4 lines · Judith Mendez

This patch addresses silicon errata i2478 [0] "MMCSD0: HS400 Mode not supported". Where, eMMC HS400 mode is not supported due to bus timing limitations. As per workaround, use HS200 mode instead.

Quoted 7 lines
Quoted 5 lines

[0] https://www.ti.com/lit/pdf/sprz575

---
  configs/j722s_evm_a53_defconfig | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)

I think you should disable HS400 for am62px_evm_a53_defconfig as well

Hs400 has not been descoped on AM62Px device. So we should not remove for AM62Px.

~ Judith

#25 lore raw

Re: [PATCH 4/4] configs: j722s_evm_a53_defconfig: Disable eMMC HS400

Hi Judith

Quoted 15 lines · Judith Mendez

Hi Udit,

Quoted 12 lines · Udit
Quoted 9 lines · Judith Mendez

This patch addresses silicon errata i2478 [0] "MMCSD0: HS400 Mode not supported". Where, eMMC HS400 mode is not supported due to bus timing limitations. As per workaround, use HS200 mode instead.

[0] https://www.ti.com/lit/pdf/sprz575

---
  configs/j722s_evm_a53_defconfig | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 4 lines
Quoted 1 line

I think you should disable HS400 for am62px_evm_a53_defconfig as well

Hs400 has not been descoped on AM62Px device. So we should not remove for AM62Px.

then please check, why this is getting removed only from r5/spl in patch 3/4

configs/am62px_evm_r5_defconfig

configs/am62px_evm_r5_defconfig +0 -1
@@ -88,7 +88,6 @@ CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_ESM_K3=y
 CONFIG_SUPPORT_EMMC_BOOT=y
-CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
Quoted 2 lines

~ Judith

#26 lore raw

Re: [PATCH 4/4] configs: j722s_evm_a53_defconfig: Disable eMMC HS400

Hi Udit,

Quoted 31 lines · Udit

Hi Judith

Quoted 15 lines · Judith Mendez

Hi Udit,

Quoted 12 lines · Udit
Quoted 9 lines · Judith Mendez

This patch addresses silicon errata i2478 [0] "MMCSD0: HS400 Mode not supported". Where, eMMC HS400 mode is not supported due to bus timing limitations. As per workaround, use HS200 mode instead.

[0] https://www.ti.com/lit/pdf/sprz575

---
  configs/j722s_evm_a53_defconfig | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 4 lines
Quoted 1 line

I think you should disable HS400 for am62px_evm_a53_defconfig as well

Hs400 has not been descoped on AM62Px device. So we should not remove for AM62Px.

then please check, why this is getting removed only from r5/spl in patch 3/4

configs/am62px_evm_r5_defconfig

configs/am62px_evm_r5_defconfig CONFIG_DM_MAILBOX=y · line 91

Quoted 4 lines
configs/am62px_evm_r5_defconfig +0 -1
@@ -88,7 +88,6 @@ CONFIG_DM_MAILBOX=y
  CONFIG_K3_SEC_PROXY=y
  CONFIG_ESM_K3=y
  CONFIG_SUPPORT_EMMC_BOOT=y
-CONFIG_MMC_HS400_SUPPORT=y

This config is not for SPL, SPL config is: CONFIG_SPL_MMC_HS200_SUPPORT. Patch 3/4 is a cleanup patch since that config does nothing.

~ Judith

Reviewed-by on v1 4/4
#27 lore raw

Re: [PATCH 4/4] configs: j722s_evm_a53_defconfig: Disable eMMC HS400

In reply to Judith Mendez
Quoted 15 lines · Judith Mendez

This patch addresses silicon errata i2478 [0] "MMCSD0: HS400 Mode not supported". Where, eMMC HS400 mode is not supported due to bus timing limitations. As per workaround, use HS200 mode instead.

[0] https://www.ti.com/lit/pdf/sprz575

---
  configs/j722s_evm_a53_defconfig | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
configs/j722s_evm_a53_defconfig +0 -0
index 83ac99c922a..a7ab78a367a 100644

configs/j722s_evm_a53_defconfig CONFIG_FS_LOADER=y · line 108

Quoted 10 lines
configs/j722s_evm_a53_defconfig +2 -2
@@ -101,8 +101,8 @@ CONFIG_FS_LOADER=y
  CONFIG_SUPPORT_EMMC_BOOT=y
  CONFIG_MMC_IO_VOLTAGE=y
  CONFIG_SPL_MMC_IO_VOLTAGE=y
-CONFIG_MMC_HS400_SUPPORT=y
-CONFIG_SPL_MMC_HS400_SUPPORT=y
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_SPL_MMC_HS200_SUPPORT=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ADMA=y
  CONFIG_SPL_MMC_SDHCI_ADMA=y

Regards,
Moteen