]>
Commit | Line | Data |
---|---|---|
b0f80b91 | 1 | /* |
6451223a | 2 | * Copyright (C) 2014-2015 Stefan Roese <sr@denx.de> |
b0f80b91 SR |
3 | * |
4 | * SPDX-License-Identifier: GPL-2.0+ | |
5 | */ | |
6 | ||
7 | #include <common.h> | |
6451223a SR |
8 | #include <dm.h> |
9 | #include <debug_uart.h> | |
10 | #include <fdtdec.h> | |
b0f80b91 SR |
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 | { | |
8ed43b96 | 20 | #if defined(CONFIG_SPL_SPI_FLASH_SUPPORT) |
b0f80b91 | 21 | return BOOT_DEVICE_SPI; |
8ed43b96 SR |
22 | #endif |
23 | #if defined(CONFIG_SPL_MMC_SUPPORT) | |
24 | return BOOT_DEVICE_MMC1; | |
25 | #endif | |
b0f80b91 SR |
26 | } |
27 | ||
8ed43b96 SR |
28 | #ifdef CONFIG_SPL_MMC_SUPPORT |
29 | u32 spl_boot_mode(void) | |
30 | { | |
31 | return MMCSD_MODE_RAW; | |
32 | } | |
33 | #endif | |
34 | ||
b0f80b91 SR |
35 | void board_init_f(ulong dummy) |
36 | { | |
6451223a SR |
37 | int ret; |
38 | ||
944c7a31 SR |
39 | #ifndef CONFIG_MVEBU_BOOTROM_UARTBOOT |
40 | /* | |
41 | * Only call arch_cpu_init() when not returning to the | |
42 | * Marvell BootROM, which is done when booting via | |
43 | * the xmodem protocol (kwboot tool). Otherwise the | |
44 | * internal register will get remapped and the BootROM | |
45 | * can't continue to run correctly. | |
46 | */ | |
47 | ||
b0f80b91 SR |
48 | /* Linux expects the internal registers to be at 0xf1000000 */ |
49 | arch_cpu_init(); | |
944c7a31 | 50 | #endif |
b0f80b91 | 51 | |
e3cccf9e SR |
52 | /* |
53 | * Pin muxing needs to be done before UART output, since | |
54 | * on A38x the UART pins need some re-muxing for output | |
55 | * to work. | |
56 | */ | |
57 | board_early_init_f(); | |
58 | ||
6451223a SR |
59 | /* Example code showing how to enable the debug UART on MVEBU */ |
60 | #ifdef EARLY_UART | |
61 | /* | |
62 | * Debug UART can be used from here if required: | |
63 | * | |
64 | * debug_uart_init(); | |
65 | * printch('a'); | |
66 | * printhex8(0x1234); | |
67 | * printascii("string"); | |
68 | */ | |
69 | #endif | |
70 | ||
71 | ret = spl_init(); | |
72 | if (ret) { | |
73 | debug("spl_init() failed: %d\n", ret); | |
74 | hang(); | |
75 | } | |
76 | ||
77 | /* Use special translation offset for SPL */ | |
78 | dm_set_translation_offset(0xd0000000 - 0xf1000000); | |
79 | ||
b0f80b91 SR |
80 | preloader_console_init(); |
81 | ||
ade741b3 SR |
82 | timer_init(); |
83 | ||
b0f80b91 SR |
84 | /* First init the serdes PHY's */ |
85 | serdes_phy_config(); | |
86 | ||
87 | /* Setup DDR */ | |
88 | ddr3_init(); | |
89 | ||
944c7a31 SR |
90 | #ifdef CONFIG_MVEBU_BOOTROM_UARTBOOT |
91 | /* | |
92 | * Return to the BootROM to continue the Marvell xmodem | |
93 | * UART boot protocol. As initiated by the kwboot tool. | |
94 | * | |
95 | * This can only be done by the BootROM and not by the | |
96 | * U-Boot SPL infrastructure, since the beginning of the | |
97 | * image is already read and interpreted by the BootROM. | |
98 | * SPL has no chance to receive this information. So we | |
99 | * need to return to the BootROM to enable this xmodem | |
100 | * UART download. | |
101 | */ | |
102 | return_to_bootrom(); | |
103 | #endif | |
b0f80b91 | 104 | } |