spl.c 1.7 KB

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