1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (C) 2011 4 * Heiko Schocher, DENX Software Engineering, hs@denx.de. 5 */ 6 #include <common.h> 7 #include <config.h> 8 #include <spl.h> 9 #include <asm/u-boot.h> 10 #include <asm/utils.h> 11 #include <nand.h> 12 #include <asm/arch/dm365_lowlevel.h> 13 #include <ns16550.h> 14 #include <malloc.h> 15 #include <spi_flash.h> 16 #include <mmc.h> 17 18 #ifndef CONFIG_SPL_LIBCOMMON_SUPPORT puts(const char * str)19void puts(const char *str) 20 { 21 while (*str) 22 putc(*str++); 23 } 24 putc(char c)25void putc(char c) 26 { 27 if (c == '\n') 28 NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), '\r'); 29 30 NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c); 31 } 32 #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */ 33 board_init_f(ulong dummy)34void board_init_f(ulong dummy) 35 { 36 arch_cpu_init(); 37 38 spl_early_init(); 39 40 preloader_console_init(); 41 } 42 spl_boot_device(void)43u32 spl_boot_device(void) 44 { 45 switch (davinci_syscfg_regs->bootcfg) { 46 #ifdef CONFIG_SPL_NAND_SUPPORT 47 case DAVINCI_NAND8_BOOT: 48 case DAVINCI_NAND16_BOOT: 49 return BOOT_DEVICE_NAND; 50 #endif 51 52 #ifdef CONFIG_SPL_MMC_SUPPORT 53 case DAVINCI_SD_OR_MMC_BOOT: 54 case DAVINCI_MMC_ONLY_BOOT: 55 return BOOT_DEVICE_MMC1; 56 #endif 57 58 #ifdef CONFIG_SPL_SPI_FLASH_SUPPORT 59 case DAVINCI_SPI0_FLASH_BOOT: 60 case DAVINCI_SPI1_FLASH_BOOT: 61 return BOOT_DEVICE_SPI; 62 #endif 63 64 default: 65 puts("Unknown boot device\n"); 66 hang(); 67 } 68 } 69