2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2011-11-01 20:00:29 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011
|
|
|
|
* Heiko Schocher, DENX Software Engineering, hs@denx.de.
|
|
|
|
*/
|
|
|
|
#include <common.h>
|
2012-08-14 19:27:13 +00:00
|
|
|
#include <config.h>
|
2019-12-28 17:45:07 +00:00
|
|
|
#include <hang.h>
|
2020-05-10 17:40:02 +00:00
|
|
|
#include <init.h>
|
2012-08-14 19:27:13 +00:00
|
|
|
#include <spl.h>
|
2011-11-01 20:00:29 +00:00
|
|
|
#include <asm/u-boot.h>
|
|
|
|
#include <asm/utils.h>
|
|
|
|
#include <nand.h>
|
|
|
|
#include <asm/arch/dm365_lowlevel.h>
|
|
|
|
#include <ns16550.h>
|
2011-12-09 09:47:36 +00:00
|
|
|
#include <malloc.h>
|
|
|
|
#include <spi_flash.h>
|
2012-06-24 21:35:20 +00:00
|
|
|
#include <mmc.h>
|
2011-12-09 09:47:36 +00:00
|
|
|
|
2012-08-14 19:27:13 +00:00
|
|
|
#ifndef CONFIG_SPL_LIBCOMMON_SUPPORT
|
2011-11-01 20:00:29 +00:00
|
|
|
void puts(const char *str)
|
|
|
|
{
|
|
|
|
while (*str)
|
|
|
|
putc(*str++);
|
|
|
|
}
|
|
|
|
|
|
|
|
void putc(char c)
|
|
|
|
{
|
|
|
|
if (c == '\n')
|
|
|
|
NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), '\r');
|
|
|
|
|
|
|
|
NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c);
|
|
|
|
}
|
2011-12-09 09:47:36 +00:00
|
|
|
#endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
|
|
|
|
|
2019-05-30 13:34:55 +00:00
|
|
|
void board_init_f(ulong dummy)
|
2011-11-01 20:00:29 +00:00
|
|
|
{
|
2011-12-09 09:47:36 +00:00
|
|
|
arch_cpu_init();
|
2019-05-30 13:34:55 +00:00
|
|
|
|
|
|
|
spl_early_init();
|
|
|
|
|
2012-08-14 19:27:13 +00:00
|
|
|
preloader_console_init();
|
|
|
|
}
|
2012-06-24 21:35:18 +00:00
|
|
|
|
2012-08-14 19:27:13 +00:00
|
|
|
u32 spl_boot_device(void)
|
|
|
|
{
|
2017-01-09 10:06:36 +00:00
|
|
|
switch (davinci_syscfg_regs->bootcfg) {
|
|
|
|
#ifdef CONFIG_SPL_NAND_SUPPORT
|
|
|
|
case DAVINCI_NAND8_BOOT:
|
|
|
|
case DAVINCI_NAND16_BOOT:
|
|
|
|
return BOOT_DEVICE_NAND;
|
2012-06-24 21:35:20 +00:00
|
|
|
#endif
|
2017-01-09 10:06:36 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_SPL_MMC_SUPPORT
|
|
|
|
case DAVINCI_SD_OR_MMC_BOOT:
|
|
|
|
case DAVINCI_MMC_ONLY_BOOT:
|
|
|
|
return BOOT_DEVICE_MMC1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_SPL_SPI_FLASH_SUPPORT
|
|
|
|
case DAVINCI_SPI0_FLASH_BOOT:
|
|
|
|
case DAVINCI_SPI1_FLASH_BOOT:
|
|
|
|
return BOOT_DEVICE_SPI;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
puts("Unknown boot device\n");
|
|
|
|
hang();
|
|
|
|
}
|
2011-11-01 20:00:29 +00:00
|
|
|
}
|