spl.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * (C) Copyright 2014 - 2017 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. #include <asm/arch/ps7_init_gpl.h>
  14. DECLARE_GLOBAL_DATA_PTR;
  15. void board_init_f(ulong dummy)
  16. {
  17. ps7_init();
  18. arch_cpu_init();
  19. /*
  20. * The debug UART can be used from this point:
  21. * debug_uart_init();
  22. * printch('x');
  23. */
  24. }
  25. #ifdef CONFIG_SPL_BOARD_INIT
  26. void spl_board_init(void)
  27. {
  28. preloader_console_init();
  29. board_init();
  30. }
  31. #endif
  32. u32 spl_boot_device(void)
  33. {
  34. u32 mode;
  35. switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
  36. #ifdef CONFIG_SPL_SPI_SUPPORT
  37. case ZYNQ_BM_QSPI:
  38. puts("qspi boot\n");
  39. mode = BOOT_DEVICE_SPI;
  40. break;
  41. #endif
  42. case ZYNQ_BM_NAND:
  43. mode = BOOT_DEVICE_NAND;
  44. break;
  45. case ZYNQ_BM_NOR:
  46. mode = BOOT_DEVICE_NOR;
  47. break;
  48. #ifdef CONFIG_SPL_MMC_SUPPORT
  49. case ZYNQ_BM_SD:
  50. puts("mmc boot\n");
  51. mode = BOOT_DEVICE_MMC1;
  52. break;
  53. #endif
  54. case ZYNQ_BM_JTAG:
  55. mode = BOOT_DEVICE_RAM;
  56. break;
  57. default:
  58. puts("Unsupported boot mode selected\n");
  59. hang();
  60. }
  61. return mode;
  62. }
  63. #ifdef CONFIG_SPL_MMC_SUPPORT
  64. u32 spl_boot_mode(const u32 boot_device)
  65. {
  66. return MMCSD_MODE_FS;
  67. }
  68. #endif
  69. #ifdef CONFIG_SPL_OS_BOOT
  70. int spl_start_uboot(void)
  71. {
  72. /* boot linux */
  73. return 0;
  74. }
  75. #endif
  76. void spl_board_prepare_for_boot(void)
  77. {
  78. ps7_post_config();
  79. debug("SPL bye\n");
  80. }
  81. #ifdef CONFIG_SPL_LOAD_FIT
  82. int board_fit_config_name_match(const char *name)
  83. {
  84. /* Just empty function now - can't decide what to choose */
  85. debug("%s: %s\n", __func__, name);
  86. return 0;
  87. }
  88. #endif