Ryder Lee | cbd2fba | 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 | db41d65 | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 9 | #include <hang.h> |
Ryder Lee | cbd2fba | 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 | { |
| 33 | #if defined(CONFIG_SPL_SPI_SUPPORT) |
| 34 | return BOOT_DEVICE_SPI; |
| 35 | #elif defined(CONFIG_SPL_MMC_SUPPORT) |
| 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 | } |