spl.c 1.3 KB

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