start.S 2.4 KB

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