spl.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 2014-2015 Freescale Semiconductor, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <spl.h>
  8. #include <asm/io.h>
  9. #include <fsl_ifc.h>
  10. #include <i2c.h>
  11. DECLARE_GLOBAL_DATA_PTR;
  12. u32 spl_boot_device(void)
  13. {
  14. #ifdef CONFIG_SPL_MMC_SUPPORT
  15. return BOOT_DEVICE_MMC1;
  16. #endif
  17. #ifdef CONFIG_SPL_NAND_SUPPORT
  18. return BOOT_DEVICE_NAND;
  19. #endif
  20. return 0;
  21. }
  22. u32 spl_boot_mode(const u32 boot_device)
  23. {
  24. switch (spl_boot_device()) {
  25. case BOOT_DEVICE_MMC1:
  26. #ifdef CONFIG_SPL_FAT_SUPPORT
  27. return MMCSD_MODE_FS;
  28. #else
  29. return MMCSD_MODE_RAW;
  30. #endif
  31. case BOOT_DEVICE_NAND:
  32. return 0;
  33. default:
  34. puts("spl: error: unsupported device\n");
  35. hang();
  36. }
  37. }
  38. #ifdef CONFIG_SPL_BUILD
  39. void board_init_f(ulong dummy)
  40. {
  41. /* Clear global data */
  42. memset((void *)gd, 0, sizeof(gd_t));
  43. #ifdef CONFIG_LS2080A
  44. arch_cpu_init();
  45. #endif
  46. board_early_init_f();
  47. timer_init();
  48. #ifdef CONFIG_LS2080A
  49. env_init();
  50. #endif
  51. get_clocks();
  52. preloader_console_init();
  53. #ifdef CONFIG_SPL_I2C_SUPPORT
  54. i2c_init_all();
  55. #endif
  56. dram_init();
  57. }
  58. #endif