blob: 247d7ee6f1db43d88ebb9a57e47eeed0809da759 [file] [log] [blame]
developerf4a079c2018-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>
Simon Glassf11478f2019-12-28 10:45:07 -07008#include <hang.h>
Simon Glass97589732020-05-10 11:40:02 -06009#include <init.h>
developerf4a079c2018-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{
Simon Glassa5820472021-08-08 12:20:14 -060033#if defined(CONFIG_SPL_SPI)
developerf4a079c2018-11-15 10:07:52 +080034 return BOOT_DEVICE_SPI;
Simon Glassb58bfe02021-08-08 12:20:09 -060035#elif defined(CONFIG_SPL_MMC)
developerf4a079c2018-11-15 10:07:52 +080036 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}