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