developer | 19d572e | 2020-04-21 09:28:47 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2020 MediaTek Inc. All Rights Reserved. |
| 4 | * |
| 5 | * Author: Weijie Gao <weijie.gao@mediatek.com> |
| 6 | */ |
| 7 | |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 8 | #include <init.h> |
developer | 19d572e | 2020-04-21 09:28:47 +0200 | [diff] [blame] | 9 | #include <spl.h> |
| 10 | #include <asm/sections.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 11 | #include <linux/libfdt.h> |
developer | 19d572e | 2020-04-21 09:28:47 +0200 | [diff] [blame] | 12 | #include <linux/sizes.h> |
| 13 | #include <mach/serial.h> |
| 14 | |
| 15 | void __noreturn board_init_f(ulong dummy) |
| 16 | { |
| 17 | spl_init(); |
| 18 | |
Simon Glass | f4d6039 | 2021-08-08 12:20:12 -0600 | [diff] [blame] | 19 | #ifdef CONFIG_SPL_SERIAL |
developer | 19d572e | 2020-04-21 09:28:47 +0200 | [diff] [blame] | 20 | /* |
| 21 | * mtmips_spl_serial_init() is useful if debug uart is enabled, |
| 22 | * or DM based serial is not enabled. |
| 23 | */ |
| 24 | mtmips_spl_serial_init(); |
| 25 | preloader_console_init(); |
| 26 | #endif |
| 27 | |
| 28 | board_init_r(NULL, 0); |
| 29 | } |
| 30 | |
| 31 | void board_boot_order(u32 *spl_boot_list) |
| 32 | { |
| 33 | spl_boot_list[0] = BOOT_DEVICE_NOR; |
| 34 | } |
| 35 | |
| 36 | unsigned long spl_nor_get_uboot_base(void) |
| 37 | { |
| 38 | void *uboot_base = __image_copy_end; |
| 39 | |
| 40 | if (fdt_magic(uboot_base) == FDT_MAGIC) |
| 41 | return (unsigned long)uboot_base + fdt_totalsize(uboot_base); |
| 42 | |
| 43 | return (unsigned long)uboot_base; |
| 44 | } |