/board/espt/lowlevel_init.S

https://gitlab.com/veo-labs/u-boot · Assembly · 319 lines · 198 code · 86 blank · 35 comment · 0 complexity · 046f00ce42b4589c219ae2df774c10e1 MD5 · raw file

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