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