developer | f4a079c | 2018-11-15 10:07:52 +0800 | [diff] [blame] | 1 | // 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 Glass | f11478f | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 9 | #include <hang.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 10 | #include <init.h> |
developer | f4a079c | 2018-11-15 10:07:52 +0800 | [diff] [blame] | 11 | #include <spl.h> |
| 12 | |
| 13 | #include "init.h" |
| 14 | |
| 15 | void 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 | |
| 32 | u32 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 | } |