imxrt1020-evk.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2020
  4. * Author(s): Giulio Benetti <giulio.benetti@benettiengineering.com>
  5. */
  6. #include <common.h>
  7. #include <dm.h>
  8. #include <init.h>
  9. #include <log.h>
  10. #include <ram.h>
  11. #include <spl.h>
  12. #include <asm/io.h>
  13. #include <asm/armv7m.h>
  14. DECLARE_GLOBAL_DATA_PTR;
  15. int dram_init(void)
  16. {
  17. #ifndef CONFIG_SUPPORT_SPL
  18. int rv;
  19. struct udevice *dev;
  20. rv = uclass_get_device(UCLASS_RAM, 0, &dev);
  21. if (rv) {
  22. debug("DRAM init failed: %d\n", rv);
  23. return rv;
  24. }
  25. #endif
  26. return fdtdec_setup_mem_size_base();
  27. }
  28. int dram_init_banksize(void)
  29. {
  30. return fdtdec_setup_memory_banksize();
  31. }
  32. #ifdef CONFIG_SPL_BUILD
  33. #ifdef CONFIG_SPL_OS_BOOT
  34. int spl_start_uboot(void)
  35. {
  36. debug("SPL: booting kernel\n");
  37. /* break into full u-boot on 'c' */
  38. return serial_tstc() && serial_getc() == 'c';
  39. }
  40. #endif
  41. int spl_dram_init(void)
  42. {
  43. struct udevice *dev;
  44. int rv;
  45. rv = uclass_get_device(UCLASS_RAM, 0, &dev);
  46. if (rv)
  47. debug("DRAM init failed: %d\n", rv);
  48. return rv;
  49. }
  50. void spl_board_init(void)
  51. {
  52. spl_dram_init();
  53. preloader_console_init();
  54. arch_cpu_init(); /* to configure mpu for sdram rw permissions */
  55. }
  56. u32 spl_boot_device(void)
  57. {
  58. return BOOT_DEVICE_MMC1;
  59. }
  60. #endif
  61. u32 get_board_rev(void)
  62. {
  63. return 0;
  64. }
  65. int board_init(void)
  66. {
  67. gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
  68. return 0;
  69. }