spl.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2014 - 2017 Xilinx, Inc. Michal Simek
  4. */
  5. #include <common.h>
  6. #include <debug_uart.h>
  7. #include <hang.h>
  8. #include <image.h>
  9. #include <spl.h>
  10. #include <generated/dt.h>
  11. #include <asm/io.h>
  12. #include <asm/spl.h>
  13. #include <asm/arch/hardware.h>
  14. #include <asm/arch/sys_proto.h>
  15. #include <asm/arch/ps7_init_gpl.h>
  16. void board_init_f(ulong dummy)
  17. {
  18. ps7_init();
  19. arch_cpu_init();
  20. #ifdef CONFIG_DEBUG_UART
  21. /* Uart debug for sure */
  22. debug_uart_init();
  23. puts("Debug uart enabled\n"); /* or printch() */
  24. #endif
  25. }
  26. #ifdef CONFIG_SPL_BOARD_INIT
  27. void spl_board_init(void)
  28. {
  29. preloader_console_init();
  30. #if defined(CONFIG_ARCH_EARLY_INIT_R) && defined(CONFIG_SPL_FPGA_SUPPORT)
  31. arch_early_init_r();
  32. #endif
  33. board_init();
  34. }
  35. #endif
  36. u32 spl_boot_device(void)
  37. {
  38. u32 mode;
  39. switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
  40. #ifdef CONFIG_SPL_SPI_SUPPORT
  41. case ZYNQ_BM_QSPI:
  42. mode = BOOT_DEVICE_SPI;
  43. break;
  44. #endif
  45. case ZYNQ_BM_NAND:
  46. mode = BOOT_DEVICE_NAND;
  47. break;
  48. case ZYNQ_BM_NOR:
  49. mode = BOOT_DEVICE_NOR;
  50. break;
  51. #ifdef CONFIG_SPL_MMC_SUPPORT
  52. case ZYNQ_BM_SD:
  53. mode = BOOT_DEVICE_MMC1;
  54. break;
  55. #endif
  56. case ZYNQ_BM_JTAG:
  57. mode = BOOT_DEVICE_RAM;
  58. break;
  59. default:
  60. puts("Unsupported boot mode selected\n");
  61. hang();
  62. }
  63. return mode;
  64. }
  65. #ifdef CONFIG_SPL_OS_BOOT
  66. int spl_start_uboot(void)
  67. {
  68. /* boot linux */
  69. return 0;
  70. }
  71. #endif
  72. void spl_board_prepare_for_boot(void)
  73. {
  74. ps7_post_config();
  75. debug("SPL bye\n");
  76. }
  77. #ifdef CONFIG_SPL_LOAD_FIT
  78. int board_fit_config_name_match(const char *name)
  79. {
  80. /* Just empty function now - can't decide what to choose */
  81. debug("%s: Check %s, default %s\n", __func__, name, DEVICE_TREE);
  82. if (!strcmp(name, DEVICE_TREE))
  83. return 0;
  84. return -1;
  85. }
  86. #endif