blob: e273339648fb542863ba400be3b53eb69a083ad9 [file] [log] [blame]
Stefan Roesee463bf32015-01-19 11:33:42 +01001/*
2 * Copyright (C) 2014 Stefan Roese <sr@denx.de>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <spl.h>
9#include <asm/io.h>
10#include <asm/arch/cpu.h>
11#include <asm/arch/soc.h>
12
13DECLARE_GLOBAL_DATA_PTR;
14
15u32 spl_boot_device(void)
16{
Stefan Roese63962132015-07-20 11:20:36 +020017#if defined(CONFIG_SPL_SPI_FLASH_SUPPORT)
Stefan Roesee463bf32015-01-19 11:33:42 +010018 return BOOT_DEVICE_SPI;
Stefan Roese63962132015-07-20 11:20:36 +020019#endif
20#if defined(CONFIG_SPL_MMC_SUPPORT)
21 return BOOT_DEVICE_MMC1;
22#endif
23}
24
25#ifdef CONFIG_SPL_MMC_SUPPORT
26u32 spl_boot_mode(void)
27{
28 return MMCSD_MODE_RAW;
Stefan Roesee463bf32015-01-19 11:33:42 +010029}
Stefan Roese63962132015-07-20 11:20:36 +020030#endif
Stefan Roesee463bf32015-01-19 11:33:42 +010031
32void board_init_f(ulong dummy)
33{
34 /* Set global data pointer */
35 gd = &gdata;
36
Stefan Roese99b3ea72015-08-25 13:49:41 +020037#ifndef CONFIG_MVEBU_BOOTROM_UARTBOOT
38 /*
39 * Only call arch_cpu_init() when not returning to the
40 * Marvell BootROM, which is done when booting via
41 * the xmodem protocol (kwboot tool). Otherwise the
42 * internal register will get remapped and the BootROM
43 * can't continue to run correctly.
44 */
45
Stefan Roesee463bf32015-01-19 11:33:42 +010046 /* Linux expects the internal registers to be at 0xf1000000 */
47 arch_cpu_init();
Stefan Roese99b3ea72015-08-25 13:49:41 +020048#endif
Stefan Roesee463bf32015-01-19 11:33:42 +010049
Stefan Roesed7f2c122015-04-17 18:13:06 +020050 /*
51 * Pin muxing needs to be done before UART output, since
52 * on A38x the UART pins need some re-muxing for output
53 * to work.
54 */
55 board_early_init_f();
56
Stefan Roesee463bf32015-01-19 11:33:42 +010057 preloader_console_init();
58
Stefan Roesed04fe8b2015-07-15 15:36:52 +020059 timer_init();
60
Stefan Roesee463bf32015-01-19 11:33:42 +010061 /* First init the serdes PHY's */
62 serdes_phy_config();
63
64 /* Setup DDR */
65 ddr3_init();
66
Stefan Roese99b3ea72015-08-25 13:49:41 +020067#ifdef CONFIG_MVEBU_BOOTROM_UARTBOOT
68 /*
69 * Return to the BootROM to continue the Marvell xmodem
70 * UART boot protocol. As initiated by the kwboot tool.
71 *
72 * This can only be done by the BootROM and not by the
73 * U-Boot SPL infrastructure, since the beginning of the
74 * image is already read and interpreted by the BootROM.
75 * SPL has no chance to receive this information. So we
76 * need to return to the BootROM to enable this xmodem
77 * UART download.
78 */
79 return_to_bootrom();
80#endif
Stefan Roesee463bf32015-01-19 11:33:42 +010081}