Merge branch 'master' of git://git.denx.de/u-boot-fdt
[oweals/u-boot.git] / common / spl / spl.c
index 6b90ad8841d33858d79b7504f8fc0df5b9a17720..ded0f304786d275ad3818072ab7019e49a26ba6a 100644 (file)
@@ -7,6 +7,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
+#include <dm.h>
 #include <spl.h>
 #include <asm/u-boot.h>
 #include <nand.h>
@@ -15,6 +16,7 @@
 #include <i2c.h>
 #include <image.h>
 #include <malloc.h>
+#include <dm/root.h>
 #include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -147,6 +149,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
        gd->malloc_limit = gd->malloc_base + CONFIG_SYS_MALLOC_F_LEN;
        gd->malloc_ptr = 0;
 #endif
+#ifdef CONFIG_SPL_DM
+       dm_init_and_scan(true);
+#endif
 
 #ifndef CONFIG_PPC
        /*
@@ -223,9 +228,16 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
        case BOOT_DEVICE_SATA:
                spl_sata_load_image();
                break;
+#endif
+#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
+       case BOOT_DEVICE_BOARD:
+               spl_board_load_image();
+               break;
 #endif
        default:
-               debug("SPL: Un-supported Boot Device\n");
+#if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
+               puts("SPL: Unsupported Boot Device!\n");
+#endif
                hang();
        }