blob: d3cda94617e1a7925d7cad17224d2330d429da88 [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>
8#include <common.h>
Simon Glassf11478f2019-12-28 10:45:07 -07009#include <hang.h>
Simon Glass97589732020-05-10 11:40:02 -060010#include <init.h>
developerf4a079c2018-11-15 10:07:52 +080011#include <spl.h>
12
13#include "init.h"
14
15void 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
32u32 spl_boot_device(void)
33{
Simon Glassa5820472021-08-08 12:20:14 -060034#if defined(CONFIG_SPL_SPI)
developerf4a079c2018-11-15 10:07:52 +080035 return BOOT_DEVICE_SPI;
Simon Glassb58bfe02021-08-08 12:20:09 -060036#elif defined(CONFIG_SPL_MMC)
developerf4a079c2018-11-15 10:07:52 +080037 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}