spl.c 1.6 KB

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