spl.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 <hang.h>
  9. #include <init.h>
  10. #include <spl.h>
  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>
  16. #include <malloc.h>
  17. #include <spi_flash.h>
  18. #include <mmc.h>
  19. #ifndef CONFIG_SPL_LIBCOMMON_SUPPORT
  20. void puts(const char *str)
  21. {
  22. while (*str)
  23. putc(*str++);
  24. }
  25. void putc(char c)
  26. {
  27. if (c == '\n')
  28. NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), '\r');
  29. NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c);
  30. }
  31. #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
  32. void board_init_f(ulong dummy)
  33. {
  34. arch_cpu_init();
  35. spl_early_init();
  36. preloader_console_init();
  37. }
  38. u32 spl_boot_device(void)
  39. {
  40. switch (davinci_syscfg_regs->bootcfg) {
  41. #ifdef CONFIG_SPL_NAND_SUPPORT
  42. case DAVINCI_NAND8_BOOT:
  43. case DAVINCI_NAND16_BOOT:
  44. return BOOT_DEVICE_NAND;
  45. #endif
  46. #ifdef CONFIG_SPL_MMC_SUPPORT
  47. case DAVINCI_SD_OR_MMC_BOOT:
  48. case DAVINCI_MMC_ONLY_BOOT:
  49. return BOOT_DEVICE_MMC1;
  50. #endif
  51. #ifdef CONFIG_SPL_SPI_FLASH_SUPPORT
  52. case DAVINCI_SPI0_FLASH_BOOT:
  53. case DAVINCI_SPI1_FLASH_BOOT:
  54. return BOOT_DEVICE_SPI;
  55. #endif
  56. default:
  57. puts("Unknown boot device\n");
  58. hang();
  59. }
  60. }