rockchip: Add support for veyron-minnie (ASUS Chromebook Flip)
[oweals/u-boot.git] / arch / arm / mach-rockchip / rk3288-board-spl.c
index 6a54368fe32cd1868822e5006ae1ae159882d714..930939ad24c4bc9a3b97850f3db32959819290ea 100644 (file)
@@ -29,6 +29,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 +64,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;
 }
@@ -114,7 +120,8 @@ static void configure_l2ctlr(void)
 #ifdef CONFIG_SPL_MMC_SUPPORT
 static int configure_emmc(struct udevice *pinctrl)
 {
-#ifndef CONFIG_TARGET_ROCK2
+#if defined(CONFIG_TARGET_CHROMEBOOK_JERRY)
+
        struct gpio_desc desc;
        int ret;
 
@@ -145,11 +152,10 @@ static int configure_emmc(struct udevice *pinctrl)
                return ret;
        }
 #endif
-
        return 0;
 }
 #endif
-
+extern void back_to_bootrom(void);
 void board_init_f(ulong dummy)
 {
        struct udevice *pinctrl;
@@ -187,7 +193,7 @@ void board_init_f(ulong dummy)
        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;
@@ -204,6 +210,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)
@@ -246,6 +255,7 @@ 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) {
@@ -267,6 +277,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);
@@ -274,7 +287,3 @@ err:
        /* No way to report error here */
        hang();
 }
-
-void lowlevel_init(void)
-{
-}