]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/arm/mach-zynq/spl.c
common: Pass the boot device into spl_boot_mode()
[people/ms/u-boot.git] / arch / arm / mach-zynq / spl.c
CommitLineData
d7e269cf
MS
1/*
2 * (C) Copyright 2014 Xilinx, Inc. Michal Simek
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6#include <common.h>
c54c0a4c 7#include <debug_uart.h>
d7e269cf
MS
8#include <spl.h>
9
10#include <asm/io.h>
ae2ee77f 11#include <asm/spl.h>
bd44758a 12#include <asm/arch/hardware.h>
d7e269cf
MS
13#include <asm/arch/sys_proto.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
17void board_init_f(ulong dummy)
18{
19 ps7_init();
20
d7e269cf 21 arch_cpu_init();
c54c0a4c
SG
22 /*
23 * The debug UART can be used from this point:
24 * debug_uart_init();
25 * printch('x');
26 */
d7e269cf
MS
27}
28
1540fb72
MS
29#ifdef CONFIG_SPL_BOARD_INIT
30void spl_board_init(void)
31{
5fa030b9 32 preloader_console_init();
1540fb72
MS
33 board_init();
34}
35#endif
36
d7e269cf
MS
37u32 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
63e3cea5
MS
48 case ZYNQ_BM_NAND:
49 mode = BOOT_DEVICE_NAND;
50 break;
51 case ZYNQ_BM_NOR:
52 mode = BOOT_DEVICE_NOR;
53 break;
d7e269cf
MS
54#ifdef CONFIG_SPL_MMC_SUPPORT
55 case ZYNQ_BM_SD:
56 puts("mmc boot\n");
57 mode = BOOT_DEVICE_MMC1;
58 break;
59#endif
63e3cea5
MS
60 case ZYNQ_BM_JTAG:
61 mode = BOOT_DEVICE_RAM;
62 break;
d7e269cf
MS
63 default:
64 puts("Unsupported boot mode selected\n");
65 hang();
66 }
67
68 return mode;
69}
70
71#ifdef CONFIG_SPL_MMC_SUPPORT
2b1cdafa 72u32 spl_boot_mode(const u32 boot_device)
d7e269cf 73{
205b4f33 74 return MMCSD_MODE_FS;
d7e269cf
MS
75}
76#endif
77
78#ifdef CONFIG_SPL_OS_BOOT
79int spl_start_uboot(void)
80{
81 /* boot linux */
82 return 0;
83}
84#endif
66e6715c
MY
85
86__weak void ps7_init(void)
87{
88 /*
89 * This function is overridden by the one in
95b237ec 90 * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists.
66e6715c
MY
91 */
92}
9a23f458 93
f44e603f
MS
94__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
9a23f458
MS
109#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