[U-Boot] ARM: imx6: Add support for SD/MMC Manufacture Mode

Jay Carlson jay.d.carlson at gmail.com
Wed Jul 31 20:59:30 UTC 2019


Newer i.MX6 devices support booting from uSDHC1 if the boot fuses
haven't been configured. Since we already check for serial download
mode, this change won't break unfused i.MX6 devices that don't support
this feature and would have ended up in Serial Download mode. The
caveat is that we can't have an active USB connection *and* try to use
this mode at the same time since the existing SPL code will assume
we're in Serial Download mode, when it is actually SD/MMC Manufacture
Mode that the boot ROM attempts first.

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

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 9f1e0f6a72..afde33a2cc 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -44,6 +44,25 @@ u32 spl_boot_device(void)
   if (is_usbotg_phy_active())
       return BOOT_DEVICE_BOARD;
+   /**
+    * To support SD/MMC Manufacture Mode found on some i.MX6 parts,
+    * we check that BOOT_MODE == 0 and that BT_FUSE_SEL == 0.
+    * These will be nonzero if the BMODE has actually been programmed,
+    * so we'll skip to the actual Boot Configuration check next. We don't
+    * need to check if this particular i.MX6 supports this mode, or whether
+    * the user blew DISABLE_SDMMC_MFG or if SDMMC MFG mode failed,
+    * since the only way we'd be running with unprogrammed fuses would
+    * would have been through Serial mode, which we check above.
+    *
+    * Technically, the boot ROM on supported devices attempts this mode
+    * before moving onto the serial downloader, but there's no documented
+    * way of detecting we're in this mode. As a caveat, to use this mode
+    * the user must not have a USB connection active otherwise we'll think
+    * we're in serial download mode.
+    */
+   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) {
    /* EIM: See 8.5.1, Table 8-9 */
-- 
2.17.1.windows.2


More information about the U-Boot mailing list