]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/mach-imx/spl.c
imx: Create distinct pre-processed mkimage config files
[u-boot] / arch / arm / mach-imx / spl.c
index a9079fceac8d6a7d8f88999306ad4f90feb45526..6fc24630ba95c7b8dd55892e787516a5c7d89965 100644 (file)
@@ -101,6 +101,29 @@ u32 spl_boot_device(void)
 /* Translate iMX7/MX8M boot device to the SPL boot device enumeration */
 u32 spl_boot_device(void)
 {
+#if defined(CONFIG_MX7)
+       unsigned int bmode = readl(&src_base->sbmr2);
+
+       /*
+        * Check for BMODE if serial downloader is enabled
+        * BOOT_MODE - see IMX7DRM Table 6-24
+        */
+       if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
+               return BOOT_DEVICE_BOARD;
+
+       /*
+        * The above method does not detect that the boot ROM used
+        * serial downloader in case the boot ROM decided to use the
+        * serial downloader as a fall back (primary boot source failed).
+        *
+        * Infer that the boot ROM used the USB serial downloader by
+        * checking whether the USB PHY is currently active... This
+        * assumes that SPL did not (yet) initialize the USB PHY...
+        */
+       if (is_boot_from_usb())
+               return BOOT_DEVICE_BOARD;
+#endif
+
        enum boot_device boot_device_spl = get_boot_device();
 
        switch (boot_device_spl) {
@@ -132,6 +155,29 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 }
 #endif
 
+#if defined(CONFIG_SPL_MMC_SUPPORT)
+/* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
+u32 spl_boot_mode(const u32 boot_device)
+{
+       switch (spl_boot_device()) {
+       /* for MMC return either RAW or FAT mode */
+       case BOOT_DEVICE_MMC1:
+       case BOOT_DEVICE_MMC2:
+#if defined(CONFIG_SPL_FAT_SUPPORT)
+               return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+               return MMCSD_MODE_EMMCBOOT;
+#else
+               return MMCSD_MODE_RAW;
+#endif
+               break;
+       default:
+               puts("spl: ERROR:  unsupported device\n");
+               hang();
+       }
+}
+#endif
+
 #if defined(CONFIG_SECURE_BOOT)
 
 /*