start.S 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * armboot - Startup Code for SA1100 CPU
  3. *
  4. * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
  5. * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
  6. * Copyright (C) 2000 Wolfgang Denk <wd@denx.de>
  7. * Copyright (c) 2001 Alex Züpke <azu@sysgo.de>
  8. *
  9. * SPDX-License-Identifier: GPL-2.0+
  10. */
  11. #include <asm-offsets.h>
  12. #include <config.h>
  13. /*
  14. *************************************************************************
  15. *
  16. * Startup Code (reset vector)
  17. *
  18. * do important init only if we don't start from memory!
  19. * relocate armboot to ram
  20. * setup stack
  21. * jump to second stage
  22. *
  23. *************************************************************************
  24. */
  25. .globl reset
  26. reset:
  27. /*
  28. * set the cpu to SVC32 mode
  29. */
  30. mrs r0,cpsr
  31. bic r0,r0,#0x1f
  32. orr r0,r0,#0xd3
  33. msr cpsr,r0
  34. /*
  35. * we do sys-critical inits only at reboot,
  36. * not when booting from ram!
  37. */
  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. mov pc, lr
  46. /*
  47. *************************************************************************
  48. *
  49. * CPU_init_critical registers
  50. *
  51. * setup important registers
  52. * setup memory timing
  53. *
  54. *************************************************************************
  55. */
  56. /* Interrupt-Controller base address */
  57. IC_BASE: .word 0x90050000
  58. #define ICMR 0x04
  59. /* Reset-Controller */
  60. RST_BASE: .word 0x90030000
  61. #define RSRR 0x00
  62. #define RCSR 0x04
  63. /* PWR */
  64. PWR_BASE: .word 0x90020000
  65. #define PSPR 0x08
  66. #define PPCR 0x14
  67. cpuspeed: .word CONFIG_SYS_CPUSPEED
  68. cpu_init_crit:
  69. /*
  70. * mask all IRQs
  71. */
  72. ldr r0, IC_BASE
  73. mov r1, #0x00
  74. str r1, [r0, #ICMR]
  75. /* set clock speed */
  76. ldr r0, PWR_BASE
  77. ldr r1, cpuspeed
  78. str r1, [r0, #PPCR]
  79. #ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY
  80. /*
  81. * before relocating, we have to setup RAM timing
  82. * because memory timing is board-dependend, you will
  83. * find a lowlevel_init.S in your board directory.
  84. */
  85. mov ip, lr
  86. bl lowlevel_init
  87. mov lr, ip
  88. #endif
  89. /*
  90. * disable MMU stuff and enable I-cache
  91. */
  92. mrc p15,0,r0,c1,c0
  93. bic r0, r0, #0x00002000 @ clear bit 13 (X)
  94. bic r0, r0, #0x0000000f @ clear bits 3-0 (WCAM)
  95. orr r0, r0, #0x00001000 @ set bit 12 (I) Icache
  96. orr r0, r0, #0x00000002 @ set bit 1 (A) Align
  97. mcr p15,0,r0,c1,c0
  98. /*
  99. * flush v4 I/D caches
  100. */
  101. mov r0, #0
  102. mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
  103. mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
  104. mov pc, lr