blob: 37f1f219b2d55d2844205c872c19a13744ff5fd5 [file] [log] [blame]
Ryder Leecbd2fba2018-11-15 10:07:52 +08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2018 MediaTek Inc.
4 * Author: Ryder Lee <ryder.lee@mediatek.com>
5 */
6
7#include <clk.h>
8#include <common.h>
Simon Glassdb41d652019-12-28 10:45:07 -07009#include <hang.h>
Ryder Leecbd2fba2018-11-15 10:07:52 +080010#include <spl.h>
11
12#include "init.h"
13
14void board_init_f(ulong dummy)
15{
16 int ret;
17
18 ret = spl_early_init();
19 if (ret)
20 hang();
21
22 /* enable console uart printing */
23 preloader_console_init();
24
25 /* soc early initialization */
26 ret = mtk_soc_early_init();
27 if (ret)
28 hang();
29}
30
31u32 spl_boot_device(void)
32{
33#if defined(CONFIG_SPL_SPI_SUPPORT)
34 return BOOT_DEVICE_SPI;
35#elif defined(CONFIG_SPL_MMC_SUPPORT)
36 return BOOT_DEVICE_MMC1;
37#elif defined(CONFIG_SPL_NAND_SUPPORT)
38 return BOOT_DEVICE_NAND;
39#elif defined(CONFIG_SPL_NOR_SUPPORT)
40 return BOOT_DEVICE_NOR;
41#else
42 return BOOT_DEVICE_NONE;
43#endif
44}