Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2011 |
| 4 | * Heiko Schocher, DENX Software Engineering, hs@denx.de. |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 5 | */ |
| 6 | #include <common.h> |
Tom Rini | 1293858 | 2012-08-14 12:27:13 -0700 | [diff] [blame] | 7 | #include <config.h> |
Simon Glass | f11478f | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 8 | #include <hang.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 9 | #include <init.h> |
Tom Rini | 1293858 | 2012-08-14 12:27:13 -0700 | [diff] [blame] | 10 | #include <spl.h> |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 11 | #include <asm/u-boot.h> |
| 12 | #include <asm/utils.h> |
| 13 | #include <nand.h> |
| 14 | #include <asm/arch/dm365_lowlevel.h> |
| 15 | #include <ns16550.h> |
Christian Riesch | 17a6a2f | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 16 | #include <malloc.h> |
| 17 | #include <spi_flash.h> |
Lad, Prabhakar | 8dc6df8 | 2012-06-24 21:35:20 +0000 | [diff] [blame] | 18 | #include <mmc.h> |
Christian Riesch | 17a6a2f | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 19 | |
Tom Rini | 1293858 | 2012-08-14 12:27:13 -0700 | [diff] [blame] | 20 | #ifndef CONFIG_SPL_LIBCOMMON_SUPPORT |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 21 | void puts(const char *str) |
| 22 | { |
| 23 | while (*str) |
| 24 | putc(*str++); |
| 25 | } |
| 26 | |
| 27 | void putc(char c) |
| 28 | { |
| 29 | if (c == '\n') |
| 30 | NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), '\r'); |
| 31 | |
| 32 | NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c); |
| 33 | } |
Christian Riesch | 17a6a2f | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 34 | #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */ |
| 35 | |
Sekhar Nori | 68e4f8f | 2019-05-30 19:04:55 +0530 | [diff] [blame] | 36 | void board_init_f(ulong dummy) |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 37 | { |
Christian Riesch | 17a6a2f | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 38 | arch_cpu_init(); |
Sekhar Nori | 68e4f8f | 2019-05-30 19:04:55 +0530 | [diff] [blame] | 39 | |
| 40 | spl_early_init(); |
| 41 | |
Tom Rini | 1293858 | 2012-08-14 12:27:13 -0700 | [diff] [blame] | 42 | preloader_console_init(); |
| 43 | } |
Lad, Prabhakar | 5dad921 | 2012-06-24 21:35:18 +0000 | [diff] [blame] | 44 | |
Tom Rini | 1293858 | 2012-08-14 12:27:13 -0700 | [diff] [blame] | 45 | u32 spl_boot_device(void) |
| 46 | { |
Fabien Parent | 9efa10f | 2017-01-09 11:06:36 +0100 | [diff] [blame] | 47 | switch (davinci_syscfg_regs->bootcfg) { |
| 48 | #ifdef CONFIG_SPL_NAND_SUPPORT |
| 49 | case DAVINCI_NAND8_BOOT: |
| 50 | case DAVINCI_NAND16_BOOT: |
| 51 | return BOOT_DEVICE_NAND; |
| 52 | #endif |
| 53 | |
| 54 | #ifdef CONFIG_SPL_MMC_SUPPORT |
| 55 | case DAVINCI_SD_OR_MMC_BOOT: |
| 56 | case DAVINCI_MMC_ONLY_BOOT: |
| 57 | return BOOT_DEVICE_MMC1; |
| 58 | #endif |
| 59 | |
| 60 | #ifdef CONFIG_SPL_SPI_FLASH_SUPPORT |
| 61 | case DAVINCI_SPI0_FLASH_BOOT: |
| 62 | case DAVINCI_SPI1_FLASH_BOOT: |
| 63 | return BOOT_DEVICE_SPI; |
Lad, Prabhakar | 8dc6df8 | 2012-06-24 21:35:20 +0000 | [diff] [blame] | 64 | #endif |
Fabien Parent | 9efa10f | 2017-01-09 11:06:36 +0100 | [diff] [blame] | 65 | |
| 66 | default: |
| 67 | puts("Unknown boot device\n"); |
| 68 | hang(); |
| 69 | } |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 70 | } |