Weijie Gao | 7a4b696 | 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 | |
| 8 | #include <common.h> |
Simon Glass | 691d719 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 9 | #include <init.h> |
Weijie Gao | 7a4b696 | 2020-04-21 09:28:47 +0200 | [diff] [blame] | 10 | #include <spl.h> |
| 11 | #include <asm/sections.h> |
Simon Glass | 401d1c4 | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 12 | #include <linux/libfdt.h> |
Weijie Gao | 7a4b696 | 2020-04-21 09:28:47 +0200 | [diff] [blame] | 13 | #include <linux/sizes.h> |
| 14 | #include <mach/serial.h> |
| 15 | |
| 16 | void __noreturn board_init_f(ulong dummy) |
| 17 | { |
| 18 | spl_init(); |
| 19 | |
Simon Glass | 2a73606 | 2021-08-08 12:20:12 -0600 | [diff] [blame] | 20 | #ifdef CONFIG_SPL_SERIAL |
Weijie Gao | 7a4b696 | 2020-04-21 09:28:47 +0200 | [diff] [blame] | 21 | /* |
| 22 | * mtmips_spl_serial_init() is useful if debug uart is enabled, |
| 23 | * or DM based serial is not enabled. |
| 24 | */ |
| 25 | mtmips_spl_serial_init(); |
| 26 | preloader_console_init(); |
| 27 | #endif |
| 28 | |
| 29 | board_init_r(NULL, 0); |
| 30 | } |
| 31 | |
| 32 | void board_boot_order(u32 *spl_boot_list) |
| 33 | { |
| 34 | spl_boot_list[0] = BOOT_DEVICE_NOR; |
| 35 | } |
| 36 | |
| 37 | unsigned long spl_nor_get_uboot_base(void) |
| 38 | { |
| 39 | void *uboot_base = __image_copy_end; |
| 40 | |
| 41 | if (fdt_magic(uboot_base) == FDT_MAGIC) |
| 42 | return (unsigned long)uboot_base + fdt_totalsize(uboot_base); |
| 43 | |
| 44 | return (unsigned long)uboot_base; |
| 45 | } |