]> git.ipfire.org Git - people/ms/u-boot.git/blame_incremental - arch/arm/cpu/arm926ejs/davinci/spl.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / arch / arm / cpu / arm926ejs / davinci / spl.c
... / ...
CommitLineData
1/*
2 * Copyright (C) 2011
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7#include <common.h>
8#include <config.h>
9#include <spl.h>
10#include <asm/u-boot.h>
11#include <asm/utils.h>
12#include <nand.h>
13#include <asm/arch/dm365_lowlevel.h>
14#include <ns16550.h>
15#include <malloc.h>
16#include <spi_flash.h>
17#include <mmc.h>
18
19DECLARE_GLOBAL_DATA_PTR;
20
21#ifndef CONFIG_SPL_LIBCOMMON_SUPPORT
22void puts(const char *str)
23{
24 while (*str)
25 putc(*str++);
26}
27
28void putc(char c)
29{
30 if (c == '\n')
31 NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), '\r');
32
33 NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c);
34}
35#endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
36
37void board_init_f(ulong dummy)
38{
39 /* First, setup our stack pointer. */
40 asm volatile("mov sp, %0\n" : : "r"(CONFIG_SPL_STACK));
41
42 /* Second, perform our low-level init. */
43#ifdef CONFIG_SOC_DM365
44 dm36x_lowlevel_init(0);
45#endif
46#ifdef CONFIG_SOC_DA8XX
47 arch_cpu_init();
48#endif
49
50 /* Third, we clear the BSS. */
51 memset(__bss_start, 0, __bss_end - __bss_start);
52
53 /* Finally, setup gd and move to the next step. */
54 gd = &gdata;
55 board_init_r(NULL, 0);
56}
57
58void spl_board_init(void)
59{
60 preloader_console_init();
61}
62
63u32 spl_boot_mode(void)
64{
65 return MMCSD_MODE_RAW;
66}
67
68u32 spl_boot_device(void)
69{
70#ifdef CONFIG_SPL_NAND_SIMPLE
71 return BOOT_DEVICE_NAND;
72#elif defined(CONFIG_SPL_SPI_LOAD)
73 return BOOT_DEVICE_SPI;
74#elif defined(CONFIG_SPL_MMC_LOAD)
75 return BOOT_DEVICE_MMC1;
76#else
77 puts("Unknown boot device\n");
78 hang();
79#endif
80}