2 * Copyright (C) 2014-2016 Stefan Roese <sr@denx.de>
4 * SPDX-License-Identifier: GPL-2.0+
9 #include <debug_uart.h>
13 #include <asm/arch/cpu.h>
14 #include <asm/arch/soc.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 static u32 get_boot_device(void)
23 val = readl(CONFIG_SAR_REG); /* SAR - Sample At Reset */
24 boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS;
25 switch (boot_device) {
26 #ifdef CONFIG_SPL_MMC_SUPPORT
28 case BOOT_FROM_MMC_ALT:
29 return BOOT_DEVICE_MMC1;
32 return BOOT_DEVICE_UART;
35 return BOOT_DEVICE_SPI;
39 u32 spl_boot_device(void)
41 return get_boot_device();
44 #ifdef CONFIG_SPL_MMC_SUPPORT
45 u32 spl_boot_mode(void)
47 return MMCSD_MODE_RAW;
51 void board_init_f(ulong dummy)
56 * Pin muxing needs to be done before UART output, since
57 * on A38x the UART pins need some re-muxing for output
62 /* Example code showing how to enable the debug UART on MVEBU */
65 * Debug UART can be used from here if required:
70 * printascii("string");
76 debug("spl_init() failed: %d\n", ret);
80 /* Use special translation offset for SPL */
81 dm_set_translation_offset(0xd0000000 - 0xf1000000);
83 preloader_console_init();
87 /* First init the serdes PHY's */
93 #ifdef CONFIG_MVEBU_BOOTROM_UARTBOOT
95 * Return to the BootROM to continue the Marvell xmodem
96 * UART boot protocol. As initiated by the kwboot tool.
98 * This can only be done by the BootROM and not by the
99 * U-Boot SPL infrastructure, since the beginning of the
100 * image is already read and interpreted by the BootROM.
101 * SPL has no chance to receive this information. So we
102 * need to return to the BootROM to enable this xmodem