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