Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2013 - 2014 Xilinx, Inc |
| 4 | * |
| 5 | * Michal Simek <michal.simek@xilinx.com> |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 9 | #include <command.h> |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 10 | #include <image.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 11 | #include <log.h> |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 12 | #include <spl.h> |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 13 | #include <asm/io.h> |
| 14 | #include <asm/u-boot.h> |
| 15 | |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 16 | bool boot_linux; |
| 17 | |
| 18 | u32 spl_boot_device(void) |
| 19 | { |
| 20 | return BOOT_DEVICE_NOR; |
| 21 | } |
| 22 | |
| 23 | /* Board initialization after bss clearance */ |
| 24 | void spl_board_init(void) |
| 25 | { |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 26 | /* enable console uart printing */ |
| 27 | preloader_console_init(); |
| 28 | } |
| 29 | |
| 30 | #ifdef CONFIG_SPL_OS_BOOT |
Vikas Manocha | 62b021c | 2017-04-07 15:38:13 -0700 | [diff] [blame] | 31 | void __noreturn jump_to_image_linux(struct spl_image_info *spl_image) |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 32 | { |
Vikas Manocha | 62b021c | 2017-04-07 15:38:13 -0700 | [diff] [blame] | 33 | debug("Entering kernel arg pointer: 0x%p\n", spl_image->arg); |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 34 | typedef void (*image_entry_arg_t)(char *, ulong, ulong) |
| 35 | __attribute__ ((noreturn)); |
| 36 | image_entry_arg_t image_entry = |
Simon Glass | b805c35 | 2016-09-24 18:19:54 -0600 | [diff] [blame] | 37 | (image_entry_arg_t)spl_image->entry_point; |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 38 | |
Vikas Manocha | 62b021c | 2017-04-07 15:38:13 -0700 | [diff] [blame] | 39 | image_entry(NULL, 0, (ulong)spl_image->arg); |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 40 | } |
| 41 | #endif /* CONFIG_SPL_OS_BOOT */ |
| 42 | |
| 43 | int spl_start_uboot(void) |
| 44 | { |
| 45 | #ifdef CONFIG_SPL_OS_BOOT |
| 46 | if (boot_linux) |
| 47 | return 0; |
| 48 | #endif |
| 49 | |
| 50 | return 1; |
| 51 | } |
Michal Simek | 4e39ea8 | 2018-07-13 08:26:28 +0200 | [diff] [blame] | 52 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 53 | int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
Michal Simek | 4e39ea8 | 2018-07-13 08:26:28 +0200 | [diff] [blame] | 54 | { |
| 55 | __asm__ __volatile__ ("mts rmsr, r0;" \ |
| 56 | "bra r0"); |
| 57 | |
| 58 | return 0; |
| 59 | } |