summaryrefslogtreecommitdiff
path: root/arch/arm/mach-mediatek/spl.c
blob: 37f1f219b2d55d2844205c872c19a13744ff5fd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2018 MediaTek Inc.
 * Author: Ryder Lee <ryder.lee@mediatek.com>
 */

#include <clk.h>
#include <common.h>
#include <hang.h>
#include <spl.h>

#include "init.h"

void board_init_f(ulong dummy)
{
	int ret;

	ret = spl_early_init();
	if (ret)
		hang();

	/* enable console uart printing */
	preloader_console_init();

	/* soc early initialization */
	ret = mtk_soc_early_init();
	if (ret)
		hang();
}

u32 spl_boot_device(void)
{
#if defined(CONFIG_SPL_SPI_SUPPORT)
	return BOOT_DEVICE_SPI;
#elif defined(CONFIG_SPL_MMC_SUPPORT)
	return BOOT_DEVICE_MMC1;
#elif defined(CONFIG_SPL_NAND_SUPPORT)
	return BOOT_DEVICE_NAND;
#elif defined(CONFIG_SPL_NOR_SUPPORT)
	return BOOT_DEVICE_NOR;
#else
	return BOOT_DEVICE_NONE;
#endif
}