18054559f5a60cc0f3150aa1beae6a77d9e749e1
[oweals/u-boot.git] / arch / arm / mach-zynq / spl.c
1 /*
2  * (C) Copyright 2014 Xilinx, Inc. Michal Simek
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6 #include <common.h>
7 #include <spl.h>
8
9 #include <asm/io.h>
10 #include <asm/spl.h>
11 #include <asm/arch/hardware.h>
12 #include <asm/arch/sys_proto.h>
13
14 DECLARE_GLOBAL_DATA_PTR;
15
16 void board_init_f(ulong dummy)
17 {
18         ps7_init();
19
20         arch_cpu_init();
21 }
22
23 #ifdef CONFIG_SPL_BOARD_INIT
24 void spl_board_init(void)
25 {
26         preloader_console_init();
27         board_init();
28 }
29 #endif
30
31 u32 spl_boot_device(void)
32 {
33         u32 mode;
34
35         switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
36 #ifdef CONFIG_SPL_SPI_SUPPORT
37         case ZYNQ_BM_QSPI:
38                 puts("qspi boot\n");
39                 mode = BOOT_DEVICE_SPI;
40                 break;
41 #endif
42         case ZYNQ_BM_NAND:
43                 mode = BOOT_DEVICE_NAND;
44                 break;
45         case ZYNQ_BM_NOR:
46                 mode = BOOT_DEVICE_NOR;
47                 break;
48 #ifdef CONFIG_SPL_MMC_SUPPORT
49         case ZYNQ_BM_SD:
50                 puts("mmc boot\n");
51                 mode = BOOT_DEVICE_MMC1;
52                 break;
53 #endif
54         case ZYNQ_BM_JTAG:
55                 mode = BOOT_DEVICE_RAM;
56                 break;
57         default:
58                 puts("Unsupported boot mode selected\n");
59                 hang();
60         }
61
62         return mode;
63 }
64
65 #ifdef CONFIG_SPL_MMC_SUPPORT
66 u32 spl_boot_mode(void)
67 {
68         return MMCSD_MODE_FS;
69 }
70 #endif
71
72 #ifdef CONFIG_SPL_OS_BOOT
73 int spl_start_uboot(void)
74 {
75         /* boot linux */
76         return 0;
77 }
78 #endif
79
80 __weak void ps7_init(void)
81 {
82         /*
83          * This function is overridden by the one in
84          * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists.
85          */
86 }