blob: 247d7ee6f1db43d88ebb9a57e47eeed0809da759 [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>
Simon Glassdb41d652019-12-28 10:45:07 -07008#include <hang.h>
Simon Glass691d7192020-05-10 11:40:02 -06009#include <init.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{
Simon Glassea2ca7e2021-08-08 12:20:14 -060033#if defined(CONFIG_SPL_SPI)
Ryder Leecbd2fba2018-11-15 10:07:52 +080034 return BOOT_DEVICE_SPI;
Simon Glass103c5f12021-08-08 12:20:09 -060035#elif defined(CONFIG_SPL_MMC)
Ryder Leecbd2fba2018-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}