lowlevel_init.S 6.9 KB

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