]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/arm/mach-davinci/spl.c
spl: eMMC/SD: Provide one __weak spl_boot_mode() function
[people/ms/u-boot.git] / arch / arm / mach-davinci / spl.c
CommitLineData
435199f3
HS
1/*
2 * Copyright (C) 2011
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
435199f3
HS
6 */
7#include <common.h>
3f7f2414
TR
8#include <config.h>
9#include <spl.h>
435199f3
HS
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>
620fd27c
CR
15#include <malloc.h>
16#include <spi_flash.h>
0d986e61 17#include <mmc.h>
620fd27c 18
8f743140 19DECLARE_GLOBAL_DATA_PTR;
435199f3 20
3f7f2414 21#ifndef CONFIG_SPL_LIBCOMMON_SUPPORT
435199f3
HS
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}
620fd27c
CR
35#endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
36
212324a9 37void spl_board_init(void)
435199f3 38{
620fd27c 39#ifdef CONFIG_SOC_DM365
435199f3 40 dm36x_lowlevel_init(0);
620fd27c
CR
41#endif
42#ifdef CONFIG_SOC_DA8XX
43 arch_cpu_init();
44#endif
3f7f2414
TR
45 preloader_console_init();
46}
560e69bf 47
3f7f2414
TR
48u32 spl_boot_device(void)
49{
c0fa385c
FP
50 switch (davinci_syscfg_regs->bootcfg) {
51#ifdef CONFIG_SPL_NAND_SUPPORT
52 case DAVINCI_NAND8_BOOT:
53 case DAVINCI_NAND16_BOOT:
54 return BOOT_DEVICE_NAND;
0d986e61 55#endif
c0fa385c
FP
56
57#ifdef CONFIG_SPL_MMC_SUPPORT
58 case DAVINCI_SD_OR_MMC_BOOT:
59 case DAVINCI_MMC_ONLY_BOOT:
60 return BOOT_DEVICE_MMC1;
61#endif
62
63#ifdef CONFIG_SPL_SPI_FLASH_SUPPORT
64 case DAVINCI_SPI0_FLASH_BOOT:
65 case DAVINCI_SPI1_FLASH_BOOT:
66 return BOOT_DEVICE_SPI;
67#endif
68
69 default:
70 puts("Unknown boot device\n");
71 hang();
72 }
435199f3 73}