diff mbox series

[U-Boot,v2] arm, imx6: add support for SD/MMC Manufacture Mode

Message ID 20180622051226.17912-1-jay.d.carlson@gmail.com
State Changes Requested
Delegated to: Stefano Babic
Headers show
Series [U-Boot,v2] arm, imx6: add support for SD/MMC Manufacture Mode | expand

Commit Message

Jay Carlson June 22, 2018, 5:12 a.m. UTC
From: Jay Carlson <jcarlson@unl.edu>

This patch adds support for booting blank i.MX6 devices in SD/MMC Manufacture
Mode: a fallback mode which the boot ROM enters when no fuses or boot mode 
pins have been set, the USB serial downloader connection is inactive, and there
is an SD card inserted into uSDHC1. The i.MX7 and i.MX8, which both have 
a Boot_SW_Info data structure which can be parsed to determine boot source, is
unaffected by this patch.

Signed-off-by: Jay Carlson <jay.d.carlson@gmail.com>
---
 arch/arm/mach-imx/spl.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index a20b30d154..8ecae8605c 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -43,6 +43,16 @@  u32 spl_boot_device(void)
 	 */
 	if (is_usbotg_phy_active())
 		return BOOT_DEVICE_BOARD;
+	
+	/**
+	 * To support SD/MMC Manufacture Mode, we check that BOOT_MODE == 0
+	 * and that BT_FUSE_SEL == 0. If this was disabled via
+	 * blowing DISABLE_SDMMC_MFG, or if SDMMC MFG mode failed,
+	 * we would be in USB download mode, which the previous line would 
+	 * have detected.
+	 */
+	if (((bmode >> 24) & 0x03) == 0x00 && (bmode >> 4) == 0x00)
+		return BOOT_DEVICE_MMC1;
 
 	/* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
 	switch ((reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) {