start.S 2.7 KB

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