blob: 83297d6c694722366d6238c1c1fa3ba614430392 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Michal Simekd7e269c2014-01-14 14:21:52 +01002/*
Michal Simek3e1b61d2018-01-17 07:37:47 +01003 * (C) Copyright 2014 - 2017 Xilinx, Inc. Michal Simek
Michal Simekd7e269c2014-01-14 14:21:52 +01004 */
5#include <common.h>
Simon Glassc54c0a42015-10-17 19:41:22 -06006#include <debug_uart.h>
Michal Simekd7e269c2014-01-14 14:21:52 +01007#include <spl.h>
8
9#include <asm/io.h>
Michal Simekae2ee772014-08-11 14:03:15 +020010#include <asm/spl.h>
Simon Glassbd447582015-10-17 19:41:21 -060011#include <asm/arch/hardware.h>
Michal Simekd7e269c2014-01-14 14:21:52 +010012#include <asm/arch/sys_proto.h>
Michal Simekf0b619e2017-11-08 16:14:47 +010013#include <asm/arch/ps7_init_gpl.h>
Michal Simekd7e269c2014-01-14 14:21:52 +010014
Michal Simekd7e269c2014-01-14 14:21:52 +010015void board_init_f(ulong dummy)
16{
17 ps7_init();
18
Michal Simekd7e269c2014-01-14 14:21:52 +010019 arch_cpu_init();
Michal Simek57213c52018-04-19 12:36:48 +020020
21#ifdef CONFIG_DEBUG_UART
22 /* Uart debug for sure */
23 debug_uart_init();
24 puts("Debug uart enabled\n"); /* or printch() */
25#endif
Michal Simekd7e269c2014-01-14 14:21:52 +010026}
27
Michal Simek1540fb72014-04-25 12:15:40 +020028#ifdef CONFIG_SPL_BOARD_INIT
29void spl_board_init(void)
30{
Simon Glass5fa030b2015-10-19 06:50:02 -060031 preloader_console_init();
Michal Simek1540fb72014-04-25 12:15:40 +020032 board_init();
33}
34#endif
35
Michal Simekd7e269c2014-01-14 14:21:52 +010036u32 spl_boot_device(void)
37{
38 u32 mode;
39
40 switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
41#ifdef CONFIG_SPL_SPI_SUPPORT
42 case ZYNQ_BM_QSPI:
43 puts("qspi boot\n");
44 mode = BOOT_DEVICE_SPI;
45 break;
46#endif
Michal Simek63e3cea2015-01-13 16:04:10 +010047 case ZYNQ_BM_NAND:
48 mode = BOOT_DEVICE_NAND;
49 break;
50 case ZYNQ_BM_NOR:
51 mode = BOOT_DEVICE_NOR;
52 break;
Michal Simekd7e269c2014-01-14 14:21:52 +010053#ifdef CONFIG_SPL_MMC_SUPPORT
54 case ZYNQ_BM_SD:
55 puts("mmc boot\n");
56 mode = BOOT_DEVICE_MMC1;
57 break;
58#endif
Michal Simek63e3cea2015-01-13 16:04:10 +010059 case ZYNQ_BM_JTAG:
60 mode = BOOT_DEVICE_RAM;
61 break;
Michal Simekd7e269c2014-01-14 14:21:52 +010062 default:
63 puts("Unsupported boot mode selected\n");
64 hang();
65 }
66
67 return mode;
68}
69
Michal Simekd7e269c2014-01-14 14:21:52 +010070#ifdef CONFIG_SPL_OS_BOOT
71int spl_start_uboot(void)
72{
73 /* boot linux */
74 return 0;
75}
76#endif
Masahiro Yamada66e67152014-05-12 12:18:30 +090077
Michal Simekf44e6032016-05-10 07:55:52 +020078void spl_board_prepare_for_boot(void)
79{
80 ps7_post_config();
81 debug("SPL bye\n");
82}
83
Michal Simek9a23f452016-05-03 14:20:17 +020084#ifdef CONFIG_SPL_LOAD_FIT
85int board_fit_config_name_match(const char *name)
86{
87 /* Just empty function now - can't decide what to choose */
88 debug("%s: %s\n", __func__, name);
89
90 return 0;
91}
92#endif