start.S 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. #if defined(CONFIG_OMAP1610)
  42. #include <./configs/omap1510.h>
  43. #elif defined(CONFIG_OMAP730)
  44. #include <./configs/omap730.h>
  45. #endif
  46. /*
  47. *************************************************************************
  48. *
  49. * Jump vector table as in table 3.1 in [1]
  50. *
  51. *************************************************************************
  52. */
  53. .globl _start
  54. _start:
  55. b reset
  56. b undefined_instruction
  57. b software_interrupt
  58. b prefetch_abort
  59. b data_abort
  60. b not_used
  61. b irq
  62. b fiq
  63. /*
  64. * Vector table, located at address 0x20.
  65. * This table allows the code running AFTER SPL, the U-Boot, to install it's
  66. * interrupt handlers here. The problem is that the U-Boot is loaded into RAM,
  67. * including it's interrupt vectoring table and the table at 0x0 is still the
  68. * SPLs. So if interrupt happens in U-Boot, the SPLs interrupt vectoring table
  69. * is still used.
  70. */
  71. _vt_reset:
  72. .word _reset
  73. _vt_undefined_instruction:
  74. .word _hang
  75. _vt_software_interrupt:
  76. .word _hang
  77. _vt_prefetch_abort:
  78. .word _hang
  79. _vt_data_abort:
  80. .word _hang
  81. _vt_not_used:
  82. .word _reset
  83. _vt_irq:
  84. .word _hang
  85. _vt_fiq:
  86. .word _hang
  87. reset:
  88. ldr pc, _vt_reset
  89. undefined_instruction:
  90. ldr pc, _vt_undefined_instruction
  91. software_interrupt:
  92. ldr pc, _vt_software_interrupt
  93. prefetch_abort:
  94. ldr pc, _vt_prefetch_abort
  95. data_abort:
  96. ldr pc, _vt_data_abort
  97. not_used:
  98. ldr pc, _vt_not_used
  99. irq:
  100. ldr pc, _vt_irq
  101. fiq:
  102. ldr pc, _vt_fiq
  103. .balignl 16,0xdeadbeef
  104. /*
  105. *************************************************************************
  106. *
  107. * Startup Code (reset vector)
  108. *
  109. * do important init only if we don't start from memory!
  110. * setup Memory and board specific bits prior to relocation.
  111. * relocate armboot to ram
  112. * setup stack
  113. *
  114. *************************************************************************
  115. */
  116. .globl _TEXT_BASE
  117. _TEXT_BASE:
  118. .word CONFIG_SYS_TEXT_BASE
  119. /*
  120. * These are defined in the board-specific linker script.
  121. * Subtracting _start from them lets the linker put their
  122. * relative position in the executable instead of leaving
  123. * them null.
  124. */
  125. .globl _bss_start_ofs
  126. _bss_start_ofs:
  127. .word __bss_start - _start
  128. .globl _bss_end_ofs
  129. _bss_end_ofs:
  130. .word __bss_end__ - _start
  131. .globl _end_ofs
  132. _end_ofs:
  133. .word _end - _start
  134. #ifdef CONFIG_USE_IRQ
  135. /* IRQ stack memory (calculated at run-time) */
  136. .globl IRQ_STACK_START
  137. IRQ_STACK_START:
  138. .word 0x0badc0de
  139. /* IRQ stack memory (calculated at run-time) */
  140. .globl FIQ_STACK_START
  141. FIQ_STACK_START:
  142. .word 0x0badc0de
  143. #endif
  144. /* IRQ stack memory (calculated at run-time) + 8 bytes */
  145. .globl IRQ_STACK_START_IN
  146. IRQ_STACK_START_IN:
  147. .word 0x0badc0de
  148. /*
  149. * the actual reset code
  150. */
  151. _reset:
  152. /*
  153. * Store all registers on old stack pointer, this will allow us later to
  154. * return to the BootROM and let the BootROM load U-Boot into RAM.
  155. */
  156. push {r0-r12,r14}
  157. /*
  158. * set the cpu to SVC32 mode
  159. */
  160. mrs r0,cpsr
  161. bic r0,r0,#0x1f
  162. orr r0,r0,#0xd3
  163. msr cpsr,r0
  164. /*
  165. * we do sys-critical inits only at reboot,
  166. * not when booting from ram!
  167. */
  168. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  169. bl cpu_init_crit
  170. #endif
  171. bl board_init_ll
  172. pop {r0-r12,r14}
  173. bx lr
  174. /*
  175. *************************************************************************
  176. *
  177. * CPU_init_critical registers
  178. *
  179. * setup important registers
  180. * setup memory timing
  181. *
  182. *************************************************************************
  183. */
  184. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  185. cpu_init_crit:
  186. /*
  187. * flush v4 I/D caches
  188. */
  189. mov r0, #0
  190. mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
  191. mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
  192. /*
  193. * disable MMU stuff and caches
  194. */
  195. mrc p15, 0, r0, c1, c0, 0
  196. bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */
  197. bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */
  198. orr r0, r0, #0x00000002 /* set bit 2 (A) Align */
  199. orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */
  200. mcr p15, 0, r0, c1, c0, 0
  201. mov pc, lr /* back to my caller */
  202. .align 5
  203. #endif /* CONFIG_SKIP_LOWLEVEL_INIT */
  204. _hang:
  205. ldr sp, _TEXT_BASE /* switch to abort stack */
  206. 1:
  207. bl 1b /* hang and never return */