1 /* 2 * Copyright (C) 2014-2015 Stefan Roese <sr@denx.de> 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #include <common.h> 8 #include <dm.h> 9 #include <debug_uart.h> 10 #include <fdtdec.h> 11 #include <spl.h> 12 #include <asm/io.h> 13 #include <asm/arch/cpu.h> 14 #include <asm/arch/soc.h> 15 16 DECLARE_GLOBAL_DATA_PTR; 17 18 u32 spl_boot_device(void) 19 { 20 #if defined(CONFIG_SPL_SPI_FLASH_SUPPORT) 21 return BOOT_DEVICE_SPI; 22 #endif 23 #if defined(CONFIG_SPL_MMC_SUPPORT) 24 return BOOT_DEVICE_MMC1; 25 #endif 26 } 27 28 #ifdef CONFIG_SPL_MMC_SUPPORT 29 u32 spl_boot_mode(void) 30 { 31 return MMCSD_MODE_RAW; 32 } 33 #endif 34 35 void board_init_f(ulong dummy) 36 { 37 int ret; 38 39 /* 40 * Pin muxing needs to be done before UART output, since 41 * on A38x the UART pins need some re-muxing for output 42 * to work. 43 */ 44 board_early_init_f(); 45 46 /* Example code showing how to enable the debug UART on MVEBU */ 47 #ifdef EARLY_UART 48 /* 49 * Debug UART can be used from here if required: 50 * 51 * debug_uart_init(); 52 * printch('a'); 53 * printhex8(0x1234); 54 * printascii("string"); 55 */ 56 #endif 57 58 ret = spl_init(); 59 if (ret) { 60 debug("spl_init() failed: %d\n", ret); 61 hang(); 62 } 63 64 /* Use special translation offset for SPL */ 65 dm_set_translation_offset(0xd0000000 - 0xf1000000); 66 67 preloader_console_init(); 68 69 timer_init(); 70 71 /* First init the serdes PHY's */ 72 serdes_phy_config(); 73 74 /* Setup DDR */ 75 ddr3_init(); 76 77 #ifdef CONFIG_MVEBU_BOOTROM_UARTBOOT 78 /* 79 * Return to the BootROM to continue the Marvell xmodem 80 * UART boot protocol. As initiated by the kwboot tool. 81 * 82 * This can only be done by the BootROM and not by the 83 * U-Boot SPL infrastructure, since the beginning of the 84 * image is already read and interpreted by the BootROM. 85 * SPL has no chance to receive this information. So we 86 * need to return to the BootROM to enable this xmodem 87 * UART download. 88 */ 89 return_to_bootrom(); 90 #endif 91 } 92