[PATCH RESEND 1/7] mach-k3: am62a7_init: Add FS and raw mode for eMMC

Judith Mendez jm at ti.com
Fri Dec 20 21:36:58 CET 2024


From: Vignesh Raghavendra <vigneshr at ti.com>

This adds FS and raw boot mode support for eMMC similar to other K3
platforms.

Signed-off-by: Vignesh Raghavendra <vigneshr at ti.com>
---
 arch/arm/mach-k3/am62ax/am62a7_init.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/am62ax/am62a7_init.c
index 5c0d3ee6869..78153c97a58 100644
--- a/arch/arm/mach-k3/am62ax/am62a7_init.c
+++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
@@ -171,6 +171,25 @@ void board_init_f(ulong dummy)
 	debug("am62a_init: %s done\n", __func__);
 }
 
+u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
+{
+	u32 devstat = readl(CTRLMMR_MAIN_DEVSTAT);
+	u32 bootmode = (devstat & MAIN_DEVSTAT_PRIMARY_BOOTMODE_MASK) >>
+				MAIN_DEVSTAT_PRIMARY_BOOTMODE_SHIFT;
+	u32 bootmode_cfg = (devstat & MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_MASK) >>
+			    MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_SHIFT;
+
+	switch (bootmode) {
+	case BOOT_DEVICE_EMMC:
+		return MMCSD_MODE_EMMCBOOT;
+	case BOOT_DEVICE_MMC:
+		if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK)
+			return MMCSD_MODE_RAW;
+	default:
+		return MMCSD_MODE_FS;
+	}
+}
+
 u32 spl_boot_device(void)
 {
 	return get_boot_device();
-- 
2.47.1



More information about the U-Boot mailing list