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> |
| 7 | #include <spl.h> |
| 8 | |
| 9 | #include <asm/io.h> |
| 10 | #include <asm/arch/hardware.h> |
Michal Simek | ae2ee77 | 2014-08-11 14:03:15 +0200 | [diff] [blame] | 11 | #include <asm/spl.h> |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 12 | #include <asm/arch/sys_proto.h> |
| 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
| 16 | void board_init_f(ulong dummy) |
| 17 | { |
| 18 | ps7_init(); |
| 19 | |
| 20 | /* Clear the BSS. */ |
| 21 | memset(__bss_start, 0, __bss_end - __bss_start); |
| 22 | |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 23 | preloader_console_init(); |
| 24 | arch_cpu_init(); |
| 25 | board_init_r(NULL, 0); |
| 26 | } |
| 27 | |
Michal Simek | 1540fb7 | 2014-04-25 12:15:40 +0200 | [diff] [blame] | 28 | #ifdef CONFIG_SPL_BOARD_INIT |
| 29 | void spl_board_init(void) |
| 30 | { |
| 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 | |
| 69 | #ifdef CONFIG_SPL_MMC_SUPPORT |
| 70 | u32 spl_boot_mode(void) |
| 71 | { |
Guillaume GARDET | 205b4f3 | 2014-10-15 17:53:11 +0200 | [diff] [blame] | 72 | return MMCSD_MODE_FS; |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 73 | } |
| 74 | #endif |
| 75 | |
| 76 | #ifdef CONFIG_SPL_OS_BOOT |
| 77 | int spl_start_uboot(void) |
| 78 | { |
| 79 | /* boot linux */ |
| 80 | return 0; |
| 81 | } |
| 82 | #endif |
Masahiro Yamada | 66e6715 | 2014-05-12 12:18:30 +0900 | [diff] [blame] | 83 | |
| 84 | __weak void ps7_init(void) |
| 85 | { |
| 86 | /* |
| 87 | * This function is overridden by the one in |
Masahiro Yamada | 95b237e | 2015-05-18 15:31:52 +0900 | [diff] [blame] | 88 | * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists. |
Masahiro Yamada | 66e6715 | 2014-05-12 12:18:30 +0900 | [diff] [blame] | 89 | */ |
| 90 | } |