pinctrl-amlogic-c3.c 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108
  1. // SPDX-License-Identifier: (GPL-2.0-only OR MIT)
  2. /*
  3. * Pin controller and GPIO driver for Amlogic C3 SoC.
  4. *
  5. * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
  6. * Author: Huqiang Qin <huqiang.qin@amlogic.com>
  7. */
  8. #include <dt-bindings/gpio/amlogic-c3-gpio.h>
  9. #include "pinctrl-meson.h"
  10. #include "pinctrl-meson-axg-pmx.h"
  11. static const struct pinctrl_pin_desc c3_periphs_pins[] = {
  12. MESON_PIN(GPIOE_0),
  13. MESON_PIN(GPIOE_1),
  14. MESON_PIN(GPIOE_2),
  15. MESON_PIN(GPIOE_3),
  16. MESON_PIN(GPIOE_4),
  17. MESON_PIN(GPIOB_0),
  18. MESON_PIN(GPIOB_1),
  19. MESON_PIN(GPIOB_2),
  20. MESON_PIN(GPIOB_3),
  21. MESON_PIN(GPIOB_4),
  22. MESON_PIN(GPIOB_5),
  23. MESON_PIN(GPIOB_6),
  24. MESON_PIN(GPIOB_7),
  25. MESON_PIN(GPIOB_8),
  26. MESON_PIN(GPIOB_9),
  27. MESON_PIN(GPIOB_10),
  28. MESON_PIN(GPIOB_11),
  29. MESON_PIN(GPIOB_12),
  30. MESON_PIN(GPIOB_13),
  31. MESON_PIN(GPIOB_14),
  32. MESON_PIN(GPIOC_0),
  33. MESON_PIN(GPIOC_1),
  34. MESON_PIN(GPIOC_2),
  35. MESON_PIN(GPIOC_3),
  36. MESON_PIN(GPIOC_4),
  37. MESON_PIN(GPIOC_5),
  38. MESON_PIN(GPIOC_6),
  39. MESON_PIN(GPIOX_0),
  40. MESON_PIN(GPIOX_1),
  41. MESON_PIN(GPIOX_2),
  42. MESON_PIN(GPIOX_3),
  43. MESON_PIN(GPIOX_4),
  44. MESON_PIN(GPIOX_5),
  45. MESON_PIN(GPIOX_6),
  46. MESON_PIN(GPIOX_7),
  47. MESON_PIN(GPIOX_8),
  48. MESON_PIN(GPIOX_9),
  49. MESON_PIN(GPIOX_10),
  50. MESON_PIN(GPIOX_11),
  51. MESON_PIN(GPIOX_12),
  52. MESON_PIN(GPIOX_13),
  53. MESON_PIN(GPIOD_0),
  54. MESON_PIN(GPIOD_1),
  55. MESON_PIN(GPIOD_2),
  56. MESON_PIN(GPIOD_3),
  57. MESON_PIN(GPIOD_4),
  58. MESON_PIN(GPIOD_5),
  59. MESON_PIN(GPIOD_6),
  60. MESON_PIN(GPIOA_0),
  61. MESON_PIN(GPIOA_1),
  62. MESON_PIN(GPIOA_2),
  63. MESON_PIN(GPIOA_3),
  64. MESON_PIN(GPIOA_4),
  65. MESON_PIN(GPIOA_5),
  66. MESON_PIN(GPIO_TEST_N),
  67. };
  68. /* Bank E func1 */
  69. static const unsigned int pwm_a_pins[] = { GPIOE_0 };
  70. static const unsigned int pwm_b_pins[] = { GPIOE_1 };
  71. static const unsigned int i2c2_sda_pins[] = { GPIOE_2 };
  72. static const unsigned int i2c2_scl_pins[] = { GPIOE_3 };
  73. static const unsigned int gen_clk_e_pins[] = { GPIOE_4 };
  74. /* Bank E func2 */
  75. static const unsigned int i2c0_sda_e_pins[] = { GPIOE_0 };
  76. static const unsigned int i2c0_scl_e_pins[] = { GPIOE_1 };
  77. static const unsigned int clk_32k_in_pins[] = { GPIOE_4 };
  78. /* Bank E func3 */
  79. static const unsigned int i2c_slave_scl_pins[] = { GPIOE_0 };
  80. static const unsigned int i2c_slave_sda_pins[] = { GPIOE_1 };
  81. static const unsigned int clk12_24_e_pins[] = { GPIOE_4 };
  82. /* Bank B func1 */
  83. static const unsigned int emmc_nand_d0_pins[] = { GPIOB_0 };
  84. static const unsigned int emmc_nand_d1_pins[] = { GPIOB_1 };
  85. static const unsigned int emmc_nand_d2_pins[] = { GPIOB_2 };
  86. static const unsigned int emmc_nand_d3_pins[] = { GPIOB_3 };
  87. static const unsigned int emmc_nand_d4_pins[] = { GPIOB_4 };
  88. static const unsigned int emmc_nand_d5_pins[] = { GPIOB_5 };
  89. static const unsigned int emmc_nand_d6_pins[] = { GPIOB_6 };
  90. static const unsigned int emmc_nand_d7_pins[] = { GPIOB_7 };
  91. static const unsigned int emmc_clk_pins[] = { GPIOB_8 };
  92. static const unsigned int emmc_rst_pins[] = { GPIOB_9 };
  93. static const unsigned int emmc_cmd_pins[] = { GPIOB_10 };
  94. static const unsigned int emmc_nand_ds_pins[] = { GPIOB_11 };
  95. /* Bank B func2 */
  96. static const unsigned int nand_wen_clk_pins[] = { GPIOB_8 };
  97. static const unsigned int nand_ale_pins[] = { GPIOB_9 };
  98. static const unsigned int nand_ren_wr_pins[] = { GPIOB_10 };
  99. static const unsigned int nand_cle_pins[] = { GPIOB_11 };
  100. static const unsigned int nand_ce0_pins[] = { GPIOB_12 };
  101. /* Bank B func3 */
  102. static const unsigned int pwm_g_b_pins[] = { GPIOB_0 };
  103. static const unsigned int pwm_h_b_pins[] = { GPIOB_1 };
  104. static const unsigned int pwm_i_b_pins[] = { GPIOB_2 };
  105. static const unsigned int spif_hold_pins[] = { GPIOB_3 };
  106. static const unsigned int spif_mo_pins[] = { GPIOB_4 };
  107. static const unsigned int spif_mi_pins[] = { GPIOB_5 };
  108. static const unsigned int spif_clk_pins[] = { GPIOB_6 };
  109. static const unsigned int spif_wp_pins[] = { GPIOB_7 };
  110. static const unsigned int pwm_j_b_pins[] = { GPIOB_8 };
  111. static const unsigned int pwm_k_b_pins[] = { GPIOB_9 };
  112. static const unsigned int pwm_l_b_pins[] = { GPIOB_10 };
  113. static const unsigned int pwm_m_b_pins[] = { GPIOB_11 };
  114. static const unsigned int pwm_n_b_pins[] = { GPIOB_12 };
  115. static const unsigned int spif_cs_pins[] = { GPIOB_13 };
  116. static const unsigned int spif_clk_loop_pins[] = { GPIOB_14 };
  117. /* Bank B func4 */
  118. static const unsigned int lcd_d0_pins[] = { GPIOB_0 };
  119. static const unsigned int lcd_d1_pins[] = { GPIOB_1 };
  120. static const unsigned int lcd_d2_pins[] = { GPIOB_2 };
  121. static const unsigned int lcd_d3_pins[] = { GPIOB_8 };
  122. static const unsigned int lcd_d4_pins[] = { GPIOB_9 };
  123. static const unsigned int lcd_d5_pins[] = { GPIOB_10 };
  124. static const unsigned int lcd_d6_pins[] = { GPIOB_11 };
  125. static const unsigned int lcd_d7_pins[] = { GPIOB_12 };
  126. /* Bank B func5 */
  127. static const unsigned int spi_a_mosi_b_pins[] = { GPIOB_0 };
  128. static const unsigned int spi_a_miso_b_pins[] = { GPIOB_1 };
  129. static const unsigned int spi_a_clk_b_pins[] = { GPIOB_2 };
  130. static const unsigned int spi_a_ss0_b_pins[] = { GPIOB_8 };
  131. static const unsigned int spi_a_ss1_b_pins[] = { GPIOB_9 };
  132. static const unsigned int spi_a_ss2_b_pins[] = { GPIOB_10 };
  133. static const unsigned int i2c1_sda_b_pins[] = { GPIOB_11 };
  134. static const unsigned int i2c1_scl_b_pins[] = { GPIOB_12 };
  135. /* Bank B func6 */
  136. static const unsigned int uart_a_tx_b_pins[] = { GPIOB_0 };
  137. static const unsigned int uart_a_rx_b_pins[] = { GPIOB_1 };
  138. static const unsigned int uart_a_cts_b_pins[] = { GPIOB_2 };
  139. static const unsigned int uart_a_rts_b_pins[] = { GPIOB_8 };
  140. static const unsigned int uart_d_tx_b_pins[] = { GPIOB_9 };
  141. static const unsigned int uart_d_rx_b_pins[] = { GPIOB_10 };
  142. static const unsigned int pdm_dclk_b_pins[] = { GPIOB_11 };
  143. static const unsigned int pdm_din0_b_pins[] = { GPIOB_12 };
  144. /* Bank C func1 */
  145. static const unsigned int sdcard_d0_pins[] = { GPIOC_0 };
  146. static const unsigned int sdcard_d1_pins[] = { GPIOC_1 };
  147. static const unsigned int sdcard_d2_pins[] = { GPIOC_2 };
  148. static const unsigned int sdcard_d3_pins[] = { GPIOC_3 };
  149. static const unsigned int sdcard_clk_pins[] = { GPIOC_4 };
  150. static const unsigned int sdcard_cmd_pins[] = { GPIOC_5 };
  151. static const unsigned int sdcard_cd_pins[] = { GPIOC_6 };
  152. /* Bank C func2 */
  153. static const unsigned int jtag_b_tdo_pins[] = { GPIOC_0 };
  154. static const unsigned int jtag_b_tdi_pins[] = { GPIOC_1 };
  155. static const unsigned int uart_b_rx_c_pins[] = { GPIOC_2 };
  156. static const unsigned int uart_b_tx_c_pins[] = { GPIOC_3 };
  157. static const unsigned int jtag_b_clk_pins[] = { GPIOC_4 };
  158. static const unsigned int jtag_b_tms_pins[] = { GPIOC_5 };
  159. static const unsigned int gen_clk_c_pins[] = { GPIOC_6 };
  160. /* Bank C func3 */
  161. static const unsigned int tdm_d3_pins[] = { GPIOC_0 };
  162. static const unsigned int tdm_d2_pins[] = { GPIOC_1 };
  163. static const unsigned int mclk_1_pins[] = { GPIOC_2 };
  164. static const unsigned int tdm_sclk1_pins[] = { GPIOC_3 };
  165. static const unsigned int tdm_fs1_pins[] = { GPIOC_4 };
  166. static const unsigned int pdm_dclk_c_pins[] = { GPIOC_5 };
  167. static const unsigned int pdm_din0_c_pins[] = { GPIOC_6 };
  168. /* Bank C func4 */
  169. static const unsigned int spi_a_mosi_c_pins[] = { GPIOC_0 };
  170. static const unsigned int spi_a_miso_c_pins[] = { GPIOC_1 };
  171. static const unsigned int spi_a_clk_c_pins[] = { GPIOC_2 };
  172. static const unsigned int spi_a_ss0_c_pins[] = { GPIOC_3 };
  173. static const unsigned int spi_a_ss1_c_pins[] = { GPIOC_4 };
  174. /* Bank C func5 */
  175. static const unsigned int pwm_g_c_pins[] = { GPIOC_0 };
  176. static const unsigned int pwm_h_c_pins[] = { GPIOC_1 };
  177. static const unsigned int pwm_i_c_pins[] = { GPIOC_2 };
  178. static const unsigned int pwm_j_c_pins[] = { GPIOC_3 };
  179. static const unsigned int pwm_k_c_pins[] = { GPIOC_4 };
  180. static const unsigned int pwm_l_c_pins[] = { GPIOC_5 };
  181. static const unsigned int pwm_m_c_pins[] = { GPIOC_6 };
  182. /* Bank C func6 */
  183. static const unsigned int uart_a_rx_c_pins[] = { GPIOC_0 };
  184. static const unsigned int uart_a_tx_c_pins[] = { GPIOC_1 };
  185. static const unsigned int uart_c_rx_c_pins[] = { GPIOC_2 };
  186. static const unsigned int uart_c_tx_c_pins[] = { GPIOC_3 };
  187. static const unsigned int i2c3_sda_c_pins[] = { GPIOC_4 };
  188. static const unsigned int i2c3_scl_c_pins[] = { GPIOC_5 };
  189. static const unsigned int clk12_24_c_pins[] = { GPIOC_6 };
  190. /* Bank X func1 */
  191. static const unsigned int sdio_d0_pins[] = { GPIOX_0 };
  192. static const unsigned int sdio_d1_pins[] = { GPIOX_1 };
  193. static const unsigned int sdio_d2_pins[] = { GPIOX_2 };
  194. static const unsigned int sdio_d3_pins[] = { GPIOX_3 };
  195. static const unsigned int sdio_clk_pins[] = { GPIOX_4 };
  196. static const unsigned int sdio_cmd_pins[] = { GPIOX_5 };
  197. static const unsigned int clk12_24_x_pins[] = { GPIOX_6 };
  198. static const unsigned int uart_e_tx_x_pins[] = { GPIOX_7 };
  199. static const unsigned int uart_e_rx_x_pins[] = { GPIOX_8 };
  200. static const unsigned int uart_e_cts_pins[] = { GPIOX_9 };
  201. static const unsigned int uart_e_rts_pins[] = { GPIOX_10 };
  202. static const unsigned int pwm_e_pins[] = { GPIOX_11 };
  203. static const unsigned int pwm_j_x12_pins[] = { GPIOX_12 };
  204. static const unsigned int pwm_k_x13_pins[] = { GPIOX_13 };
  205. /* Bank X func2 */
  206. static const unsigned int spi_a_mosi_x_pins[] = { GPIOX_0 };
  207. static const unsigned int spi_a_miso_x_pins[] = { GPIOX_1 };
  208. static const unsigned int spi_a_clk_x_pins[] = { GPIOX_2 };
  209. static const unsigned int spi_a_ss0_x_pins[] = { GPIOX_3 };
  210. static const unsigned int spi_a_ss1_x_pins[] = { GPIOX_4 };
  211. static const unsigned int spi_a_ss2_x_pins[] = { GPIOX_5 };
  212. static const unsigned int spi_b_ss2_x6_pins[] = { GPIOX_6 };
  213. static const unsigned int spi_b_miso_x_pins[] = { GPIOX_7 };
  214. static const unsigned int spi_b_clk_x_pins[] = { GPIOX_8 };
  215. static const unsigned int spi_b_mosi_x_pins[] = { GPIOX_9 };
  216. static const unsigned int spi_b_ss0_x_pins[] = { GPIOX_10 };
  217. static const unsigned int spi_b_ss1_x_pins[] = { GPIOX_11 };
  218. static const unsigned int spi_b_ss2_x12_pins[] = { GPIOX_12 };
  219. static const unsigned int gen_clk_x_pins[] = { GPIOX_13 };
  220. /* Bank X func3 */
  221. static const unsigned int tdm_d1_x_pins[] = { GPIOX_0 };
  222. static const unsigned int tdm_d0_x_pins[] = { GPIOX_1 };
  223. static const unsigned int mclk_0_x_pins[] = { GPIOX_2 };
  224. static const unsigned int tdm_sclk0_x_pins[] = { GPIOX_3 };
  225. static const unsigned int tdm_fs0_x_pins[] = { GPIOX_4 };
  226. static const unsigned int pdm_dclk_x5_pins[] = { GPIOX_5 };
  227. static const unsigned int pdm_din0_x6_pins[] = { GPIOX_6 };
  228. static const unsigned int pdm_din0_x9_pins[] = { GPIOX_9 };
  229. static const unsigned int pdm_dclk_x10_pins[] = { GPIOX_10 };
  230. static const unsigned int clk12_24_x13_pins[] = { GPIOX_13 };
  231. /* Bank X func4 */
  232. static const unsigned int lcd_d8_pins[] = { GPIOX_0 };
  233. static const unsigned int lcd_d9_pins[] = { GPIOX_1 };
  234. static const unsigned int lcd_d10_pins[] = { GPIOX_2 };
  235. static const unsigned int lcd_d11_pins[] = { GPIOX_3 };
  236. static const unsigned int lcd_d12_pins[] = { GPIOX_4 };
  237. static const unsigned int lcd_d13_pins[] = { GPIOX_5 };
  238. static const unsigned int lcd_d14_pins[] = { GPIOX_6 };
  239. static const unsigned int lcd_d15_pins[] = { GPIOX_7 };
  240. static const unsigned int lcd_vs_pins[] = { GPIOX_8 };
  241. static const unsigned int lcd_hs_pins[] = { GPIOX_9 };
  242. static const unsigned int lcd_den_pins[] = { GPIOX_10 };
  243. static const unsigned int lcd_d16_pins[] = { GPIOX_11 };
  244. static const unsigned int lcd_clk_x_pins[] = { GPIOX_12 };
  245. static const unsigned int lcd_d17_pins[] = { GPIOX_13 };
  246. /* Bank X func5 */
  247. static const unsigned int pwm_g_x0_pins[] = { GPIOX_0 };
  248. static const unsigned int pwm_h_x1_pins[] = { GPIOX_1 };
  249. static const unsigned int pwm_i_x2_pins[] = { GPIOX_2 };
  250. static const unsigned int pwm_j_x3_pins[] = { GPIOX_3 };
  251. static const unsigned int pwm_k_x4_pins[] = { GPIOX_4 };
  252. static const unsigned int pwm_l_x_pins[] = { GPIOX_5 };
  253. static const unsigned int pwm_m_x_pins[] = { GPIOX_6 };
  254. static const unsigned int pwm_n_x_pins[] = { GPIOX_7 };
  255. static const unsigned int pwm_g_x8_pins[] = { GPIOX_8 };
  256. static const unsigned int pwm_h_x9_pins[] = { GPIOX_9 };
  257. static const unsigned int pwm_i_x10_pins[] = { GPIOX_10 };
  258. static const unsigned int clk12_24_x11_pins[] = { GPIOX_11 };
  259. /* Bank X func6 */
  260. static const unsigned int uart_a_rx_x_pins[] = { GPIOX_0 };
  261. static const unsigned int uart_a_tx_x_pins[] = { GPIOX_1 };
  262. static const unsigned int uart_c_rx_x_pins[] = { GPIOX_2 };
  263. static const unsigned int uart_c_tx_x_pins[] = { GPIOX_3 };
  264. static const unsigned int i2c3_sda_x_pins[] = { GPIOX_4 };
  265. static const unsigned int i2c3_scl_x_pins[] = { GPIOX_5 };
  266. static const unsigned int i2c1_sda_x_pins[] = { GPIOX_7 };
  267. static const unsigned int i2c1_scl_x_pins[] = { GPIOX_8 };
  268. static const unsigned int uart_d_tx_x_pins[] = { GPIOX_9 };
  269. static const unsigned int uart_d_rx_x_pins[] = { GPIOX_10 };
  270. /* Bank D func1 */
  271. static const unsigned int pwm_g_d_pins[] = { GPIOD_0 };
  272. static const unsigned int pwm_h_d_pins[] = { GPIOD_1 };
  273. static const unsigned int eth_led_act_pins[] = { GPIOD_2 };
  274. static const unsigned int eth_led_link_pins[] = { GPIOD_3 };
  275. static const unsigned int pwm_d_pins[] = { GPIOD_4 };
  276. static const unsigned int pwm_f_pins[] = { GPIOD_5 };
  277. static const unsigned int pwm_k_d_pins[] = { GPIOD_6 };
  278. /* Bank D func2 */
  279. static const unsigned int uart_a_tx_d_pins[] = { GPIOD_0 };
  280. static const unsigned int uart_a_rx_d_pins[] = { GPIOD_1 };
  281. static const unsigned int spi_b_miso_d_pins[] = { GPIOD_2 };
  282. static const unsigned int spi_b_clk_d_pins[] = { GPIOD_3 };
  283. static const unsigned int spi_b_mosi_d_pins[] = { GPIOD_4 };
  284. static const unsigned int spi_b_ss0_d_pins[] = { GPIOD_5 };
  285. static const unsigned int spi_b_ss1_d_pins[] = { GPIOD_6 };
  286. /* Bank D func3 */
  287. static const unsigned int i2c0_sda_d_pins[] = { GPIOD_0 };
  288. static const unsigned int i2c0_scl_d_pins[] = { GPIOD_1 };
  289. static const unsigned int i2c1_sda_d_pins[] = { GPIOD_2 };
  290. static const unsigned int i2c1_scl_d_pins[] = { GPIOD_3 };
  291. static const unsigned int pdm_dclk_d_pins[] = { GPIOD_4 };
  292. static const unsigned int pdm_din0_d_pins[] = { GPIOD_5 };
  293. static const unsigned int ir_in_d6_pins[] = { GPIOD_6 };
  294. /* Bank D func4 */
  295. static const unsigned int ir_in_d0_pins[] = { GPIOD_0 };
  296. static const unsigned int ir_out_pins[] = { GPIOD_1 };
  297. static const unsigned int pwm_i_d_pins[] = { GPIOD_2 };
  298. static const unsigned int pwm_j_d_pins[] = { GPIOD_3 };
  299. static const unsigned int i2c3_sda_d_pins[] = { GPIOD_4 };
  300. static const unsigned int i2c3_scl_d_pins[] = { GPIOD_5 };
  301. /* Bank D func5 */
  302. static const unsigned int tdm_fs0_d_pins[] = { GPIOD_2 };
  303. static const unsigned int tdm_sclk0_d_pins[] = { GPIOD_3 };
  304. static const unsigned int mclk_0_d_pins[] = { GPIOD_4 };
  305. static const unsigned int tdm_d1_d_pins[] = { GPIOD_5 };
  306. static const unsigned int tdm_d0_d_pins[] = { GPIOD_6 };
  307. /* Bank D func6 */
  308. static const unsigned int uart_d_tx_d_pins[] = { GPIOD_0 };
  309. static const unsigned int uart_d_rx_d_pins[] = { GPIOD_1 };
  310. static const unsigned int uart_c_tx_d_pins[] = { GPIOD_2 };
  311. static const unsigned int uart_c_rx_d_pins[] = { GPIOD_3 };
  312. /* Bank A func1 */
  313. static const unsigned int uart_b_tx_a_pins[] = { GPIOA_0 };
  314. static const unsigned int uart_b_rx_a_pins[] = { GPIOA_1 };
  315. static const unsigned int pwm_c_pins[] = { GPIOA_2 };
  316. static const unsigned int pwm_l_a_pins[] = { GPIOA_3 };
  317. static const unsigned int i2c1_sda_a_pins[] = { GPIOA_4 };
  318. static const unsigned int i2c1_scl_a_pins[] = { GPIOA_5 };
  319. /* Bank A func2 */
  320. static const unsigned int pwm_c_hiz_pins[] = { GPIOA_2 };
  321. static const unsigned int gen_clk_a_pins[] = { GPIOA_3 };
  322. static const unsigned int pdm_dclk_z_pins[] = { GPIOA_4 };
  323. static const unsigned int pdm_din0_a_pins[] = { GPIOA_5 };
  324. /* Bank A func3 */
  325. static const unsigned int jtag_a_clk_pins[] = { GPIOA_2 };
  326. static const unsigned int jtag_a_tms_pins[] = { GPIOA_3 };
  327. static const unsigned int jtag_a_tdi_pins[] = { GPIOA_4 };
  328. static const unsigned int jtag_a_tdo_pins[] = { GPIOA_5 };
  329. /* Bank A func4 */
  330. static const unsigned int lcd_clk_a_pins[] = { GPIOA_3 };
  331. static const unsigned int uart_f_tx_a_pins[] = { GPIOA_4 };
  332. static const unsigned int uart_f_rx_a_pins[] = { GPIOA_5 };
  333. /* Bank A func5 */
  334. static const unsigned int uart_e_tx_a_pins[] = { GPIOA_2 };
  335. static const unsigned int uart_e_rx_a_pins[] = { GPIOA_3 };
  336. static const unsigned int pwm_m_a_pins[] = { GPIOA_4 };
  337. static const unsigned int pwm_n_a_pins[] = { GPIOA_5 };
  338. /* Bank A func6 */
  339. static const unsigned int spi_a_mosi_a_pins[] = { GPIOA_3 };
  340. static const unsigned int gen_clk_a4_pins[] = { GPIOA_4 };
  341. static const unsigned int clk12_24_a_pins[] = { GPIOA_5 };
  342. static const struct meson_pmx_group c3_periphs_groups[] = {
  343. GPIO_GROUP(GPIOE_0),
  344. GPIO_GROUP(GPIOE_1),
  345. GPIO_GROUP(GPIOE_2),
  346. GPIO_GROUP(GPIOE_3),
  347. GPIO_GROUP(GPIOE_4),
  348. GPIO_GROUP(GPIOB_0),
  349. GPIO_GROUP(GPIOB_1),
  350. GPIO_GROUP(GPIOB_2),
  351. GPIO_GROUP(GPIOB_3),
  352. GPIO_GROUP(GPIOB_4),
  353. GPIO_GROUP(GPIOB_5),
  354. GPIO_GROUP(GPIOB_6),
  355. GPIO_GROUP(GPIOB_7),
  356. GPIO_GROUP(GPIOB_8),
  357. GPIO_GROUP(GPIOB_9),
  358. GPIO_GROUP(GPIOB_10),
  359. GPIO_GROUP(GPIOB_11),
  360. GPIO_GROUP(GPIOB_12),
  361. GPIO_GROUP(GPIOB_13),
  362. GPIO_GROUP(GPIOB_14),
  363. GPIO_GROUP(GPIOC_0),
  364. GPIO_GROUP(GPIOC_1),
  365. GPIO_GROUP(GPIOC_2),
  366. GPIO_GROUP(GPIOC_3),
  367. GPIO_GROUP(GPIOC_4),
  368. GPIO_GROUP(GPIOC_5),
  369. GPIO_GROUP(GPIOC_6),
  370. GPIO_GROUP(GPIOX_0),
  371. GPIO_GROUP(GPIOX_1),
  372. GPIO_GROUP(GPIOX_2),
  373. GPIO_GROUP(GPIOX_3),
  374. GPIO_GROUP(GPIOX_4),
  375. GPIO_GROUP(GPIOX_5),
  376. GPIO_GROUP(GPIOX_6),
  377. GPIO_GROUP(GPIOX_7),
  378. GPIO_GROUP(GPIOX_8),
  379. GPIO_GROUP(GPIOX_9),
  380. GPIO_GROUP(GPIOX_10),
  381. GPIO_GROUP(GPIOX_11),
  382. GPIO_GROUP(GPIOX_12),
  383. GPIO_GROUP(GPIOX_13),
  384. GPIO_GROUP(GPIOD_0),
  385. GPIO_GROUP(GPIOD_1),
  386. GPIO_GROUP(GPIOD_2),
  387. GPIO_GROUP(GPIOD_3),
  388. GPIO_GROUP(GPIOD_4),
  389. GPIO_GROUP(GPIOD_5),
  390. GPIO_GROUP(GPIOD_6),
  391. GPIO_GROUP(GPIOA_0),
  392. GPIO_GROUP(GPIOA_1),
  393. GPIO_GROUP(GPIOA_2),
  394. GPIO_GROUP(GPIOA_3),
  395. GPIO_GROUP(GPIOA_4),
  396. GPIO_GROUP(GPIOA_5),
  397. GPIO_GROUP(GPIO_TEST_N),
  398. /* Bank E func1 */
  399. GROUP(pwm_a, 1),
  400. GROUP(pwm_b, 1),
  401. GROUP(i2c2_sda, 1),
  402. GROUP(i2c2_scl, 1),
  403. GROUP(gen_clk_e, 1),
  404. /* Bank E func2 */
  405. GROUP(i2c0_sda_e, 2),
  406. GROUP(i2c0_scl_e, 2),
  407. GROUP(clk_32k_in, 2),
  408. /* Bank E func3 */
  409. GROUP(i2c_slave_scl, 3),
  410. GROUP(i2c_slave_sda, 3),
  411. GROUP(clk12_24_e, 3),
  412. /* Bank B func1 */
  413. GROUP(emmc_nand_d0, 1),
  414. GROUP(emmc_nand_d1, 1),
  415. GROUP(emmc_nand_d2, 1),
  416. GROUP(emmc_nand_d3, 1),
  417. GROUP(emmc_nand_d4, 1),
  418. GROUP(emmc_nand_d5, 1),
  419. GROUP(emmc_nand_d6, 1),
  420. GROUP(emmc_nand_d7, 1),
  421. GROUP(emmc_clk, 1),
  422. GROUP(emmc_rst, 1),
  423. GROUP(emmc_cmd, 1),
  424. GROUP(emmc_nand_ds, 1),
  425. /* Bank B func2 */
  426. GROUP(nand_wen_clk, 2),
  427. GROUP(nand_ale, 2),
  428. GROUP(nand_ren_wr, 2),
  429. GROUP(nand_cle, 2),
  430. GROUP(nand_ce0, 2),
  431. /* Bank B func3 */
  432. GROUP(pwm_g_b, 3),
  433. GROUP(pwm_h_b, 3),
  434. GROUP(pwm_i_b, 3),
  435. GROUP(spif_hold, 3),
  436. GROUP(spif_mo, 3),
  437. GROUP(spif_mi, 3),
  438. GROUP(spif_clk, 3),
  439. GROUP(spif_wp, 3),
  440. GROUP(pwm_j_b, 3),
  441. GROUP(pwm_k_b, 3),
  442. GROUP(pwm_l_b, 3),
  443. GROUP(pwm_m_b, 3),
  444. GROUP(pwm_n_b, 3),
  445. GROUP(spif_cs, 3),
  446. GROUP(spif_clk_loop, 3),
  447. /* Bank B func4 */
  448. GROUP(lcd_d0, 4),
  449. GROUP(lcd_d1, 4),
  450. GROUP(lcd_d2, 4),
  451. GROUP(lcd_d3, 4),
  452. GROUP(lcd_d4, 4),
  453. GROUP(lcd_d5, 4),
  454. GROUP(lcd_d6, 4),
  455. GROUP(lcd_d7, 4),
  456. /* Bank B func5 */
  457. GROUP(spi_a_mosi_b, 5),
  458. GROUP(spi_a_miso_b, 5),
  459. GROUP(spi_a_clk_b, 5),
  460. GROUP(spi_a_ss0_b, 5),
  461. GROUP(spi_a_ss1_b, 5),
  462. GROUP(spi_a_ss2_b, 5),
  463. GROUP(i2c1_sda_b, 5),
  464. GROUP(i2c1_scl_b, 5),
  465. /* Bank B func6 */
  466. GROUP(uart_a_tx_b, 6),
  467. GROUP(uart_a_rx_b, 6),
  468. GROUP(uart_a_cts_b, 6),
  469. GROUP(uart_a_rts_b, 6),
  470. GROUP(uart_d_tx_b, 6),
  471. GROUP(uart_d_rx_b, 6),
  472. GROUP(pdm_dclk_b, 6),
  473. GROUP(pdm_din0_b, 6),
  474. /* Bank C func1 */
  475. GROUP(sdcard_d0, 1),
  476. GROUP(sdcard_d1, 1),
  477. GROUP(sdcard_d2, 1),
  478. GROUP(sdcard_d3, 1),
  479. GROUP(sdcard_clk, 1),
  480. GROUP(sdcard_cmd, 1),
  481. GROUP(sdcard_cd, 1),
  482. /* Bank C func2 */
  483. GROUP(jtag_b_tdo, 2),
  484. GROUP(jtag_b_tdi, 2),
  485. GROUP(uart_b_rx_c, 2),
  486. GROUP(uart_b_tx_c, 2),
  487. GROUP(jtag_b_clk, 2),
  488. GROUP(jtag_b_tms, 2),
  489. GROUP(gen_clk_c, 2),
  490. /* Bank C func3 */
  491. GROUP(tdm_d3, 3),
  492. GROUP(tdm_d2, 3),
  493. GROUP(mclk_1, 3),
  494. GROUP(tdm_sclk1, 3),
  495. GROUP(tdm_fs1, 3),
  496. GROUP(pdm_dclk_c, 3),
  497. GROUP(pdm_din0_c, 3),
  498. /* Bank C func4 */
  499. GROUP(spi_a_mosi_c, 4),
  500. GROUP(spi_a_miso_c, 4),
  501. GROUP(spi_a_clk_c, 4),
  502. GROUP(spi_a_ss0_c, 4),
  503. GROUP(spi_a_ss1_c, 4),
  504. /* Bank C func5 */
  505. GROUP(pwm_g_c, 5),
  506. GROUP(pwm_h_c, 5),
  507. GROUP(pwm_i_c, 5),
  508. GROUP(pwm_j_c, 5),
  509. GROUP(pwm_k_c, 5),
  510. GROUP(pwm_l_c, 5),
  511. GROUP(pwm_m_c, 5),
  512. /* Bank C func6 */
  513. GROUP(uart_a_rx_c, 6),
  514. GROUP(uart_a_tx_c, 6),
  515. GROUP(uart_c_rx_c, 6),
  516. GROUP(uart_c_tx_c, 6),
  517. GROUP(i2c3_sda_c, 6),
  518. GROUP(i2c3_scl_c, 6),
  519. GROUP(clk12_24_c, 6),
  520. /* Bank X func1 */
  521. GROUP(sdio_d0, 1),
  522. GROUP(sdio_d1, 1),
  523. GROUP(sdio_d2, 1),
  524. GROUP(sdio_d3, 1),
  525. GROUP(sdio_clk, 1),
  526. GROUP(sdio_cmd, 1),
  527. GROUP(clk12_24_x, 1),
  528. GROUP(uart_e_tx_x, 1),
  529. GROUP(uart_e_rx_x, 1),
  530. GROUP(uart_e_cts, 1),
  531. GROUP(uart_e_rts, 1),
  532. GROUP(pwm_e, 1),
  533. GROUP(pwm_j_x12, 1),
  534. GROUP(pwm_k_x13, 1),
  535. /* Bank X func2 */
  536. GROUP(spi_a_mosi_x, 2),
  537. GROUP(spi_a_miso_x, 2),
  538. GROUP(spi_a_clk_x, 2),
  539. GROUP(spi_a_ss0_x, 2),
  540. GROUP(spi_a_ss1_x, 2),
  541. GROUP(spi_a_ss2_x, 2),
  542. GROUP(spi_b_ss2_x6, 2),
  543. GROUP(spi_b_miso_x, 2),
  544. GROUP(spi_b_clk_x, 2),
  545. GROUP(spi_b_mosi_x, 2),
  546. GROUP(spi_b_ss0_x, 2),
  547. GROUP(spi_b_ss1_x, 2),
  548. GROUP(spi_b_ss2_x12, 2),
  549. GROUP(gen_clk_x, 2),
  550. /* Bank X func3 */
  551. GROUP(tdm_d1_x, 3),
  552. GROUP(tdm_d0_x, 3),
  553. GROUP(mclk_0_x, 3),
  554. GROUP(tdm_sclk0_x, 3),
  555. GROUP(tdm_fs0_x, 3),
  556. GROUP(pdm_dclk_x5, 3),
  557. GROUP(pdm_din0_x6, 3),
  558. GROUP(pdm_din0_x9, 3),
  559. GROUP(pdm_dclk_x10, 3),
  560. GROUP(clk12_24_x13, 3),
  561. /* Bank X func4 */
  562. GROUP(lcd_d8, 4),
  563. GROUP(lcd_d9, 4),
  564. GROUP(lcd_d10, 4),
  565. GROUP(lcd_d11, 4),
  566. GROUP(lcd_d12, 4),
  567. GROUP(lcd_d13, 4),
  568. GROUP(lcd_d14, 4),
  569. GROUP(lcd_d15, 4),
  570. GROUP(lcd_vs, 4),
  571. GROUP(lcd_hs, 4),
  572. GROUP(lcd_den, 4),
  573. GROUP(lcd_d16, 4),
  574. GROUP(lcd_clk_x, 4),
  575. GROUP(lcd_d17, 4),
  576. /* Bank X func5 */
  577. GROUP(pwm_g_x0, 5),
  578. GROUP(pwm_h_x1, 5),
  579. GROUP(pwm_i_x2, 5),
  580. GROUP(pwm_j_x3, 5),
  581. GROUP(pwm_k_x4, 5),
  582. GROUP(pwm_l_x, 5),
  583. GROUP(pwm_m_x, 5),
  584. GROUP(pwm_n_x, 5),
  585. GROUP(pwm_g_x8, 5),
  586. GROUP(pwm_h_x9, 5),
  587. GROUP(pwm_i_x10, 5),
  588. GROUP(clk12_24_x11, 5),
  589. /* Bank X func6 */
  590. GROUP(uart_a_rx_x, 6),
  591. GROUP(uart_a_tx_x, 6),
  592. GROUP(uart_c_rx_x, 6),
  593. GROUP(uart_c_tx_x, 6),
  594. GROUP(i2c3_sda_x, 6),
  595. GROUP(i2c3_scl_x, 6),
  596. GROUP(i2c1_sda_x, 6),
  597. GROUP(i2c1_scl_x, 6),
  598. GROUP(uart_d_tx_x, 6),
  599. GROUP(uart_d_rx_x, 6),
  600. /* Bank D func1 */
  601. GROUP(pwm_g_d, 1),
  602. GROUP(pwm_h_d, 1),
  603. GROUP(eth_led_act, 1),
  604. GROUP(eth_led_link, 1),
  605. GROUP(pwm_d, 1),
  606. GROUP(pwm_f, 1),
  607. GROUP(pwm_k_d, 1),
  608. /* Bank D func2 */
  609. GROUP(uart_a_tx_d, 2),
  610. GROUP(uart_a_rx_d, 2),
  611. GROUP(spi_b_miso_d, 2),
  612. GROUP(spi_b_clk_d, 2),
  613. GROUP(spi_b_mosi_d, 2),
  614. GROUP(spi_b_ss0_d, 2),
  615. GROUP(spi_b_ss1_d, 2),
  616. /* Bank D func3 */
  617. GROUP(i2c0_sda_d, 3),
  618. GROUP(i2c0_scl_d, 3),
  619. GROUP(i2c1_sda_d, 3),
  620. GROUP(i2c1_scl_d, 3),
  621. GROUP(pdm_dclk_d, 3),
  622. GROUP(pdm_din0_d, 3),
  623. GROUP(ir_in_d6, 3),
  624. /* Bank D func4 */
  625. GROUP(ir_in_d0, 4),
  626. GROUP(ir_out, 4),
  627. GROUP(pwm_i_d, 4),
  628. GROUP(pwm_j_d, 4),
  629. GROUP(i2c3_sda_d, 4),
  630. GROUP(i2c3_scl_d, 4),
  631. /* Bank D func5 */
  632. GROUP(tdm_fs0_d, 5),
  633. GROUP(tdm_sclk0_d, 5),
  634. GROUP(mclk_0_d, 5),
  635. GROUP(tdm_d1_d, 5),
  636. GROUP(tdm_d0_d, 5),
  637. /* Bank D func6 */
  638. GROUP(uart_d_tx_d, 6),
  639. GROUP(uart_d_rx_d, 6),
  640. GROUP(uart_c_tx_d, 6),
  641. GROUP(uart_c_rx_d, 6),
  642. /* Bank A func1 */
  643. GROUP(uart_b_tx_a, 1),
  644. GROUP(uart_b_rx_a, 1),
  645. GROUP(pwm_c, 1),
  646. GROUP(pwm_l_a, 1),
  647. GROUP(i2c1_sda_a, 1),
  648. GROUP(i2c1_scl_a, 1),
  649. /* Bank A func2 */
  650. GROUP(pwm_c_hiz, 2),
  651. GROUP(gen_clk_a, 2),
  652. GROUP(pdm_dclk_z, 2),
  653. GROUP(pdm_din0_a, 2),
  654. /* Bank A func3 */
  655. GROUP(jtag_a_clk, 3),
  656. GROUP(jtag_a_tms, 3),
  657. GROUP(jtag_a_tdi, 3),
  658. GROUP(jtag_a_tdo, 3),
  659. /* Bank A func4 */
  660. GROUP(lcd_clk_a, 4),
  661. GROUP(uart_f_tx_a, 4),
  662. GROUP(uart_f_rx_a, 4),
  663. /* Bank A func5 */
  664. GROUP(uart_e_tx_a, 5),
  665. GROUP(uart_e_rx_a, 5),
  666. GROUP(pwm_m_a, 5),
  667. GROUP(pwm_n_a, 5),
  668. /* Bank A func6 */
  669. GROUP(spi_a_mosi_a, 6),
  670. GROUP(gen_clk_a4, 6),
  671. GROUP(clk12_24_a, 6),
  672. };
  673. static const char * const gpio_periphs_groups[] = {
  674. "GPIO_TEST_N",
  675. "GPIOE_0", "GPIOE_1", "GPIOE_2", "GPIOE_3", "GPIOE_4",
  676. "GPIOB_0", "GPIOB_1", "GPIOB_2", "GPIOB_3", "GPIOB_4",
  677. "GPIOB_5", "GPIOB_6", "GPIOB_7", "GPIOB_8", "GPIOB_9",
  678. "GPIOB_10", "GPIOB_11", "GPIOB_12", "GPIOB_13",
  679. "GPIOB_14",
  680. "GPIOC_0", "GPIOC_1", "GPIOC_2", "GPIOC_3", "GPIOC_4",
  681. "GPIOC_5", "GPIOC_6",
  682. "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4",
  683. "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9",
  684. "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13",
  685. "GPIOD_0", "GPIOD_1", "GPIOD_2", "GPIOD_3", "GPIOD_4",
  686. "GPIOD_5", "GPIOD_6",
  687. "GPIOA_0", "GPIOA_1", "GPIOA_2", "GPIOA_3", "GPIOA_4",
  688. "GPIOA_5",
  689. };
  690. static const char * const uart_a_groups[] = {
  691. "uart_a_tx_b", "uart_a_rx_b", "uart_a_cts_b", "uart_a_rts_b",
  692. "uart_a_rx_c", "uart_a_tx_c", "uart_a_rx_x", "uart_a_tx_x",
  693. "uart_a_tx_d", "uart_a_rx_d",
  694. };
  695. static const char * const uart_b_groups[] = {
  696. "uart_b_rx_c", "uart_b_tx_c", "uart_b_tx_a", "uart_b_rx_a",
  697. };
  698. static const char * const uart_c_groups[] = {
  699. "uart_c_rx_c", "uart_c_tx_c",
  700. "uart_c_rx_x", "uart_c_tx_x",
  701. "uart_c_tx_d", "uart_c_rx_d",
  702. };
  703. static const char * const uart_d_groups[] = {
  704. "uart_d_tx_b", "uart_d_rx_b", "uart_d_tx_d", "uart_d_rx_d",
  705. "uart_d_rx_x", "uart_d_tx_x",
  706. };
  707. static const char * const uart_e_groups[] = {
  708. "uart_e_cts", "uart_e_tx_x", "uart_e_rx_x", "uart_e_rts",
  709. "uart_e_tx_a", "uart_e_rx_a",
  710. };
  711. static const char * const i2c0_groups[] = {
  712. "i2c0_sda_e", "i2c0_scl_e",
  713. "i2c0_sda_d", "i2c0_scl_d",
  714. };
  715. static const char * const i2c1_groups[] = {
  716. "i2c1_sda_x", "i2c1_scl_x",
  717. "i2c1_sda_d", "i2c1_scl_d",
  718. "i2c1_sda_a", "i2c1_scl_a",
  719. "i2c1_sda_b", "i2c1_scl_b",
  720. };
  721. static const char * const i2c2_groups[] = {
  722. "i2c2_sda", "i2c2_scl",
  723. };
  724. static const char * const i2c3_groups[] = {
  725. "i2c3_sda_c", "i2c3_scl_c",
  726. "i2c3_sda_x", "i2c3_scl_x",
  727. "i2c3_sda_d", "i2c3_scl_d",
  728. };
  729. static const char * const i2c_slave_groups[] = {
  730. "i2c_slave_scl", "i2c_slave_sda",
  731. };
  732. static const char * const pwm_a_groups[] = {
  733. "pwm_a",
  734. };
  735. static const char * const pwm_b_groups[] = {
  736. "pwm_b",
  737. };
  738. static const char * const pwm_c_groups[] = {
  739. "pwm_c",
  740. };
  741. static const char * const pwm_d_groups[] = {
  742. "pwm_d",
  743. };
  744. static const char * const pwm_e_groups[] = {
  745. "pwm_e",
  746. };
  747. static const char * const pwm_f_groups[] = {
  748. "pwm_f",
  749. };
  750. static const char * const pwm_g_groups[] = {
  751. "pwm_g_b", "pwm_g_c", "pwm_g_d", "pwm_g_x0", "pwm_g_x8",
  752. };
  753. static const char * const pwm_h_groups[] = {
  754. "pwm_h_b", "pwm_h_c", "pwm_h_d", "pwm_h_x1", "pwm_h_x9",
  755. };
  756. static const char * const pwm_i_groups[] = {
  757. "pwm_i_b", "pwm_i_c", "pwm_i_d", "pwm_i_x2", "pwm_i_x10",
  758. };
  759. static const char * const pwm_j_groups[] = {
  760. "pwm_j_c", "pwm_j_d", "pwm_j_b", "pwm_j_x3", "pwm_j_x12",
  761. };
  762. static const char * const pwm_k_groups[] = {
  763. "pwm_k_c", "pwm_k_d", "pwm_k_b", "pwm_k_x4", "pwm_k_x13",
  764. };
  765. static const char * const pwm_l_groups[] = {
  766. "pwm_l_c", "pwm_l_x", "pwm_l_b", "pwm_l_a",
  767. };
  768. static const char * const pwm_m_groups[] = {
  769. "pwm_m_c", "pwm_m_x", "pwm_m_a", "pwm_m_b",
  770. };
  771. static const char * const pwm_n_groups[] = {
  772. "pwm_n_x", "pwm_n_a", "pwm_n_b",
  773. };
  774. static const char * const pwm_c_hiz_groups[] = {
  775. "pwm_c_hiz",
  776. };
  777. static const char * const ir_out_groups[] = {
  778. "ir_out",
  779. };
  780. static const char * const ir_in_groups[] = {
  781. "ir_in_d0", "ir_in_d6",
  782. };
  783. static const char * const jtag_a_groups[] = {
  784. "jtag_a_clk", "jtag_a_tms", "jtag_a_tdi", "jtag_a_tdo",
  785. };
  786. static const char * const jtag_b_groups[] = {
  787. "jtag_b_tdo", "jtag_b_tdi", "jtag_b_clk", "jtag_b_tms",
  788. };
  789. static const char * const gen_clk_groups[] = {
  790. "gen_clk_e", "gen_clk_c", "gen_clk_a", "gen_clk_x",
  791. "gen_clk_a4",
  792. };
  793. static const char * const clk12_24_groups[] = {
  794. "clk12_24_e", "clk12_24_c", "clk12_24_x", "clk12_24_a",
  795. "clk12_24_x13", "clk12_24_x11",
  796. };
  797. static const char * const clk_32k_in_groups[] = {
  798. "clk_32k_in",
  799. };
  800. static const char * const emmc_groups[] = {
  801. "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2", "emmc_nand_d3",
  802. "emmc_nand_d4", "emmc_nand_d5", "emmc_nand_d6", "emmc_nand_d7",
  803. "emmc_clk", "emmc_rst", "emmc_cmd", "emmc_nand_ds",
  804. };
  805. static const char * const nand_groups[] = {
  806. "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2", "emmc_nand_d3",
  807. "emmc_nand_d4", "emmc_nand_d5", "emmc_nand_d6", "emmc_nand_d7",
  808. "emmc_clk", "emmc_rst", "emmc_cmd", "emmc_nand_ds",
  809. "nand_wen_clk", "nand_ale", "nand_ren_wr", "nand_cle",
  810. "nand_ce0",
  811. };
  812. static const char * const spif_groups[] = {
  813. "spif_mo", "spif_mi", "spif_wp", "spif_cs",
  814. "spif_clk", "spif_hold", "spif_clk_loop",
  815. };
  816. static const char * const spi_a_groups[] = {
  817. "spi_a_clk_b", "spi_a_ss0_b", "spi_a_ss1_b", "spi_a_ss2_b",
  818. "spi_a_mosi_b", "spi_a_miso_b",
  819. "spi_a_clk_c", "spi_a_ss0_c", "spi_a_ss1_c",
  820. "spi_a_mosi_c", "spi_a_miso_c",
  821. "spi_a_clk_x", "spi_a_ss0_x", "spi_a_ss1_x", "spi_a_ss2_x",
  822. "spi_a_mosi_x", "spi_a_miso_x",
  823. "spi_a_mosi_a",
  824. };
  825. static const char * const spi_b_groups[] = {
  826. "spi_b_clk_x", "spi_b_ss0_x", "spi_b_ss1_x", "spi_b_ss2_x6",
  827. "spi_b_miso_x", "spi_b_mosi_x", "spi_b_ss2_x12",
  828. "spi_b_clk_d", "spi_b_ss0_d", "spi_b_ss1_d", "spi_b_miso_d",
  829. "spi_b_mosi_d",
  830. };
  831. static const char * const sdcard_groups[] = {
  832. "sdcard_d0", "sdcard_d1", "sdcard_d2", "sdcard_d3",
  833. "sdcard_cd", "sdcard_clk", "sdcard_cmd",
  834. };
  835. static const char * const sdio_groups[] = {
  836. "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3",
  837. "sdio_clk", "sdio_cmd",
  838. };
  839. static const char * const pdm_groups[] = {
  840. "pdm_dclk_c", "pdm_din0_c", "pdm_dclk_d", "pdm_din0_d",
  841. "pdm_dclk_z", "pdm_din0_a", "pdm_dclk_b", "pdm_din0_b",
  842. "pdm_dclk_x5", "pdm_din0_x6", "pdm_din0_x9", "pdm_dclk_x10",
  843. };
  844. static const char * const eth_groups[] = {
  845. "eth_led_act", "eth_led_link",
  846. };
  847. static const char * const mclk_0_groups[] = {
  848. "mclk_0_x", "mclk_0_d",
  849. };
  850. static const char * const mclk_1_groups[] = {
  851. "mclk_1",
  852. };
  853. static const char * const tdm_groups[] = {
  854. "tdm_d3", "tdm_d2", "tdm_fs1", "tdm_d1_x", "tdm_d0_x",
  855. "tdm_d1_d", "tdm_d0_d", "tdm_sclk1", "tdm_fs0_x", "tdm_fs0_d",
  856. "tdm_sclk0_x", "tdm_sclk0_d",
  857. };
  858. static const char * const lcd_groups[] = {
  859. "lcd_d0", "lcd_d1", "lcd_d2", "lcd_d3", "lcd_d4",
  860. "lcd_d5", "lcd_d6", "lcd_d7", "lcd_d8", "lcd_d9",
  861. "lcd_d10", "lcd_d11", "lcd_d12", "lcd_d13", "lcd_d14",
  862. "lcd_d15", "lcd_d16", "lcd_d17", "lcd_den",
  863. "lcd_clk_a", "lcd_clk_x", "lcd_hs", "lcd_vs",
  864. };
  865. static const struct meson_pmx_func c3_periphs_functions[] = {
  866. FUNCTION(gpio_periphs),
  867. FUNCTION(uart_a),
  868. FUNCTION(uart_b),
  869. FUNCTION(uart_c),
  870. FUNCTION(uart_d),
  871. FUNCTION(uart_e),
  872. FUNCTION(i2c0),
  873. FUNCTION(i2c1),
  874. FUNCTION(i2c2),
  875. FUNCTION(i2c3),
  876. FUNCTION(i2c_slave),
  877. FUNCTION(pwm_a),
  878. FUNCTION(pwm_b),
  879. FUNCTION(pwm_c),
  880. FUNCTION(pwm_d),
  881. FUNCTION(pwm_e),
  882. FUNCTION(pwm_f),
  883. FUNCTION(pwm_g),
  884. FUNCTION(pwm_h),
  885. FUNCTION(pwm_i),
  886. FUNCTION(pwm_j),
  887. FUNCTION(pwm_k),
  888. FUNCTION(pwm_l),
  889. FUNCTION(pwm_m),
  890. FUNCTION(pwm_n),
  891. FUNCTION(pwm_c_hiz),
  892. FUNCTION(ir_out),
  893. FUNCTION(ir_in),
  894. FUNCTION(jtag_a),
  895. FUNCTION(jtag_b),
  896. FUNCTION(gen_clk),
  897. FUNCTION(clk12_24),
  898. FUNCTION(clk_32k_in),
  899. FUNCTION(emmc),
  900. FUNCTION(nand),
  901. FUNCTION(spif),
  902. FUNCTION(spi_a),
  903. FUNCTION(spi_b),
  904. FUNCTION(sdcard),
  905. FUNCTION(sdio),
  906. FUNCTION(pdm),
  907. FUNCTION(eth),
  908. FUNCTION(mclk_0),
  909. FUNCTION(mclk_1),
  910. FUNCTION(tdm),
  911. FUNCTION(lcd),
  912. };
  913. static const struct meson_bank c3_periphs_banks[] = {
  914. /* name first last irq pullen pull dir out in ds */
  915. BANK_DS("X", GPIOX_0, GPIOX_13, 40, 53,
  916. 0x03, 0, 0x04, 0, 0x02, 0, 0x01, 0, 0x00, 0, 0x07, 0),
  917. BANK_DS("D", GPIOD_0, GPIOD_6, 33, 39,
  918. 0x23, 0, 0x24, 0, 0x22, 0, 0x21, 0, 0x20, 0, 0x27, 0),
  919. BANK_DS("E", GPIOE_0, GPIOE_4, 22, 26,
  920. 0x33, 0, 0x34, 0, 0x32, 0, 0x31, 0, 0x30, 0, 0x37, 0),
  921. BANK_DS("C", GPIOC_0, GPIOC_6, 15, 21,
  922. 0x43, 0, 0x44, 0, 0x42, 0, 0x41, 0, 0x40, 0, 0x47, 0),
  923. BANK_DS("B", GPIOB_0, GPIOB_14, 0, 14,
  924. 0x53, 0, 0x54, 0, 0x52, 0, 0x51, 0, 0x50, 0, 0x57, 0),
  925. BANK_DS("A", GPIOA_0, GPIOA_5, 27, 32,
  926. 0x63, 0, 0x64, 0, 0x62, 0, 0x61, 0, 0x60, 0, 0x67, 0),
  927. BANK_DS("TEST_N", GPIO_TEST_N, GPIO_TEST_N, 54, 54,
  928. 0x73, 0, 0x74, 0, 0x72, 0, 0x71, 0, 0x70, 0, 0x77, 0),
  929. };
  930. static const struct meson_pmx_bank c3_periphs_pmx_banks[] = {
  931. /* name first last reg offset */
  932. BANK_PMX("B", GPIOB_0, GPIOB_14, 0x00, 0),
  933. BANK_PMX("X", GPIOX_0, GPIOX_13, 0x03, 0),
  934. BANK_PMX("C", GPIOC_0, GPIOC_6, 0x09, 0),
  935. BANK_PMX("A", GPIOA_0, GPIOA_5, 0x0b, 0),
  936. BANK_PMX("D", GPIOD_0, GPIOD_6, 0x10, 0),
  937. BANK_PMX("E", GPIOE_0, GPIOE_4, 0x12, 0),
  938. BANK_PMX("TEST_N", GPIO_TEST_N, GPIO_TEST_N, 0x02, 0),
  939. };
  940. static const struct meson_axg_pmx_data c3_periphs_pmx_banks_data = {
  941. .pmx_banks = c3_periphs_pmx_banks,
  942. .num_pmx_banks = ARRAY_SIZE(c3_periphs_pmx_banks),
  943. };
  944. static const struct meson_pinctrl_data c3_periphs_pinctrl_data = {
  945. .name = "periphs-banks",
  946. .pins = c3_periphs_pins,
  947. .groups = c3_periphs_groups,
  948. .funcs = c3_periphs_functions,
  949. .banks = c3_periphs_banks,
  950. .num_pins = ARRAY_SIZE(c3_periphs_pins),
  951. .num_groups = ARRAY_SIZE(c3_periphs_groups),
  952. .num_funcs = ARRAY_SIZE(c3_periphs_functions),
  953. .num_banks = ARRAY_SIZE(c3_periphs_banks),
  954. .pmx_ops = &meson_axg_pmx_ops,
  955. .pmx_data = &c3_periphs_pmx_banks_data,
  956. .parse_dt = &meson_a1_parse_dt_extra,
  957. };
  958. static const struct of_device_id c3_pinctrl_dt_match[] = {
  959. {
  960. .compatible = "amlogic,c3-periphs-pinctrl",
  961. .data = &c3_periphs_pinctrl_data,
  962. },
  963. { }
  964. };
  965. MODULE_DEVICE_TABLE(of, c3_pinctrl_dt_match);
  966. static struct platform_driver c3_pinctrl_driver = {
  967. .probe = meson_pinctrl_probe,
  968. .driver = {
  969. .name = "amlogic-c3-pinctrl",
  970. .of_match_table = c3_pinctrl_dt_match,
  971. },
  972. };
  973. module_platform_driver(c3_pinctrl_driver);
  974. MODULE_AUTHOR("Huqiang Qin <huqiang.qin@amlogic.com>");
  975. MODULE_DESCRIPTION("Pin controller and GPIO driver for Amlogic C3 SoC");
  976. MODULE_LICENSE("Dual BSD/GPL");