lowlevel_init.S 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * SoC-specific setup info
  3. *
  4. * (C) Copyright 2010,2011
  5. * NVIDIA Corporation <www.nvidia.com>
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #include <config.h>
  26. #include <version.h>
  27. _TEXT_BASE:
  28. .word CONFIG_SYS_TEXT_BASE @ sdram load addr from config file
  29. .global invalidate_dcache
  30. invalidate_dcache:
  31. mov pc, lr
  32. .align 5
  33. .global reset_cpu
  34. reset_cpu:
  35. ldr r1, rstctl @ get addr for global reset
  36. @ reg
  37. ldr r3, [r1]
  38. orr r3, r3, #0x10
  39. str r3, [r1] @ force reset
  40. mov r0, r0
  41. _loop_forever:
  42. b _loop_forever
  43. rstctl:
  44. .word PRM_RSTCTRL
  45. .globl lowlevel_init
  46. lowlevel_init:
  47. ldr sp, SRAM_STACK
  48. str ip, [sp]
  49. mov ip, lr
  50. bl s_init @ go setup pll, mux & memory
  51. ldr ip, [sp]
  52. mov lr, ip
  53. mov pc, lr @ back to arch calling code
  54. .globl startup_cpu
  55. startup_cpu:
  56. @ Initialize the AVP, clocks, and memory controller
  57. @ SDRAM is guaranteed to be on at this point
  58. ldr r0, =cold_boot @ R0 = reset vector for CPU
  59. bl start_cpu @ start the CPU
  60. @ Transfer control to the AVP code
  61. bl halt_avp
  62. @ Should never get here
  63. _loop_forever2:
  64. b _loop_forever2
  65. .globl cache_configure
  66. cache_configure:
  67. stmdb r13!,{r14}
  68. @ invalidate instruction cache
  69. mov r1, #0
  70. mcr p15, 0, r1, c7, c5, 0
  71. @ invalidate the i&d tlb entries
  72. mcr p15, 0, r1, c8, c5, 0
  73. mcr p15, 0, r1, c8, c6, 0
  74. @ enable instruction cache
  75. mrc p15, 0, r1, c1, c0, 0
  76. orr r1, r1, #(1<<12)
  77. mcr p15, 0, r1, c1, c0, 0
  78. bl enable_scu
  79. @ enable SMP mode and FW for CPU0, by writing to Auxiliary Ctl reg
  80. mrc p15, 0, r0, c1, c0, 1
  81. orr r0, r0, #0x41
  82. mcr p15, 0, r0, c1, c0, 1
  83. @ Now flush the Dcache
  84. mov r0, #0
  85. @ 256 cache lines
  86. mov r1, #256
  87. invalidate_loop:
  88. add r1, r1, #-1
  89. mov r0, r1, lsl #5
  90. @ invalidate d-cache using line (way0)
  91. mcr p15, 0, r0, c7, c6, 2
  92. orr r2, r0, #(1<<30)
  93. @ invalidate d-cache using line (way1)
  94. mcr p15, 0, r2, c7, c6, 2
  95. orr r2, r0, #(2<<30)
  96. @ invalidate d-cache using line (way2)
  97. mcr p15, 0, r2, c7, c6, 2
  98. orr r2, r0, #(3<<30)
  99. @ invalidate d-cache using line (way3)
  100. mcr p15, 0, r2, c7, c6, 2
  101. cmp r1, #0
  102. bne invalidate_loop
  103. @ FIXME: should have ap20's L2 disabled too?
  104. invalidate_done:
  105. ldmia r13!,{pc}
  106. .globl cold_boot
  107. cold_boot:
  108. msr cpsr_c, #0xD3
  109. @ Check current processor: CPU or AVP?
  110. @ If CPU, go to CPU boot code, else continue on AVP path
  111. ldr r0, =NV_PA_PG_UP_BASE
  112. ldr r1, [r0]
  113. ldr r2, =PG_UP_TAG_AVP
  114. @ are we the CPU?
  115. ldr sp, CPU_STACK
  116. cmp r1, r2
  117. @ yep, we are the CPU
  118. bne _armboot_start
  119. @ AVP initialization follows this path
  120. ldr sp, AVP_STACK
  121. @ Init AVP and start CPU
  122. b startup_cpu
  123. @ the literal pools origin
  124. .ltorg
  125. SRAM_STACK:
  126. .word LOW_LEVEL_SRAM_STACK
  127. AVP_STACK:
  128. .word EARLY_AVP_STACK
  129. CPU_STACK:
  130. .word EARLY_CPU_STACK