start.S 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * armboot - Startup Code for OMP2420/ARM1136 CPU-core
  3. *
  4. * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com>
  5. *
  6. * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
  7. * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
  8. * Copyright (c) 2002 Gary Jennejohn <garyj@denx.de>
  9. * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
  10. * Copyright (c) 2003 Kshitij <kshitij@ti.com>
  11. *
  12. * SPDX-License-Identifier: GPL-2.0+
  13. */
  14. #include <asm-offsets.h>
  15. #include <config.h>
  16. #include <version.h>
  17. /*
  18. *************************************************************************
  19. *
  20. * Startup Code (reset vector)
  21. *
  22. * do important init only if we don't start from memory!
  23. * setup Memory and board specific bits prior to relocation.
  24. * relocate armboot to ram
  25. * setup stack
  26. *
  27. *************************************************************************
  28. */
  29. .globl reset
  30. reset:
  31. /*
  32. * set the cpu to SVC32 mode
  33. */
  34. mrs r0,cpsr
  35. bic r0,r0,#0x1f
  36. orr r0,r0,#0xd3
  37. msr cpsr,r0
  38. /* the mask ROM code should have PLL and others stable */
  39. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  40. bl cpu_init_crit
  41. #endif
  42. bl _main
  43. /*------------------------------------------------------------------------------*/
  44. .globl c_runtime_cpu_setup
  45. c_runtime_cpu_setup:
  46. bx lr
  47. /*
  48. *************************************************************************
  49. *
  50. * CPU_init_critical registers
  51. *
  52. * setup important registers
  53. * setup memory timing
  54. *
  55. *************************************************************************
  56. */
  57. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  58. cpu_init_crit:
  59. /*
  60. * flush v4 I/D caches
  61. */
  62. mov r0, #0
  63. mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */
  64. mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */
  65. /*
  66. * disable MMU stuff and caches
  67. */
  68. mrc p15, 0, r0, c1, c0, 0
  69. bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
  70. bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
  71. orr r0, r0, #0x00000002 @ set bit 2 (A) Align
  72. orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
  73. mcr p15, 0, r0, c1, c0, 0
  74. /*
  75. * Jump to board specific initialization... The Mask ROM will have already initialized
  76. * basic memory. Go here to bump up clock rate and handle wake up conditions.
  77. */
  78. mov ip, lr /* persevere link reg across call */
  79. bl lowlevel_init /* go setup pll,mux,memory */
  80. mov lr, ip /* restore link */
  81. mov pc, lr /* back to my caller */
  82. #endif /* CONFIG_SKIP_LOWLEVEL_INIT */