lowlevel_init.S 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. /*
  2. * Copyright (C) 2007
  3. * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  4. *
  5. * Copyright (C) 2007
  6. * Kenati Technologies, Inc.
  7. *
  8. * board/ms7722se/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. /* Address of Cache Control Register */
  40. mov.l CCR_A, r1
  41. /*Instruction Cache Invalidate */
  42. mov.l CCR_D, r0
  43. mov.l r0, @r1
  44. /* Address of MMU Control Register */
  45. mov.l MMUCR_A, r1
  46. /* TI == TLB Invalidate bit */
  47. mov.l MMUCR_D, r0
  48. mov.l r0, @r1
  49. /* Address of Power Control Register 0 */
  50. mov.l MSTPCR0_A, r1
  51. mov.l MSTPCR0_D, r0
  52. mov.l r0, @r1
  53. /* Address of Power Control Register 2 */
  54. mov.l MSTPCR2_A, r1
  55. mov.l MSTPCR2_D, r0
  56. mov.l 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. /* 0xA4520004 (Watchdog Control / Status Register) */
  64. ! mov.l RWTCSR_A, r1
  65. /* 0xA507 -> timer_STOP/WDT_CLK=max */
  66. ! mov.w RWTCSR_D_1, r0
  67. ! mov.w r0, @r1
  68. /* 0xA4520000 (Watchdog Count Register) */
  69. mov.l RWTCNT_A, r1
  70. /*0x5A00 -> Clear */
  71. mov.w RWTCNT_D, r0
  72. mov.w r0, @r1
  73. /* 0xA4520004 (Watchdog Control / Status Register) */
  74. mov.l RWTCSR_A, r1
  75. /* 0xA504 -> timer_STOP/CLK=500ms */
  76. mov.w RWTCSR_D_2, r0
  77. mov.w r0, @r1
  78. /* 0xA4150000 Frequency control register */
  79. mov.l FRQCR_A, r1
  80. mov.l FRQCR_D, r0 !
  81. mov.l r0, @r1
  82. mov.l CCR_A, r1
  83. mov.l CCR_D_2, r0
  84. mov.l r0, @r1
  85. bsc_init:
  86. mov.l PSELA_A, r1
  87. mov.w PSELA_D, r0
  88. mov.w r0, @r1
  89. mov.l DRVCR_A, r1
  90. mov.w DRVCR_D, r0
  91. mov.w r0, @r1
  92. mov.l PCCR_A, r1
  93. mov.w PCCR_D, r0
  94. mov.w r0, @r1
  95. mov.l PECR_A, r1
  96. mov.w PECR_D, r0
  97. mov.w r0, @r1
  98. mov.l PJCR_A, r1
  99. mov.w PJCR_D, r0
  100. mov.w r0, @r1
  101. mov.l PXCR_A, r1
  102. mov.w PXCR_D, r0
  103. mov.w r0, @r1
  104. mov.l CMNCR_A, r1 ! CMNCR address -> R1
  105. mov.l CMNCR_D, r0 ! CMNCR data -> R0
  106. mov.l r0, @r1 ! CMNCR set
  107. mov.l CS0BCR_A, r1 ! CS0BCR address -> R1
  108. mov.l CS0BCR_D, r0 ! CS0BCR data -> R0
  109. mov.l r0, @r1 ! CS0BCR set
  110. mov.l CS2BCR_A, r1 ! CS2BCR address -> R1
  111. mov.l CS2BCR_D, r0 ! CS2BCR data -> R0
  112. mov.l r0, @r1 ! CS2BCR set
  113. mov.l CS4BCR_A, r1 ! CS4BCR address -> R1
  114. mov.l CS4BCR_D, r0 ! CS4BCR data -> R0
  115. mov.l r0, @r1 ! CS4BCR set
  116. mov.l CS5ABCR_A, r1 ! CS5ABCR address -> R1
  117. mov.l CS5ABCR_D, r0 ! CS5ABCR data -> R0
  118. mov.l r0, @r1 ! CS5ABCR set
  119. mov.l CS5BBCR_A, r1 ! CS5BBCR address -> R1
  120. mov.l CS5BBCR_D, r0 ! CS5BBCR data -> R0
  121. mov.l r0, @r1 ! CS5BBCR set
  122. mov.l CS6ABCR_A, r1 ! CS6ABCR address -> R1
  123. mov.l CS6ABCR_D, r0 ! CS6ABCR data -> R0
  124. mov.l r0, @r1 ! CS6ABCR set
  125. mov.l CS0WCR_A, r1 ! CS0WCR address -> R1
  126. mov.l CS0WCR_D, r0 ! CS0WCR data -> R0
  127. mov.l r0, @r1 ! CS0WCR set
  128. mov.l CS2WCR_A, r1 ! CS2WCR address -> R1
  129. mov.l CS2WCR_D, r0 ! CS2WCR data -> R0
  130. mov.l r0, @r1 ! CS2WCR set
  131. mov.l CS4WCR_A, r1 ! CS4WCR address -> R1
  132. mov.l CS4WCR_D, r0 ! CS4WCR data -> R0
  133. mov.l r0, @r1 ! CS4WCR set
  134. mov.l CS5AWCR_A, r1 ! CS5AWCR address -> R1
  135. mov.l CS5AWCR_D, r0 ! CS5AWCR data -> R0
  136. mov.l r0, @r1 ! CS5AWCR set
  137. mov.l CS5BWCR_A, r1 ! CS5BWCR address -> R1
  138. mov.l CS5BWCR_D, r0 ! CS5BWCR data -> R0
  139. mov.l r0, @r1 ! CS5BWCR set
  140. mov.l CS6AWCR_A, r1 ! CS6AWCR address -> R1
  141. mov.l CS6AWCR_D, r0 ! CS6AWCR data -> R0
  142. mov.l r0, @r1 ! CS6AWCR set
  143. ! SDRAM initialization
  144. mov.l SDCR_A, r1 ! SB_SDCR address -> R1
  145. mov.l SDCR_D, r0 ! SB_SDCR data -> R0
  146. mov.l r0, @r1 ! SB_SDCR set
  147. mov.l SDWCR_A, r1 ! SB_SDWCR address -> R1
  148. mov.l SDWCR_D, r0 ! SB_SDWCR data -> R0
  149. mov.l r0, @r1 ! SB_SDWCR set
  150. mov.l SDPCR_A, r1 ! SB_SDPCR address -> R1
  151. mov.l SDPCR_D, r0 ! SB_SDPCR data -> R0
  152. mov.l r0, @r1 ! SB_SDPCR set
  153. mov.l RTCOR_A, r1 ! SB_RTCOR address -> R1
  154. mov.l RTCOR_D, r0 ! SB_RTCOR data -> R0
  155. mov.l r0, @r1 ! SB_RTCOR set
  156. mov.l RTCSR_A, r1 ! SB_RTCSR address -> R1
  157. mov.l RTCSR_D, r0 ! SB_RTCSR data -> R0
  158. mov.l r0, @r1 ! SB_RTCSR set
  159. mov.l SDMR3_A, r1 ! SDMR3 address -> R1
  160. mov #0x00, r0 ! SDMR3 data -> R0
  161. mov.b r0, @r1 ! SDMR3 set
  162. ! BL bit off (init = ON) (?!?)
  163. stc sr, r0 ! BL bit off(init=ON)
  164. mov.l SR_MASK_D, r1
  165. and r1, r0
  166. ldc r0, sr
  167. rts
  168. mov #0, r0
  169. .align 2
  170. CCR_A: .long CCR
  171. MMUCR_A: .long MMUCR
  172. MSTPCR0_A: .long MSTPCR0
  173. MSTPCR2_A: .long MSTPCR2
  174. SBSCR_A: .long SBSCR
  175. PSCR_A: .long PSCR
  176. RWTCSR_A: .long RWTCSR
  177. RWTCNT_A: .long RWTCNT
  178. FRQCR_A: .long FRQCR
  179. CCR_D: .long 0x00000800
  180. CCR_D_2: .long 0x00000103
  181. MMUCR_D: .long 0x00000004
  182. MSTPCR0_D: .long 0x00001001
  183. MSTPCR2_D: .long 0xffffffff
  184. FRQCR_D: .long 0x07022538
  185. PSELA_A: .long 0xa405014E
  186. PSELA_D: .word 0x0A10
  187. .align 2
  188. DRVCR_A: .long 0xa405018A
  189. DRVCR_D: .word 0x0554
  190. .align 2
  191. PCCR_A: .long 0xa4050104
  192. PCCR_D: .word 0x8800
  193. .align 2
  194. PECR_A: .long 0xa4050108
  195. PECR_D: .word 0x0000
  196. .align 2
  197. PJCR_A: .long 0xa4050110
  198. PJCR_D: .word 0x1000
  199. .align 2
  200. PXCR_A: .long 0xa4050148
  201. PXCR_D: .word 0x0AAA
  202. .align 2
  203. CMNCR_A: .long CMNCR
  204. CMNCR_D: .long 0x00000013
  205. CS0BCR_A: .long CS0BCR ! Flash bank 1
  206. CS0BCR_D: .long 0x24920400
  207. CS2BCR_A: .long CS2BCR ! SRAM
  208. CS2BCR_D: .long 0x24920400
  209. CS4BCR_A: .long CS4BCR ! FPGA, PCMCIA, USB, ext slot
  210. CS4BCR_D: .long 0x24920400
  211. CS5ABCR_A: .long CS5ABCR ! Ext slot
  212. CS5ABCR_D: .long 0x24920400
  213. CS5BBCR_A: .long CS5BBCR ! USB controller
  214. CS5BBCR_D: .long 0x24920400
  215. CS6ABCR_A: .long CS6ABCR ! Ethernet
  216. CS6ABCR_D: .long 0x24920400
  217. CS0WCR_A: .long CS0WCR
  218. CS0WCR_D: .long 0x00000300
  219. CS2WCR_A: .long CS2WCR
  220. CS2WCR_D: .long 0x00000300
  221. CS4WCR_A: .long CS4WCR
  222. CS4WCR_D: .long 0x00000300
  223. CS5AWCR_A: .long CS5AWCR
  224. CS5AWCR_D: .long 0x00000300
  225. CS5BWCR_A: .long CS5BWCR
  226. CS5BWCR_D: .long 0x00000300
  227. CS6AWCR_A: .long CS6AWCR
  228. CS6AWCR_D: .long 0x00000300
  229. SDCR_A: .long SBSC_SDCR
  230. SDCR_D: .long 0x00020809
  231. SDWCR_A: .long SBSC_SDWCR
  232. SDWCR_D: .long 0x00164d0d
  233. SDPCR_A: .long SBSC_SDPCR
  234. SDPCR_D: .long 0x00000087
  235. RTCOR_A: .long SBSC_RTCOR
  236. RTCOR_D: .long 0xA55A0034
  237. RTCSR_A: .long SBSC_RTCSR
  238. RTCSR_D: .long 0xA55A0010
  239. SDMR3_A: .long 0xFE500180
  240. .align 1
  241. SBSCR_D: .word 0x0040
  242. PSCR_D: .word 0x0000
  243. RWTCSR_D_1: .word 0xA507
  244. RWTCSR_D_2: .word 0xA507
  245. RWTCNT_D: .word 0x5A00
  246. .align 2
  247. SR_MASK_D: .long 0xEFFFFF0F