1 // 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>
9 #include <hang.h>
10 #include <init.h>
11 #include <spl.h>
12 
13 #include "init.h"
14 
board_init_f(ulong dummy)15 void board_init_f(ulong dummy)
16 {
17 	int ret;
18 
19 	ret = spl_early_init();
20 	if (ret)
21 		hang();
22 
23 	/* enable console uart printing */
24 	preloader_console_init();
25 
26 	/* soc early initialization */
27 	ret = mtk_soc_early_init();
28 	if (ret)
29 		hang();
30 }
31 
spl_boot_device(void)32 u32 spl_boot_device(void)
33 {
34 #if defined(CONFIG_SPL_SPI_SUPPORT)
35 	return BOOT_DEVICE_SPI;
36 #elif defined(CONFIG_SPL_MMC_SUPPORT)
37 	return BOOT_DEVICE_MMC1;
38 #elif defined(CONFIG_SPL_NAND_SUPPORT)
39 	return BOOT_DEVICE_NAND;
40 #elif defined(CONFIG_SPL_NOR_SUPPORT)
41 	return BOOT_DEVICE_NOR;
42 #else
43 	return BOOT_DEVICE_NONE;
44 #endif
45 }
46