lowlevel_init.S 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /*
  2. * Copyright (C) 2007
  3. * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  4. *
  5. * Copyright (C) 2007
  6. * Kenati Technologies, Inc.
  7. *
  8. * board/MigoR/lowlevel_init.S
  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. #include <asm/processor.h>
  28. /*
  29. * Board specific low level init code, called _very_ early in the
  30. * startup sequence. Relocation to SDRAM has not happened yet, no
  31. * stack is available, bss section has not been initialised, etc.
  32. *
  33. * (Note: As no stack is available, no subroutines can be called...).
  34. */
  35. .global lowlevel_init
  36. .text
  37. .align 2
  38. lowlevel_init:
  39. mov.l CCR_A, r1 ! Address of Cache Control Register
  40. mov.l CCR_D, r0 ! Instruction Cache Invalidate
  41. mov.l r0, @r1
  42. mov.l MMUCR_A, r1 ! Address of MMU Control Register
  43. mov.l MMUCR_D, r0 ! TI == TLB Invalidate bit
  44. mov.l r0, @r1
  45. mov.l MSTPCR0_A, r1 ! Address of Power Control Register 0
  46. mov.l MSTPCR0_D, r0 !
  47. mov.l r0, @r1
  48. mov.l MSTPCR2_A, r1 ! Address of Power Control Register 2
  49. mov.l MSTPCR2_D, r0 !
  50. mov.l r0, @r1
  51. mov.l PFC_PULCR_A, r1
  52. mov.w PFC_PULCR_D, r0
  53. mov.w r0,@r1
  54. mov.l PFC_DRVCR_A, r1
  55. mov.w PFC_DRVCR_D, r0
  56. mov.w r0, @r1
  57. mov.l SBSCR_A, r1 !
  58. mov.w SBSCR_D, r0 !
  59. mov.w r0, @r1
  60. mov.l PSCR_A, r1 !
  61. mov.w PSCR_D, r0 !
  62. mov.w r0, @r1
  63. mov.l RWTCSR_A, r1 ! 0xA4520004 (Watchdog Control / Status Register)
  64. mov.w RWTCSR_D_1, r0 ! 0xA507 -> timer_STOP/WDT_CLK=max
  65. mov.w r0, @r1
  66. mov.l RWTCNT_A, r1 ! 0xA4520000 (Watchdog Count Register)
  67. mov.w RWTCNT_D, r0 ! 0x5A00 -> Clear
  68. mov.w r0, @r1
  69. mov.l RWTCSR_A, r1 ! 0xA4520004 (Watchdog Control / Status Register)
  70. mov.w RWTCSR_D_2, r0 ! 0xA504 -> timer_STOP/CLK=500ms
  71. mov.w r0, @r1
  72. mov.l DLLFRQ_A, r1 ! 20080115
  73. mov.l DLLFRQ_D, r0 ! 20080115
  74. mov.l r0, @r1
  75. mov.l FRQCR_A, r1 ! 0xA4150000 Frequency control register
  76. mov.l FRQCR_D, r0 ! 20080115
  77. mov.l r0, @r1
  78. mov.l CCR_A, r1 ! Address of Cache Control Register
  79. mov.l CCR_D_2, r0 ! ??
  80. mov.l r0, @r1
  81. bsc_init:
  82. mov.l CMNCR_A, r1 ! CMNCR address -> R1
  83. mov.l CMNCR_D, r0 ! CMNCR data -> R0
  84. mov.l r0, @r1 ! CMNCR set
  85. mov.l CS0BCR_A, r1 ! CS0BCR address -> R1
  86. mov.l CS0BCR_D, r0 ! CS0BCR data -> R0
  87. mov.l r0, @r1 ! CS0BCR set
  88. mov.l CS4BCR_A, r1 ! CS4BCR address -> R1
  89. mov.l CS4BCR_D, r0 ! CS4BCR data -> R0
  90. mov.l r0, @r1 ! CS4BCR set
  91. mov.l CS5ABCR_A, r1 ! CS5ABCR address -> R1
  92. mov.l CS5ABCR_D, r0 ! CS5ABCR data -> R0
  93. mov.l r0, @r1 ! CS5ABCR set
  94. mov.l CS5BBCR_A, r1 ! CS5BBCR address -> R1
  95. mov.l CS5BBCR_D, r0 ! CS5BBCR data -> R0
  96. mov.l r0, @r1 ! CS5BBCR set
  97. mov.l CS6ABCR_A, r1 ! CS6ABCR address -> R1
  98. mov.l CS6ABCR_D, r0 ! CS6ABCR data -> R0
  99. mov.l r0, @r1 ! CS6ABCR set
  100. mov.l CS0WCR_A, r1 ! CS0WCR address -> R1
  101. mov.l CS0WCR_D, r0 ! CS0WCR data -> R0
  102. mov.l r0, @r1 ! CS0WCR set
  103. mov.l CS4WCR_A, r1 ! CS4WCR address -> R1
  104. mov.l CS4WCR_D, r0 ! CS4WCR data -> R0
  105. mov.l r0, @r1 ! CS4WCR set
  106. mov.l CS5AWCR_A, r1 ! CS5AWCR address -> R1
  107. mov.l CS5AWCR_D, r0 ! CS5AWCR data -> R0
  108. mov.l r0, @r1 ! CS5AWCR set
  109. mov.l CS5BWCR_A, r1 ! CS5BWCR address -> R1
  110. mov.l CS5BWCR_D, r0 ! CS5BWCR data -> R0
  111. mov.l r0, @r1 ! CS5BWCR set
  112. mov.l CS6AWCR_A, r1 ! CS6AWCR address -> R1
  113. mov.l CS6AWCR_D, r0 ! CS6AWCR data -> R0
  114. mov.l r0, @r1 ! CS6AWCR set
  115. ! SDRAM initialization
  116. mov.l SDCR_A, r1 ! SB_SDCR address -> R1
  117. mov.l SDCR_D, r0 ! SB_SDCR data -> R0
  118. mov.l r0, @r1 ! SB_SDCR set
  119. mov.l SDWCR_A, r1 ! SB_SDWCR address -> R1
  120. mov.l SDWCR_D, r0 ! SB_SDWCR data -> R0
  121. mov.l r0, @r1 ! SB_SDWCR set
  122. mov.l SDPCR_A, r1 ! SB_SDPCR address -> R1
  123. mov.l SDPCR_D, r0 ! SB_SDPCR data -> R0
  124. mov.l r0, @r1 ! SB_SDPCR set
  125. mov.l RTCOR_A, r1 ! SB_RTCOR address -> R1
  126. mov.l RTCOR_D, r0 ! SB_RTCOR data -> R0
  127. mov.l r0, @r1 ! SB_RTCOR set
  128. mov.l RTCNT_A, r1 ! SB_RTCNT address -> R1
  129. mov.l RTCNT_D, r0 ! SB_RTCNT data -> R0
  130. mov.l r0, @r1
  131. mov.l RTCSR_A, r1 ! SB_RTCSR address -> R1
  132. mov.l RTCSR_D, r0 ! SB_RTCSR data -> R0
  133. mov.l r0, @r1 ! SB_RTCSR set
  134. mov.l RFCR_A, r1 ! SB_RFCR address -> R1
  135. mov.l RFCR_D, r0 ! SB_RFCR data -> R0
  136. mov.l r0, @r1
  137. mov.l SDMR3_A, r1 ! SDMR3 address -> R1
  138. mov #0x00, r0 ! SDMR3 data -> R0
  139. mov.b r0, @r1 ! SDMR3 set
  140. ! BL bit off (init = ON) (?!?)
  141. stc sr, r0 ! BL bit off(init=ON)
  142. mov.l SR_MASK_D, r1
  143. and r1, r0
  144. ldc r0, sr
  145. rts
  146. mov #0, r0
  147. .align 4
  148. CCR_A: .long CCR
  149. MMUCR_A: .long MMUCR
  150. MSTPCR0_A: .long MSTPCR0
  151. MSTPCR2_A: .long MSTPCR2
  152. PFC_PULCR_A: .long PULCR
  153. PFC_DRVCR_A: .long DRVCR
  154. SBSCR_A: .long SBSCR
  155. PSCR_A: .long PSCR
  156. RWTCSR_A: .long RWTCSR
  157. RWTCNT_A: .long RWTCNT
  158. FRQCR_A: .long FRQCR
  159. PLLCR_A: .long PLLCR
  160. DLLFRQ_A: .long DLLFRQ
  161. CCR_D: .long 0x00000800
  162. CCR_D_2: .long 0x00000103
  163. MMUCR_D: .long 0x00000004
  164. MSTPCR0_D: .long 0x00001001
  165. MSTPCR2_D: .long 0xffffffff
  166. PFC_PULCR_D: .long 0x6000
  167. PFC_DRVCR_D: .long 0x0464
  168. FRQCR_D: .long 0x07033639
  169. PLLCR_D: .long 0x00005000
  170. DLLFRQ_D: .long 0x000004F6 ! 20080115
  171. CMNCR_A: .long CMNCR
  172. CMNCR_D: .long 0x0000001B ! 20080115
  173. CS0BCR_A: .long CS0BCR ! Flash bank 1
  174. CS0BCR_D: .long 0x24920400
  175. CS4BCR_A: .long CS4BCR !
  176. CS4BCR_D: .long 0x10003400 ! 20080115
  177. CS5ABCR_A: .long CS5ABCR !
  178. CS5ABCR_D: .long 0x24920400
  179. CS5BBCR_A: .long CS5BBCR !
  180. CS5BBCR_D: .long 0x24920400
  181. CS6ABCR_A: .long CS6ABCR !
  182. CS6ABCR_D: .long 0x24920400
  183. CS0WCR_A: .long CS0WCR
  184. CS0WCR_D: .long 0x00000380
  185. CS4WCR_A: .long CS4WCR
  186. CS4WCR_D: .long 0x00100A81 ! 20080115
  187. CS5AWCR_A: .long CS5AWCR
  188. CS5AWCR_D: .long 0x00000300
  189. CS5BWCR_A: .long CS5BWCR
  190. CS5BWCR_D: .long 0x00000300
  191. CS6AWCR_A: .long CS6AWCR
  192. CS6AWCR_D: .long 0x00000300
  193. SDCR_A: .long SBSC_SDCR
  194. SDCR_D: .long 0x80160809 ! 20080115
  195. SDWCR_A: .long SBSC_SDWCR
  196. SDWCR_D: .long 0x0014450C ! 20080115
  197. SDPCR_A: .long SBSC_SDPCR
  198. SDPCR_D: .long 0x00000087
  199. RTCOR_A: .long SBSC_RTCOR
  200. RTCNT_A: .long SBSC_RTCNT
  201. RTCNT_D: .long 0xA55A0012
  202. RTCOR_D: .long 0xA55A001C ! 20080115
  203. RTCSR_A: .long SBSC_RTCSR
  204. RFCR_A: .long SBSC_RFCR
  205. RFCR_D: .long 0xA55A0221
  206. RTCSR_D: .long 0xA55A009a ! 20080115
  207. SDMR3_A: .long 0xFE581180 ! 20080115
  208. SR_MASK_D: .long 0xEFFFFF0F
  209. .align 2
  210. SBSCR_D: .word 0x0044
  211. PSCR_D: .word 0x0000
  212. RWTCSR_D_1: .word 0xA507
  213. RWTCSR_D_2: .word 0xA504 ! 20080115
  214. RWTCNT_D: .word 0x5A00