blob: 48e3d8d57f01e3a242524c1e09de253e8d6962b1 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Michal Simeke60148d2014-01-14 14:21:52 +01002/*
Michal Simek98d0f1f2018-01-17 07:37:47 +01003 * (C) Copyright 2014 - 2017 Xilinx, Inc. Michal Simek
Michal Simeke60148d2014-01-14 14:21:52 +01004 */
5#include <common.h>
Simon Glass091f6a32015-10-17 19:41:22 -06006#include <debug_uart.h>
Michal Simeke60148d2014-01-14 14:21:52 +01007#include <spl.h>
8
9#include <asm/io.h>
Michal Simek162c6372014-08-11 14:03:15 +020010#include <asm/spl.h>
Simon Glass122216d2015-10-17 19:41:21 -060011#include <asm/arch/hardware.h>
Michal Simeke60148d2014-01-14 14:21:52 +010012#include <asm/arch/sys_proto.h>
Michal Simek85dc76a2017-11-08 16:14:47 +010013#include <asm/arch/ps7_init_gpl.h>
Michal Simeke60148d2014-01-14 14:21:52 +010014
Michal Simeke60148d2014-01-14 14:21:52 +010015void board_init_f(ulong dummy)
16{
17 ps7_init();
18
Michal Simeke60148d2014-01-14 14:21:52 +010019 arch_cpu_init();
Simon Glass091f6a32015-10-17 19:41:22 -060020 /*
21 * The debug UART can be used from this point:
22 * debug_uart_init();
23 * printch('x');
24 */
Michal Simeke60148d2014-01-14 14:21:52 +010025}
26
Michal Simeka831f1f2014-04-25 12:15:40 +020027#ifdef CONFIG_SPL_BOARD_INIT
28void spl_board_init(void)
29{
Simon Glasse04843d2015-10-19 06:50:02 -060030 preloader_console_init();
Michal Simeka831f1f2014-04-25 12:15:40 +020031 board_init();
32}
33#endif
34
Michal Simeke60148d2014-01-14 14:21:52 +010035u32 spl_boot_device(void)
36{
37 u32 mode;
38
39 switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
40#ifdef CONFIG_SPL_SPI_SUPPORT
41 case ZYNQ_BM_QSPI:
42 puts("qspi boot\n");
43 mode = BOOT_DEVICE_SPI;
44 break;
45#endif
Michal Simek25830022015-01-13 16:04:10 +010046 case ZYNQ_BM_NAND:
47 mode = BOOT_DEVICE_NAND;
48 break;
49 case ZYNQ_BM_NOR:
50 mode = BOOT_DEVICE_NOR;
51 break;
Michal Simeke60148d2014-01-14 14:21:52 +010052#ifdef CONFIG_SPL_MMC_SUPPORT
53 case ZYNQ_BM_SD:
54 puts("mmc boot\n");
55 mode = BOOT_DEVICE_MMC1;
56 break;
57#endif
Michal Simek25830022015-01-13 16:04:10 +010058 case ZYNQ_BM_JTAG:
59 mode = BOOT_DEVICE_RAM;
60 break;
Michal Simeke60148d2014-01-14 14:21:52 +010061 default:
62 puts("Unsupported boot mode selected\n");
63 hang();
64 }
65
66 return mode;
67}
68
Michal Simeke60148d2014-01-14 14:21:52 +010069#ifdef CONFIG_SPL_OS_BOOT
70int spl_start_uboot(void)
71{
72 /* boot linux */
73 return 0;
74}
75#endif
Masahiro Yamadac2d10792014-05-12 12:18:30 +090076
Michal Simek42c8c412016-05-10 07:55:52 +020077void spl_board_prepare_for_boot(void)
78{
79 ps7_post_config();
80 debug("SPL bye\n");
81}
82
Michal Simekf669e222016-05-03 14:20:17 +020083#ifdef CONFIG_SPL_LOAD_FIT
84int board_fit_config_name_match(const char *name)
85{
86 /* Just empty function now - can't decide what to choose */
87 debug("%s: %s\n", __func__, name);
88
89 return 0;
90}
91#endif