lowlevel_init.S 5.6 KB

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