lowlevel_init.S 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /*
  2. * Copyright (C) 2011 Renesas Solutions Corp.
  3. * Copyright (C) 2011 Nobuhiro Iwamatsu <nobuhiro.Iwamatsu.yj@renesas.com>
  4. *
  5. * board/renesas/ecovec/lowlevel_init.S
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <config.h>
  23. #include <version.h>
  24. #include <asm/processor.h>
  25. #include <asm/macro.h>
  26. #include <configs/ecovec.h>
  27. .global lowlevel_init
  28. .text
  29. .align 2
  30. lowlevel_init:
  31. /* jump to 0xA0020000 if bit 1 of PVDR_A */
  32. mov.l PVDR_A, r1
  33. mov.l PVDR_D, r2
  34. mov.b @r1, r0
  35. tst r0, r2
  36. bt 1f
  37. mov.l JUMP_A, r1
  38. jmp @r1
  39. nop
  40. 1:
  41. /* Disable watchdog */
  42. write16 RWTCSR_A, RWTCSR_D
  43. /* MMU Disable */
  44. write32 MMUCR_A, MMUCR_D
  45. /* Setup clocks */
  46. write32 PLLCR_A, PLLCR_D
  47. write32 FRQCRA_A, FRQCRA_D
  48. write32 FRQCRB_A, FRQCRB_D
  49. wait_timer TIMER_D
  50. write32 MMSELR_A, MMSELR_D
  51. /* Srtup BSC */
  52. write32 CMNCR_A, CMNCR_D
  53. write32 CS0BCR_A, CS0BCR_D
  54. write32 CS0WCR_A, CS0WCR_D
  55. wait_timer TIMER_D
  56. /* Setup SDRAM */
  57. write32 DBPDCNT0_A, DBPDCNT0_D0
  58. write32 DBCONF_A, DBCONF_D
  59. write32 DBTR0_A, DBTR0_D
  60. write32 DBTR1_A, DBTR1_D
  61. write32 DBTR2_A, DBTR2_D
  62. write32 DBTR3_A, DBTR3_D
  63. write32 DBKIND_A, DBKIND_D
  64. write32 DBCKECNT_A, DBCKECNT_D
  65. wait_timer TIMER_D
  66. write32 DBCMDCNT_A, DBCMDCNT_D0
  67. write32 DBMRCNT_A, DBMRCNT_D0
  68. write32 DBMRCNT_A, DBMRCNT_D1
  69. write32 DBMRCNT_A, DBMRCNT_D2
  70. write32 DBMRCNT_A, DBMRCNT_D3
  71. write32 DBCMDCNT_A, DBCMDCNT_D0
  72. write32 DBCMDCNT_A, DBCMDCNT_D1
  73. write32 DBCMDCNT_A, DBCMDCNT_D1
  74. write32 DBMRCNT_A, DBMRCNT_D4
  75. write32 DBMRCNT_A, DBMRCNT_D5
  76. write32 DBMRCNT_A, DBMRCNT_D6
  77. wait_timer TIMER_D
  78. write32 DBEN_A, DBEN_D
  79. write32 DBRFPDN1_A, DBRFPDN1_D
  80. write32 DBRFPDN2_A, DBRFPDN2_D
  81. write32 DBCMDCNT_A, DBCMDCNT_D0
  82. /* Dummy read */
  83. mov.l DUMMY_A ,r1
  84. synco
  85. mov.l @r1, r0
  86. synco
  87. mov.l SDRAM_A ,r1
  88. synco
  89. mov.l @r1, r0
  90. synco
  91. wait_timer TIMER_D
  92. add #4, r1
  93. synco
  94. mov.l @r1, r0
  95. synco
  96. wait_timer TIMER_D
  97. add #4, r1
  98. synco
  99. mov.l @r1, r0
  100. synco
  101. wait_timer TIMER_D
  102. add #4, r1
  103. synco
  104. mov.l @r1, r0
  105. synco
  106. wait_timer TIMER_D
  107. write32 DBCMDCNT_A, DBCMDCNT_D0
  108. write32 DBCMDCNT_A, DBCMDCNT_D1
  109. write32 DBPDCNT0_A, DBPDCNT0_D1
  110. write32 DBRFPDN0_A, DBRFPDN0_D
  111. wait_timer TIMER_D
  112. write32 CCR_A, CCR_D
  113. stc sr, r0
  114. mov.l SR_MASK_D, r1
  115. and r1, r0
  116. ldc r0, sr
  117. rts
  118. .align 2
  119. PVDR_A: .long PVDR
  120. PVDR_D: .long 0x00000001
  121. JUMP_A: .long CONFIG_ECOVEC_ROMIMAGE_ADDR
  122. TIMER_D: .long 64
  123. RWTCSR_A: .long RWTCSR
  124. RWTCSR_D: .long 0x0000A507
  125. MMUCR_A: .long MMUCR
  126. MMUCR_D: .long 0x00000004
  127. PLLCR_A: .long PLLCR
  128. PLLCR_D: .long 0x00004000
  129. FRQCRA_A: .long FRQCRA
  130. FRQCRA_D: .long 0x8E003508
  131. FRQCRB_A: .long FRQCRB
  132. FRQCRB_D: .long 0x0
  133. MMSELR_A: .long MMSELR
  134. MMSELR_D: .long 0xA5A50000
  135. CMNCR_A: .long CMNCR
  136. CMNCR_D: .long 0x00000013
  137. CS0BCR_A: .long CS0BCR
  138. CS0BCR_D: .long 0x11110400
  139. CS0WCR_A: .long CS0WCR
  140. CS0WCR_D: .long 0x00000440
  141. DBPDCNT0_A: .long DBPDCNT0
  142. DBPDCNT0_D0: .long 0x00000181
  143. DBPDCNT0_D1: .long 0x00000080
  144. DBCONF_A: .long DBCONF
  145. DBCONF_D: .long 0x015B0002
  146. DBTR0_A: .long DBTR0
  147. DBTR0_D: .long 0x03061502
  148. DBTR1_A: .long DBTR1
  149. DBTR1_D: .long 0x02020102
  150. DBTR2_A: .long DBTR2
  151. DBTR2_D: .long 0x01090305
  152. DBTR3_A: .long DBTR3
  153. DBTR3_D: .long 0x00000002
  154. DBKIND_A: .long DBKIND
  155. DBKIND_D: .long 0x00000005
  156. DBCKECNT_A: .long DBCKECNT
  157. DBCKECNT_D: .long 0x00000001
  158. DBCMDCNT_A: .long DBCMDCNT
  159. DBCMDCNT_D0:.long 0x2
  160. DBCMDCNT_D1:.long 0x4
  161. DBMRCNT_A: .long DBMRCNT
  162. DBMRCNT_D0: .long 0x00020000
  163. DBMRCNT_D1: .long 0x00030000
  164. DBMRCNT_D2: .long 0x00010040
  165. DBMRCNT_D3: .long 0x00000532
  166. DBMRCNT_D4: .long 0x00000432
  167. DBMRCNT_D5: .long 0x000103C0
  168. DBMRCNT_D6: .long 0x00010040
  169. DBEN_A: .long DBEN
  170. DBEN_D: .long 0x01
  171. DBRFPDN0_A: .long DBRFPDN0
  172. DBRFPDN1_A: .long DBRFPDN1
  173. DBRFPDN2_A: .long DBRFPDN2
  174. DBRFPDN0_D: .long 0x00010000
  175. DBRFPDN1_D: .long 0x00000613
  176. DBRFPDN2_D: .long 0x238C003A
  177. SDRAM_A: .long 0xa8000000
  178. DUMMY_A: .long 0x0c400000
  179. CCR_A: .long CCR
  180. CCR_D: .long 0x0000090B
  181. SR_MASK_D: .long 0xEFFFFF0F