start.S 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. /*
  17. *************************************************************************
  18. *
  19. * Startup Code (reset vector)
  20. *
  21. * do important init only if we don't start from memory!
  22. * setup Memory and board specific bits prior to relocation.
  23. * relocate armboot to ram
  24. * setup stack
  25. *
  26. *************************************************************************
  27. */
  28. .globl reset
  29. reset:
  30. /*
  31. * set the cpu to SVC32 mode
  32. */
  33. mrs r0,cpsr
  34. bic r0,r0,#0x1f
  35. orr r0,r0,#0xd3
  36. msr cpsr,r0
  37. /* the mask ROM code should have PLL and others stable */
  38. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  39. bl cpu_init_crit
  40. #endif
  41. bl _main
  42. /*------------------------------------------------------------------------------*/
  43. .globl c_runtime_cpu_setup
  44. c_runtime_cpu_setup:
  45. bx lr
  46. /*
  47. *************************************************************************
  48. *
  49. * CPU_init_critical registers
  50. *
  51. * setup important registers
  52. * setup memory timing
  53. *
  54. *************************************************************************
  55. */
  56. #ifndef CONFIG_SKIP_LOWLEVEL_INIT
  57. cpu_init_crit:
  58. /*
  59. * flush v4 I/D caches
  60. */
  61. mov r0, #0
  62. mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */
  63. mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */
  64. /*
  65. * disable MMU stuff and caches
  66. */
  67. mrc p15, 0, r0, c1, c0, 0
  68. bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
  69. bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
  70. orr r0, r0, #0x00000002 @ set bit 1 (A) Align
  71. orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
  72. mcr p15, 0, r0, c1, c0, 0
  73. #ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY
  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. #endif
  82. mov pc, lr /* back to my caller */
  83. #endif /* CONFIG_SKIP_LOWLEVEL_INIT */