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> |
| 11 | #include <spl.h> |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 12 | #include <asm/io.h> |
| 13 | #include <asm/u-boot.h> |
| 14 | |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 15 | bool boot_linux; |
| 16 | |
| 17 | u32 spl_boot_device(void) |
| 18 | { |
| 19 | return BOOT_DEVICE_NOR; |
| 20 | } |
| 21 | |
| 22 | /* Board initialization after bss clearance */ |
| 23 | void spl_board_init(void) |
| 24 | { |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 25 | /* enable console uart printing */ |
| 26 | preloader_console_init(); |
| 27 | } |
| 28 | |
| 29 | #ifdef CONFIG_SPL_OS_BOOT |
Vikas Manocha | 62b021c | 2017-04-07 15:38:13 -0700 | [diff] [blame] | 30 | void __noreturn jump_to_image_linux(struct spl_image_info *spl_image) |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 31 | { |
Vikas Manocha | 62b021c | 2017-04-07 15:38:13 -0700 | [diff] [blame] | 32 | debug("Entering kernel arg pointer: 0x%p\n", spl_image->arg); |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 33 | typedef void (*image_entry_arg_t)(char *, ulong, ulong) |
| 34 | __attribute__ ((noreturn)); |
| 35 | image_entry_arg_t image_entry = |
Simon Glass | b805c35 | 2016-09-24 18:19:54 -0600 | [diff] [blame] | 36 | (image_entry_arg_t)spl_image->entry_point; |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 37 | |
Vikas Manocha | 62b021c | 2017-04-07 15:38:13 -0700 | [diff] [blame] | 38 | image_entry(NULL, 0, (ulong)spl_image->arg); |
Michal Simek | 26acb3e | 2014-01-21 07:30:37 +0100 | [diff] [blame] | 39 | } |
| 40 | #endif /* CONFIG_SPL_OS_BOOT */ |
| 41 | |
| 42 | int spl_start_uboot(void) |
| 43 | { |
| 44 | #ifdef CONFIG_SPL_OS_BOOT |
| 45 | if (boot_linux) |
| 46 | return 0; |
| 47 | #endif |
| 48 | |
| 49 | return 1; |
| 50 | } |
Michal Simek | 4e39ea8 | 2018-07-13 08:26:28 +0200 | [diff] [blame] | 51 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame^] | 52 | 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] | 53 | { |
| 54 | __asm__ __volatile__ ("mts rmsr, r0;" \ |
| 55 | "bra r0"); |
| 56 | |
| 57 | return 0; |
| 58 | } |