spl.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * (C) Copyright 2014 Xilinx, Inc. Michal Simek
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <debug_uart.h>
  8. #include <spl.h>
  9. #include <asm/io.h>
  10. #include <asm/spl.h>
  11. #include <asm/arch/hardware.h>
  12. #include <asm/arch/sys_proto.h>
  13. DECLARE_GLOBAL_DATA_PTR;
  14. void board_init_f(ulong dummy)
  15. {
  16. ps7_init();
  17. arch_cpu_init();
  18. /*
  19. * The debug UART can be used from this point:
  20. * debug_uart_init();
  21. * printch('x');
  22. */
  23. }
  24. #ifdef CONFIG_SPL_BOARD_INIT
  25. void spl_board_init(void)
  26. {
  27. preloader_console_init();
  28. board_init();
  29. }
  30. #endif
  31. u32 spl_boot_device(void)
  32. {
  33. u32 mode;
  34. switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
  35. #ifdef CONFIG_SPL_SPI_SUPPORT
  36. case ZYNQ_BM_QSPI:
  37. puts("qspi boot\n");
  38. mode = BOOT_DEVICE_SPI;
  39. break;
  40. #endif
  41. case ZYNQ_BM_NAND:
  42. mode = BOOT_DEVICE_NAND;
  43. break;
  44. case ZYNQ_BM_NOR:
  45. mode = BOOT_DEVICE_NOR;
  46. break;
  47. #ifdef CONFIG_SPL_MMC_SUPPORT
  48. case ZYNQ_BM_SD:
  49. puts("mmc boot\n");
  50. mode = BOOT_DEVICE_MMC1;
  51. break;
  52. #endif
  53. case ZYNQ_BM_JTAG:
  54. mode = BOOT_DEVICE_RAM;
  55. break;
  56. default:
  57. puts("Unsupported boot mode selected\n");
  58. hang();
  59. }
  60. return mode;
  61. }
  62. #ifdef CONFIG_SPL_MMC_SUPPORT
  63. u32 spl_boot_mode(const u32 boot_device)
  64. {
  65. return MMCSD_MODE_FS;
  66. }
  67. #endif
  68. #ifdef CONFIG_SPL_OS_BOOT
  69. int spl_start_uboot(void)
  70. {
  71. /* boot linux */
  72. return 0;
  73. }
  74. #endif
  75. __weak void ps7_init(void)
  76. {
  77. /*
  78. * This function is overridden by the one in
  79. * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists.
  80. */
  81. }
  82. __weak int ps7_post_config(void)
  83. {
  84. /*
  85. * This function is overridden by the one in
  86. * board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists.
  87. */
  88. return 0;
  89. }
  90. void spl_board_prepare_for_boot(void)
  91. {
  92. ps7_post_config();
  93. debug("SPL bye\n");
  94. }
  95. #ifdef CONFIG_SPL_LOAD_FIT
  96. int board_fit_config_name_match(const char *name)
  97. {
  98. /* Just empty function now - can't decide what to choose */
  99. debug("%s: %s\n", __func__, name);
  100. return 0;
  101. }
  102. #endif