xref: /openbmc/u-boot/arch/arm/mach-zynq/spl.c (revision 23ff8633)
1 /*
2  * (C) Copyright 2014 Xilinx, Inc. Michal Simek
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 #include <common.h>
7 #include <debug_uart.h>
8 #include <spl.h>
9 
10 #include <asm/io.h>
11 #include <asm/spl.h>
12 #include <asm/arch/hardware.h>
13 #include <asm/arch/sys_proto.h>
14 
15 DECLARE_GLOBAL_DATA_PTR;
16 
17 void board_init_f(ulong dummy)
18 {
19 	ps7_init();
20 
21 	arch_cpu_init();
22 	/*
23 	 * The debug UART can be used from this point:
24 	 * debug_uart_init();
25 	 * printch('x');
26 	 */
27 }
28 
29 #ifdef CONFIG_SPL_BOARD_INIT
30 void spl_board_init(void)
31 {
32 	preloader_console_init();
33 	board_init();
34 }
35 #endif
36 
37 u32 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
48 	case ZYNQ_BM_NAND:
49 		mode = BOOT_DEVICE_NAND;
50 		break;
51 	case ZYNQ_BM_NOR:
52 		mode = BOOT_DEVICE_NOR;
53 		break;
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
60 	case ZYNQ_BM_JTAG:
61 		mode = BOOT_DEVICE_RAM;
62 		break;
63 	default:
64 		puts("Unsupported boot mode selected\n");
65 		hang();
66 	}
67 
68 	return mode;
69 }
70 
71 #ifdef CONFIG_SPL_MMC_SUPPORT
72 u32 spl_boot_mode(void)
73 {
74 	return MMCSD_MODE_FS;
75 }
76 #endif
77 
78 #ifdef CONFIG_SPL_OS_BOOT
79 int spl_start_uboot(void)
80 {
81 	/* boot linux */
82 	return 0;
83 }
84 #endif
85 
86 __weak void ps7_init(void)
87 {
88 	/*
89 	 * This function is overridden by the one in
90 	 * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists.
91 	 */
92 }
93