start.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. /*
  21. *************************************************************************
  22. *
  23. * Startup Code (reset vector)
  24. *
  25. * do important init only if we don't start from memory!
  26. * setup Memory and board specific bits prior to relocation.
  27. * relocate armboot to ram
  28. * setup stack
  29. *
  30. *************************************************************************
  31. */
  32. .globl reset
  33. reset:
  34. /*
  35. * set the cpu to SVC32 mode
  36. */
  37. mrs r0,cpsr
  38. bic r0,r0,#0x1f
  39. orr r0,r0,#0xd3
  40. msr cpsr,r0
  41. /*
  42. * we do sys-critical inits only at reboot,
  43. * not when booting from ram!
  44. */
  45. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  46. bl cpu_init_crit
  47. #endif
  48. bl _main
  49. /*------------------------------------------------------------------------------*/
  50. .globl c_runtime_cpu_setup
  51. c_runtime_cpu_setup:
  52. bx lr
  53. /*
  54. *************************************************************************
  55. *
  56. * CPU_init_critical registers
  57. *
  58. * setup important registers
  59. * setup memory timing
  60. *
  61. *************************************************************************
  62. */
  63. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  64. cpu_init_crit:
  65. /*
  66. * flush D cache before disabling it
  67. */
  68. mov r0, #0
  69. flush_dcache:
  70. mrc p15, 0, r15, c7, c10, 3
  71. bne flush_dcache
  72. mcr p15, 0, r0, c8, c7, 0 /* invalidate TLB */
  73. mcr p15, 0, r0, c7, c5, 0 /* invalidate I Cache */
  74. /*
  75. * disable MMU and D cache
  76. * enable I cache if CONFIG_SYS_ICACHE_OFF is not defined
  77. */
  78. mrc p15, 0, r0, c1, c0, 0
  79. bic r0, r0, #0x00000300 /* clear bits 9:8 (---- --RS) */
  80. bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */
  81. #ifdef CONFIG_SYS_EXCEPTION_VECTORS_HIGH
  82. orr r0, r0, #0x00002000 /* set bit 13 (--V- ----) */
  83. #else
  84. bic r0, r0, #0x00002000 /* clear bit 13 (--V- ----) */
  85. #endif
  86. orr r0, r0, #0x00000002 /* set bit 1 (A) Align */
  87. #ifndef CONFIG_SYS_ICACHE_OFF
  88. orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */
  89. #endif
  90. mcr p15, 0, r0, c1, c0, 0
  91. #ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY
  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. #endif
  99. mov pc, lr /* back to my caller */
  100. #endif /* CONFIG_SKIP_LOWLEVEL_INIT */