start.S 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. * SPDX-License-Identifier: GPL-2.0+
  20. */
  21. #include <asm-offsets.h>
  22. #include <config.h>
  23. #include <common.h>
  24. #include <version.h>
  25. /*
  26. *************************************************************************
  27. *
  28. * Startup Code (reset vector)
  29. *
  30. * do important init only if we don't start from memory!
  31. * setup Memory and board specific bits prior to relocation.
  32. * relocate armboot to ram
  33. * setup stack
  34. *
  35. *************************************************************************
  36. */
  37. .globl reset
  38. reset:
  39. /*
  40. * If the CPU is configured in "Wait JTAG connection mode", the stack
  41. * pointer is not configured and is zero. This will cause crash when
  42. * trying to push data onto stack right below here. Load the SP and make
  43. * it point to the end of OCRAM if the SP is zero.
  44. */
  45. cmp sp, #0x00000000
  46. ldreq sp, =CONFIG_SYS_INIT_SP_ADDR
  47. /*
  48. * Store all registers on old stack pointer, this will allow us later to
  49. * return to the BootROM and let the BootROM load U-Boot into RAM.
  50. *
  51. * WARNING: Register r0 and r1 are used by the BootROM to pass data
  52. * to the called code. Register r0 will contain arbitrary
  53. * data that are set in the BootStream. In case this code
  54. * was started with CALL instruction, register r1 will contain
  55. * pointer to the return value this function can then set.
  56. * The code below MUST NOT CHANGE register r0 and r1 !
  57. */
  58. push {r0-r12,r14}
  59. /* Save control register c1 */
  60. mrc p15, 0, r2, c1, c0, 0
  61. push {r2}
  62. /* Set the cpu to SVC32 mode and store old CPSR register content. */
  63. mrs r2, cpsr
  64. push {r2}
  65. bic r2, r2, #0x1f
  66. orr r2, r2, #0xd3
  67. msr cpsr, r2
  68. bl board_init_ll
  69. /* Restore BootROM's CPU mode (especially FIQ). */
  70. pop {r2}
  71. msr cpsr,r2
  72. /*
  73. * Restore c1 register. Especially set exception vector location
  74. * back to BootROM space which is required by bootrom for USB boot.
  75. */
  76. pop {r2}
  77. mcr p15, 0, r2, c1, c0, 0
  78. pop {r0-r12,r14}
  79. /*
  80. * In case this code was started by the CALL instruction, the register
  81. * r0 is examined by the BootROM after this code returns. The value in
  82. * r0 must be set to 0 to indicate successful return.
  83. */
  84. mov r0, #0
  85. bx lr