]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/arm/mach-mvebu/spl.c
d16a62d2dd32f8d8d51369c664d1716b770f2c08
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 static u32
get_boot_device(void)
22 * First check, if UART boot-mode is active. This can only
23 * be done, via the bootrom error register. Here the
24 * MSB marks if the UART mode is active.
26 val
= readl(CONFIG_BOOTROM_ERR_REG
);
27 boot_device
= (val
& BOOTROM_ERR_MODE_MASK
) >> BOOTROM_ERR_MODE_OFFS
;
28 debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val
, boot_device
);
29 #if defined(CONFIG_ARMADA_38X)
31 * If the bootrom error register contains any else than zeros
32 * in the first 8 bits it's an error condition. And in that case
33 * try to boot from UART.
37 if (boot_device
== BOOTROM_ERR_MODE_UART
)
39 return BOOT_DEVICE_UART
;
42 * Now check the SAR register for the strapped boot-device
44 val
= readl(CONFIG_SAR_REG
); /* SAR - Sample At Reset */
45 boot_device
= (val
& BOOT_DEV_SEL_MASK
) >> BOOT_DEV_SEL_OFFS
;
46 debug("SAR_REG=0x%08x boot_device=0x%x\n", val
, boot_device
);
47 switch (boot_device
) {
48 #if defined(CONFIG_ARMADA_38X)
50 return BOOT_DEVICE_NAND
;
52 #ifdef CONFIG_SPL_MMC_SUPPORT
54 case BOOT_FROM_MMC_ALT
:
55 return BOOT_DEVICE_MMC1
;
58 #ifdef BOOT_FROM_UART_ALT
59 case BOOT_FROM_UART_ALT
:
61 return BOOT_DEVICE_UART
;
64 return BOOT_DEVICE_SPI
;
68 u32
spl_boot_device(void)
70 return get_boot_device();
73 #ifdef CONFIG_SPL_MMC_SUPPORT
74 u32
spl_boot_mode(const u32 boot_device
)
76 return MMCSD_MODE_RAW
;
80 void board_init_f(ulong dummy
)
85 * Pin muxing needs to be done before UART output, since
86 * on A38x the UART pins need some re-muxing for output
91 /* Example code showing how to enable the debug UART on MVEBU */
94 * Debug UART can be used from here if required:
99 * printascii("string");
105 debug("spl_init() failed: %d\n", ret
);
109 /* Use special translation offset for SPL */
110 dm_set_translation_offset(0xd0000000 - 0xf1000000);
112 preloader_console_init();
116 /* Armada 375 does not support SerDes and DDR3 init yet */
117 #if !defined(CONFIG_ARMADA_375)
118 /* First init the serdes PHY's */
126 * Return to the BootROM to continue the Marvell xmodem
127 * UART boot protocol. As initiated by the kwboot tool.
129 * This can only be done by the BootROM and not by the
130 * U-Boot SPL infrastructure, since the beginning of the
131 * image is already read and interpreted by the BootROM.
132 * SPL has no chance to receive this information. So we
133 * need to return to the BootROM to enable this xmodem
136 * If booting from NAND lets let the BootROM load the
137 * rest of the bootloader.
139 switch (get_boot_device()) {
140 case BOOT_DEVICE_UART
:
141 #if defined(CONFIG_ARMADA_38X)
142 case BOOT_DEVICE_NAND
: