spl.c 1.4 KB
Newer Older
1
// SPDX-License-Identifier: GPL-2.0+
M
Michal Simek 已提交
2
/*
3
 * (C) Copyright 2014 - 2017 Xilinx, Inc. Michal Simek
M
Michal Simek 已提交
4 5
 */
#include <common.h>
S
Simon Glass 已提交
6
#include <debug_uart.h>
7
#include <hang.h>
8
#include <image.h>
9
#include <init.h>
10
#include <log.h>
M
Michal Simek 已提交
11 12 13
#include <spl.h>

#include <asm/io.h>
M
Michal Simek 已提交
14
#include <asm/spl.h>
15
#include <asm/arch/hardware.h>
M
Michal Simek 已提交
16
#include <asm/arch/sys_proto.h>
17
#include <asm/arch/ps7_init_gpl.h>
M
Michal Simek 已提交
18 19 20 21 22 23

void board_init_f(ulong dummy)
{
	ps7_init();

	arch_cpu_init();
24 25 26 27 28 29

#ifdef CONFIG_DEBUG_UART
	/* Uart debug for sure */
	debug_uart_init();
	puts("Debug uart enabled\n"); /* or printch() */
#endif
M
Michal Simek 已提交
30 31
}

32 33 34
#ifdef CONFIG_SPL_BOARD_INIT
void spl_board_init(void)
{
35
	preloader_console_init();
36
#if defined(CONFIG_ARCH_EARLY_INIT_R) && defined(CONFIG_SPL_FPGA)
37 38
	arch_early_init_r();
#endif
39 40 41 42
	board_init();
}
#endif

M
Michal Simek 已提交
43 44 45 46 47
u32 spl_boot_device(void)
{
	u32 mode;

	switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
S
Simon Glass 已提交
48
#ifdef CONFIG_SPL_SPI
M
Michal Simek 已提交
49 50 51 52
	case ZYNQ_BM_QSPI:
		mode = BOOT_DEVICE_SPI;
		break;
#endif
53 54 55 56 57 58
	case ZYNQ_BM_NAND:
		mode = BOOT_DEVICE_NAND;
		break;
	case ZYNQ_BM_NOR:
		mode = BOOT_DEVICE_NOR;
		break;
S
Simon Glass 已提交
59
#ifdef CONFIG_SPL_MMC
M
Michal Simek 已提交
60 61 62 63
	case ZYNQ_BM_SD:
		mode = BOOT_DEVICE_MMC1;
		break;
#endif
64 65 66
	case ZYNQ_BM_JTAG:
		mode = BOOT_DEVICE_RAM;
		break;
M
Michal Simek 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
	default:
		puts("Unsupported boot mode selected\n");
		hang();
	}

	return mode;
}

#ifdef CONFIG_SPL_OS_BOOT
int spl_start_uboot(void)
{
	/* boot linux */
	return 0;
}
#endif
82

83 84 85 86 87
void spl_board_prepare_for_boot(void)
{
	ps7_post_config();
	debug("SPL bye\n");
}