lowlevel_init.S 5.6 KB

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