lowlevel_init.S 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /*
  2. * Copyright (C) 2009 Renesas Solutions Corp.
  3. * Copyright (C) 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
  4. *
  5. * board/espt/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. .global lowlevel_init
  27. .text
  28. .align 2
  29. lowlevel_init:
  30. write32 WDTCSR_A, WDTCSR_D
  31. write32 WDTST_A, WDTST_D
  32. write32 WDTBST_A, WDTBST_D
  33. write32 CCR_A, CCR_CACHE_ICI_D
  34. write32 MMUCR_A, MMU_CONTROL_TI_D
  35. write32 MSTPCR0_A, MSTPCR0_D
  36. write32 MSTPCR1_A, MSTPCR1_D
  37. write32 RAMCR_A, RAMCR_D
  38. /*
  39. * Setting infomation from
  40. * original ESPT-GIGA bootloader register
  41. */
  42. write32 MMSEL_A, MMSEL_D
  43. /* dummy */
  44. mov.l @r1, r2
  45. mov.l @r1, r2
  46. synco
  47. write32 BCR_A, BCR_D
  48. write32 CS0BCR_A, CS0BCR_D
  49. write32 CS0WCR_A, CS0WCR_D
  50. /*
  51. * DDR-SDRAM setting
  52. */
  53. /* set DDR-SDRAM dummy read */
  54. write32 MMSEL_A, MMSEL_D
  55. mov.l MMSEL_A, r0
  56. synco
  57. mov.l @r0, r1
  58. synco
  59. mov.l CS0_A, r0
  60. synco
  61. mov.l @r0, r1
  62. synco
  63. /* set DDR-SDRAM bus/endian etc */
  64. write32 MIM_U_A, MIM_U_D
  65. write32 MIM_L_A, MIM_L_D0
  66. write32 SDR_L_A, SDR_L_A_D0
  67. write32 STR_L_A, STR_L_A_D0
  68. /* DDR-SDRAM access control */
  69. write32 MIM_L_A, MIM_L_D1
  70. write32 SCR_L_A, SCR_L_A_D0
  71. write32 SCR_L_A, SCR_L_A_D1
  72. write32 EMRS_A, EMRS_D
  73. write32 MRS1_A, MRS1_D
  74. write32 MIM_U_A, MIM_U_D
  75. write32 MIM_L_A, MIM_L_A_D2
  76. write32 SCR_L_A, SCR_L_A_D2
  77. write32 SCR_L_A, SCR_L_A_D2
  78. write32 MRS2_A, MRS2_D
  79. /* wait 200us */
  80. wait_timer REPEAT_R3
  81. /* GPIO setting */
  82. write16 PSEL0_A, PSEL0_D
  83. write16 PSEL1_A, PSEL1_D
  84. write16 PSEL2_A, PSEL2_D
  85. write16 PSEL3_A, PSEL3_D
  86. write16 PSEL4_A, PSEL4_D
  87. write8 PADR_A, PADR_D
  88. write16 PACR_A, PACR_D
  89. write8 PBDR_A, PBDR_D
  90. write16 PBCR_A, PBCR_D
  91. write8 PCDR_A, PCDR_D
  92. write16 PCCR_A, PCCR_D
  93. write8 PDDR_A, PDDR_D
  94. write16 PDCR_A, PDCR_D
  95. write16 PECR_A, PECR_D
  96. write16 PFCR_A, PFCR_D
  97. write16 PGCR_A, PGCR_D
  98. write16 PHCR_A, PHCR_D
  99. write16 PICR_A, PICR_D
  100. write8 PJDR_A, PJDR_D
  101. write16 PJCR_A, PJCR_D
  102. /* wait 50us */
  103. wait_timer REPEAT_R3
  104. write8 PKDR_A, PKDR_D
  105. write16 PKCR_A, PKCR_D
  106. write16 PLCR_A, PLCR_D
  107. write16 PMCR_A, PMCR_D
  108. write16 PNCR_A, PNCR_D
  109. write16 POCR_A, POCR_D
  110. /* ICR0 ,ICR1 */
  111. write32 ICR0_A, ICR0_D
  112. write32 ICR1_A, ICR1_D
  113. /* USB Host */
  114. write32 USB_USBHSC_A, USB_USBHSC_D
  115. write32 CCR_A, CCR_CACHE_D_2
  116. rts
  117. nop
  118. .align 2
  119. /* GPIO Crontrol Register */
  120. PACR_A: .long 0xFFEF0000
  121. PBCR_A: .long 0xFFEF0002
  122. PCCR_A: .long 0xFFEF0004
  123. PDCR_A: .long 0xFFEF0006
  124. PECR_A: .long 0xFFEF0008
  125. PFCR_A: .long 0xFFEF000A
  126. PGCR_A: .long 0xFFEF000C
  127. PHCR_A: .long 0xFFEF000E
  128. PICR_A: .long 0xFFEF0010
  129. PJCR_A: .long 0xFFEF0012
  130. PKCR_A: .long 0xFFEF0014
  131. PLCR_A: .long 0xFFEF0016
  132. PMCR_A: .long 0xFFEF0018
  133. PNCR_A: .long 0xFFEF001A
  134. POCR_A: .long 0xFFEF001C
  135. /* GPIO Data Register */
  136. PADR_A: .long 0xFFEF0020
  137. PBDR_A: .long 0xFFEF0022
  138. PCDR_A: .long 0xFFEF0024
  139. PDDR_A: .long 0xFFEF0026
  140. PJDR_A: .long 0xFFEF0032
  141. PKDR_A: .long 0xFFEF0034
  142. /* GPIO Set data */
  143. PADR_D: .long 0x00000000
  144. PACR_D: .long 0x00001400
  145. PBDR_D: .long 0x00000000
  146. PBCR_D: .long 0x0000555A
  147. PCDR_D: .long 0x00000000
  148. PCCR_D: .long 0x00005555
  149. PDDR_D: .long 0x00000000
  150. PDCR_D: .long 0x00000155
  151. PECR_D: .long 0x00000000
  152. PFCR_D: .long 0x00000000
  153. PGCR_D: .long 0x00000000
  154. PHCR_D: .long 0x00000000
  155. PICR_D: .long 0x00000800
  156. PJDR_D: .long 0x00000006
  157. PJCR_D: .long 0x00005A57
  158. PKDR_D: .long 0x00000000
  159. PKCR_D: .long 0x0000FFF9
  160. PLCR_D: .long 0x0000C330
  161. PMCR_D: .long 0x0000FFFF
  162. PNCR_D: .long 0x00000242
  163. POCR_D: .long 0x00000000
  164. /* Pin Select */
  165. PSEL0_A: .long 0xFFEF0070
  166. PSEL1_A: .long 0xFFEF0072
  167. PSEL2_A: .long 0xFFEF0074
  168. PSEL3_A: .long 0xFFEF0076
  169. PSEL4_A: .long 0xFFEF0078
  170. PSEL0_D: .long 0x0001
  171. PSEL1_D: .long 0x2400
  172. PSEL2_D: .long 0x0000
  173. PSEL3_D: .long 0x2421
  174. PSEL4_D: .long 0x0000
  175. MMSEL_A: .long 0xFE600020
  176. BCR_A: .long 0xFF801000
  177. CS0BCR_A: .long 0xFF802000
  178. CS0WCR_A: .long 0xFF802008
  179. ICR0_A: .long 0xFFD00000
  180. ICR1_A: .long 0xFFD0001C
  181. MMSEL_D: .long 0xA5A50000
  182. BCR_D: .long 0x05000000
  183. CS0BCR_D: .long 0x232306F0
  184. CS0WCR_D: .long 0x00011104
  185. ICR0_D: .long 0x80C00000
  186. ICR1_D: .long 0x00020000
  187. /* RWBT Address */
  188. WDTST_A: .long 0xFFCC0000
  189. WDTCSR_A: .long 0xFFCC0004
  190. WDTBST_A: .long 0xFFCC0008
  191. /* RWBT Data */
  192. WDTST_D: .long 0x5A000FFF
  193. WDTCSR_D: .long 0xA5000000
  194. WDTBST_D: .long 0x55000000
  195. /* Cache Address */
  196. CCR_A: .long 0xFF00001C
  197. MMUCR_A: .long 0xFF000010
  198. RAMCR_A: .long 0xFF000074
  199. /* Cache Data */
  200. CCR_CACHE_ICI_D:.long 0x00000800
  201. CCR_CACHE_D_2: .long 0x00000103
  202. MMU_CONTROL_TI_D:.long 0x00000004
  203. RAMCR_D: .long 0x00000200
  204. /* Low power mode control Address */
  205. MSTPCR0_A: .long 0xFFC80030
  206. MSTPCR1_A: .long 0xFFC80038
  207. /* Low power mode control Data */
  208. MSTPCR0_D: .long 0x00000000
  209. MSTPCR1_D: .long 0x00000000
  210. REPEAT0_R3: .long 0x00002000
  211. REPEAT_R3: .long 0x00000200
  212. CS0_A: .long 0xA8000000
  213. MIM_U_A: .long 0xFE800008
  214. MIM_L_A: .long 0xFE80000C
  215. SCR_U_A: .long 0xFE800010
  216. SCR_L_A: .long 0xFE800014
  217. STR_U_A: .long 0xFE800018
  218. STR_L_A: .long 0xFE80001C
  219. SDR_U_A: .long 0xFE800030
  220. SDR_L_A: .long 0xFE800034
  221. EMRS_A: .long 0xFE902000
  222. MRS1_A: .long 0xFE900B08
  223. MRS2_A: .long 0xFE900308
  224. MIM_U_D: .long 0x00000000
  225. MIM_L_D0: .long 0x04100008
  226. MIM_L_D1: .long 0x02EE0009
  227. MIM_L_D2: .long 0x02EE0209
  228. SDR_L_A_D0: .long 0x00000300
  229. STR_L_A_D0: .long 0x00010040
  230. MIM_L_A_D1: .long 0x04100009
  231. SCR_L_A_D0: .long 0x00000003
  232. SCR_L_A_D1: .long 0x00000002
  233. MIM_L_A_D2: .long 0x04100209
  234. SCR_L_A_D2: .long 0x00000004
  235. SCR_L_NORMAL: .long 0x00000000
  236. SCR_L_NOP: .long 0x00000001
  237. SCR_L_PALL: .long 0x00000002
  238. SCR_L_CKE_EN: .long 0x00000003
  239. SCR_L_CBR: .long 0x00000004
  240. STR_L_D: .long 0x000F3980
  241. SDR_L_D: .long 0x00000400
  242. EMRS_D: .long 0x00000000
  243. MRS1_D: .long 0x00000000
  244. MRS2_D: .long 0x00000000
  245. /* USB */
  246. USB_USBHSC_A: .long 0xFFEC80F0
  247. USB_USBHSC_D: .long 0x00000000