blob: 6c5415ac8f5360a936f2219e512f2258b8778061 [file] [log] [blame]
Michal Simekd7e269c2014-01-14 14:21:52 +01001/*
2 * (C) Copyright 2014 Xilinx, Inc. Michal Simek
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6#include <common.h>
Simon Glassc54c0a42015-10-17 19:41:22 -06007#include <debug_uart.h>
Michal Simekd7e269c2014-01-14 14:21:52 +01008#include <spl.h>
9
10#include <asm/io.h>
Michal Simekae2ee772014-08-11 14:03:15 +020011#include <asm/spl.h>
Simon Glassbd447582015-10-17 19:41:21 -060012#include <asm/arch/hardware.h>
Michal Simekd7e269c2014-01-14 14:21:52 +010013#include <asm/arch/sys_proto.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
17void board_init_f(ulong dummy)
18{
19 ps7_init();
20
Michal Simekd7e269c2014-01-14 14:21:52 +010021 arch_cpu_init();
Simon Glassc54c0a42015-10-17 19:41:22 -060022 /*
23 * The debug UART can be used from this point:
24 * debug_uart_init();
25 * printch('x');
26 */
Michal Simekd7e269c2014-01-14 14:21:52 +010027}
28
Michal Simek1540fb72014-04-25 12:15:40 +020029#ifdef CONFIG_SPL_BOARD_INIT
30void spl_board_init(void)
31{
Simon Glass5fa030b2015-10-19 06:50:02 -060032 preloader_console_init();
Michal Simek1540fb72014-04-25 12:15:40 +020033 board_init();
34}
35#endif
36
Michal Simekd7e269c2014-01-14 14:21:52 +010037u32 spl_boot_device(void)
38{
39 u32 mode;
40
41 switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
42#ifdef CONFIG_SPL_SPI_SUPPORT
43 case ZYNQ_BM_QSPI:
44 puts("qspi boot\n");
45 mode = BOOT_DEVICE_SPI;
46 break;
47#endif
Michal Simek63e3cea2015-01-13 16:04:10 +010048 case ZYNQ_BM_NAND:
49 mode = BOOT_DEVICE_NAND;
50 break;
51 case ZYNQ_BM_NOR:
52 mode = BOOT_DEVICE_NOR;
53 break;
Michal Simekd7e269c2014-01-14 14:21:52 +010054#ifdef CONFIG_SPL_MMC_SUPPORT
55 case ZYNQ_BM_SD:
56 puts("mmc boot\n");
57 mode = BOOT_DEVICE_MMC1;
58 break;
59#endif
Michal Simek63e3cea2015-01-13 16:04:10 +010060 case ZYNQ_BM_JTAG:
61 mode = BOOT_DEVICE_RAM;
62 break;
Michal Simekd7e269c2014-01-14 14:21:52 +010063 default:
64 puts("Unsupported boot mode selected\n");
65 hang();
66 }
67
68 return mode;
69}
70
71#ifdef CONFIG_SPL_MMC_SUPPORT
72u32 spl_boot_mode(void)
73{
Guillaume GARDET205b4f32014-10-15 17:53:11 +020074 return MMCSD_MODE_FS;
Michal Simekd7e269c2014-01-14 14:21:52 +010075}
76#endif
77
78#ifdef CONFIG_SPL_OS_BOOT
79int spl_start_uboot(void)
80{
81 /* boot linux */
82 return 0;
83}
84#endif
Masahiro Yamada66e67152014-05-12 12:18:30 +090085
86__weak void ps7_init(void)
87{
88 /*
89 * This function is overridden by the one in
Masahiro Yamada95b237e2015-05-18 15:31:52 +090090 * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists.
Masahiro Yamada66e67152014-05-12 12:18:30 +090091 */
92}
Michal Simek9a23f452016-05-03 14:20:17 +020093
Michal Simekf44e6032016-05-10 07:55:52 +020094__weak int ps7_post_config(void)
95{
96 /*
97 * This function is overridden by the one in
98 * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists.
99 */
100 return 0;
101}
102
103void spl_board_prepare_for_boot(void)
104{
105 ps7_post_config();
106 debug("SPL bye\n");
107}
108
Michal Simek9a23f452016-05-03 14:20:17 +0200109#ifdef CONFIG_SPL_LOAD_FIT
110int board_fit_config_name_match(const char *name)
111{
112 /* Just empty function now - can't decide what to choose */
113 debug("%s: %s\n", __func__, name);
114
115 return 0;
116}
117#endif