pfc_init_m3n.c 42 KB

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