]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - arch/arm/cpu/armv7/zynq/spl.c
ARM: zynq: List nand, qspi and jtag boot modes
[karo-tx-uboot.git] / arch / arm / cpu / armv7 / 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/arch/hardware.h>
11 #include <asm/spl.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         /* Clear the BSS. */
21         memset(__bss_start, 0, __bss_end - __bss_start);
22
23         /* Set global data pointer. */
24         gd = &gdata;
25
26         preloader_console_init();
27         arch_cpu_init();
28         board_init_r(NULL, 0);
29 }
30
31 #ifdef CONFIG_SPL_BOARD_INIT
32 void spl_board_init(void)
33 {
34         board_init();
35 }
36 #endif
37
38 u32 spl_boot_device(void)
39 {
40         u32 mode;
41
42         switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
43 #ifdef CONFIG_SPL_SPI_SUPPORT
44         case ZYNQ_BM_QSPI:
45                 puts("qspi boot\n");
46                 mode = BOOT_DEVICE_SPI;
47                 break;
48 #endif
49         case ZYNQ_BM_NAND:
50                 mode = BOOT_DEVICE_NAND;
51                 break;
52         case ZYNQ_BM_NOR:
53                 mode = BOOT_DEVICE_NOR;
54                 break;
55 #ifdef CONFIG_SPL_MMC_SUPPORT
56         case ZYNQ_BM_SD:
57                 puts("mmc boot\n");
58                 mode = BOOT_DEVICE_MMC1;
59                 break;
60 #endif
61         case ZYNQ_BM_JTAG:
62                 mode = BOOT_DEVICE_RAM;
63                 break;
64         default:
65                 puts("Unsupported boot mode selected\n");
66                 hang();
67         }
68
69         return mode;
70 }
71
72 #ifdef CONFIG_SPL_MMC_SUPPORT
73 u32 spl_boot_mode(void)
74 {
75         return MMCSD_MODE_FS;
76 }
77 #endif
78
79 #ifdef CONFIG_SPL_OS_BOOT
80 int spl_start_uboot(void)
81 {
82         /* boot linux */
83         return 0;
84 }
85 #endif
86
87 __weak void ps7_init(void)
88 {
89         /*
90          * This function is overridden by the one in
91          * board/xilinx/zynq/ps7_init.c, if it exists.
92          */
93 }