start.S 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*
  2. * armboot - Startup Code for ARM926EJS CPU-core
  3. *
  4. * Copyright (c) 2003 Texas Instruments
  5. *
  6. * ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------
  7. *
  8. * Copyright (c) 2001 Marius Groger <mag@sysgo.de>
  9. * Copyright (c) 2002 Alex Zupke <azu@sysgo.de>
  10. * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
  11. * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
  12. * Copyright (c) 2003 Kshitij <kshitij@ti.com>
  13. * Copyright (c) 2010 Albert Aribaud <albert.u.boot@aribaud.net>
  14. *
  15. * Change to support call back into iMX28 bootrom
  16. * Copyright (c) 2011 Marek Vasut <marek.vasut@gmail.com>
  17. * on behalf of DENX Software Engineering GmbH
  18. *
  19. * See file CREDITS for list of people who contributed to this
  20. * project.
  21. *
  22. * This program is free software; you can redistribute it and/or
  23. * modify it under the terms of the GNU General Public License as
  24. * published by the Free Software Foundation; either version 2 of
  25. * the License, or (at your option) any later version.
  26. *
  27. * This program is distributed in the hope that it will be useful,
  28. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. * GNU General Public License for more details.
  31. *
  32. * You should have received a copy of the GNU General Public License
  33. * along with this program; if not, write to the Free Software
  34. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35. * MA 02111-1307 USA
  36. */
  37. #include <asm-offsets.h>
  38. #include <config.h>
  39. #include <common.h>
  40. #include <version.h>
  41. /*
  42. *************************************************************************
  43. *
  44. * Jump vector table as in table 3.1 in [1]
  45. *
  46. *************************************************************************
  47. */
  48. .globl _start
  49. _start:
  50. b reset
  51. b undefined_instruction
  52. b software_interrupt
  53. b prefetch_abort
  54. b data_abort
  55. b not_used
  56. b irq
  57. b fiq
  58. /*
  59. * Vector table, located at address 0x20.
  60. * This table allows the code running AFTER SPL, the U-Boot, to install it's
  61. * interrupt handlers here. The problem is that the U-Boot is loaded into RAM,
  62. * including it's interrupt vectoring table and the table at 0x0 is still the
  63. * SPLs. So if interrupt happens in U-Boot, the SPLs interrupt vectoring table
  64. * is still used.
  65. */
  66. _vt_reset:
  67. .word _reset
  68. _vt_undefined_instruction:
  69. .word _hang
  70. _vt_software_interrupt:
  71. .word _hang
  72. _vt_prefetch_abort:
  73. .word _hang
  74. _vt_data_abort:
  75. .word _hang
  76. _vt_not_used:
  77. .word _reset
  78. _vt_irq:
  79. .word _hang
  80. _vt_fiq:
  81. .word _hang
  82. reset:
  83. ldr pc, _vt_reset
  84. undefined_instruction:
  85. ldr pc, _vt_undefined_instruction
  86. software_interrupt:
  87. ldr pc, _vt_software_interrupt
  88. prefetch_abort:
  89. ldr pc, _vt_prefetch_abort
  90. data_abort:
  91. ldr pc, _vt_data_abort
  92. not_used:
  93. ldr pc, _vt_not_used
  94. irq:
  95. ldr pc, _vt_irq
  96. fiq:
  97. ldr pc, _vt_fiq
  98. .balignl 16,0xdeadbeef
  99. /*
  100. *************************************************************************
  101. *
  102. * Startup Code (reset vector)
  103. *
  104. * do important init only if we don't start from memory!
  105. * setup Memory and board specific bits prior to relocation.
  106. * relocate armboot to ram
  107. * setup stack
  108. *
  109. *************************************************************************
  110. */
  111. .globl _TEXT_BASE
  112. _TEXT_BASE:
  113. #ifdef CONFIG_SPL_TEXT_BASE
  114. .word CONFIG_SPL_TEXT_BASE
  115. #else
  116. .word CONFIG_SYS_TEXT_BASE
  117. #endif
  118. /*
  119. * These are defined in the board-specific linker script.
  120. * Subtracting _start from them lets the linker put their
  121. * relative position in the executable instead of leaving
  122. * them null.
  123. */
  124. .globl _bss_start_ofs
  125. _bss_start_ofs:
  126. .word __bss_start - _start
  127. .globl _bss_end_ofs
  128. _bss_end_ofs:
  129. .word __bss_end - _start
  130. .globl _end_ofs
  131. _end_ofs:
  132. .word _end - _start
  133. #ifdef CONFIG_USE_IRQ
  134. /* IRQ stack memory (calculated at run-time) */
  135. .globl IRQ_STACK_START
  136. IRQ_STACK_START:
  137. .word 0x0badc0de
  138. /* IRQ stack memory (calculated at run-time) */
  139. .globl FIQ_STACK_START
  140. FIQ_STACK_START:
  141. .word 0x0badc0de
  142. #endif
  143. /* IRQ stack memory (calculated at run-time) + 8 bytes */
  144. .globl IRQ_STACK_START_IN
  145. IRQ_STACK_START_IN:
  146. .word 0x0badc0de
  147. /*
  148. * the actual reset code
  149. */
  150. _reset:
  151. /*
  152. * Store all registers on old stack pointer, this will allow us later to
  153. * return to the BootROM and let the BootROM load U-Boot into RAM.
  154. */
  155. push {r0-r12,r14}
  156. /* save control register c1 */
  157. mrc p15, 0, r0, c1, c0, 0
  158. push {r0}
  159. /*
  160. * set the cpu to SVC32 mode and store old CPSR register content
  161. */
  162. mrs r0,cpsr
  163. push {r0}
  164. bic r0,r0,#0x1f
  165. orr r0,r0,#0xd3
  166. msr cpsr,r0
  167. bl board_init_ll
  168. /*
  169. * restore bootrom's cpu mode (especially FIQ)
  170. */
  171. pop {r0}
  172. msr cpsr,r0
  173. /*
  174. * restore c1 register
  175. * (especially set exception vector location back to
  176. * bootrom space which is required by bootrom for USB boot)
  177. */
  178. pop {r0}
  179. mcr p15, 0, r0, c1, c0, 0
  180. pop {r0-r12,r14}
  181. bx lr
  182. _hang:
  183. ldr sp, _TEXT_BASE /* switch to abort stack */
  184. 1:
  185. bl 1b /* hang and never return */