spl_boot.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (C) 2013 Stefan Roese <sr@denx.de>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <spl.h>
  8. DECLARE_GLOBAL_DATA_PTR;
  9. /*
  10. * Return selected boot device. On PPC4xx its only NOR flash right now.
  11. */
  12. u32 spl_boot_device(void)
  13. {
  14. return BOOT_DEVICE_NOR;
  15. }
  16. /*
  17. * SPL version of board_init_f()
  18. */
  19. void board_init_f(ulong bootflag)
  20. {
  21. /*
  22. * First we need to initialize the SDRAM, so that the real
  23. * U-Boot or the OS (Linux) can be loaded
  24. */
  25. initdram(0);
  26. /* Clear bss */
  27. memset(__bss_start, '\0', __bss_end - __bss_start);
  28. /*
  29. * Init global_data pointer. Has to be done before calling
  30. * get_clocks(), as it stores some clock values into gd needed
  31. * later on in the serial driver.
  32. */
  33. /* Pointer is writable since we allocated a register for it */
  34. gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
  35. /* Clear initial global data */
  36. memset((void *)gd, 0, sizeof(gd_t));
  37. /*
  38. * get_clocks() needs to be called so that the serial driver
  39. * works correctly
  40. */
  41. get_clocks();
  42. /*
  43. * Do rudimental console / serial setup
  44. */
  45. preloader_console_init();
  46. /*
  47. * Call board_init_r() (SPL framework version) to load and boot
  48. * real U-Boot or OS
  49. */
  50. board_init_r(NULL, 0);
  51. /* Does not return!!! */
  52. }