blob: 0a303f41ebdfb606f92f993facdde7761d79f07c [file] [log] [blame]
Michal Simeke60148d2014-01-14 14:21:52 +01001/*
Michal Simek98d0f1f2018-01-17 07:37:47 +01002 * (C) Copyright 2014 - 2017 Xilinx, Inc. Michal Simek
Michal Simeke60148d2014-01-14 14:21:52 +01003 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6#include <common.h>
Simon Glass091f6a32015-10-17 19:41:22 -06007#include <debug_uart.h>
Michal Simeke60148d2014-01-14 14:21:52 +01008#include <spl.h>
9
10#include <asm/io.h>
Michal Simek162c6372014-08-11 14:03:15 +020011#include <asm/spl.h>
Simon Glass122216d2015-10-17 19:41:21 -060012#include <asm/arch/hardware.h>
Michal Simeke60148d2014-01-14 14:21:52 +010013#include <asm/arch/sys_proto.h>
Michal Simek85dc76a2017-11-08 16:14:47 +010014#include <asm/arch/ps7_init_gpl.h>
Michal Simeke60148d2014-01-14 14:21:52 +010015
16DECLARE_GLOBAL_DATA_PTR;
17
18void board_init_f(ulong dummy)
19{
20 ps7_init();
21
Michal Simeke60148d2014-01-14 14:21:52 +010022 arch_cpu_init();
Simon Glass091f6a32015-10-17 19:41:22 -060023 /*
24 * The debug UART can be used from this point:
25 * debug_uart_init();
26 * printch('x');
27 */
Michal Simeke60148d2014-01-14 14:21:52 +010028}
29
Michal Simeka831f1f2014-04-25 12:15:40 +020030#ifdef CONFIG_SPL_BOARD_INIT
31void spl_board_init(void)
32{
Simon Glasse04843d2015-10-19 06:50:02 -060033 preloader_console_init();
Michal Simeka831f1f2014-04-25 12:15:40 +020034 board_init();
35}
36#endif
37
Michal Simeke60148d2014-01-14 14:21:52 +010038u32 spl_boot_device(void)
39{
40 u32 mode;
41
42 switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
43#ifdef CONFIG_SPL_SPI_SUPPORT
44 case ZYNQ_BM_QSPI:
45 puts("qspi boot\n");
46 mode = BOOT_DEVICE_SPI;
47 break;
48#endif
Michal Simek25830022015-01-13 16:04:10 +010049 case ZYNQ_BM_NAND:
50 mode = BOOT_DEVICE_NAND;
51 break;
52 case ZYNQ_BM_NOR:
53 mode = BOOT_DEVICE_NOR;
54 break;
Michal Simeke60148d2014-01-14 14:21:52 +010055#ifdef CONFIG_SPL_MMC_SUPPORT
56 case ZYNQ_BM_SD:
57 puts("mmc boot\n");
58 mode = BOOT_DEVICE_MMC1;
59 break;
60#endif
Michal Simek25830022015-01-13 16:04:10 +010061 case ZYNQ_BM_JTAG:
62 mode = BOOT_DEVICE_RAM;
63 break;
Michal Simeke60148d2014-01-14 14:21:52 +010064 default:
65 puts("Unsupported boot mode selected\n");
66 hang();
67 }
68
69 return mode;
70}
71
Michal Simeke60148d2014-01-14 14:21:52 +010072#ifdef CONFIG_SPL_OS_BOOT
73int spl_start_uboot(void)
74{
75 /* boot linux */
76 return 0;
77}
78#endif
Masahiro Yamadac2d10792014-05-12 12:18:30 +090079
Michal Simek42c8c412016-05-10 07:55:52 +020080void spl_board_prepare_for_boot(void)
81{
82 ps7_post_config();
83 debug("SPL bye\n");
84}
85
Michal Simekf669e222016-05-03 14:20:17 +020086#ifdef CONFIG_SPL_LOAD_FIT
87int board_fit_config_name_match(const char *name)
88{
89 /* Just empty function now - can't decide what to choose */
90 debug("%s: %s\n", __func__, name);
91
92 return 0;
93}
94#endif