imx8: Configure SNVS
[oweals/u-boot.git] / arch / arm / mach-imx / spl.c
index f025c4b301eb6ea022ab115e63c85ca3aee0223e..49bb3b928da1582e98600f472321866678bb1ecb 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <hang.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
@@ -135,7 +136,8 @@ u32 spl_boot_device(void)
 
        enum boot_device boot_device_spl = get_boot_device();
 
-       if (IS_ENABLED(CONFIG_IMX8MM))
+       if (IS_ENABLED(CONFIG_IMX8MM) || IS_ENABLED(CONFIG_IMX8MN) ||
+           IS_ENABLED(CONFIG_IMX8MP))
                return spl_board_boot_device(boot_device_spl);
 
        switch (boot_device_spl) {
@@ -187,8 +189,36 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 
 #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)
+u32 spl_mmc_boot_mode(const u32 boot_device)
 {
+#if defined(CONFIG_MX7) || defined(CONFIG_IMX8M) || defined(CONFIG_IMX8)
+       switch (get_boot_device()) {
+       /* for MMC return either RAW or FAT mode */
+       case SD1_BOOT:
+       case SD2_BOOT:
+       case SD3_BOOT:
+#if defined(CONFIG_SPL_FAT_SUPPORT)
+               return MMCSD_MODE_FS;
+#else
+               return MMCSD_MODE_RAW;
+#endif
+               break;
+       case MMC1_BOOT:
+       case MMC2_BOOT:
+       case MMC3_BOOT:
+#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();
+       }
+#else
 /*
  * When CONFIG_SPL_FORCE_MMC_BOOT is defined the 'boot_device' is used
  * unconditionally to decide about device to use for booting.
@@ -217,6 +247,7 @@ u32 spl_boot_mode(const u32 boot_device)
                puts("spl: ERROR:  unsupported device\n");
                hang();
        }
+#endif
 }
 #endif