lowlevel_init.S 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. * (C) Copyright 2010
  7. * Texas Instruments, <www.ti.com>
  8. *
  9. * Author :
  10. * Aneesh V <aneesh@ti.com>
  11. */
  12. #include <asm-offsets.h>
  13. #include <config.h>
  14. #include <linux/linkage.h>
  15. .pushsection .text.s_init, "ax"
  16. WEAK(s_init)
  17. bx lr
  18. ENDPROC(s_init)
  19. .popsection
  20. .pushsection .text.lowlevel_init, "ax"
  21. WEAK(lowlevel_init)
  22. /*
  23. * Setup a temporary stack. Global data is not available yet.
  24. */
  25. #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
  26. ldr sp, =CONFIG_SPL_STACK
  27. #else
  28. ldr sp, =CONFIG_SYS_INIT_SP_ADDR
  29. #endif
  30. bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
  31. #ifdef CONFIG_SPL_DM
  32. mov r9, #0
  33. #else
  34. /*
  35. * Set up global data for boards that still need it. This will be
  36. * removed soon.
  37. */
  38. #ifdef CONFIG_SPL_BUILD
  39. ldr r9, =gdata
  40. #else
  41. sub sp, sp, #GD_SIZE
  42. bic sp, sp, #7
  43. mov r9, sp
  44. #endif
  45. #endif
  46. /*
  47. * Save the old lr(passed in ip) and the current lr to stack
  48. */
  49. push {ip, lr}
  50. /*
  51. * Call the very early init function. This should do only the
  52. * absolute bare minimum to get started. It should not:
  53. *
  54. * - set up DRAM
  55. * - use global_data
  56. * - clear BSS
  57. * - try to start a console
  58. *
  59. * For boards with SPL this should be empty since SPL can do all of
  60. * this init in the SPL board_init_f() function which is called
  61. * immediately after this.
  62. */
  63. bl s_init
  64. pop {ip, pc}
  65. ENDPROC(lowlevel_init)
  66. .popsection