blob: b9ff9c3702279832b2bfe3475a4679676e9d4455 [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 *
5 * Michal Simek <michal.simek@xilinx.com>
Michal Simek26acb3e2014-01-21 07:30:37 +01006 */
7
8#include <common.h>
Simon Glassed38aef2020-05-10 11:40:03 -06009#include <command.h>
Michal Simek26acb3e2014-01-21 07:30:37 +010010#include <image.h>
Simon Glass0f2af882020-05-10 11:40:05 -060011#include <log.h>
Michal Simek26acb3e2014-01-21 07:30:37 +010012#include <spl.h>
Michal Simek26acb3e2014-01-21 07:30:37 +010013#include <asm/io.h>
14#include <asm/u-boot.h>
Ovidiu Panait9f97ced2021-11-30 18:33:57 +020015#include <linux/stringify.h>
Michal Simek26acb3e2014-01-21 07:30:37 +010016
Michal Simek26acb3e2014-01-21 07:30:37 +010017bool boot_linux;
18
Ovidiu Panait3d68e1f2021-11-30 18:33:50 +020019void board_boot_order(u32 *spl_boot_list)
Michal Simek26acb3e2014-01-21 07:30:37 +010020{
Ovidiu Panait3d68e1f2021-11-30 18:33:50 +020021 spl_boot_list[0] = BOOT_DEVICE_NOR;
22 spl_boot_list[1] = BOOT_DEVICE_RAM;
23 spl_boot_list[2] = BOOT_DEVICE_SPI;
Michal Simek26acb3e2014-01-21 07:30:37 +010024}
25
26/* Board initialization after bss clearance */
27void spl_board_init(void)
28{
Michal Simek26acb3e2014-01-21 07:30:37 +010029 /* enable console uart printing */
30 preloader_console_init();
31}
32
33#ifdef CONFIG_SPL_OS_BOOT
Vikas Manocha62b021c2017-04-07 15:38:13 -070034void __noreturn jump_to_image_linux(struct spl_image_info *spl_image)
Michal Simek26acb3e2014-01-21 07:30:37 +010035{
Vikas Manocha62b021c2017-04-07 15:38:13 -070036 debug("Entering kernel arg pointer: 0x%p\n", spl_image->arg);
Michal Simek26acb3e2014-01-21 07:30:37 +010037 typedef void (*image_entry_arg_t)(char *, ulong, ulong)
38 __attribute__ ((noreturn));
39 image_entry_arg_t image_entry =
Simon Glassb805c352016-09-24 18:19:54 -060040 (image_entry_arg_t)spl_image->entry_point;
Michal Simek26acb3e2014-01-21 07:30:37 +010041
Vikas Manocha62b021c2017-04-07 15:38:13 -070042 image_entry(NULL, 0, (ulong)spl_image->arg);
Michal Simek26acb3e2014-01-21 07:30:37 +010043}
Michal Simek26acb3e2014-01-21 07:30:37 +010044
45int spl_start_uboot(void)
46{
Michal Simek26acb3e2014-01-21 07:30:37 +010047 if (boot_linux)
48 return 0;
Michal Simek26acb3e2014-01-21 07:30:37 +010049
50 return 1;
51}
Ovidiu Panaitd482acd2023-01-25 18:41:55 +020052#endif /* CONFIG_SPL_OS_BOOT */
Michal Simek4e39ea82018-07-13 08:26:28 +020053
Simon Glassed38aef2020-05-10 11:40:03 -060054int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Michal Simek4e39ea82018-07-13 08:26:28 +020055{
Ovidiu Panait9f97ced2021-11-30 18:33:57 +020056 __asm__ __volatile__ (
57 "mts rmsr, r0;" \
58 "brai " __stringify(CONFIG_XILINX_MICROBLAZE0_VECTOR_BASE_ADDR));
Michal Simek4e39ea82018-07-13 08:26:28 +020059
60 return 0;
61}