blob: dc964dc2f9fee1956b40ef3bc5348b4d8af7aa8d [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Michal Simeke60148d2014-01-14 14:21:52 +01002/*
Michal Simek98d0f1f2018-01-17 07:37:47 +01003 * (C) Copyright 2014 - 2017 Xilinx, Inc. Michal Simek
Michal Simeke60148d2014-01-14 14:21:52 +01004 */
Simon Glass091f6a32015-10-17 19:41:22 -06005#include <debug_uart.h>
Simon Glassf11478f2019-12-28 10:45:07 -07006#include <hang.h>
Simon Glass2dc9c342020-05-10 11:40:01 -06007#include <image.h>
Simon Glass97589732020-05-10 11:40:02 -06008#include <init.h>
Simon Glass0f2af882020-05-10 11:40:05 -06009#include <log.h>
Michal Simeke60148d2014-01-14 14:21:52 +010010#include <spl.h>
11
12#include <asm/io.h>
Michal Simek162c6372014-08-11 14:03:15 +020013#include <asm/spl.h>
Simon Glass122216d2015-10-17 19:41:21 -060014#include <asm/arch/hardware.h>
Michal Simeke60148d2014-01-14 14:21:52 +010015#include <asm/arch/sys_proto.h>
Michal Simek85dc76a2017-11-08 16:14:47 +010016#include <asm/arch/ps7_init_gpl.h>
Michal Simeke60148d2014-01-14 14:21:52 +010017
Michal Simek7659fe42022-02-17 14:28:41 +010018#if defined(CONFIG_DEBUG_UART_BOARD_INIT)
19void board_debug_uart_init(void)
20{
21 ps7_init();
22}
23#endif
24
Michal Simeke60148d2014-01-14 14:21:52 +010025void board_init_f(ulong dummy)
26{
Michal Simek7659fe42022-02-17 14:28:41 +010027#if !defined(CONFIG_DEBUG_UART_BOARD_INIT)
Michal Simeke60148d2014-01-14 14:21:52 +010028 ps7_init();
Michal Simek7659fe42022-02-17 14:28:41 +010029#endif
Michal Simeke60148d2014-01-14 14:21:52 +010030
Michal Simeke60148d2014-01-14 14:21:52 +010031 arch_cpu_init();
Michal Simeke60148d2014-01-14 14:21:52 +010032}
33
Lukas Funkebae556542024-03-27 13:11:53 +010034#ifdef CONFIG_SPL_SOC_INIT
35void spl_soc_init(void)
Michal Simeka831f1f2014-04-25 12:15:40 +020036{
Simon Glasse04843d2015-10-19 06:50:02 -060037 preloader_console_init();
Michal Simek1aab1142020-09-09 14:41:56 +020038#if defined(CONFIG_ARCH_EARLY_INIT_R) && defined(CONFIG_SPL_FPGA)
Luis Araneda7d9405a2018-07-19 03:10:18 -040039 arch_early_init_r();
40#endif
Michal Simeka831f1f2014-04-25 12:15:40 +020041 board_init();
42}
43#endif
44
Michal Simeke60148d2014-01-14 14:21:52 +010045u32 spl_boot_device(void)
46{
47 u32 mode;
48
49 switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
Simon Glassa5820472021-08-08 12:20:14 -060050#ifdef CONFIG_SPL_SPI
Michal Simeke60148d2014-01-14 14:21:52 +010051 case ZYNQ_BM_QSPI:
Michal Simeke60148d2014-01-14 14:21:52 +010052 mode = BOOT_DEVICE_SPI;
53 break;
54#endif
Michal Simek25830022015-01-13 16:04:10 +010055 case ZYNQ_BM_NAND:
56 mode = BOOT_DEVICE_NAND;
57 break;
58 case ZYNQ_BM_NOR:
59 mode = BOOT_DEVICE_NOR;
60 break;
Simon Glassb58bfe02021-08-08 12:20:09 -060061#ifdef CONFIG_SPL_MMC
Michal Simeke60148d2014-01-14 14:21:52 +010062 case ZYNQ_BM_SD:
Michal Simeke60148d2014-01-14 14:21:52 +010063 mode = BOOT_DEVICE_MMC1;
64 break;
65#endif
Michal Simek25830022015-01-13 16:04:10 +010066 case ZYNQ_BM_JTAG:
67 mode = BOOT_DEVICE_RAM;
68 break;
Michal Simeke60148d2014-01-14 14:21:52 +010069 default:
70 puts("Unsupported boot mode selected\n");
71 hang();
72 }
73
74 return mode;
75}
76
Michal Simeke60148d2014-01-14 14:21:52 +010077#ifdef CONFIG_SPL_OS_BOOT
78int spl_start_uboot(void)
79{
80 /* boot linux */
81 return 0;
82}
83#endif
Masahiro Yamadac2d10792014-05-12 12:18:30 +090084
Michal Simek42c8c412016-05-10 07:55:52 +020085void spl_board_prepare_for_boot(void)
86{
87 ps7_post_config();
88 debug("SPL bye\n");
89}