Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 |
| 3 | * Heiko Schocher, DENX Software Engineering, hs@denx.de. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 6 | */ |
| 7 | #include <common.h> |
Tom Rini | 3f7f241 | 2012-08-14 12:27:13 -0700 | [diff] [blame] | 8 | #include <config.h> |
| 9 | #include <spl.h> |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 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> |
Christian Riesch | 620fd27 | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 15 | #include <malloc.h> |
| 16 | #include <spi_flash.h> |
Lad, Prabhakar | 0d986e6 | 2012-06-24 21:35:20 +0000 | [diff] [blame] | 17 | #include <mmc.h> |
Christian Riesch | 620fd27 | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 18 | |
Christian Riesch | 8f74314 | 2011-12-14 09:54:36 +0100 | [diff] [blame] | 19 | DECLARE_GLOBAL_DATA_PTR; |
Christian Riesch | 620fd27 | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 20 | |
Tom Rini | 3f7f241 | 2012-08-14 12:27:13 -0700 | [diff] [blame] | 21 | #ifndef CONFIG_SPL_LIBCOMMON_SUPPORT |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 22 | void puts(const char *str) |
| 23 | { |
| 24 | while (*str) |
| 25 | putc(*str++); |
| 26 | } |
| 27 | |
| 28 | void 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 | } |
Christian Riesch | 620fd27 | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 35 | #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */ |
| 36 | |
Tom Rini | 212324a | 2015-01-22 09:38:10 -0500 | [diff] [blame] | 37 | void spl_board_init(void) |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 38 | { |
Christian Riesch | 620fd27 | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 39 | #ifdef CONFIG_SOC_DM365 |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 40 | dm36x_lowlevel_init(0); |
Christian Riesch | 620fd27 | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 41 | #endif |
| 42 | #ifdef CONFIG_SOC_DA8XX |
| 43 | arch_cpu_init(); |
| 44 | #endif |
Tom Rini | 3f7f241 | 2012-08-14 12:27:13 -0700 | [diff] [blame] | 45 | preloader_console_init(); |
| 46 | } |
Christian Riesch | 620fd27 | 2011-12-09 09:47:36 +0000 | [diff] [blame] | 47 | |
Tom Rini | 3f7f241 | 2012-08-14 12:27:13 -0700 | [diff] [blame] | 48 | u32 spl_boot_device(void) |
| 49 | { |
Fabien Parent | c0fa385 | 2017-01-09 11:06:36 +0100 | [diff] [blame] | 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; |
Lad, Prabhakar | 0d986e6 | 2012-06-24 21:35:20 +0000 | [diff] [blame] | 55 | #endif |
Fabien Parent | c0fa385 | 2017-01-09 11:06:36 +0100 | [diff] [blame] | 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 | } |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 73 | } |