blob: 723019d25279b15dedfffac977eb98d9ab37d4f2 [file] [log] [blame]
Michal Simeke60148d2014-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 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>
14
15DECLARE_GLOBAL_DATA_PTR;
16
17void board_init_f(ulong dummy)
18{
19 ps7_init();
20
Michal Simeke60148d2014-01-14 14:21:52 +010021 arch_cpu_init();
Simon Glass091f6a32015-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 Simeke60148d2014-01-14 14:21:52 +010027}
28
Michal Simeka831f1f2014-04-25 12:15:40 +020029#ifdef CONFIG_SPL_BOARD_INIT
30void spl_board_init(void)
31{
Simon Glasse04843d2015-10-19 06:50:02 -060032 preloader_console_init();
Michal Simeka831f1f2014-04-25 12:15:40 +020033 board_init();
34}
35#endif
36
Michal Simeke60148d2014-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 Simek25830022015-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 Simeke60148d2014-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 Simek25830022015-01-13 16:04:10 +010060 case ZYNQ_BM_JTAG:
61 mode = BOOT_DEVICE_RAM;
62 break;
Michal Simeke60148d2014-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 GARDET602a16c2014-10-15 17:53:11 +020074 return MMCSD_MODE_FS;
Michal Simeke60148d2014-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 Yamadac2d10792014-05-12 12:18:30 +090085
86__weak void ps7_init(void)
87{
88 /*
89 * This function is overridden by the one in
Masahiro Yamada2ab28d12015-05-18 15:31:52 +090090 * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists.
Masahiro Yamadac2d10792014-05-12 12:18:30 +090091 */
92}