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 | */ |
| 5 | #include <common.h> |
Simon Glass | 091f6a3 | 2015-10-17 19:41:22 -0600 | [diff] [blame] | 6 | #include <debug_uart.h> |
Simon Glass | f11478f | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 7 | #include <hang.h> |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 8 | #include <spl.h> |
Michal Simek | db2337c | 2020-02-18 15:03:13 +0100 | [diff] [blame] | 9 | #include <generated/dt.h> |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 10 | |
| 11 | #include <asm/io.h> |
Michal Simek | 162c637 | 2014-08-11 14:03:15 +0200 | [diff] [blame] | 12 | #include <asm/spl.h> |
Simon Glass | 122216d | 2015-10-17 19:41:21 -0600 | [diff] [blame] | 13 | #include <asm/arch/hardware.h> |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 14 | #include <asm/arch/sys_proto.h> |
Michal Simek | 85dc76a | 2017-11-08 16:14:47 +0100 | [diff] [blame] | 15 | #include <asm/arch/ps7_init_gpl.h> |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 16 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 17 | void board_init_f(ulong dummy) |
| 18 | { |
| 19 | ps7_init(); |
| 20 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 21 | arch_cpu_init(); |
Michal Simek | e533ad2 | 2018-04-19 12:36:48 +0200 | [diff] [blame] | 22 | |
| 23 | #ifdef CONFIG_DEBUG_UART |
| 24 | /* Uart debug for sure */ |
| 25 | debug_uart_init(); |
| 26 | puts("Debug uart enabled\n"); /* or printch() */ |
| 27 | #endif |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 28 | } |
| 29 | |
Michal Simek | a831f1f | 2014-04-25 12:15:40 +0200 | [diff] [blame] | 30 | #ifdef CONFIG_SPL_BOARD_INIT |
| 31 | void spl_board_init(void) |
| 32 | { |
Simon Glass | e04843d | 2015-10-19 06:50:02 -0600 | [diff] [blame] | 33 | preloader_console_init(); |
Luis Araneda | 7d9405a | 2018-07-19 03:10:18 -0400 | [diff] [blame] | 34 | #if defined(CONFIG_ARCH_EARLY_INIT_R) && defined(CONFIG_SPL_FPGA_SUPPORT) |
| 35 | arch_early_init_r(); |
| 36 | #endif |
Michal Simek | a831f1f | 2014-04-25 12:15:40 +0200 | [diff] [blame] | 37 | board_init(); |
| 38 | } |
| 39 | #endif |
| 40 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 41 | u32 spl_boot_device(void) |
| 42 | { |
| 43 | u32 mode; |
| 44 | |
| 45 | switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) { |
| 46 | #ifdef CONFIG_SPL_SPI_SUPPORT |
| 47 | case ZYNQ_BM_QSPI: |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 48 | mode = BOOT_DEVICE_SPI; |
| 49 | break; |
| 50 | #endif |
Michal Simek | 2583002 | 2015-01-13 16:04:10 +0100 | [diff] [blame] | 51 | case ZYNQ_BM_NAND: |
| 52 | mode = BOOT_DEVICE_NAND; |
| 53 | break; |
| 54 | case ZYNQ_BM_NOR: |
| 55 | mode = BOOT_DEVICE_NOR; |
| 56 | break; |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 57 | #ifdef CONFIG_SPL_MMC_SUPPORT |
| 58 | case ZYNQ_BM_SD: |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 59 | mode = BOOT_DEVICE_MMC1; |
| 60 | break; |
| 61 | #endif |
Michal Simek | 2583002 | 2015-01-13 16:04:10 +0100 | [diff] [blame] | 62 | case ZYNQ_BM_JTAG: |
| 63 | mode = BOOT_DEVICE_RAM; |
| 64 | break; |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 65 | default: |
| 66 | puts("Unsupported boot mode selected\n"); |
| 67 | hang(); |
| 68 | } |
| 69 | |
| 70 | return mode; |
| 71 | } |
| 72 | |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 73 | #ifdef CONFIG_SPL_OS_BOOT |
| 74 | int spl_start_uboot(void) |
| 75 | { |
| 76 | /* boot linux */ |
| 77 | return 0; |
| 78 | } |
| 79 | #endif |
Masahiro Yamada | c2d1079 | 2014-05-12 12:18:30 +0900 | [diff] [blame] | 80 | |
Michal Simek | 42c8c41 | 2016-05-10 07:55:52 +0200 | [diff] [blame] | 81 | void spl_board_prepare_for_boot(void) |
| 82 | { |
| 83 | ps7_post_config(); |
| 84 | debug("SPL bye\n"); |
| 85 | } |
| 86 | |
Michal Simek | f669e22 | 2016-05-03 14:20:17 +0200 | [diff] [blame] | 87 | #ifdef CONFIG_SPL_LOAD_FIT |
| 88 | int board_fit_config_name_match(const char *name) |
| 89 | { |
| 90 | /* Just empty function now - can't decide what to choose */ |
Michal Simek | db2337c | 2020-02-18 15:03:13 +0100 | [diff] [blame] | 91 | debug("%s: Check %s, default %s\n", __func__, name, DEVICE_TREE); |
Michal Simek | f669e22 | 2016-05-03 14:20:17 +0200 | [diff] [blame] | 92 | |
Michal Simek | db2337c | 2020-02-18 15:03:13 +0100 | [diff] [blame] | 93 | if (!strcmp(name, DEVICE_TREE)) |
| 94 | return 0; |
| 95 | |
| 96 | return -1; |
Michal Simek | f669e22 | 2016-05-03 14:20:17 +0200 | [diff] [blame] | 97 | } |
| 98 | #endif |