]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/mach-rockchip/rk3288-board-spl.c
Merge git://git.denx.de/u-boot-dm
[u-boot] / arch / arm / mach-rockchip / rk3288-board-spl.c
index 8199cad3facc20251984605ca4005e91c0b8e093..74f337919457637453fe90d474b83a358976a32b 100644 (file)
@@ -14,6 +14,7 @@
 #include <spl.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <asm/arch/bootrom.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/periph.h>
@@ -29,6 +30,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 u32 spl_boot_device(void)
 {
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
        const void *blob = gd->fdt_blob;
        struct udevice *dev;
        const char *bootdev;
@@ -63,10 +65,15 @@ u32 spl_boot_device(void)
        }
 
 fallback:
+#elif defined(CONFIG_TARGET_CHROMEBOOK_JERRY) || \
+               defined(CONFIG_TARGET_CHROMEBIT_MICKEY) || \
+               defined(CONFIG_TARGET_CHROMEBOOK_MINNIE)
+       return BOOT_DEVICE_SPI;
+#endif
        return BOOT_DEVICE_MMC1;
 }
 
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
        return MMCSD_MODE_RAW;
 }
@@ -111,8 +118,11 @@ static void configure_l2ctlr(void)
        write_l2ctlr(l2ctlr);
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
 static int configure_emmc(struct udevice *pinctrl)
 {
+#if defined(CONFIG_TARGET_CHROMEBOOK_JERRY)
+
        struct gpio_desc desc;
        int ret;
 
@@ -142,9 +152,10 @@ static int configure_emmc(struct udevice *pinctrl)
                debug("gpio value ret=%d\n", ret);
                return ret;
        }
-
+#endif
        return 0;
 }
+#endif
 
 void board_init_f(ulong dummy)
 {
@@ -174,16 +185,16 @@ void board_init_f(ulong dummy)
        debug_uart_init();
 #endif
 
-       ret = spl_init();
+       ret = spl_early_init();
        if (ret) {
-               debug("spl_init() failed: %d\n", ret);
+               debug("spl_early_init() failed: %d\n", ret);
                hang();
        }
 
        rockchip_timer_init();
        configure_l2ctlr();
 
-       ret = uclass_get_device(UCLASS_CLK, 0, &dev);
+       ret = rockchip_get_clk(&dev);
        if (ret) {
                debug("CLK init failed: %d\n", ret);
                return;
@@ -200,6 +211,9 @@ void board_init_f(ulong dummy)
                debug("DRAM init failed: %d\n", ret);
                return;
        }
+#if defined(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM) && !defined(CONFIG_SPL_BOARD_INIT)
+       back_to_bootrom();
+#endif
 }
 
 static int setup_led(void)
@@ -242,6 +256,8 @@ void spl_board_init(void)
                debug("%s: Cannot find pinctrl device\n", __func__);
                goto err;
        }
+
+#ifdef CONFIG_SPL_MMC_SUPPORT
        ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD);
        if (ret) {
                debug("%s: Failed to set up SD card\n", __func__);
@@ -252,6 +268,7 @@ void spl_board_init(void)
                debug("%s: Failed to set up eMMC\n", __func__);
                goto err;
        }
+#endif
 
        /* Enable debug UART */
        ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
@@ -261,6 +278,9 @@ void spl_board_init(void)
        }
 
        preloader_console_init();
+#ifdef CONFIG_ROCKCHIP_SPL_BACK_TO_BROM
+       back_to_bootrom();
+#endif
        return;
 err:
        printf("spl_board_init: Error %d\n", ret);