Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 2 | /* |
Michal Simek | 98d0f1f | 2018-01-17 07:37:47 +0100 | [diff] [blame] | 3 | * (C) Copyright 2014 - 2017 Xilinx, Inc. Michal Simek |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 4 | */ |
Simon Glass | 091f6a3 | 2015-10-17 19:41:22 -0600 | [diff] [blame] | 5 | #include <debug_uart.h> |
Simon Glass | f11478f | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 6 | #include <hang.h> |
Simon Glass | 2dc9c34 | 2020-05-10 11:40:01 -0600 | [diff] [blame] | 7 | #include <image.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 8 | #include <init.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 9 | #include <log.h> |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 10 | #include <spl.h> |
11 | |||||
12 | #include <asm/io.h> | ||||
Michal Simek | 162c637 | 2014-08-11 14:03:15 +0200 | [diff] [blame] | 13 | #include <asm/spl.h> |
Simon Glass | 122216d | 2015-10-17 19:41:21 -0600 | [diff] [blame] | 14 | #include <asm/arch/hardware.h> |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 15 | #include <asm/arch/sys_proto.h> |
Michal Simek | 85dc76a | 2017-11-08 16:14:47 +0100 | [diff] [blame] | 16 | #include <asm/arch/ps7_init_gpl.h> |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 17 | |
Michal Simek | 7659fe4 | 2022-02-17 14:28:41 +0100 | [diff] [blame] | 18 | #if defined(CONFIG_DEBUG_UART_BOARD_INIT) |
19 | void board_debug_uart_init(void) | ||||
20 | { | ||||
21 | ps7_init(); | ||||
22 | } | ||||
23 | #endif | ||||
24 | |||||
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 25 | void board_init_f(ulong dummy) |
26 | { | ||||
Michal Simek | 7659fe4 | 2022-02-17 14:28:41 +0100 | [diff] [blame] | 27 | #if !defined(CONFIG_DEBUG_UART_BOARD_INIT) |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 28 | ps7_init(); |
Michal Simek | 7659fe4 | 2022-02-17 14:28:41 +0100 | [diff] [blame] | 29 | #endif |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 30 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 31 | arch_cpu_init(); |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 32 | } |
33 | |||||
Lukas Funke | bae55654 | 2024-03-27 13:11:53 +0100 | [diff] [blame] | 34 | #ifdef CONFIG_SPL_SOC_INIT |
35 | void spl_soc_init(void) | ||||
Michal Simek | a831f1f | 2014-04-25 12:15:40 +0200 | [diff] [blame] | 36 | { |
Simon Glass | e04843d | 2015-10-19 06:50:02 -0600 | [diff] [blame] | 37 | preloader_console_init(); |
Michal Simek | 1aab114 | 2020-09-09 14:41:56 +0200 | [diff] [blame] | 38 | #if defined(CONFIG_ARCH_EARLY_INIT_R) && defined(CONFIG_SPL_FPGA) |
Luis Araneda | 7d9405a | 2018-07-19 03:10:18 -0400 | [diff] [blame] | 39 | arch_early_init_r(); |
40 | #endif | ||||
Michal Simek | a831f1f | 2014-04-25 12:15:40 +0200 | [diff] [blame] | 41 | board_init(); |
42 | } | ||||
43 | #endif | ||||
44 | |||||
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 45 | u32 spl_boot_device(void) |
46 | { | ||||
47 | u32 mode; | ||||
48 | |||||
49 | switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) { | ||||
Simon Glass | a582047 | 2021-08-08 12:20:14 -0600 | [diff] [blame] | 50 | #ifdef CONFIG_SPL_SPI |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 51 | case ZYNQ_BM_QSPI: |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 52 | mode = BOOT_DEVICE_SPI; |
53 | break; | ||||
54 | #endif | ||||
Michal Simek | 2583002 | 2015-01-13 16:04:10 +0100 | [diff] [blame] | 55 | case ZYNQ_BM_NAND: |
56 | mode = BOOT_DEVICE_NAND; | ||||
57 | break; | ||||
58 | case ZYNQ_BM_NOR: | ||||
59 | mode = BOOT_DEVICE_NOR; | ||||
60 | break; | ||||
Simon Glass | b58bfe0 | 2021-08-08 12:20:09 -0600 | [diff] [blame] | 61 | #ifdef CONFIG_SPL_MMC |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 62 | case ZYNQ_BM_SD: |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 63 | mode = BOOT_DEVICE_MMC1; |
64 | break; | ||||
65 | #endif | ||||
Michal Simek | 2583002 | 2015-01-13 16:04:10 +0100 | [diff] [blame] | 66 | case ZYNQ_BM_JTAG: |
67 | mode = BOOT_DEVICE_RAM; | ||||
68 | break; | ||||
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 69 | default: |
70 | puts("Unsupported boot mode selected\n"); | ||||
71 | hang(); | ||||
72 | } | ||||
73 | |||||
74 | return mode; | ||||
75 | } | ||||
76 | |||||
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 77 | #ifdef CONFIG_SPL_OS_BOOT |
78 | int spl_start_uboot(void) | ||||
79 | { | ||||
80 | /* boot linux */ | ||||
81 | return 0; | ||||
82 | } | ||||
83 | #endif | ||||
Masahiro Yamada | c2d1079 | 2014-05-12 12:18:30 +0900 | [diff] [blame] | 84 | |
Michal Simek | 42c8c41 | 2016-05-10 07:55:52 +0200 | [diff] [blame] | 85 | void spl_board_prepare_for_boot(void) |
86 | { | ||||
87 | ps7_post_config(); | ||||
88 | debug("SPL bye\n"); | ||||
89 | } |