Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 13 | DECLARE_GLOBAL_DATA_PTR; |
| 14 | |
| 15 | u32 spl_boot_device(void) |
| 16 | { |
Stefan Roese | 6396213 | 2015-07-20 11:20:36 +0200 | [diff] [blame] | 17 | #if defined(CONFIG_SPL_SPI_FLASH_SUPPORT) |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 18 | return BOOT_DEVICE_SPI; |
Stefan Roese | 6396213 | 2015-07-20 11:20:36 +0200 | [diff] [blame] | 19 | #endif |
| 20 | #if defined(CONFIG_SPL_MMC_SUPPORT) |
| 21 | return BOOT_DEVICE_MMC1; |
| 22 | #endif |
| 23 | } |
| 24 | |
| 25 | #ifdef CONFIG_SPL_MMC_SUPPORT |
| 26 | u32 spl_boot_mode(void) |
| 27 | { |
| 28 | return MMCSD_MODE_RAW; |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 29 | } |
Stefan Roese | 6396213 | 2015-07-20 11:20:36 +0200 | [diff] [blame] | 30 | #endif |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 31 | |
| 32 | void board_init_f(ulong dummy) |
| 33 | { |
Stefan Roese | 99b3ea7 | 2015-08-25 13:49:41 +0200 | [diff] [blame] | 34 | #ifndef CONFIG_MVEBU_BOOTROM_UARTBOOT |
| 35 | /* |
| 36 | * Only call arch_cpu_init() when not returning to the |
| 37 | * Marvell BootROM, which is done when booting via |
| 38 | * the xmodem protocol (kwboot tool). Otherwise the |
| 39 | * internal register will get remapped and the BootROM |
| 40 | * can't continue to run correctly. |
| 41 | */ |
| 42 | |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 43 | /* Linux expects the internal registers to be at 0xf1000000 */ |
| 44 | arch_cpu_init(); |
Stefan Roese | 99b3ea7 | 2015-08-25 13:49:41 +0200 | [diff] [blame] | 45 | #endif |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 46 | |
Stefan Roese | d7f2c12 | 2015-04-17 18:13:06 +0200 | [diff] [blame] | 47 | /* |
| 48 | * Pin muxing needs to be done before UART output, since |
| 49 | * on A38x the UART pins need some re-muxing for output |
| 50 | * to work. |
| 51 | */ |
| 52 | board_early_init_f(); |
| 53 | |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 54 | preloader_console_init(); |
| 55 | |
Stefan Roese | d04fe8b | 2015-07-15 15:36:52 +0200 | [diff] [blame] | 56 | timer_init(); |
| 57 | |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 58 | /* First init the serdes PHY's */ |
| 59 | serdes_phy_config(); |
| 60 | |
| 61 | /* Setup DDR */ |
| 62 | ddr3_init(); |
| 63 | |
Stefan Roese | 99b3ea7 | 2015-08-25 13:49:41 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_MVEBU_BOOTROM_UARTBOOT |
| 65 | /* |
| 66 | * Return to the BootROM to continue the Marvell xmodem |
| 67 | * UART boot protocol. As initiated by the kwboot tool. |
| 68 | * |
| 69 | * This can only be done by the BootROM and not by the |
| 70 | * U-Boot SPL infrastructure, since the beginning of the |
| 71 | * image is already read and interpreted by the BootROM. |
| 72 | * SPL has no chance to receive this information. So we |
| 73 | * need to return to the BootROM to enable this xmodem |
| 74 | * UART download. |
| 75 | */ |
| 76 | return_to_bootrom(); |
| 77 | #endif |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 78 | } |