lowlevel_init.S 1.2 KB

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