spl.c 796 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2018 MediaTek Inc.
  4. * Author: Ryder Lee <ryder.lee@mediatek.com>
  5. */
  6. #include <clk.h>
  7. #include <common.h>
  8. #include <hang.h>
  9. #include <init.h>
  10. #include <spl.h>
  11. #include "init.h"
  12. void board_init_f(ulong dummy)
  13. {
  14. int ret;
  15. ret = spl_early_init();
  16. if (ret)
  17. hang();
  18. /* enable console uart printing */
  19. preloader_console_init();
  20. /* soc early initialization */
  21. ret = mtk_soc_early_init();
  22. if (ret)
  23. hang();
  24. }
  25. u32 spl_boot_device(void)
  26. {
  27. #if defined(CONFIG_SPL_SPI_SUPPORT)
  28. return BOOT_DEVICE_SPI;
  29. #elif defined(CONFIG_SPL_MMC_SUPPORT)
  30. return BOOT_DEVICE_MMC1;
  31. #elif defined(CONFIG_SPL_NAND_SUPPORT)
  32. return BOOT_DEVICE_NAND;
  33. #elif defined(CONFIG_SPL_NOR_SUPPORT)
  34. return BOOT_DEVICE_NOR;
  35. #else
  36. return BOOT_DEVICE_NONE;
  37. #endif
  38. }