start.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 Gröger <mag@sysgo.de>
  9. * Copyright (c) 2002 Alex Züpke <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. * SPDX-License-Identifier: GPL-2.0+
  16. */
  17. #include <asm-offsets.h>
  18. #include <config.h>
  19. #include <common.h>
  20. #include <version.h>
  21. /*
  22. *************************************************************************
  23. *
  24. * Startup Code (reset vector)
  25. *
  26. * do important init only if we don't start from memory!
  27. * setup Memory and board specific bits prior to relocation.
  28. * relocate armboot to ram
  29. * setup stack
  30. *
  31. *************************************************************************
  32. */
  33. .globl reset
  34. reset:
  35. /*
  36. * set the cpu to SVC32 mode
  37. */
  38. mrs r0,cpsr
  39. bic r0,r0,#0x1f
  40. orr r0,r0,#0xd3
  41. msr cpsr,r0
  42. /*
  43. * we do sys-critical inits only at reboot,
  44. * not when booting from ram!
  45. */
  46. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  47. bl cpu_init_crit
  48. #endif
  49. bl _main
  50. /*------------------------------------------------------------------------------*/
  51. .globl c_runtime_cpu_setup
  52. c_runtime_cpu_setup:
  53. bx lr
  54. /*
  55. *************************************************************************
  56. *
  57. * CPU_init_critical registers
  58. *
  59. * setup important registers
  60. * setup memory timing
  61. *
  62. *************************************************************************
  63. */
  64. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  65. cpu_init_crit:
  66. /*
  67. * flush D cache before disabling it
  68. */
  69. mov r0, #0
  70. flush_dcache:
  71. mrc p15, 0, r15, c7, c10, 3
  72. bne flush_dcache
  73. mcr p15, 0, r0, c8, c7, 0 /* invalidate TLB */
  74. mcr p15, 0, r0, c7, c5, 0 /* invalidate I Cache */
  75. /*
  76. * disable MMU and D cache
  77. * enable I cache if CONFIG_SYS_ICACHE_OFF is not defined
  78. */
  79. mrc p15, 0, r0, c1, c0, 0
  80. bic r0, r0, #0x00000300 /* clear bits 9:8 (---- --RS) */
  81. bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */
  82. #ifdef CONFIG_SYS_EXCEPTION_VECTORS_HIGH
  83. orr r0, r0, #0x00002000 /* set bit 13 (--V- ----) */
  84. #else
  85. bic r0, r0, #0x00002000 /* clear bit 13 (--V- ----) */
  86. #endif
  87. orr r0, r0, #0x00000002 /* set bit 2 (A) Align */
  88. #ifndef CONFIG_SYS_ICACHE_OFF
  89. orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */
  90. #endif
  91. mcr p15, 0, r0, c1, c0, 0
  92. /*
  93. * Go setup Memory and board specific bits prior to relocation.
  94. */
  95. mov ip, lr /* perserve link reg across call */
  96. bl lowlevel_init /* go setup pll,mux,memory */
  97. mov lr, ip /* restore link */
  98. mov pc, lr /* back to my caller */
  99. #endif /* CONFIG_SKIP_LOWLEVEL_INIT */