lowlevel_init.S 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * A lowlevel_init function that sets up the stack to call a C function to
  4. * perform further init.
  5. */
  6. #include <asm-offsets.h>
  7. #include <config.h>
  8. #include <linux/linkage.h>
  9. ENTRY(lowlevel_init)
  10. /*
  11. * Setup a temporary stack. Global data is not available yet.
  12. */
  13. #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
  14. ldr w0, =CONFIG_SPL_STACK
  15. #else
  16. ldr w0, =CONFIG_SYS_INIT_SP_ADDR
  17. #endif
  18. bic sp, x0, #0xf /* 16-byte alignment for ABI compliance */
  19. /*
  20. * Save the old LR(passed in x29) and the current LR to stack
  21. */
  22. stp x29, x30, [sp, #-16]!
  23. /*
  24. * Call the very early init function. This should do only the
  25. * absolute bare minimum to get started. It should not:
  26. *
  27. * - set up DRAM
  28. * - use global_data
  29. * - clear BSS
  30. * - try to start a console
  31. *
  32. * For boards with SPL this should be empty since SPL can do all of
  33. * this init in the SPL board_init_f() function which is called
  34. * immediately after this.
  35. */
  36. bl s_init
  37. ldp x29, x30, [sp]
  38. ret
  39. ENDPROC(lowlevel_init)