blob: cb224bd254236202ed31f57f1decc33516cab56f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Michal Simek26acb3e2014-01-21 07:30:37 +01002/*
3 * (C) Copyright 2013 - 2014 Xilinx, Inc
4 *
Michal Simeka8c94362023-07-10 14:35:49 +02005 * Michal Simek <michal.simek@amd.com>
Michal Simek26acb3e2014-01-21 07:30:37 +01006 */
7
Simon Glassed38aef2020-05-10 11:40:03 -06008#include <command.h>
Michal Simek26acb3e2014-01-21 07:30:37 +01009#include <image.h>
Simon Glass0f2af882020-05-10 11:40:05 -060010#include <log.h>
Michal Simek26acb3e2014-01-21 07:30:37 +010011#include <spl.h>
Michal Simek26acb3e2014-01-21 07:30:37 +010012#include <asm/io.h>
13#include <asm/u-boot.h>
Ovidiu Panait9f97ced2021-11-30 18:33:57 +020014#include <linux/stringify.h>
Michal Simek26acb3e2014-01-21 07:30:37 +010015
Ovidiu Panait3d68e1f2021-11-30 18:33:50 +020016void board_boot_order(u32 *spl_boot_list)
Michal Simek26acb3e2014-01-21 07:30:37 +010017{
Ovidiu Panait3d68e1f2021-11-30 18:33:50 +020018 spl_boot_list[0] = BOOT_DEVICE_NOR;
19 spl_boot_list[1] = BOOT_DEVICE_RAM;
20 spl_boot_list[2] = BOOT_DEVICE_SPI;
Michal Simek26acb3e2014-01-21 07:30:37 +010021}
22
23/* Board initialization after bss clearance */
24void spl_board_init(void)
25{
Michal Simek26acb3e2014-01-21 07:30:37 +010026 /* enable console uart printing */
27 preloader_console_init();
28}
29
30#ifdef CONFIG_SPL_OS_BOOT
Vikas Manocha62b021c2017-04-07 15:38:13 -070031void __noreturn jump_to_image_linux(struct spl_image_info *spl_image)
Michal Simek26acb3e2014-01-21 07:30:37 +010032{
Vikas Manocha62b021c2017-04-07 15:38:13 -070033 debug("Entering kernel arg pointer: 0x%p\n", spl_image->arg);
Michal Simek26acb3e2014-01-21 07:30:37 +010034 typedef void (*image_entry_arg_t)(char *, ulong, ulong)
35 __attribute__ ((noreturn));
36 image_entry_arg_t image_entry =
Simon Glassb805c352016-09-24 18:19:54 -060037 (image_entry_arg_t)spl_image->entry_point;
Michal Simek26acb3e2014-01-21 07:30:37 +010038
Vikas Manocha62b021c2017-04-07 15:38:13 -070039 image_entry(NULL, 0, (ulong)spl_image->arg);
Michal Simek26acb3e2014-01-21 07:30:37 +010040}
Michal Simek26acb3e2014-01-21 07:30:37 +010041
42int spl_start_uboot(void)
43{
Ovidiu Panaitadc28912023-01-25 18:41:56 +020044 return 0;
Michal Simek26acb3e2014-01-21 07:30:37 +010045}
Ovidiu Panaitd482acd2023-01-25 18:41:55 +020046#endif /* CONFIG_SPL_OS_BOOT */
Michal Simek4e39ea82018-07-13 08:26:28 +020047
Simon Glassed38aef2020-05-10 11:40:03 -060048int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Michal Simek4e39ea82018-07-13 08:26:28 +020049{
Ovidiu Panait9f97ced2021-11-30 18:33:57 +020050 __asm__ __volatile__ (
51 "mts rmsr, r0;" \
52 "brai " __stringify(CONFIG_XILINX_MICROBLAZE0_VECTOR_BASE_ADDR));
Michal Simek4e39ea82018-07-13 08:26:28 +020053
54 return 0;
55}