start.S 2.5 KB

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