lowlevel_init.S 6.2 KB

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