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> |
| 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | void board_init_f(ulong dummy) |
| 18 | { |
| 19 | ps7_init(); |
| 20 | |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 21 | arch_cpu_init(); |
Simon Glass | c54c0a4 | 2015-10-17 19:41:22 -0600 | [diff] [blame] | 22 | /* |
| 23 | * The debug UART can be used from this point: |
| 24 | * debug_uart_init(); |
| 25 | * printch('x'); |
| 26 | */ |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 27 | } |
| 28 | |
Michal Simek | 1540fb7 | 2014-04-25 12:15:40 +0200 | [diff] [blame] | 29 | #ifdef CONFIG_SPL_BOARD_INIT |
| 30 | void spl_board_init(void) |
| 31 | { |
Simon Glass | 5fa030b | 2015-10-19 06:50:02 -0600 | [diff] [blame] | 32 | preloader_console_init(); |
Michal Simek | 1540fb7 | 2014-04-25 12:15:40 +0200 | [diff] [blame] | 33 | board_init(); |
| 34 | } |
| 35 | #endif |
| 36 | |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 37 | u32 spl_boot_device(void) |
| 38 | { |
| 39 | u32 mode; |
| 40 | |
| 41 | switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) { |
| 42 | #ifdef CONFIG_SPL_SPI_SUPPORT |
| 43 | case ZYNQ_BM_QSPI: |
| 44 | puts("qspi boot\n"); |
| 45 | mode = BOOT_DEVICE_SPI; |
| 46 | break; |
| 47 | #endif |
Michal Simek | 63e3cea | 2015-01-13 16:04:10 +0100 | [diff] [blame] | 48 | case ZYNQ_BM_NAND: |
| 49 | mode = BOOT_DEVICE_NAND; |
| 50 | break; |
| 51 | case ZYNQ_BM_NOR: |
| 52 | mode = BOOT_DEVICE_NOR; |
| 53 | break; |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 54 | #ifdef CONFIG_SPL_MMC_SUPPORT |
| 55 | case ZYNQ_BM_SD: |
| 56 | puts("mmc boot\n"); |
| 57 | mode = BOOT_DEVICE_MMC1; |
| 58 | break; |
| 59 | #endif |
Michal Simek | 63e3cea | 2015-01-13 16:04:10 +0100 | [diff] [blame] | 60 | case ZYNQ_BM_JTAG: |
| 61 | mode = BOOT_DEVICE_RAM; |
| 62 | break; |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 63 | default: |
| 64 | puts("Unsupported boot mode selected\n"); |
| 65 | hang(); |
| 66 | } |
| 67 | |
| 68 | return mode; |
| 69 | } |
| 70 | |
| 71 | #ifdef CONFIG_SPL_MMC_SUPPORT |
Marek Vasut | 2b1cdaf | 2016-05-14 23:42:07 +0200 | [diff] [blame] | 72 | u32 spl_boot_mode(const u32 boot_device) |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 73 | { |
Guillaume GARDET | 205b4f3 | 2014-10-15 17:53:11 +0200 | [diff] [blame] | 74 | return MMCSD_MODE_FS; |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 75 | } |
| 76 | #endif |
| 77 | |
| 78 | #ifdef CONFIG_SPL_OS_BOOT |
| 79 | int spl_start_uboot(void) |
| 80 | { |
| 81 | /* boot linux */ |
| 82 | return 0; |
| 83 | } |
| 84 | #endif |
Masahiro Yamada | 66e6715 | 2014-05-12 12:18:30 +0900 | [diff] [blame] | 85 | |
| 86 | __weak void ps7_init(void) |
| 87 | { |
| 88 | /* |
| 89 | * This function is overridden by the one in |
Masahiro Yamada | 95b237e | 2015-05-18 15:31:52 +0900 | [diff] [blame] | 90 | * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists. |
Masahiro Yamada | 66e6715 | 2014-05-12 12:18:30 +0900 | [diff] [blame] | 91 | */ |
| 92 | } |
Michal Simek | 9a23f45 | 2016-05-03 14:20:17 +0200 | [diff] [blame] | 93 | |
Michal Simek | f44e603 | 2016-05-10 07:55:52 +0200 | [diff] [blame] | 94 | __weak int ps7_post_config(void) |
| 95 | { |
| 96 | /* |
| 97 | * This function is overridden by the one in |
| 98 | * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists. |
| 99 | */ |
| 100 | return 0; |
| 101 | } |
| 102 | |
| 103 | void spl_board_prepare_for_boot(void) |
| 104 | { |
| 105 | ps7_post_config(); |
| 106 | debug("SPL bye\n"); |
| 107 | } |
| 108 | |
Michal Simek | 9a23f45 | 2016-05-03 14:20:17 +0200 | [diff] [blame] | 109 | #ifdef CONFIG_SPL_LOAD_FIT |
| 110 | int board_fit_config_name_match(const char *name) |
| 111 | { |
| 112 | /* Just empty function now - can't decide what to choose */ |
| 113 | debug("%s: %s\n", __func__, name); |
| 114 | |
| 115 | return 0; |
| 116 | } |
| 117 | #endif |