pfc_init_g2m.c 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300
  1. /*
  2. * Copyright (c) 2020, Renesas Electronics Corporation. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <stdint.h> /* for uint32_t */
  7. #include <lib/mmio.h>
  8. #include "pfc_init_g2m.h"
  9. #include "rcar_def.h"
  10. #include "rcar_private.h"
  11. #include "pfc_regs.h"
  12. #define GPSR0_D15 BIT(15)
  13. #define GPSR0_D14 BIT(14)
  14. #define GPSR0_D13 BIT(13)
  15. #define GPSR0_D12 BIT(12)
  16. #define GPSR0_D11 BIT(11)
  17. #define GPSR0_D10 BIT(10)
  18. #define GPSR0_D9 BIT(9)
  19. #define GPSR0_D8 BIT(8)
  20. #define GPSR0_D7 BIT(7)
  21. #define GPSR0_D6 BIT(6)
  22. #define GPSR0_D5 BIT(5)
  23. #define GPSR0_D4 BIT(4)
  24. #define GPSR0_D3 BIT(3)
  25. #define GPSR0_D2 BIT(2)
  26. #define GPSR0_D1 BIT(1)
  27. #define GPSR0_D0 BIT(0)
  28. #define GPSR1_CLKOUT BIT(28)
  29. #define GPSR1_EX_WAIT0_A BIT(27)
  30. #define GPSR1_WE1 BIT(26)
  31. #define GPSR1_WE0 BIT(25)
  32. #define GPSR1_RD_WR BIT(24)
  33. #define GPSR1_RD BIT(23)
  34. #define GPSR1_BS BIT(22)
  35. #define GPSR1_CS1_A26 BIT(21)
  36. #define GPSR1_CS0 BIT(20)
  37. #define GPSR1_A19 BIT(19)
  38. #define GPSR1_A18 BIT(18)
  39. #define GPSR1_A17 BIT(17)
  40. #define GPSR1_A16 BIT(16)
  41. #define GPSR1_A15 BIT(15)
  42. #define GPSR1_A14 BIT(14)
  43. #define GPSR1_A13 BIT(13)
  44. #define GPSR1_A12 BIT(12)
  45. #define GPSR1_A11 BIT(11)
  46. #define GPSR1_A10 BIT(10)
  47. #define GPSR1_A9 BIT(9)
  48. #define GPSR1_A8 BIT(8)
  49. #define GPSR1_A7 BIT(7)
  50. #define GPSR1_A6 BIT(6)
  51. #define GPSR1_A5 BIT(5)
  52. #define GPSR1_A4 BIT(4)
  53. #define GPSR1_A3 BIT(3)
  54. #define GPSR1_A2 BIT(2)
  55. #define GPSR1_A1 BIT(1)
  56. #define GPSR1_A0 BIT(0)
  57. #define GPSR2_AVB_AVTP_CAPTURE_A BIT(14)
  58. #define GPSR2_AVB_AVTP_MATCH_A BIT(13)
  59. #define GPSR2_AVB_LINK BIT(12)
  60. #define GPSR2_AVB_PHY_INT BIT(11)
  61. #define GPSR2_AVB_MAGIC BIT(10)
  62. #define GPSR2_AVB_MDC BIT(9)
  63. #define GPSR2_PWM2_A BIT(8)
  64. #define GPSR2_PWM1_A BIT(7)
  65. #define GPSR2_PWM0 BIT(6)
  66. #define GPSR2_IRQ5 BIT(5)
  67. #define GPSR2_IRQ4 BIT(4)
  68. #define GPSR2_IRQ3 BIT(3)
  69. #define GPSR2_IRQ2 BIT(2)
  70. #define GPSR2_IRQ1 BIT(1)
  71. #define GPSR2_IRQ0 BIT(0)
  72. #define GPSR3_SD1_WP BIT(15)
  73. #define GPSR3_SD1_CD BIT(14)
  74. #define GPSR3_SD0_WP BIT(13)
  75. #define GPSR3_SD0_CD BIT(12)
  76. #define GPSR3_SD1_DAT3 BIT(11)
  77. #define GPSR3_SD1_DAT2 BIT(10)
  78. #define GPSR3_SD1_DAT1 BIT(9)
  79. #define GPSR3_SD1_DAT0 BIT(8)
  80. #define GPSR3_SD1_CMD BIT(7)
  81. #define GPSR3_SD1_CLK BIT(6)
  82. #define GPSR3_SD0_DAT3 BIT(5)
  83. #define GPSR3_SD0_DAT2 BIT(4)
  84. #define GPSR3_SD0_DAT1 BIT(3)
  85. #define GPSR3_SD0_DAT0 BIT(2)
  86. #define GPSR3_SD0_CMD BIT(1)
  87. #define GPSR3_SD0_CLK BIT(0)
  88. #define GPSR4_SD3_DS BIT(17)
  89. #define GPSR4_SD3_DAT7 BIT(16)
  90. #define GPSR4_SD3_DAT6 BIT(15)
  91. #define GPSR4_SD3_DAT5 BIT(14)
  92. #define GPSR4_SD3_DAT4 BIT(13)
  93. #define GPSR4_SD3_DAT3 BIT(12)
  94. #define GPSR4_SD3_DAT2 BIT(11)
  95. #define GPSR4_SD3_DAT1 BIT(10)
  96. #define GPSR4_SD3_DAT0 BIT(9)
  97. #define GPSR4_SD3_CMD BIT(8)
  98. #define GPSR4_SD3_CLK BIT(7)
  99. #define GPSR4_SD2_DS BIT(6)
  100. #define GPSR4_SD2_DAT3 BIT(5)
  101. #define GPSR4_SD2_DAT2 BIT(4)
  102. #define GPSR4_SD2_DAT1 BIT(3)
  103. #define GPSR4_SD2_DAT0 BIT(2)
  104. #define GPSR4_SD2_CMD BIT(1)
  105. #define GPSR4_SD2_CLK BIT(0)
  106. #define GPSR5_MLB_DAT BIT(25)
  107. #define GPSR5_MLB_SIG BIT(24)
  108. #define GPSR5_MLB_CLK BIT(23)
  109. #define GPSR5_MSIOF0_RXD BIT(22)
  110. #define GPSR5_MSIOF0_SS2 BIT(21)
  111. #define GPSR5_MSIOF0_TXD BIT(20)
  112. #define GPSR5_MSIOF0_SS1 BIT(19)
  113. #define GPSR5_MSIOF0_SYNC BIT(18)
  114. #define GPSR5_MSIOF0_SCK BIT(17)
  115. #define GPSR5_HRTS0 BIT(16)
  116. #define GPSR5_HCTS0 BIT(15)
  117. #define GPSR5_HTX0 BIT(14)
  118. #define GPSR5_HRX0 BIT(13)
  119. #define GPSR5_HSCK0 BIT(12)
  120. #define GPSR5_RX2_A BIT(11)
  121. #define GPSR5_TX2_A BIT(10)
  122. #define GPSR5_SCK2 BIT(9)
  123. #define GPSR5_RTS1 BIT(8)
  124. #define GPSR5_CTS1 BIT(7)
  125. #define GPSR5_TX1_A BIT(6)
  126. #define GPSR5_RX1_A BIT(5)
  127. #define GPSR5_RTS0 BIT(4)
  128. #define GPSR5_CTS0 BIT(3)
  129. #define GPSR5_TX0 BIT(2)
  130. #define GPSR5_RX0 BIT(1)
  131. #define GPSR5_SCK0 BIT(0)
  132. #define GPSR6_USB31_OVC BIT(31)
  133. #define GPSR6_USB31_PWEN BIT(30)
  134. #define GPSR6_USB30_OVC BIT(29)
  135. #define GPSR6_USB30_PWEN BIT(28)
  136. #define GPSR6_USB1_OVC BIT(27)
  137. #define GPSR6_USB1_PWEN BIT(26)
  138. #define GPSR6_USB0_OVC BIT(25)
  139. #define GPSR6_USB0_PWEN BIT(24)
  140. #define GPSR6_AUDIO_CLKB_B BIT(23)
  141. #define GPSR6_AUDIO_CLKA_A BIT(22)
  142. #define GPSR6_SSI_SDATA9_A BIT(21)
  143. #define GPSR6_SSI_SDATA8 BIT(20)
  144. #define GPSR6_SSI_SDATA7 BIT(19)
  145. #define GPSR6_SSI_WS78 BIT(18)
  146. #define GPSR6_SSI_SCK78 BIT(17)
  147. #define GPSR6_SSI_SDATA6 BIT(16)
  148. #define GPSR6_SSI_WS6 BIT(15)
  149. #define GPSR6_SSI_SCK6 BIT(14)
  150. #define GPSR6_SSI_SDATA5 BIT(13)
  151. #define GPSR6_SSI_WS5 BIT(12)
  152. #define GPSR6_SSI_SCK5 BIT(11)
  153. #define GPSR6_SSI_SDATA4 BIT(10)
  154. #define GPSR6_SSI_WS4 BIT(9)
  155. #define GPSR6_SSI_SCK4 BIT(8)
  156. #define GPSR6_SSI_SDATA3 BIT(7)
  157. #define GPSR6_SSI_WS34 BIT(6)
  158. #define GPSR6_SSI_SCK34 BIT(5)
  159. #define GPSR6_SSI_SDATA2_A BIT(4)
  160. #define GPSR6_SSI_SDATA1_A BIT(3)
  161. #define GPSR6_SSI_SDATA0 BIT(2)
  162. #define GPSR6_SSI_WS0129 BIT(1)
  163. #define GPSR6_SSI_SCK0129 BIT(0)
  164. #define GPSR7_AVS2 BIT(1)
  165. #define GPSR7_AVS1 BIT(0)
  166. #define IPSR_28_FUNC(x) ((uint32_t)(x) << 28U)
  167. #define IPSR_24_FUNC(x) ((uint32_t)(x) << 24U)
  168. #define IPSR_20_FUNC(x) ((uint32_t)(x) << 20U)
  169. #define IPSR_16_FUNC(x) ((uint32_t)(x) << 16U)
  170. #define IPSR_12_FUNC(x) ((uint32_t)(x) << 12U)
  171. #define IPSR_8_FUNC(x) ((uint32_t)(x) << 8U)
  172. #define IPSR_4_FUNC(x) ((uint32_t)(x) << 4U)
  173. #define IPSR_0_FUNC(x) ((uint32_t)(x) << 0U)
  174. #define POC_SD3_DS_33V BIT(29)
  175. #define POC_SD3_DAT7_33V BIT(28)
  176. #define POC_SD3_DAT6_33V BIT(27)
  177. #define POC_SD3_DAT5_33V BIT(26)
  178. #define POC_SD3_DAT4_33V BIT(25)
  179. #define POC_SD3_DAT3_33V BIT(24)
  180. #define POC_SD3_DAT2_33V BIT(23)
  181. #define POC_SD3_DAT1_33V BIT(22)
  182. #define POC_SD3_DAT0_33V BIT(21)
  183. #define POC_SD3_CMD_33V BIT(20)
  184. #define POC_SD3_CLK_33V BIT(19)
  185. #define POC_SD2_DS_33V BIT(18)
  186. #define POC_SD2_DAT3_33V BIT(17)
  187. #define POC_SD2_DAT2_33V BIT(16)
  188. #define POC_SD2_DAT1_33V BIT(15)
  189. #define POC_SD2_DAT0_33V BIT(14)
  190. #define POC_SD2_CMD_33V BIT(13)
  191. #define POC_SD2_CLK_33V BIT(12)
  192. #define POC_SD1_DAT3_33V BIT(11)
  193. #define POC_SD1_DAT2_33V BIT(10)
  194. #define POC_SD1_DAT1_33V BIT(9)
  195. #define POC_SD1_DAT0_33V BIT(8)
  196. #define POC_SD1_CMD_33V BIT(7)
  197. #define POC_SD1_CLK_33V BIT(6)
  198. #define POC_SD0_DAT3_33V BIT(5)
  199. #define POC_SD0_DAT2_33V BIT(4)
  200. #define POC_SD0_DAT1_33V BIT(3)
  201. #define POC_SD0_DAT0_33V BIT(2)
  202. #define POC_SD0_CMD_33V BIT(1)
  203. #define POC_SD0_CLK_33V BIT(0)
  204. #define DRVCTRL0_MASK (0xCCCCCCCCU)
  205. #define DRVCTRL1_MASK (0xCCCCCCC8U)
  206. #define DRVCTRL2_MASK (0x88888888U)
  207. #define DRVCTRL3_MASK (0x88888888U)
  208. #define DRVCTRL4_MASK (0x88888888U)
  209. #define DRVCTRL5_MASK (0x88888888U)
  210. #define DRVCTRL6_MASK (0x88888888U)
  211. #define DRVCTRL7_MASK (0x88888888U)
  212. #define DRVCTRL8_MASK (0x88888888U)
  213. #define DRVCTRL9_MASK (0x88888888U)
  214. #define DRVCTRL10_MASK (0x88888888U)
  215. #define DRVCTRL11_MASK (0x888888CCU)
  216. #define DRVCTRL12_MASK (0xCCCFFFCFU)
  217. #define DRVCTRL13_MASK (0xCC888888U)
  218. #define DRVCTRL14_MASK (0x88888888U)
  219. #define DRVCTRL15_MASK (0x88888888U)
  220. #define DRVCTRL16_MASK (0x88888888U)
  221. #define DRVCTRL17_MASK (0x88888888U)
  222. #define DRVCTRL18_MASK (0x88888888U)
  223. #define DRVCTRL19_MASK (0x88888888U)
  224. #define DRVCTRL20_MASK (0x88888888U)
  225. #define DRVCTRL21_MASK (0x88888888U)
  226. #define DRVCTRL22_MASK (0x88888888U)
  227. #define DRVCTRL23_MASK (0x88888888U)
  228. #define DRVCTRL24_MASK (0x8888888FU)
  229. #define DRVCTRL0_QSPI0_SPCLK(x) ((uint32_t)(x) << 28U)
  230. #define DRVCTRL0_QSPI0_MOSI_IO0(x) ((uint32_t)(x) << 24U)
  231. #define DRVCTRL0_QSPI0_MISO_IO1(x) ((uint32_t)(x) << 20U)
  232. #define DRVCTRL0_QSPI0_IO2(x) ((uint32_t)(x) << 16U)
  233. #define DRVCTRL0_QSPI0_IO3(x) ((uint32_t)(x) << 12U)
  234. #define DRVCTRL0_QSPI0_SSL(x) ((uint32_t)(x) << 8U)
  235. #define DRVCTRL0_QSPI1_SPCLK(x) ((uint32_t)(x) << 4U)
  236. #define DRVCTRL0_QSPI1_MOSI_IO0(x) ((uint32_t)(x) << 0U)
  237. #define DRVCTRL1_QSPI1_MISO_IO1(x) ((uint32_t)(x) << 28U)
  238. #define DRVCTRL1_QSPI1_IO2(x) ((uint32_t)(x) << 24U)
  239. #define DRVCTRL1_QSPI1_IO3(x) ((uint32_t)(x) << 20U)
  240. #define DRVCTRL1_QSPI1_SS(x) ((uint32_t)(x) << 16U)
  241. #define DRVCTRL1_RPC_INT(x) ((uint32_t)(x) << 12U)
  242. #define DRVCTRL1_RPC_WP(x) ((uint32_t)(x) << 8U)
  243. #define DRVCTRL1_RPC_RESET(x) ((uint32_t)(x) << 4U)
  244. #define DRVCTRL1_AVB_RX_CTL(x) ((uint32_t)(x) << 0U)
  245. #define DRVCTRL2_AVB_RXC(x) ((uint32_t)(x) << 28U)
  246. #define DRVCTRL2_AVB_RD0(x) ((uint32_t)(x) << 24U)
  247. #define DRVCTRL2_AVB_RD1(x) ((uint32_t)(x) << 20U)
  248. #define DRVCTRL2_AVB_RD2(x) ((uint32_t)(x) << 16U)
  249. #define DRVCTRL2_AVB_RD3(x) ((uint32_t)(x) << 12U)
  250. #define DRVCTRL2_AVB_TX_CTL(x) ((uint32_t)(x) << 8U)
  251. #define DRVCTRL2_AVB_TXC(x) ((uint32_t)(x) << 4U)
  252. #define DRVCTRL2_AVB_TD0(x) ((uint32_t)(x) << 0U)
  253. #define DRVCTRL3_AVB_TD1(x) ((uint32_t)(x) << 28U)
  254. #define DRVCTRL3_AVB_TD2(x) ((uint32_t)(x) << 24U)
  255. #define DRVCTRL3_AVB_TD3(x) ((uint32_t)(x) << 20U)
  256. #define DRVCTRL3_AVB_TXCREFCLK(x) ((uint32_t)(x) << 16U)
  257. #define DRVCTRL3_AVB_MDIO(x) ((uint32_t)(x) << 12U)
  258. #define DRVCTRL3_AVB_MDC(x) ((uint32_t)(x) << 8U)
  259. #define DRVCTRL3_AVB_MAGIC(x) ((uint32_t)(x) << 4U)
  260. #define DRVCTRL3_AVB_PHY_INT(x) ((uint32_t)(x) << 0U)
  261. #define DRVCTRL4_AVB_LINK(x) ((uint32_t)(x) << 28U)
  262. #define DRVCTRL4_AVB_AVTP_MATCH(x) ((uint32_t)(x) << 24U)
  263. #define DRVCTRL4_AVB_AVTP_CAPTURE(x) ((uint32_t)(x) << 20U)
  264. #define DRVCTRL4_IRQ0(x) ((uint32_t)(x) << 16U)
  265. #define DRVCTRL4_IRQ1(x) ((uint32_t)(x) << 12U)
  266. #define DRVCTRL4_IRQ2(x) ((uint32_t)(x) << 8U)
  267. #define DRVCTRL4_IRQ3(x) ((uint32_t)(x) << 4U)
  268. #define DRVCTRL4_IRQ4(x) ((uint32_t)(x) << 0U)
  269. #define DRVCTRL5_IRQ5(x) ((uint32_t)(x) << 28U)
  270. #define DRVCTRL5_PWM0(x) ((uint32_t)(x) << 24U)
  271. #define DRVCTRL5_PWM1(x) ((uint32_t)(x) << 20U)
  272. #define DRVCTRL5_PWM2(x) ((uint32_t)(x) << 16U)
  273. #define DRVCTRL5_A0(x) ((uint32_t)(x) << 12U)
  274. #define DRVCTRL5_A1(x) ((uint32_t)(x) << 8U)
  275. #define DRVCTRL5_A2(x) ((uint32_t)(x) << 4U)
  276. #define DRVCTRL5_A3(x) ((uint32_t)(x) << 0U)
  277. #define DRVCTRL6_A4(x) ((uint32_t)(x) << 28U)
  278. #define DRVCTRL6_A5(x) ((uint32_t)(x) << 24U)
  279. #define DRVCTRL6_A6(x) ((uint32_t)(x) << 20U)
  280. #define DRVCTRL6_A7(x) ((uint32_t)(x) << 16U)
  281. #define DRVCTRL6_A8(x) ((uint32_t)(x) << 12U)
  282. #define DRVCTRL6_A9(x) ((uint32_t)(x) << 8U)
  283. #define DRVCTRL6_A10(x) ((uint32_t)(x) << 4U)
  284. #define DRVCTRL6_A11(x) ((uint32_t)(x) << 0U)
  285. #define DRVCTRL7_A12(x) ((uint32_t)(x) << 28U)
  286. #define DRVCTRL7_A13(x) ((uint32_t)(x) << 24U)
  287. #define DRVCTRL7_A14(x) ((uint32_t)(x) << 20U)
  288. #define DRVCTRL7_A15(x) ((uint32_t)(x) << 16U)
  289. #define DRVCTRL7_A16(x) ((uint32_t)(x) << 12U)
  290. #define DRVCTRL7_A17(x) ((uint32_t)(x) << 8U)
  291. #define DRVCTRL7_A18(x) ((uint32_t)(x) << 4U)
  292. #define DRVCTRL7_A19(x) ((uint32_t)(x) << 0U)
  293. #define DRVCTRL8_CLKOUT(x) ((uint32_t)(x) << 28U)
  294. #define DRVCTRL8_CS0(x) ((uint32_t)(x) << 24U)
  295. #define DRVCTRL8_CS1_A2(x) ((uint32_t)(x) << 20U)
  296. #define DRVCTRL8_BS(x) ((uint32_t)(x) << 16U)
  297. #define DRVCTRL8_RD(x) ((uint32_t)(x) << 12U)
  298. #define DRVCTRL8_RD_W(x) ((uint32_t)(x) << 8U)
  299. #define DRVCTRL8_WE0(x) ((uint32_t)(x) << 4U)
  300. #define DRVCTRL8_WE1(x) ((uint32_t)(x) << 0U)
  301. #define DRVCTRL9_EX_WAIT0(x) ((uint32_t)(x) << 28U)
  302. #define DRVCTRL9_PRESETOU(x) ((uint32_t)(x) << 24U)
  303. #define DRVCTRL9_D0(x) ((uint32_t)(x) << 20U)
  304. #define DRVCTRL9_D1(x) ((uint32_t)(x) << 16U)
  305. #define DRVCTRL9_D2(x) ((uint32_t)(x) << 12U)
  306. #define DRVCTRL9_D3(x) ((uint32_t)(x) << 8U)
  307. #define DRVCTRL9_D4(x) ((uint32_t)(x) << 4U)
  308. #define DRVCTRL9_D5(x) ((uint32_t)(x) << 0U)
  309. #define DRVCTRL10_D6(x) ((uint32_t)(x) << 28U)
  310. #define DRVCTRL10_D7(x) ((uint32_t)(x) << 24U)
  311. #define DRVCTRL10_D8(x) ((uint32_t)(x) << 20U)
  312. #define DRVCTRL10_D9(x) ((uint32_t)(x) << 16U)
  313. #define DRVCTRL10_D10(x) ((uint32_t)(x) << 12U)
  314. #define DRVCTRL10_D11(x) ((uint32_t)(x) << 8U)
  315. #define DRVCTRL10_D12(x) ((uint32_t)(x) << 4U)
  316. #define DRVCTRL10_D13(x) ((uint32_t)(x) << 0U)
  317. #define DRVCTRL11_D14(x) ((uint32_t)(x) << 28U)
  318. #define DRVCTRL11_D15(x) ((uint32_t)(x) << 24U)
  319. #define DRVCTRL11_AVS1(x) ((uint32_t)(x) << 20U)
  320. #define DRVCTRL11_AVS2(x) ((uint32_t)(x) << 16U)
  321. #define DRVCTRL11_GP7_02(x) ((uint32_t)(x) << 12U)
  322. #define DRVCTRL11_GP7_03(x) ((uint32_t)(x) << 8U)
  323. #define DRVCTRL11_DU_DOTCLKIN0(x) ((uint32_t)(x) << 4U)
  324. #define DRVCTRL11_DU_DOTCLKIN1(x) ((uint32_t)(x) << 0U)
  325. #define DRVCTRL12_DU_DOTCLKIN2(x) ((uint32_t)(x) << 28U)
  326. #define DRVCTRL12_DU_DOTCLKIN3(x) ((uint32_t)(x) << 24U)
  327. #define DRVCTRL12_DU_FSCLKST(x) ((uint32_t)(x) << 20U)
  328. #define DRVCTRL12_DU_TMS(x) ((uint32_t)(x) << 4U)
  329. #define DRVCTRL13_TDO(x) ((uint32_t)(x) << 28U)
  330. #define DRVCTRL13_ASEBRK(x) ((uint32_t)(x) << 24U)
  331. #define DRVCTRL13_SD0_CLK(x) ((uint32_t)(x) << 20U)
  332. #define DRVCTRL13_SD0_CMD(x) ((uint32_t)(x) << 16U)
  333. #define DRVCTRL13_SD0_DAT0(x) ((uint32_t)(x) << 12U)
  334. #define DRVCTRL13_SD0_DAT1(x) ((uint32_t)(x) << 8U)
  335. #define DRVCTRL13_SD0_DAT2(x) ((uint32_t)(x) << 4U)
  336. #define DRVCTRL13_SD0_DAT3(x) ((uint32_t)(x) << 0U)
  337. #define DRVCTRL14_SD1_CLK(x) ((uint32_t)(x) << 28U)
  338. #define DRVCTRL14_SD1_CMD(x) ((uint32_t)(x) << 24U)
  339. #define DRVCTRL14_SD1_DAT0(x) ((uint32_t)(x) << 20U)
  340. #define DRVCTRL14_SD1_DAT1(x) ((uint32_t)(x) << 16U)
  341. #define DRVCTRL14_SD1_DAT2(x) ((uint32_t)(x) << 12U)
  342. #define DRVCTRL14_SD1_DAT3(x) ((uint32_t)(x) << 8U)
  343. #define DRVCTRL14_SD2_CLK(x) ((uint32_t)(x) << 4U)
  344. #define DRVCTRL14_SD2_CMD(x) ((uint32_t)(x) << 0U)
  345. #define DRVCTRL15_SD2_DAT0(x) ((uint32_t)(x) << 28U)
  346. #define DRVCTRL15_SD2_DAT1(x) ((uint32_t)(x) << 24U)
  347. #define DRVCTRL15_SD2_DAT2(x) ((uint32_t)(x) << 20U)
  348. #define DRVCTRL15_SD2_DAT3(x) ((uint32_t)(x) << 16U)
  349. #define DRVCTRL15_SD2_DS(x) ((uint32_t)(x) << 12U)
  350. #define DRVCTRL15_SD3_CLK(x) ((uint32_t)(x) << 8U)
  351. #define DRVCTRL15_SD3_CMD(x) ((uint32_t)(x) << 4U)
  352. #define DRVCTRL15_SD3_DAT0(x) ((uint32_t)(x) << 0U)
  353. #define DRVCTRL16_SD3_DAT1(x) ((uint32_t)(x) << 28U)
  354. #define DRVCTRL16_SD3_DAT2(x) ((uint32_t)(x) << 24U)
  355. #define DRVCTRL16_SD3_DAT3(x) ((uint32_t)(x) << 20U)
  356. #define DRVCTRL16_SD3_DAT4(x) ((uint32_t)(x) << 16U)
  357. #define DRVCTRL16_SD3_DAT5(x) ((uint32_t)(x) << 12U)
  358. #define DRVCTRL16_SD3_DAT6(x) ((uint32_t)(x) << 8U)
  359. #define DRVCTRL16_SD3_DAT7(x) ((uint32_t)(x) << 4U)
  360. #define DRVCTRL16_SD3_DS(x) ((uint32_t)(x) << 0U)
  361. #define DRVCTRL17_SD0_CD(x) ((uint32_t)(x) << 28U)
  362. #define DRVCTRL17_SD0_WP(x) ((uint32_t)(x) << 24U)
  363. #define DRVCTRL17_SD1_CD(x) ((uint32_t)(x) << 20U)
  364. #define DRVCTRL17_SD1_WP(x) ((uint32_t)(x) << 16U)
  365. #define DRVCTRL17_SCK0(x) ((uint32_t)(x) << 12U)
  366. #define DRVCTRL17_RX0(x) ((uint32_t)(x) << 8U)
  367. #define DRVCTRL17_TX0(x) ((uint32_t)(x) << 4U)
  368. #define DRVCTRL17_CTS0(x) ((uint32_t)(x) << 0U)
  369. #define DRVCTRL18_RTS0_TANS(x) ((uint32_t)(x) << 28U)
  370. #define DRVCTRL18_RX1(x) ((uint32_t)(x) << 24U)
  371. #define DRVCTRL18_TX1(x) ((uint32_t)(x) << 20U)
  372. #define DRVCTRL18_CTS1(x) ((uint32_t)(x) << 16U)
  373. #define DRVCTRL18_RTS1_TANS(x) ((uint32_t)(x) << 12U)
  374. #define DRVCTRL18_SCK2(x) ((uint32_t)(x) << 8U)
  375. #define DRVCTRL18_TX2(x) ((uint32_t)(x) << 4U)
  376. #define DRVCTRL18_RX2(x) ((uint32_t)(x) << 0U)
  377. #define DRVCTRL19_HSCK0(x) ((uint32_t)(x) << 28U)
  378. #define DRVCTRL19_HRX0(x) ((uint32_t)(x) << 24U)
  379. #define DRVCTRL19_HTX0(x) ((uint32_t)(x) << 20U)
  380. #define DRVCTRL19_HCTS0(x) ((uint32_t)(x) << 16U)
  381. #define DRVCTRL19_HRTS0(x) ((uint32_t)(x) << 12U)
  382. #define DRVCTRL19_MSIOF0_SCK(x) ((uint32_t)(x) << 8U)
  383. #define DRVCTRL19_MSIOF0_SYNC(x) ((uint32_t)(x) << 4U)
  384. #define DRVCTRL19_MSIOF0_SS1(x) ((uint32_t)(x) << 0U)
  385. #define DRVCTRL20_MSIOF0_TXD(x) ((uint32_t)(x) << 28U)
  386. #define DRVCTRL20_MSIOF0_SS2(x) ((uint32_t)(x) << 24U)
  387. #define DRVCTRL20_MSIOF0_RXD(x) ((uint32_t)(x) << 20U)
  388. #define DRVCTRL20_MLB_CLK(x) ((uint32_t)(x) << 16U)
  389. #define DRVCTRL20_MLB_SIG(x) ((uint32_t)(x) << 12U)
  390. #define DRVCTRL20_MLB_DAT(x) ((uint32_t)(x) << 8U)
  391. #define DRVCTRL20_MLB_REF(x) ((uint32_t)(x) << 4U)
  392. #define DRVCTRL20_SSI_SCK0129(x) ((uint32_t)(x) << 0U)
  393. #define DRVCTRL21_SSI_WS0129(x) ((uint32_t)(x) << 28U)
  394. #define DRVCTRL21_SSI_SDATA0(x) ((uint32_t)(x) << 24U)
  395. #define DRVCTRL21_SSI_SDATA1(x) ((uint32_t)(x) << 20U)
  396. #define DRVCTRL21_SSI_SDATA2(x) ((uint32_t)(x) << 16U)
  397. #define DRVCTRL21_SSI_SCK34(x) ((uint32_t)(x) << 12U)
  398. #define DRVCTRL21_SSI_WS34(x) ((uint32_t)(x) << 8U)
  399. #define DRVCTRL21_SSI_SDATA3(x) ((uint32_t)(x) << 4U)
  400. #define DRVCTRL21_SSI_SCK4(x) ((uint32_t)(x) << 0U)
  401. #define DRVCTRL22_SSI_WS4(x) ((uint32_t)(x) << 28U)
  402. #define DRVCTRL22_SSI_SDATA4(x) ((uint32_t)(x) << 24U)
  403. #define DRVCTRL22_SSI_SCK5(x) ((uint32_t)(x) << 20U)
  404. #define DRVCTRL22_SSI_WS5(x) ((uint32_t)(x) << 16U)
  405. #define DRVCTRL22_SSI_SDATA5(x) ((uint32_t)(x) << 12U)
  406. #define DRVCTRL22_SSI_SCK6(x) ((uint32_t)(x) << 8U)
  407. #define DRVCTRL22_SSI_WS6(x) ((uint32_t)(x) << 4U)
  408. #define DRVCTRL22_SSI_SDATA6(x) ((uint32_t)(x) << 0U)
  409. #define DRVCTRL23_SSI_SCK78(x) ((uint32_t)(x) << 28U)
  410. #define DRVCTRL23_SSI_WS78(x) ((uint32_t)(x) << 24U)
  411. #define DRVCTRL23_SSI_SDATA7(x) ((uint32_t)(x) << 20U)
  412. #define DRVCTRL23_SSI_SDATA8(x) ((uint32_t)(x) << 16U)
  413. #define DRVCTRL23_SSI_SDATA9(x) ((uint32_t)(x) << 12U)
  414. #define DRVCTRL23_AUDIO_CLKA(x) ((uint32_t)(x) << 8U)
  415. #define DRVCTRL23_AUDIO_CLKB(x) ((uint32_t)(x) << 4U)
  416. #define DRVCTRL23_USB0_PWEN(x) ((uint32_t)(x) << 0U)
  417. #define DRVCTRL24_USB0_OVC(x) ((uint32_t)(x) << 28U)
  418. #define DRVCTRL24_USB1_PWEN(x) ((uint32_t)(x) << 24U)
  419. #define DRVCTRL24_USB1_OVC(x) ((uint32_t)(x) << 20U)
  420. #define DRVCTRL24_USB30_PWEN(x) ((uint32_t)(x) << 16U)
  421. #define DRVCTRL24_USB30_OVC(x) ((uint32_t)(x) << 12U)
  422. #define DRVCTRL24_USB31_PWEN(x) ((uint32_t)(x) << 8U)
  423. #define DRVCTRL24_USB31_OVC(x) ((uint32_t)(x) << 4U)
  424. #define MOD_SEL0_MSIOF3_A ((uint32_t)0U << 29U)
  425. #define MOD_SEL0_MSIOF3_B ((uint32_t)1U << 29U)
  426. #define MOD_SEL0_MSIOF3_C ((uint32_t)2U << 29U)
  427. #define MOD_SEL0_MSIOF3_D ((uint32_t)3U << 29U)
  428. #define MOD_SEL0_MSIOF3_E ((uint32_t)4U << 29U)
  429. #define MOD_SEL0_MSIOF2_A ((uint32_t)0U << 27U)
  430. #define MOD_SEL0_MSIOF2_B ((uint32_t)1U << 27U)
  431. #define MOD_SEL0_MSIOF2_C ((uint32_t)2U << 27U)
  432. #define MOD_SEL0_MSIOF2_D ((uint32_t)3U << 27U)
  433. #define MOD_SEL0_MSIOF1_A ((uint32_t)0U << 24U)
  434. #define MOD_SEL0_MSIOF1_B ((uint32_t)1U << 24U)
  435. #define MOD_SEL0_MSIOF1_C ((uint32_t)2U << 24U)
  436. #define MOD_SEL0_MSIOF1_D ((uint32_t)3U << 24U)
  437. #define MOD_SEL0_MSIOF1_E ((uint32_t)4U << 24U)
  438. #define MOD_SEL0_MSIOF1_F ((uint32_t)5U << 24U)
  439. #define MOD_SEL0_MSIOF1_G ((uint32_t)6U << 24U)
  440. #define MOD_SEL0_LBSC_A ((uint32_t)0U << 23U)
  441. #define MOD_SEL0_LBSC_B ((uint32_t)1U << 23U)
  442. #define MOD_SEL0_IEBUS_A ((uint32_t)0U << 22U)
  443. #define MOD_SEL0_IEBUS_B ((uint32_t)1U << 22U)
  444. #define MOD_SEL0_I2C2_A ((uint32_t)0U << 21U)
  445. #define MOD_SEL0_I2C2_B ((uint32_t)1U << 21U)
  446. #define MOD_SEL0_I2C1_A ((uint32_t)0U << 20U)
  447. #define MOD_SEL0_I2C1_B ((uint32_t)1U << 20U)
  448. #define MOD_SEL0_HSCIF4_A ((uint32_t)0U << 19U)
  449. #define MOD_SEL0_HSCIF4_B ((uint32_t)1U << 19U)
  450. #define MOD_SEL0_HSCIF3_A ((uint32_t)0U << 17U)
  451. #define MOD_SEL0_HSCIF3_B ((uint32_t)1U << 17U)
  452. #define MOD_SEL0_HSCIF3_C ((uint32_t)2U << 17U)
  453. #define MOD_SEL0_HSCIF3_D ((uint32_t)3U << 17U)
  454. #define MOD_SEL0_HSCIF1_A ((uint32_t)0U << 16U)
  455. #define MOD_SEL0_HSCIF1_B ((uint32_t)1U << 16U)
  456. #define MOD_SEL0_FSO_A ((uint32_t)0U << 15U)
  457. #define MOD_SEL0_FSO_B ((uint32_t)1U << 15U)
  458. #define MOD_SEL0_HSCIF2_A ((uint32_t)0U << 13U)
  459. #define MOD_SEL0_HSCIF2_B ((uint32_t)1U << 13U)
  460. #define MOD_SEL0_HSCIF2_C ((uint32_t)2U << 13U)
  461. #define MOD_SEL0_ETHERAVB_A ((uint32_t)0U << 12U)
  462. #define MOD_SEL0_ETHERAVB_B ((uint32_t)1U << 12U)
  463. #define MOD_SEL0_DRIF3_A ((uint32_t)0U << 11U)
  464. #define MOD_SEL0_DRIF3_B ((uint32_t)1U << 11U)
  465. #define MOD_SEL0_DRIF2_A ((uint32_t)0U << 10U)
  466. #define MOD_SEL0_DRIF2_B ((uint32_t)1U << 10U)
  467. #define MOD_SEL0_DRIF1_A ((uint32_t)0U << 8U)
  468. #define MOD_SEL0_DRIF1_B ((uint32_t)1U << 8U)
  469. #define MOD_SEL0_DRIF1_C ((uint32_t)2U << 8U)
  470. #define MOD_SEL0_DRIF0_A ((uint32_t)0U << 6U)
  471. #define MOD_SEL0_DRIF0_B ((uint32_t)1U << 6U)
  472. #define MOD_SEL0_DRIF0_C ((uint32_t)2U << 6U)
  473. #define MOD_SEL0_CANFD0_A ((uint32_t)0U << 5U)
  474. #define MOD_SEL0_CANFD0_B ((uint32_t)1U << 5U)
  475. #define MOD_SEL0_ADG_A_A ((uint32_t)0U << 3U)
  476. #define MOD_SEL0_ADG_A_B ((uint32_t)1U << 3U)
  477. #define MOD_SEL0_ADG_A_C ((uint32_t)2U << 3U)
  478. #define MOD_SEL1_TSIF1_A ((uint32_t)0U << 30U)
  479. #define MOD_SEL1_TSIF1_B ((uint32_t)1U << 30U)
  480. #define MOD_SEL1_TSIF1_C ((uint32_t)2U << 30U)
  481. #define MOD_SEL1_TSIF1_D ((uint32_t)3U << 30U)
  482. #define MOD_SEL1_TSIF0_A ((uint32_t)0U << 27U)
  483. #define MOD_SEL1_TSIF0_B ((uint32_t)1U << 27U)
  484. #define MOD_SEL1_TSIF0_C ((uint32_t)2U << 27U)
  485. #define MOD_SEL1_TSIF0_D ((uint32_t)3U << 27U)
  486. #define MOD_SEL1_TSIF0_E ((uint32_t)4U << 27U)
  487. #define MOD_SEL1_TIMER_TMU_A ((uint32_t)0U << 26U)
  488. #define MOD_SEL1_TIMER_TMU_B ((uint32_t)1U << 26U)
  489. #define MOD_SEL1_SSP1_1_A ((uint32_t)0U << 24U)
  490. #define MOD_SEL1_SSP1_1_B ((uint32_t)1U << 24U)
  491. #define MOD_SEL1_SSP1_1_C ((uint32_t)2U << 24U)
  492. #define MOD_SEL1_SSP1_1_D ((uint32_t)3U << 24U)
  493. #define MOD_SEL1_SSP1_0_A ((uint32_t)0U << 21U)
  494. #define MOD_SEL1_SSP1_0_B ((uint32_t)1U << 21U)
  495. #define MOD_SEL1_SSP1_0_C ((uint32_t)2U << 21U)
  496. #define MOD_SEL1_SSP1_0_D ((uint32_t)3U << 21U)
  497. #define MOD_SEL1_SSP1_0_E ((uint32_t)4U << 21U)
  498. #define MOD_SEL1_SSI_A ((uint32_t)0U << 20U)
  499. #define MOD_SEL1_SSI_B ((uint32_t)1U << 20U)
  500. #define MOD_SEL1_SPEED_PULSE_IF_A ((uint32_t)0U << 19U)
  501. #define MOD_SEL1_SPEED_PULSE_IF_B ((uint32_t)1U << 19U)
  502. #define MOD_SEL1_SIMCARD_A ((uint32_t)0U << 17U)
  503. #define MOD_SEL1_SIMCARD_B ((uint32_t)1U << 17U)
  504. #define MOD_SEL1_SIMCARD_C ((uint32_t)2U << 17U)
  505. #define MOD_SEL1_SIMCARD_D ((uint32_t)3U << 17U)
  506. #define MOD_SEL1_SDHI2_A ((uint32_t)0U << 16U)
  507. #define MOD_SEL1_SDHI2_B ((uint32_t)1U << 16U)
  508. #define MOD_SEL1_SCIF4_A ((uint32_t)0U << 14U)
  509. #define MOD_SEL1_SCIF4_B ((uint32_t)1U << 14U)
  510. #define MOD_SEL1_SCIF4_C ((uint32_t)2U << 14U)
  511. #define MOD_SEL1_SCIF3_A ((uint32_t)0U << 13U)
  512. #define MOD_SEL1_SCIF3_B ((uint32_t)1U << 13U)
  513. #define MOD_SEL1_SCIF2_A ((uint32_t)0U << 12U)
  514. #define MOD_SEL1_SCIF2_B ((uint32_t)1U << 12U)
  515. #define MOD_SEL1_SCIF1_A ((uint32_t)0U << 11U)
  516. #define MOD_SEL1_SCIF1_B ((uint32_t)1U << 11U)
  517. #define MOD_SEL1_SCIF_A ((uint32_t)0U << 10U)
  518. #define MOD_SEL1_SCIF_B ((uint32_t)1U << 10U)
  519. #define MOD_SEL1_REMOCON_A ((uint32_t)0U << 9U)
  520. #define MOD_SEL1_REMOCON_B ((uint32_t)1U << 9U)
  521. #define MOD_SEL1_RCAN0_A ((uint32_t)0U << 6U)
  522. #define MOD_SEL1_RCAN0_B ((uint32_t)1U << 6U)
  523. #define MOD_SEL1_PWM6_A ((uint32_t)0U << 5U)
  524. #define MOD_SEL1_PWM6_B ((uint32_t)1U << 5U)
  525. #define MOD_SEL1_PWM5_A ((uint32_t)0U << 4U)
  526. #define MOD_SEL1_PWM5_B ((uint32_t)1U << 4U)
  527. #define MOD_SEL1_PWM4_A ((uint32_t)0U << 3U)
  528. #define MOD_SEL1_PWM4_B ((uint32_t)1U << 3U)
  529. #define MOD_SEL1_PWM3_A ((uint32_t)0U << 2U)
  530. #define MOD_SEL1_PWM3_B ((uint32_t)1U << 2U)
  531. #define MOD_SEL1_PWM2_A ((uint32_t)0U << 1U)
  532. #define MOD_SEL1_PWM2_B ((uint32_t)1U << 1U)
  533. #define MOD_SEL1_PWM1_A ((uint32_t)0U << 0U)
  534. #define MOD_SEL1_PWM1_B ((uint32_t)1U << 0U)
  535. #define MOD_SEL2_I2C_5_A ((uint32_t)0U << 31U)
  536. #define MOD_SEL2_I2C_5_B ((uint32_t)1U << 31U)
  537. #define MOD_SEL2_I2C_3_A ((uint32_t)0U << 30U)
  538. #define MOD_SEL2_I2C_3_B ((uint32_t)1U << 30U)
  539. #define MOD_SEL2_I2C_0_A ((uint32_t)0U << 29U)
  540. #define MOD_SEL2_I2C_0_B ((uint32_t)1U << 29U)
  541. #define MOD_SEL2_FM_A ((uint32_t)0U << 27U)
  542. #define MOD_SEL2_FM_B ((uint32_t)1U << 27U)
  543. #define MOD_SEL2_FM_C ((uint32_t)2U << 27U)
  544. #define MOD_SEL2_FM_D ((uint32_t)3U << 27U)
  545. #define MOD_SEL2_SCIF5_A ((uint32_t)0U << 26U)
  546. #define MOD_SEL2_SCIF5_B ((uint32_t)1U << 26U)
  547. #define MOD_SEL2_I2C6_A ((uint32_t)0U << 23U)
  548. #define MOD_SEL2_I2C6_B ((uint32_t)1U << 23U)
  549. #define MOD_SEL2_I2C6_C ((uint32_t)2U << 23U)
  550. #define MOD_SEL2_NDF_A ((uint32_t)0U << 22U)
  551. #define MOD_SEL2_NDF_B ((uint32_t)1U << 22U)
  552. #define MOD_SEL2_SSI2_A ((uint32_t)0U << 21U)
  553. #define MOD_SEL2_SSI2_B ((uint32_t)1U << 21U)
  554. #define MOD_SEL2_SSI9_A ((uint32_t)0U << 20U)
  555. #define MOD_SEL2_SSI9_B ((uint32_t)1U << 20U)
  556. #define MOD_SEL2_TIMER_TMU2_A ((uint32_t)0U << 19U)
  557. #define MOD_SEL2_TIMER_TMU2_B ((uint32_t)1U << 19U)
  558. #define MOD_SEL2_ADG_B_A ((uint32_t)0U << 18U)
  559. #define MOD_SEL2_ADG_B_B ((uint32_t)1U << 18U)
  560. #define MOD_SEL2_ADG_C_A ((uint32_t)0U << 17U)
  561. #define MOD_SEL2_ADG_C_B ((uint32_t)1U << 17U)
  562. #define MOD_SEL2_VIN4_A ((uint32_t)0U << 0U)
  563. #define MOD_SEL2_VIN4_B ((uint32_t)1U << 0U)
  564. /* SCIF3 Registers for Dummy write */
  565. #define SCIF3_BASE (0xE6C50000U)
  566. #define SCIF3_SCFCR (SCIF3_BASE + 0x0018U)
  567. #define SCIF3_SCFDR (SCIF3_BASE + 0x001CU)
  568. #define SCFCR_DATA (0x0000U)
  569. /* Realtime module stop control */
  570. #define CPG_BASE (0xE6150000U)
  571. #define CPG_SCMSTPCR0 (CPG_BASE + 0x0B20U)
  572. #define CPG_MSTPSR0 (CPG_BASE + 0x0030U)
  573. #define SCMSTPCR0_RTDMAC (0x00200000U)
  574. /* RT-DMAC Registers */
  575. #define RTDMAC_CH (0U) /* choose 0 to 15 */
  576. #define RTDMAC_BASE (0xFFC10000U)
  577. #define RTDMAC_RDMOR (RTDMAC_BASE + 0x0060U)
  578. #define RTDMAC_RDMCHCLR (RTDMAC_BASE + 0x0080U)
  579. #define RTDMAC_RDMSAR(x) (RTDMAC_BASE + 0x8000U + (0x80U * (x)))
  580. #define RTDMAC_RDMDAR(x) (RTDMAC_BASE + 0x8004U + (0x80U * (x)))
  581. #define RTDMAC_RDMTCR(x) (RTDMAC_BASE + 0x8008U + (0x80U * (x)))
  582. #define RTDMAC_RDMCHCR(x) (RTDMAC_BASE + 0x800CU + (0x80U * (x)))
  583. #define RTDMAC_RDMCHCRB(x) (RTDMAC_BASE + 0x801CU + (0x80U * (x)))
  584. #define RTDMAC_RDMDPBASE(x) (RTDMAC_BASE + 0x8050U + (0x80U * (x)))
  585. #define RTDMAC_DESC_BASE (RTDMAC_BASE + 0xA000U)
  586. #define RTDMAC_DESC_RDMSAR (RTDMAC_DESC_BASE + 0x0000U)
  587. #define RTDMAC_DESC_RDMDAR (RTDMAC_DESC_BASE + 0x0004U)
  588. #define RTDMAC_DESC_RDMTCR (RTDMAC_DESC_BASE + 0x0008U)
  589. #define RDMOR_DME (0x0001U) /* DMA Master Enable */
  590. #define RDMCHCR_DPM_INFINITE (0x30000000U) /* Infinite repeat mode */
  591. #define RDMCHCR_RPT_TCR (0x02000000U) /* enable to update TCR */
  592. #define RDMCHCR_TS_2 (0x00000008U) /* Word(2byte) units transfer */
  593. #define RDMCHCR_RS_AUTO (0x00000400U) /* Auto request */
  594. #define RDMCHCR_DE (0x00000001U) /* DMA Enable */
  595. #define RDMCHCRB_DRST (0x00008000U) /* Descriptor reset */
  596. #define RDMCHCRB_SLM_256 (0x00000080U) /* once in 256 clock cycle */
  597. #define RDMDPBASE_SEL_EXT (0x00000001U) /* External memory use */
  598. static void start_rtdma0_descriptor(void)
  599. {
  600. uint32_t reg;
  601. reg = mmio_read_32(RCAR_PRR);
  602. reg &= (PRR_PRODUCT_MASK | PRR_CUT_MASK);
  603. if (reg == (PRR_PRODUCT_M3_CUT10)) {
  604. /* Enable clock supply to RTDMAC. */
  605. mstpcr_write(CPG_SCMSTPCR0, CPG_MSTPSR0, SCMSTPCR0_RTDMAC);
  606. /* Initialize ch0, Reset Descriptor */
  607. mmio_write_32(RTDMAC_RDMCHCLR, BIT(RTDMAC_CH));
  608. mmio_write_32(RTDMAC_RDMCHCRB(RTDMAC_CH), RDMCHCRB_DRST);
  609. /* Enable DMA */
  610. mmio_write_16(RTDMAC_RDMOR, RDMOR_DME);
  611. /* Set first transfer */
  612. mmio_write_32(RTDMAC_RDMSAR(RTDMAC_CH), RCAR_PRR);
  613. mmio_write_32(RTDMAC_RDMDAR(RTDMAC_CH), SCIF3_SCFDR);
  614. mmio_write_32(RTDMAC_RDMTCR(RTDMAC_CH), 0x00000001U);
  615. /* Set descriptor */
  616. mmio_write_32(RTDMAC_DESC_RDMSAR, 0x00000000U);
  617. mmio_write_32(RTDMAC_DESC_RDMDAR, 0x00000000U);
  618. mmio_write_32(RTDMAC_DESC_RDMTCR, 0x00200000U);
  619. mmio_write_32(RTDMAC_RDMCHCRB(RTDMAC_CH), RDMCHCRB_SLM_256);
  620. mmio_write_32(RTDMAC_RDMDPBASE(RTDMAC_CH), RTDMAC_DESC_BASE
  621. | RDMDPBASE_SEL_EXT);
  622. /* Set transfer parameter, Start transfer */
  623. mmio_write_32(RTDMAC_RDMCHCR(RTDMAC_CH), RDMCHCR_DPM_INFINITE
  624. | RDMCHCR_RPT_TCR
  625. | RDMCHCR_TS_2
  626. | RDMCHCR_RS_AUTO
  627. | RDMCHCR_DE);
  628. }
  629. }
  630. static void pfc_reg_write(uint32_t addr, uint32_t data)
  631. {
  632. uint32_t prr;
  633. prr = mmio_read_32(RCAR_PRR);
  634. prr &= (PRR_PRODUCT_MASK | PRR_CUT_MASK);
  635. mmio_write_32(PFC_PMMR, ~data);
  636. if (prr == (PRR_PRODUCT_M3_CUT10)) {
  637. mmio_write_16(SCIF3_SCFCR, SCFCR_DATA); /* Dummy write */
  638. }
  639. mmio_write_32((uintptr_t)addr, data);
  640. if (prr == (PRR_PRODUCT_M3_CUT10)) {
  641. mmio_write_16(SCIF3_SCFCR, SCFCR_DATA); /* Dummy write */
  642. }
  643. }
  644. void pfc_init_g2m(void)
  645. {
  646. uint32_t reg;
  647. /*
  648. * PFC write access problem seen on older SoC's. Added a workaround
  649. * in RT-DMAC for fixing the same.
  650. */
  651. start_rtdma0_descriptor();
  652. /* initialize module select */
  653. pfc_reg_write(PFC_MOD_SEL0, MOD_SEL0_MSIOF3_A
  654. | MOD_SEL0_MSIOF2_A
  655. | MOD_SEL0_MSIOF1_A
  656. | MOD_SEL0_LBSC_A
  657. | MOD_SEL0_IEBUS_A
  658. | MOD_SEL0_I2C2_A
  659. | MOD_SEL0_I2C1_A
  660. | MOD_SEL0_HSCIF4_A
  661. | MOD_SEL0_HSCIF3_A
  662. | MOD_SEL0_HSCIF1_A
  663. | MOD_SEL0_FSO_A
  664. | MOD_SEL0_HSCIF2_A
  665. | MOD_SEL0_ETHERAVB_A
  666. | MOD_SEL0_DRIF3_A
  667. | MOD_SEL0_DRIF2_A
  668. | MOD_SEL0_DRIF1_A
  669. | MOD_SEL0_DRIF0_A
  670. | MOD_SEL0_CANFD0_A
  671. | MOD_SEL0_ADG_A_A);
  672. pfc_reg_write(PFC_MOD_SEL1, MOD_SEL1_TSIF1_A
  673. | MOD_SEL1_TSIF0_A
  674. | MOD_SEL1_TIMER_TMU_A
  675. | MOD_SEL1_SSP1_1_A
  676. | MOD_SEL1_SSP1_0_A
  677. | MOD_SEL1_SSI_A
  678. | MOD_SEL1_SPEED_PULSE_IF_A
  679. | MOD_SEL1_SIMCARD_A
  680. | MOD_SEL1_SDHI2_A
  681. | MOD_SEL1_SCIF4_A
  682. | MOD_SEL1_SCIF3_A
  683. | MOD_SEL1_SCIF2_A
  684. | MOD_SEL1_SCIF1_A
  685. | MOD_SEL1_SCIF_A
  686. | MOD_SEL1_REMOCON_A
  687. | MOD_SEL1_RCAN0_A
  688. | MOD_SEL1_PWM6_A
  689. | MOD_SEL1_PWM5_A
  690. | MOD_SEL1_PWM4_A
  691. | MOD_SEL1_PWM3_A
  692. | MOD_SEL1_PWM2_A
  693. | MOD_SEL1_PWM1_A);
  694. pfc_reg_write(PFC_MOD_SEL2, MOD_SEL2_I2C_5_B
  695. | MOD_SEL2_I2C_3_B
  696. | MOD_SEL2_I2C_0_B
  697. | MOD_SEL2_FM_A
  698. | MOD_SEL2_SCIF5_A
  699. | MOD_SEL2_I2C6_A
  700. | MOD_SEL2_NDF_A
  701. | MOD_SEL2_SSI2_A
  702. | MOD_SEL2_SSI9_A
  703. | MOD_SEL2_TIMER_TMU2_A
  704. | MOD_SEL2_ADG_B_A
  705. | MOD_SEL2_ADG_C_A
  706. | MOD_SEL2_VIN4_A);
  707. /* initialize peripheral function select */
  708. pfc_reg_write(PFC_IPSR0, IPSR_28_FUNC(0)
  709. | IPSR_24_FUNC(0)
  710. | IPSR_20_FUNC(0)
  711. | IPSR_16_FUNC(0)
  712. | IPSR_12_FUNC(0)
  713. | IPSR_8_FUNC(0)
  714. | IPSR_4_FUNC(0)
  715. | IPSR_0_FUNC(0));
  716. pfc_reg_write(PFC_IPSR1, IPSR_28_FUNC(6)
  717. | IPSR_24_FUNC(0)
  718. | IPSR_20_FUNC(0)
  719. | IPSR_16_FUNC(0)
  720. | IPSR_12_FUNC(3)
  721. | IPSR_8_FUNC(3)
  722. | IPSR_4_FUNC(3)
  723. | IPSR_0_FUNC(3));
  724. pfc_reg_write(PFC_IPSR2, IPSR_28_FUNC(0)
  725. | IPSR_24_FUNC(6)
  726. | IPSR_20_FUNC(6)
  727. | IPSR_16_FUNC(6)
  728. | IPSR_12_FUNC(6)
  729. | IPSR_8_FUNC(6)
  730. | IPSR_4_FUNC(6)
  731. | IPSR_0_FUNC(6));
  732. pfc_reg_write(PFC_IPSR3, IPSR_28_FUNC(6)
  733. | IPSR_24_FUNC(6)
  734. | IPSR_20_FUNC(6)
  735. | IPSR_16_FUNC(6)
  736. | IPSR_12_FUNC(6)
  737. | IPSR_8_FUNC(0)
  738. | IPSR_4_FUNC(0)
  739. | IPSR_0_FUNC(0));
  740. pfc_reg_write(PFC_IPSR4, IPSR_28_FUNC(0)
  741. | IPSR_24_FUNC(0)
  742. | IPSR_20_FUNC(0)
  743. | IPSR_16_FUNC(0)
  744. | IPSR_12_FUNC(0)
  745. | IPSR_8_FUNC(6)
  746. | IPSR_4_FUNC(6)
  747. | IPSR_0_FUNC(6));
  748. pfc_reg_write(PFC_IPSR5, IPSR_28_FUNC(0)
  749. | IPSR_24_FUNC(0)
  750. | IPSR_20_FUNC(0)
  751. | IPSR_16_FUNC(0)
  752. | IPSR_12_FUNC(0)
  753. | IPSR_8_FUNC(6)
  754. | IPSR_4_FUNC(0)
  755. | IPSR_0_FUNC(0));
  756. pfc_reg_write(PFC_IPSR6, IPSR_28_FUNC(6)
  757. | IPSR_24_FUNC(6)
  758. | IPSR_20_FUNC(6)
  759. | IPSR_16_FUNC(6)
  760. | IPSR_12_FUNC(6)
  761. | IPSR_8_FUNC(0)
  762. | IPSR_4_FUNC(0)
  763. | IPSR_0_FUNC(0));
  764. pfc_reg_write(PFC_IPSR7, IPSR_28_FUNC(0)
  765. | IPSR_24_FUNC(0)
  766. | IPSR_20_FUNC(0)
  767. | IPSR_16_FUNC(0)
  768. | IPSR_12_FUNC(0)
  769. | IPSR_8_FUNC(6)
  770. | IPSR_4_FUNC(6)
  771. | IPSR_0_FUNC(6));
  772. pfc_reg_write(PFC_IPSR8, IPSR_28_FUNC(1)
  773. | IPSR_24_FUNC(1)
  774. | IPSR_20_FUNC(1)
  775. | IPSR_16_FUNC(1)
  776. | IPSR_12_FUNC(0)
  777. | IPSR_8_FUNC(0)
  778. | IPSR_4_FUNC(0)
  779. | IPSR_0_FUNC(0));
  780. pfc_reg_write(PFC_IPSR9, IPSR_28_FUNC(0)
  781. | IPSR_24_FUNC(0)
  782. | IPSR_20_FUNC(0)
  783. | IPSR_16_FUNC(0)
  784. | IPSR_12_FUNC(0)
  785. | IPSR_8_FUNC(0)
  786. | IPSR_4_FUNC(0)
  787. | IPSR_0_FUNC(0));
  788. pfc_reg_write(PFC_IPSR10, IPSR_28_FUNC(0)
  789. | IPSR_24_FUNC(0)
  790. | IPSR_20_FUNC(0)
  791. | IPSR_16_FUNC(0)
  792. | IPSR_12_FUNC(0)
  793. | IPSR_8_FUNC(0)
  794. | IPSR_4_FUNC(0)
  795. | IPSR_0_FUNC(0));
  796. pfc_reg_write(PFC_IPSR11, IPSR_28_FUNC(0)
  797. | IPSR_24_FUNC(4)
  798. | IPSR_20_FUNC(0)
  799. | IPSR_16_FUNC(0)
  800. | IPSR_12_FUNC(0)
  801. | IPSR_8_FUNC(0)
  802. | IPSR_4_FUNC(0)
  803. | IPSR_0_FUNC(0));
  804. pfc_reg_write(PFC_IPSR12, IPSR_28_FUNC(0)
  805. | IPSR_24_FUNC(0)
  806. | IPSR_20_FUNC(0)
  807. | IPSR_16_FUNC(0)
  808. | IPSR_12_FUNC(0)
  809. | IPSR_8_FUNC(4)
  810. | IPSR_4_FUNC(0)
  811. | IPSR_0_FUNC(0));
  812. pfc_reg_write(PFC_IPSR13, IPSR_28_FUNC(8)
  813. | IPSR_24_FUNC(0)
  814. | IPSR_20_FUNC(0)
  815. | IPSR_16_FUNC(0)
  816. | IPSR_12_FUNC(0)
  817. | IPSR_8_FUNC(3)
  818. | IPSR_4_FUNC(0)
  819. | IPSR_0_FUNC(0));
  820. pfc_reg_write(PFC_IPSR14, IPSR_28_FUNC(0)
  821. | IPSR_24_FUNC(0)
  822. | IPSR_20_FUNC(0)
  823. | IPSR_16_FUNC(0)
  824. | IPSR_12_FUNC(0)
  825. | IPSR_8_FUNC(0)
  826. | IPSR_4_FUNC(3)
  827. | IPSR_0_FUNC(8));
  828. pfc_reg_write(PFC_IPSR15, IPSR_28_FUNC(0)
  829. | IPSR_24_FUNC(0)
  830. | IPSR_20_FUNC(0)
  831. | IPSR_16_FUNC(0)
  832. | IPSR_12_FUNC(0)
  833. | IPSR_8_FUNC(0)
  834. | IPSR_4_FUNC(0)
  835. | IPSR_0_FUNC(0));
  836. pfc_reg_write(PFC_IPSR16, IPSR_28_FUNC(0)
  837. | IPSR_24_FUNC(0)
  838. | IPSR_20_FUNC(0)
  839. | IPSR_16_FUNC(0)
  840. | IPSR_12_FUNC(0)
  841. | IPSR_8_FUNC(0)
  842. | IPSR_4_FUNC(0)
  843. | IPSR_0_FUNC(0));
  844. pfc_reg_write(PFC_IPSR17, IPSR_28_FUNC(0)
  845. | IPSR_24_FUNC(0)
  846. | IPSR_20_FUNC(0)
  847. | IPSR_16_FUNC(0)
  848. | IPSR_12_FUNC(0)
  849. | IPSR_8_FUNC(0)
  850. | IPSR_4_FUNC(1)
  851. | IPSR_0_FUNC(0));
  852. pfc_reg_write(PFC_IPSR18, IPSR_4_FUNC(0)
  853. | IPSR_0_FUNC(0));
  854. /* initialize GPIO/perihperal function select */
  855. pfc_reg_write(PFC_GPSR0, GPSR0_D15
  856. | GPSR0_D14
  857. | GPSR0_D13
  858. | GPSR0_D12
  859. | GPSR0_D11
  860. | GPSR0_D10
  861. | GPSR0_D9
  862. | GPSR0_D8
  863. | GPSR0_D7
  864. | GPSR0_D6
  865. | GPSR0_D5
  866. | GPSR0_D4
  867. | GPSR0_D3
  868. | GPSR0_D2
  869. | GPSR0_D0);
  870. pfc_reg_write(PFC_GPSR1, GPSR1_CLKOUT
  871. | GPSR1_EX_WAIT0_A
  872. | GPSR1_WE1
  873. | GPSR1_RD
  874. | GPSR1_RD_WR
  875. | GPSR1_CS0
  876. | GPSR1_A19
  877. | GPSR1_A18
  878. | GPSR1_A17
  879. | GPSR1_A16
  880. | GPSR1_A15
  881. | GPSR1_A14
  882. | GPSR1_A13
  883. | GPSR1_A12
  884. | GPSR1_A7
  885. | GPSR1_A6
  886. | GPSR1_A5
  887. | GPSR1_A4
  888. | GPSR1_A3
  889. | GPSR1_A2
  890. | GPSR1_A1
  891. | GPSR1_A0);
  892. pfc_reg_write(PFC_GPSR2, GPSR2_AVB_AVTP_CAPTURE_A
  893. | GPSR2_AVB_AVTP_MATCH_A
  894. | GPSR2_AVB_LINK
  895. | GPSR2_AVB_PHY_INT
  896. | GPSR2_AVB_MDC
  897. | GPSR2_PWM2_A
  898. | GPSR2_PWM1_A
  899. | GPSR2_IRQ4
  900. | GPSR2_IRQ3
  901. | GPSR2_IRQ2
  902. | GPSR2_IRQ1
  903. | GPSR2_IRQ0);
  904. pfc_reg_write(PFC_GPSR3, GPSR3_SD0_CD
  905. | GPSR3_SD1_DAT3
  906. | GPSR3_SD1_DAT2
  907. | GPSR3_SD1_DAT1
  908. | GPSR3_SD1_DAT0
  909. | GPSR3_SD0_DAT3
  910. | GPSR3_SD0_DAT2
  911. | GPSR3_SD0_DAT1
  912. | GPSR3_SD0_DAT0
  913. | GPSR3_SD0_CMD
  914. | GPSR3_SD0_CLK);
  915. pfc_reg_write(PFC_GPSR4, GPSR4_SD3_DS
  916. | GPSR4_SD3_DAT7
  917. | GPSR4_SD3_DAT6
  918. | GPSR4_SD3_DAT5
  919. | GPSR4_SD3_DAT4
  920. | GPSR4_SD3_DAT3
  921. | GPSR4_SD3_DAT2
  922. | GPSR4_SD3_DAT1
  923. | GPSR4_SD3_DAT0
  924. | GPSR4_SD3_CMD
  925. | GPSR4_SD3_CLK
  926. | GPSR4_SD2_DAT3
  927. | GPSR4_SD2_DAT2
  928. | GPSR4_SD2_DAT1
  929. | GPSR4_SD2_DAT0
  930. | GPSR4_SD2_CMD
  931. | GPSR4_SD2_CLK);
  932. pfc_reg_write(PFC_GPSR5, GPSR5_MSIOF0_RXD
  933. | GPSR5_MSIOF0_TXD
  934. | GPSR5_MSIOF0_SYNC
  935. | GPSR5_MSIOF0_SCK
  936. | GPSR5_RX2_A
  937. | GPSR5_TX2_A
  938. | GPSR5_RTS1
  939. | GPSR5_CTS1
  940. | GPSR5_TX1_A
  941. | GPSR5_RX1_A
  942. | GPSR5_RTS0
  943. | GPSR5_SCK0);
  944. pfc_reg_write(PFC_GPSR6, GPSR6_AUDIO_CLKB_B
  945. | GPSR6_AUDIO_CLKA_A
  946. | GPSR6_SSI_WS6
  947. | GPSR6_SSI_SCK6
  948. | GPSR6_SSI_SDATA4
  949. | GPSR6_SSI_WS4
  950. | GPSR6_SSI_SCK4
  951. | GPSR6_SSI_SDATA1_A
  952. | GPSR6_SSI_SDATA0
  953. | GPSR6_SSI_WS0129
  954. | GPSR6_SSI_SCK0129);
  955. pfc_reg_write(PFC_GPSR7, GPSR7_AVS2
  956. | GPSR7_AVS1);
  957. /* initialize POC control register */
  958. pfc_reg_write(PFC_POCCTRL0, POC_SD0_DAT3_33V
  959. | POC_SD0_DAT2_33V
  960. | POC_SD0_DAT1_33V
  961. | POC_SD0_DAT0_33V
  962. | POC_SD0_CMD_33V
  963. | POC_SD0_CLK_33V);
  964. /* initialize DRV control register */
  965. reg = mmio_read_32(PFC_DRVCTRL0);
  966. reg = ((reg & DRVCTRL0_MASK) | DRVCTRL0_QSPI0_SPCLK(3)
  967. | DRVCTRL0_QSPI0_MOSI_IO0(3)
  968. | DRVCTRL0_QSPI0_MISO_IO1(3)
  969. | DRVCTRL0_QSPI0_IO2(3)
  970. | DRVCTRL0_QSPI0_IO3(3)
  971. | DRVCTRL0_QSPI0_SSL(3)
  972. | DRVCTRL0_QSPI1_SPCLK(3)
  973. | DRVCTRL0_QSPI1_MOSI_IO0(3));
  974. pfc_reg_write(PFC_DRVCTRL0, reg);
  975. reg = mmio_read_32(PFC_DRVCTRL1);
  976. reg = ((reg & DRVCTRL1_MASK) | DRVCTRL1_QSPI1_MISO_IO1(3)
  977. | DRVCTRL1_QSPI1_IO2(3)
  978. | DRVCTRL1_QSPI1_IO3(3)
  979. | DRVCTRL1_QSPI1_SS(3)
  980. | DRVCTRL1_RPC_INT(3)
  981. | DRVCTRL1_RPC_WP(3)
  982. | DRVCTRL1_RPC_RESET(3)
  983. | DRVCTRL1_AVB_RX_CTL(7));
  984. pfc_reg_write(PFC_DRVCTRL1, reg);
  985. reg = mmio_read_32(PFC_DRVCTRL2);
  986. reg = ((reg & DRVCTRL2_MASK) | DRVCTRL2_AVB_RXC(7)
  987. | DRVCTRL2_AVB_RD0(7)
  988. | DRVCTRL2_AVB_RD1(7)
  989. | DRVCTRL2_AVB_RD2(7)
  990. | DRVCTRL2_AVB_RD3(7)
  991. | DRVCTRL2_AVB_TX_CTL(3)
  992. | DRVCTRL2_AVB_TXC(3)
  993. | DRVCTRL2_AVB_TD0(3));
  994. pfc_reg_write(PFC_DRVCTRL2, reg);
  995. reg = mmio_read_32(PFC_DRVCTRL3);
  996. reg = ((reg & DRVCTRL3_MASK) | DRVCTRL3_AVB_TD1(3)
  997. | DRVCTRL3_AVB_TD2(3)
  998. | DRVCTRL3_AVB_TD3(3)
  999. | DRVCTRL3_AVB_TXCREFCLK(7)
  1000. | DRVCTRL3_AVB_MDIO(7)
  1001. | DRVCTRL3_AVB_MDC(7)
  1002. | DRVCTRL3_AVB_MAGIC(7)
  1003. | DRVCTRL3_AVB_PHY_INT(7));
  1004. pfc_reg_write(PFC_DRVCTRL3, reg);
  1005. reg = mmio_read_32(PFC_DRVCTRL4);
  1006. reg = ((reg & DRVCTRL4_MASK) | DRVCTRL4_AVB_LINK(7)
  1007. | DRVCTRL4_AVB_AVTP_MATCH(7)
  1008. | DRVCTRL4_AVB_AVTP_CAPTURE(7)
  1009. | DRVCTRL4_IRQ0(7)
  1010. | DRVCTRL4_IRQ1(7)
  1011. | DRVCTRL4_IRQ2(7)
  1012. | DRVCTRL4_IRQ3(7)
  1013. | DRVCTRL4_IRQ4(7));
  1014. pfc_reg_write(PFC_DRVCTRL4, reg);
  1015. reg = mmio_read_32(PFC_DRVCTRL5);
  1016. reg = ((reg & DRVCTRL5_MASK) | DRVCTRL5_IRQ5(7)
  1017. | DRVCTRL5_PWM0(7)
  1018. | DRVCTRL5_PWM1(7)
  1019. | DRVCTRL5_PWM2(7)
  1020. | DRVCTRL5_A0(3)
  1021. | DRVCTRL5_A1(3)
  1022. | DRVCTRL5_A2(3)
  1023. | DRVCTRL5_A3(3));
  1024. pfc_reg_write(PFC_DRVCTRL5, reg);
  1025. reg = mmio_read_32(PFC_DRVCTRL6);
  1026. reg = ((reg & DRVCTRL6_MASK) | DRVCTRL6_A4(3)
  1027. | DRVCTRL6_A5(3)
  1028. | DRVCTRL6_A6(3)
  1029. | DRVCTRL6_A7(3)
  1030. | DRVCTRL6_A8(7)
  1031. | DRVCTRL6_A9(7)
  1032. | DRVCTRL6_A10(7)
  1033. | DRVCTRL6_A11(7));
  1034. pfc_reg_write(PFC_DRVCTRL6, reg);
  1035. reg = mmio_read_32(PFC_DRVCTRL7);
  1036. reg = ((reg & DRVCTRL7_MASK) | DRVCTRL7_A12(3)
  1037. | DRVCTRL7_A13(3)
  1038. | DRVCTRL7_A14(3)
  1039. | DRVCTRL7_A15(3)
  1040. | DRVCTRL7_A16(3)
  1041. | DRVCTRL7_A17(3)
  1042. | DRVCTRL7_A18(3)
  1043. | DRVCTRL7_A19(3));
  1044. pfc_reg_write(PFC_DRVCTRL7, reg);
  1045. reg = mmio_read_32(PFC_DRVCTRL8);
  1046. reg = ((reg & DRVCTRL8_MASK) | DRVCTRL8_CLKOUT(7)
  1047. | DRVCTRL8_CS0(7)
  1048. | DRVCTRL8_CS1_A2(7)
  1049. | DRVCTRL8_BS(7)
  1050. | DRVCTRL8_RD(7)
  1051. | DRVCTRL8_RD_W(7)
  1052. | DRVCTRL8_WE0(7)
  1053. | DRVCTRL8_WE1(7));
  1054. pfc_reg_write(PFC_DRVCTRL8, reg);
  1055. reg = mmio_read_32(PFC_DRVCTRL9);
  1056. reg = ((reg & DRVCTRL9_MASK) | DRVCTRL9_EX_WAIT0(7)
  1057. | DRVCTRL9_PRESETOU(7)
  1058. | DRVCTRL9_D0(7)
  1059. | DRVCTRL9_D1(7)
  1060. | DRVCTRL9_D2(7)
  1061. | DRVCTRL9_D3(7)
  1062. | DRVCTRL9_D4(7)
  1063. | DRVCTRL9_D5(7));
  1064. pfc_reg_write(PFC_DRVCTRL9, reg);
  1065. reg = mmio_read_32(PFC_DRVCTRL10);
  1066. reg = ((reg & DRVCTRL10_MASK) | DRVCTRL10_D6(7)
  1067. | DRVCTRL10_D7(7)
  1068. | DRVCTRL10_D8(3)
  1069. | DRVCTRL10_D9(3)
  1070. | DRVCTRL10_D10(3)
  1071. | DRVCTRL10_D11(3)
  1072. | DRVCTRL10_D12(3)
  1073. | DRVCTRL10_D13(3));
  1074. pfc_reg_write(PFC_DRVCTRL10, reg);
  1075. reg = mmio_read_32(PFC_DRVCTRL11);
  1076. reg = ((reg & DRVCTRL11_MASK) | DRVCTRL11_D14(3)
  1077. | DRVCTRL11_D15(3)
  1078. | DRVCTRL11_AVS1(7)
  1079. | DRVCTRL11_AVS2(7)
  1080. | DRVCTRL11_GP7_02(7)
  1081. | DRVCTRL11_GP7_03(7)
  1082. | DRVCTRL11_DU_DOTCLKIN0(3)
  1083. | DRVCTRL11_DU_DOTCLKIN1(3));
  1084. pfc_reg_write(PFC_DRVCTRL11, reg);
  1085. reg = mmio_read_32(PFC_DRVCTRL12);
  1086. reg = ((reg & DRVCTRL12_MASK) | DRVCTRL12_DU_DOTCLKIN2(3)
  1087. | DRVCTRL12_DU_DOTCLKIN3(3)
  1088. | DRVCTRL12_DU_FSCLKST(3)
  1089. | DRVCTRL12_DU_TMS(3));
  1090. pfc_reg_write(PFC_DRVCTRL12, reg);
  1091. reg = mmio_read_32(PFC_DRVCTRL13);
  1092. reg = ((reg & DRVCTRL13_MASK) | DRVCTRL13_TDO(3)
  1093. | DRVCTRL13_ASEBRK(3)
  1094. | DRVCTRL13_SD0_CLK(7)
  1095. | DRVCTRL13_SD0_CMD(7)
  1096. | DRVCTRL13_SD0_DAT0(7)
  1097. | DRVCTRL13_SD0_DAT1(7)
  1098. | DRVCTRL13_SD0_DAT2(7)
  1099. | DRVCTRL13_SD0_DAT3(7));
  1100. pfc_reg_write(PFC_DRVCTRL13, reg);
  1101. reg = mmio_read_32(PFC_DRVCTRL14);
  1102. reg = ((reg & DRVCTRL14_MASK) | DRVCTRL14_SD1_CLK(7)
  1103. | DRVCTRL14_SD1_CMD(7)
  1104. | DRVCTRL14_SD1_DAT0(5)
  1105. | DRVCTRL14_SD1_DAT1(5)
  1106. | DRVCTRL14_SD1_DAT2(5)
  1107. | DRVCTRL14_SD1_DAT3(5)
  1108. | DRVCTRL14_SD2_CLK(5)
  1109. | DRVCTRL14_SD2_CMD(5));
  1110. pfc_reg_write(PFC_DRVCTRL14, reg);
  1111. reg = mmio_read_32(PFC_DRVCTRL15);
  1112. reg = ((reg & DRVCTRL15_MASK) | DRVCTRL15_SD2_DAT0(5)
  1113. | DRVCTRL15_SD2_DAT1(5)
  1114. | DRVCTRL15_SD2_DAT2(5)
  1115. | DRVCTRL15_SD2_DAT3(5)
  1116. | DRVCTRL15_SD2_DS(5)
  1117. | DRVCTRL15_SD3_CLK(7)
  1118. | DRVCTRL15_SD3_CMD(7)
  1119. | DRVCTRL15_SD3_DAT0(7));
  1120. pfc_reg_write(PFC_DRVCTRL15, reg);
  1121. reg = mmio_read_32(PFC_DRVCTRL16);
  1122. reg = ((reg & DRVCTRL16_MASK) | DRVCTRL16_SD3_DAT1(7)
  1123. | DRVCTRL16_SD3_DAT2(7)
  1124. | DRVCTRL16_SD3_DAT3(7)
  1125. | DRVCTRL16_SD3_DAT4(7)
  1126. | DRVCTRL16_SD3_DAT5(7)
  1127. | DRVCTRL16_SD3_DAT6(7)
  1128. | DRVCTRL16_SD3_DAT7(7)
  1129. | DRVCTRL16_SD3_DS(7));
  1130. pfc_reg_write(PFC_DRVCTRL16, reg);
  1131. reg = mmio_read_32(PFC_DRVCTRL17);
  1132. reg = ((reg & DRVCTRL17_MASK) | DRVCTRL17_SD0_CD(7)
  1133. | DRVCTRL17_SD0_WP(7)
  1134. | DRVCTRL17_SD1_CD(7)
  1135. | DRVCTRL17_SD1_WP(7)
  1136. | DRVCTRL17_SCK0(7)
  1137. | DRVCTRL17_RX0(7)
  1138. | DRVCTRL17_TX0(7)
  1139. | DRVCTRL17_CTS0(7));
  1140. pfc_reg_write(PFC_DRVCTRL17, reg);
  1141. reg = mmio_read_32(PFC_DRVCTRL18);
  1142. reg = ((reg & DRVCTRL18_MASK) | DRVCTRL18_RTS0_TANS(7)
  1143. | DRVCTRL18_RX1(7)
  1144. | DRVCTRL18_TX1(7)
  1145. | DRVCTRL18_CTS1(7)
  1146. | DRVCTRL18_RTS1_TANS(7)
  1147. | DRVCTRL18_SCK2(7)
  1148. | DRVCTRL18_TX2(7)
  1149. | DRVCTRL18_RX2(7));
  1150. pfc_reg_write(PFC_DRVCTRL18, reg);
  1151. reg = mmio_read_32(PFC_DRVCTRL19);
  1152. reg = ((reg & DRVCTRL19_MASK) | DRVCTRL19_HSCK0(7)
  1153. | DRVCTRL19_HRX0(7)
  1154. | DRVCTRL19_HTX0(7)
  1155. | DRVCTRL19_HCTS0(7)
  1156. | DRVCTRL19_HRTS0(7)
  1157. | DRVCTRL19_MSIOF0_SCK(7)
  1158. | DRVCTRL19_MSIOF0_SYNC(7)
  1159. | DRVCTRL19_MSIOF0_SS1(7));
  1160. pfc_reg_write(PFC_DRVCTRL19, reg);
  1161. reg = mmio_read_32(PFC_DRVCTRL20);
  1162. reg = ((reg & DRVCTRL20_MASK) | DRVCTRL20_MSIOF0_TXD(7)
  1163. | DRVCTRL20_MSIOF0_SS2(7)
  1164. | DRVCTRL20_MSIOF0_RXD(7)
  1165. | DRVCTRL20_MLB_CLK(7)
  1166. | DRVCTRL20_MLB_SIG(7)
  1167. | DRVCTRL20_MLB_DAT(7)
  1168. | DRVCTRL20_MLB_REF(7)
  1169. | DRVCTRL20_SSI_SCK0129(7));
  1170. pfc_reg_write(PFC_DRVCTRL20, reg);
  1171. reg = mmio_read_32(PFC_DRVCTRL21);
  1172. reg = ((reg & DRVCTRL21_MASK) | DRVCTRL21_SSI_WS0129(7)
  1173. | DRVCTRL21_SSI_SDATA0(7)
  1174. | DRVCTRL21_SSI_SDATA1(7)
  1175. | DRVCTRL21_SSI_SDATA2(7)
  1176. | DRVCTRL21_SSI_SCK34(7)
  1177. | DRVCTRL21_SSI_WS34(7)
  1178. | DRVCTRL21_SSI_SDATA3(7)
  1179. | DRVCTRL21_SSI_SCK4(7));
  1180. pfc_reg_write(PFC_DRVCTRL21, reg);
  1181. reg = mmio_read_32(PFC_DRVCTRL22);
  1182. reg = ((reg & DRVCTRL22_MASK) | DRVCTRL22_SSI_WS4(7)
  1183. | DRVCTRL22_SSI_SDATA4(7)
  1184. | DRVCTRL22_SSI_SCK5(7)
  1185. | DRVCTRL22_SSI_WS5(7)
  1186. | DRVCTRL22_SSI_SDATA5(7)
  1187. | DRVCTRL22_SSI_SCK6(7)
  1188. | DRVCTRL22_SSI_WS6(7)
  1189. | DRVCTRL22_SSI_SDATA6(7));
  1190. pfc_reg_write(PFC_DRVCTRL22, reg);
  1191. reg = mmio_read_32(PFC_DRVCTRL23);
  1192. reg = ((reg & DRVCTRL23_MASK) | DRVCTRL23_SSI_SCK78(7)
  1193. | DRVCTRL23_SSI_WS78(7)
  1194. | DRVCTRL23_SSI_SDATA7(7)
  1195. | DRVCTRL23_SSI_SDATA8(7)
  1196. | DRVCTRL23_SSI_SDATA9(7)
  1197. | DRVCTRL23_AUDIO_CLKA(7)
  1198. | DRVCTRL23_AUDIO_CLKB(7)
  1199. | DRVCTRL23_USB0_PWEN(7));
  1200. pfc_reg_write(PFC_DRVCTRL23, reg);
  1201. reg = mmio_read_32(PFC_DRVCTRL24);
  1202. reg = ((reg & DRVCTRL24_MASK) | DRVCTRL24_USB0_OVC(7)
  1203. | DRVCTRL24_USB1_PWEN(7)
  1204. | DRVCTRL24_USB1_OVC(7)
  1205. | DRVCTRL24_USB30_PWEN(7)
  1206. | DRVCTRL24_USB30_OVC(7)
  1207. | DRVCTRL24_USB31_PWEN(7)
  1208. | DRVCTRL24_USB31_OVC(7));
  1209. pfc_reg_write(PFC_DRVCTRL24, reg);
  1210. /* initialize LSI pin pull-up/down control */
  1211. pfc_reg_write(PFC_PUD0, 0x00005FBFU);
  1212. pfc_reg_write(PFC_PUD1, 0x00300EFEU);
  1213. pfc_reg_write(PFC_PUD2, 0x330001E6U);
  1214. pfc_reg_write(PFC_PUD3, 0x000002E0U);
  1215. pfc_reg_write(PFC_PUD4, 0xFFFFFF00U);
  1216. pfc_reg_write(PFC_PUD5, 0x7F5FFF87U);
  1217. pfc_reg_write(PFC_PUD6, 0x00000055U);
  1218. /* initialize LSI pin pull-enable register */
  1219. pfc_reg_write(PFC_PUEN0, 0x00000FFFU);
  1220. pfc_reg_write(PFC_PUEN1, 0x00100234U);
  1221. pfc_reg_write(PFC_PUEN2, 0x000004C4U);
  1222. pfc_reg_write(PFC_PUEN3, 0x00000200U);
  1223. pfc_reg_write(PFC_PUEN4, 0x3E000000U);
  1224. pfc_reg_write(PFC_PUEN5, 0x1F000805U);
  1225. pfc_reg_write(PFC_PUEN6, 0x00000006U);
  1226. /* initialize positive/negative logic select */
  1227. mmio_write_32(GPIO_POSNEG0, 0x00000000U);
  1228. mmio_write_32(GPIO_POSNEG1, 0x00000000U);
  1229. mmio_write_32(GPIO_POSNEG2, 0x00000000U);
  1230. mmio_write_32(GPIO_POSNEG3, 0x00000000U);
  1231. mmio_write_32(GPIO_POSNEG4, 0x00000000U);
  1232. mmio_write_32(GPIO_POSNEG5, 0x00000000U);
  1233. mmio_write_32(GPIO_POSNEG6, 0x00000000U);
  1234. mmio_write_32(GPIO_POSNEG7, 0x00000000U);
  1235. /* initialize general IO/interrupt switching */
  1236. mmio_write_32(GPIO_IOINTSEL0, 0x00000000U);
  1237. mmio_write_32(GPIO_IOINTSEL1, 0x00000000U);
  1238. mmio_write_32(GPIO_IOINTSEL2, 0x00000000U);
  1239. mmio_write_32(GPIO_IOINTSEL3, 0x00000000U);
  1240. mmio_write_32(GPIO_IOINTSEL4, 0x00000000U);
  1241. mmio_write_32(GPIO_IOINTSEL5, 0x00000000U);
  1242. mmio_write_32(GPIO_IOINTSEL6, 0x00000000U);
  1243. mmio_write_32(GPIO_IOINTSEL7, 0x00000000U);
  1244. /* initialize general output register */
  1245. mmio_write_32(GPIO_OUTDT0, 0x00000001U);
  1246. mmio_write_32(GPIO_OUTDT1, 0x00000000U);
  1247. mmio_write_32(GPIO_OUTDT2, 0x00000400U);
  1248. mmio_write_32(GPIO_OUTDT3, 0x00000000U);
  1249. mmio_write_32(GPIO_OUTDT4, 0x00000000U);
  1250. mmio_write_32(GPIO_OUTDT5, 0x00000000U);
  1251. mmio_write_32(GPIO_OUTDT6, 0x00003800U);
  1252. mmio_write_32(GPIO_OUTDT7, 0x00000003U);
  1253. /* initialize general input/output switching */
  1254. mmio_write_32(GPIO_INOUTSEL0, 0x00000001U);
  1255. mmio_write_32(GPIO_INOUTSEL1, 0x00100B00U);
  1256. mmio_write_32(GPIO_INOUTSEL2, 0x00000418U);
  1257. mmio_write_32(GPIO_INOUTSEL3, 0x00002000U);
  1258. mmio_write_32(GPIO_INOUTSEL4, 0x00000040U);
  1259. mmio_write_32(GPIO_INOUTSEL5, 0x00000208U);
  1260. mmio_write_32(GPIO_INOUTSEL6, 0x00013F00U);
  1261. mmio_write_32(GPIO_INOUTSEL7, 0x00000003U);
  1262. }