Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 2 | /* |
Michal Simek | 3e1b61d | 2018-01-17 07:37:47 +0100 | [diff] [blame] | 3 | * (C) Copyright 2014 - 2017 Xilinx, Inc. Michal Simek |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 4 | */ |
| 5 | #include <common.h> |
Simon Glass | c54c0a4 | 2015-10-17 19:41:22 -0600 | [diff] [blame] | 6 | #include <debug_uart.h> |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 7 | #include <spl.h> |
| 8 | |
| 9 | #include <asm/io.h> |
Michal Simek | ae2ee77 | 2014-08-11 14:03:15 +0200 | [diff] [blame] | 10 | #include <asm/spl.h> |
Simon Glass | bd44758 | 2015-10-17 19:41:21 -0600 | [diff] [blame] | 11 | #include <asm/arch/hardware.h> |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 12 | #include <asm/arch/sys_proto.h> |
Michal Simek | f0b619e | 2017-11-08 16:14:47 +0100 | [diff] [blame] | 13 | #include <asm/arch/ps7_init_gpl.h> |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 14 | |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 15 | void board_init_f(ulong dummy) |
| 16 | { |
| 17 | ps7_init(); |
| 18 | |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 19 | arch_cpu_init(); |
Simon Glass | c54c0a4 | 2015-10-17 19:41:22 -0600 | [diff] [blame] | 20 | /* |
| 21 | * The debug UART can be used from this point: |
| 22 | * debug_uart_init(); |
| 23 | * printch('x'); |
| 24 | */ |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 25 | } |
| 26 | |
Michal Simek | 1540fb7 | 2014-04-25 12:15:40 +0200 | [diff] [blame] | 27 | #ifdef CONFIG_SPL_BOARD_INIT |
| 28 | void spl_board_init(void) |
| 29 | { |
Simon Glass | 5fa030b | 2015-10-19 06:50:02 -0600 | [diff] [blame] | 30 | preloader_console_init(); |
Michal Simek | 1540fb7 | 2014-04-25 12:15:40 +0200 | [diff] [blame] | 31 | board_init(); |
| 32 | } |
| 33 | #endif |
| 34 | |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 35 | u32 spl_boot_device(void) |
| 36 | { |
| 37 | u32 mode; |
| 38 | |
| 39 | switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) { |
| 40 | #ifdef CONFIG_SPL_SPI_SUPPORT |
| 41 | case ZYNQ_BM_QSPI: |
| 42 | puts("qspi boot\n"); |
| 43 | mode = BOOT_DEVICE_SPI; |
| 44 | break; |
| 45 | #endif |
Michal Simek | 63e3cea | 2015-01-13 16:04:10 +0100 | [diff] [blame] | 46 | case ZYNQ_BM_NAND: |
| 47 | mode = BOOT_DEVICE_NAND; |
| 48 | break; |
| 49 | case ZYNQ_BM_NOR: |
| 50 | mode = BOOT_DEVICE_NOR; |
| 51 | break; |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 52 | #ifdef CONFIG_SPL_MMC_SUPPORT |
| 53 | case ZYNQ_BM_SD: |
| 54 | puts("mmc boot\n"); |
| 55 | mode = BOOT_DEVICE_MMC1; |
| 56 | break; |
| 57 | #endif |
Michal Simek | 63e3cea | 2015-01-13 16:04:10 +0100 | [diff] [blame] | 58 | case ZYNQ_BM_JTAG: |
| 59 | mode = BOOT_DEVICE_RAM; |
| 60 | break; |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 61 | default: |
| 62 | puts("Unsupported boot mode selected\n"); |
| 63 | hang(); |
| 64 | } |
| 65 | |
| 66 | return mode; |
| 67 | } |
| 68 | |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 69 | #ifdef CONFIG_SPL_OS_BOOT |
| 70 | int spl_start_uboot(void) |
| 71 | { |
| 72 | /* boot linux */ |
| 73 | return 0; |
| 74 | } |
| 75 | #endif |
Masahiro Yamada | 66e6715 | 2014-05-12 12:18:30 +0900 | [diff] [blame] | 76 | |
Michal Simek | f44e603 | 2016-05-10 07:55:52 +0200 | [diff] [blame] | 77 | void spl_board_prepare_for_boot(void) |
| 78 | { |
| 79 | ps7_post_config(); |
| 80 | debug("SPL bye\n"); |
| 81 | } |
| 82 | |
Michal Simek | 9a23f45 | 2016-05-03 14:20:17 +0200 | [diff] [blame] | 83 | #ifdef CONFIG_SPL_LOAD_FIT |
| 84 | int board_fit_config_name_match(const char *name) |
| 85 | { |
| 86 | /* Just empty function now - can't decide what to choose */ |
| 87 | debug("%s: %s\n", __func__, name); |
| 88 | |
| 89 | return 0; |
| 90 | } |
| 91 | #endif |