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> |
Simon Glass | f11478f | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 8 | #include <hang.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 9 | #include <init.h> |
developer | f4a079c | 2018-11-15 10:07:52 +0800 | [diff] [blame] | 10 | #include <spl.h> |
| 11 | |
| 12 | #include "init.h" |
| 13 | |
| 14 | void 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 | |
| 31 | u32 spl_boot_device(void) |
| 32 | { |
Simon Glass | a582047 | 2021-08-08 12:20:14 -0600 | [diff] [blame] | 33 | #if defined(CONFIG_SPL_SPI) |
developer | f4a079c | 2018-11-15 10:07:52 +0800 | [diff] [blame] | 34 | return BOOT_DEVICE_SPI; |
Simon Glass | b58bfe0 | 2021-08-08 12:20:09 -0600 | [diff] [blame] | 35 | #elif defined(CONFIG_SPL_MMC) |
developer | f4a079c | 2018-11-15 10:07:52 +0800 | [diff] [blame] | 36 | 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 | } |