blob: 927175c5a319822834ee26c80dc2ec79364f73e0 [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{
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}