pinctrl-mt7622.c 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2017-2018 MediaTek Inc.
  4. *
  5. * Author: Sean Wang <[email protected]>
  6. *
  7. */
  8. #include "pinctrl-moore.h"
  9. #define MT7622_PIN(_number, _name) \
  10. MTK_PIN(_number, _name, 1, _number, DRV_GRP0)
  11. static const struct mtk_pin_field_calc mt7622_pin_mode_range[] = {
  12. PIN_FIELD(0, 0, 0x320, 0x10, 16, 4),
  13. PIN_FIELD(1, 4, 0x3a0, 0x10, 16, 4),
  14. PIN_FIELD(5, 5, 0x320, 0x10, 0, 4),
  15. PINS_FIELD(6, 7, 0x300, 0x10, 4, 4),
  16. PIN_FIELD(8, 9, 0x350, 0x10, 20, 4),
  17. PINS_FIELD(10, 13, 0x300, 0x10, 8, 4),
  18. PIN_FIELD(14, 15, 0x320, 0x10, 4, 4),
  19. PIN_FIELD(16, 17, 0x320, 0x10, 20, 4),
  20. PIN_FIELD(18, 21, 0x310, 0x10, 16, 4),
  21. PIN_FIELD(22, 22, 0x380, 0x10, 16, 4),
  22. PINS_FIELD(23, 24, 0x300, 0x10, 24, 4),
  23. PINS_FIELD(25, 36, 0x300, 0x10, 12, 4),
  24. PINS_FIELD(37, 50, 0x300, 0x10, 20, 4),
  25. PIN_FIELD(51, 70, 0x330, 0x10, 4, 4),
  26. PINS_FIELD(71, 72, 0x300, 0x10, 16, 4),
  27. PIN_FIELD(73, 76, 0x310, 0x10, 0, 4),
  28. PIN_FIELD(77, 77, 0x320, 0x10, 28, 4),
  29. PIN_FIELD(78, 78, 0x320, 0x10, 12, 4),
  30. PIN_FIELD(79, 82, 0x3a0, 0x10, 0, 4),
  31. PIN_FIELD(83, 83, 0x350, 0x10, 28, 4),
  32. PIN_FIELD(84, 84, 0x330, 0x10, 0, 4),
  33. PIN_FIELD(85, 90, 0x360, 0x10, 4, 4),
  34. PIN_FIELD(91, 94, 0x390, 0x10, 16, 4),
  35. PIN_FIELD(95, 97, 0x380, 0x10, 20, 4),
  36. PIN_FIELD(98, 101, 0x390, 0x10, 0, 4),
  37. PIN_FIELD(102, 102, 0x360, 0x10, 0, 4),
  38. };
  39. static const struct mtk_pin_field_calc mt7622_pin_dir_range[] = {
  40. PIN_FIELD(0, 102, 0x0, 0x10, 0, 1),
  41. };
  42. static const struct mtk_pin_field_calc mt7622_pin_di_range[] = {
  43. PIN_FIELD(0, 102, 0x200, 0x10, 0, 1),
  44. };
  45. static const struct mtk_pin_field_calc mt7622_pin_do_range[] = {
  46. PIN_FIELD(0, 102, 0x100, 0x10, 0, 1),
  47. };
  48. static const struct mtk_pin_field_calc mt7622_pin_sr_range[] = {
  49. PIN_FIELD(0, 31, 0x910, 0x10, 0, 1),
  50. PIN_FIELD(32, 50, 0xa10, 0x10, 0, 1),
  51. PIN_FIELD(51, 70, 0x810, 0x10, 0, 1),
  52. PIN_FIELD(71, 72, 0xb10, 0x10, 0, 1),
  53. PIN_FIELD(73, 86, 0xb10, 0x10, 4, 1),
  54. PIN_FIELD(87, 90, 0xc10, 0x10, 0, 1),
  55. PIN_FIELD(91, 102, 0xb10, 0x10, 18, 1),
  56. };
  57. static const struct mtk_pin_field_calc mt7622_pin_smt_range[] = {
  58. PIN_FIELD(0, 31, 0x920, 0x10, 0, 1),
  59. PIN_FIELD(32, 50, 0xa20, 0x10, 0, 1),
  60. PIN_FIELD(51, 70, 0x820, 0x10, 0, 1),
  61. PIN_FIELD(71, 72, 0xb20, 0x10, 0, 1),
  62. PIN_FIELD(73, 86, 0xb20, 0x10, 4, 1),
  63. PIN_FIELD(87, 90, 0xc20, 0x10, 0, 1),
  64. PIN_FIELD(91, 102, 0xb20, 0x10, 18, 1),
  65. };
  66. static const struct mtk_pin_field_calc mt7622_pin_pu_range[] = {
  67. PIN_FIELD(0, 31, 0x930, 0x10, 0, 1),
  68. PIN_FIELD(32, 50, 0xa30, 0x10, 0, 1),
  69. PIN_FIELD(51, 70, 0x830, 0x10, 0, 1),
  70. PIN_FIELD(71, 72, 0xb30, 0x10, 0, 1),
  71. PIN_FIELD(73, 86, 0xb30, 0x10, 4, 1),
  72. PIN_FIELD(87, 90, 0xc30, 0x10, 0, 1),
  73. PIN_FIELD(91, 102, 0xb30, 0x10, 18, 1),
  74. };
  75. static const struct mtk_pin_field_calc mt7622_pin_pd_range[] = {
  76. PIN_FIELD(0, 31, 0x940, 0x10, 0, 1),
  77. PIN_FIELD(32, 50, 0xa40, 0x10, 0, 1),
  78. PIN_FIELD(51, 70, 0x840, 0x10, 0, 1),
  79. PIN_FIELD(71, 72, 0xb40, 0x10, 0, 1),
  80. PIN_FIELD(73, 86, 0xb40, 0x10, 4, 1),
  81. PIN_FIELD(87, 90, 0xc40, 0x10, 0, 1),
  82. PIN_FIELD(91, 102, 0xb40, 0x10, 18, 1),
  83. };
  84. static const struct mtk_pin_field_calc mt7622_pin_e4_range[] = {
  85. PIN_FIELD(0, 31, 0x960, 0x10, 0, 1),
  86. PIN_FIELD(32, 50, 0xa60, 0x10, 0, 1),
  87. PIN_FIELD(51, 70, 0x860, 0x10, 0, 1),
  88. PIN_FIELD(71, 72, 0xb60, 0x10, 0, 1),
  89. PIN_FIELD(73, 86, 0xb60, 0x10, 4, 1),
  90. PIN_FIELD(87, 90, 0xc60, 0x10, 0, 1),
  91. PIN_FIELD(91, 102, 0xb60, 0x10, 18, 1),
  92. };
  93. static const struct mtk_pin_field_calc mt7622_pin_e8_range[] = {
  94. PIN_FIELD(0, 31, 0x970, 0x10, 0, 1),
  95. PIN_FIELD(32, 50, 0xa70, 0x10, 0, 1),
  96. PIN_FIELD(51, 70, 0x870, 0x10, 0, 1),
  97. PIN_FIELD(71, 72, 0xb70, 0x10, 0, 1),
  98. PIN_FIELD(73, 86, 0xb70, 0x10, 4, 1),
  99. PIN_FIELD(87, 90, 0xc70, 0x10, 0, 1),
  100. PIN_FIELD(91, 102, 0xb70, 0x10, 18, 1),
  101. };
  102. static const struct mtk_pin_field_calc mt7622_pin_tdsel_range[] = {
  103. PIN_FIELD(0, 31, 0x980, 0x4, 0, 4),
  104. PIN_FIELD(32, 50, 0xa80, 0x4, 0, 4),
  105. PIN_FIELD(51, 70, 0x880, 0x4, 0, 4),
  106. PIN_FIELD(71, 72, 0xb80, 0x4, 0, 4),
  107. PIN_FIELD(73, 86, 0xb80, 0x4, 16, 4),
  108. PIN_FIELD(87, 90, 0xc80, 0x4, 0, 4),
  109. PIN_FIELD(91, 102, 0xb88, 0x4, 8, 4),
  110. };
  111. static const struct mtk_pin_field_calc mt7622_pin_rdsel_range[] = {
  112. PIN_FIELD(0, 31, 0x990, 0x4, 0, 6),
  113. PIN_FIELD(32, 50, 0xa90, 0x4, 0, 6),
  114. PIN_FIELD(51, 58, 0x890, 0x4, 0, 6),
  115. PIN_FIELD(59, 60, 0x894, 0x4, 28, 6),
  116. PIN_FIELD(61, 62, 0x894, 0x4, 16, 6),
  117. PIN_FIELD(63, 66, 0x898, 0x4, 8, 6),
  118. PIN_FIELD(67, 68, 0x89c, 0x4, 12, 6),
  119. PIN_FIELD(69, 70, 0x89c, 0x4, 0, 6),
  120. PIN_FIELD(71, 72, 0xb90, 0x4, 0, 6),
  121. PIN_FIELD(73, 86, 0xb90, 0x4, 24, 6),
  122. PIN_FIELD(87, 90, 0xc90, 0x4, 0, 6),
  123. PIN_FIELD(91, 102, 0xb9c, 0x4, 12, 6),
  124. };
  125. static const struct mtk_pin_reg_calc mt7622_reg_cals[PINCTRL_PIN_REG_MAX] = {
  126. [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7622_pin_mode_range),
  127. [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7622_pin_dir_range),
  128. [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt7622_pin_di_range),
  129. [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt7622_pin_do_range),
  130. [PINCTRL_PIN_REG_SR] = MTK_RANGE(mt7622_pin_sr_range),
  131. [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt7622_pin_smt_range),
  132. [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt7622_pin_pu_range),
  133. [PINCTRL_PIN_REG_PD] = MTK_RANGE(mt7622_pin_pd_range),
  134. [PINCTRL_PIN_REG_E4] = MTK_RANGE(mt7622_pin_e4_range),
  135. [PINCTRL_PIN_REG_E8] = MTK_RANGE(mt7622_pin_e8_range),
  136. [PINCTRL_PIN_REG_TDSEL] = MTK_RANGE(mt7622_pin_tdsel_range),
  137. [PINCTRL_PIN_REG_RDSEL] = MTK_RANGE(mt7622_pin_rdsel_range),
  138. };
  139. static const struct mtk_pin_desc mt7622_pins[] = {
  140. MT7622_PIN(0, "GPIO_A"),
  141. MT7622_PIN(1, "I2S1_IN"),
  142. MT7622_PIN(2, "I2S1_OUT"),
  143. MT7622_PIN(3, "I2S_BCLK"),
  144. MT7622_PIN(4, "I2S_WS"),
  145. MT7622_PIN(5, "I2S_MCLK"),
  146. MT7622_PIN(6, "TXD0"),
  147. MT7622_PIN(7, "RXD0"),
  148. MT7622_PIN(8, "SPI_WP"),
  149. MT7622_PIN(9, "SPI_HOLD"),
  150. MT7622_PIN(10, "SPI_CLK"),
  151. MT7622_PIN(11, "SPI_MOSI"),
  152. MT7622_PIN(12, "SPI_MISO"),
  153. MT7622_PIN(13, "SPI_CS"),
  154. MT7622_PIN(14, "I2C_SDA"),
  155. MT7622_PIN(15, "I2C_SCL"),
  156. MT7622_PIN(16, "I2S2_IN"),
  157. MT7622_PIN(17, "I2S3_IN"),
  158. MT7622_PIN(18, "I2S4_IN"),
  159. MT7622_PIN(19, "I2S2_OUT"),
  160. MT7622_PIN(20, "I2S3_OUT"),
  161. MT7622_PIN(21, "I2S4_OUT"),
  162. MT7622_PIN(22, "GPIO_B"),
  163. MT7622_PIN(23, "MDC"),
  164. MT7622_PIN(24, "MDIO"),
  165. MT7622_PIN(25, "G2_TXD0"),
  166. MT7622_PIN(26, "G2_TXD1"),
  167. MT7622_PIN(27, "G2_TXD2"),
  168. MT7622_PIN(28, "G2_TXD3"),
  169. MT7622_PIN(29, "G2_TXEN"),
  170. MT7622_PIN(30, "G2_TXC"),
  171. MT7622_PIN(31, "G2_RXD0"),
  172. MT7622_PIN(32, "G2_RXD1"),
  173. MT7622_PIN(33, "G2_RXD2"),
  174. MT7622_PIN(34, "G2_RXD3"),
  175. MT7622_PIN(35, "G2_RXDV"),
  176. MT7622_PIN(36, "G2_RXC"),
  177. MT7622_PIN(37, "NCEB"),
  178. MT7622_PIN(38, "NWEB"),
  179. MT7622_PIN(39, "NREB"),
  180. MT7622_PIN(40, "NDL4"),
  181. MT7622_PIN(41, "NDL5"),
  182. MT7622_PIN(42, "NDL6"),
  183. MT7622_PIN(43, "NDL7"),
  184. MT7622_PIN(44, "NRB"),
  185. MT7622_PIN(45, "NCLE"),
  186. MT7622_PIN(46, "NALE"),
  187. MT7622_PIN(47, "NDL0"),
  188. MT7622_PIN(48, "NDL1"),
  189. MT7622_PIN(49, "NDL2"),
  190. MT7622_PIN(50, "NDL3"),
  191. MT7622_PIN(51, "MDI_TP_P0"),
  192. MT7622_PIN(52, "MDI_TN_P0"),
  193. MT7622_PIN(53, "MDI_RP_P0"),
  194. MT7622_PIN(54, "MDI_RN_P0"),
  195. MT7622_PIN(55, "MDI_TP_P1"),
  196. MT7622_PIN(56, "MDI_TN_P1"),
  197. MT7622_PIN(57, "MDI_RP_P1"),
  198. MT7622_PIN(58, "MDI_RN_P1"),
  199. MT7622_PIN(59, "MDI_RP_P2"),
  200. MT7622_PIN(60, "MDI_RN_P2"),
  201. MT7622_PIN(61, "MDI_TP_P2"),
  202. MT7622_PIN(62, "MDI_TN_P2"),
  203. MT7622_PIN(63, "MDI_TP_P3"),
  204. MT7622_PIN(64, "MDI_TN_P3"),
  205. MT7622_PIN(65, "MDI_RP_P3"),
  206. MT7622_PIN(66, "MDI_RN_P3"),
  207. MT7622_PIN(67, "MDI_RP_P4"),
  208. MT7622_PIN(68, "MDI_RN_P4"),
  209. MT7622_PIN(69, "MDI_TP_P4"),
  210. MT7622_PIN(70, "MDI_TN_P4"),
  211. MT7622_PIN(71, "PMIC_SCL"),
  212. MT7622_PIN(72, "PMIC_SDA"),
  213. MT7622_PIN(73, "SPIC1_CLK"),
  214. MT7622_PIN(74, "SPIC1_MOSI"),
  215. MT7622_PIN(75, "SPIC1_MISO"),
  216. MT7622_PIN(76, "SPIC1_CS"),
  217. MT7622_PIN(77, "GPIO_D"),
  218. MT7622_PIN(78, "WATCHDOG"),
  219. MT7622_PIN(79, "RTS3_N"),
  220. MT7622_PIN(80, "CTS3_N"),
  221. MT7622_PIN(81, "TXD3"),
  222. MT7622_PIN(82, "RXD3"),
  223. MT7622_PIN(83, "PERST0_N"),
  224. MT7622_PIN(84, "PERST1_N"),
  225. MT7622_PIN(85, "WLED_N"),
  226. MT7622_PIN(86, "EPHY_LED0_N"),
  227. MT7622_PIN(87, "AUXIN0"),
  228. MT7622_PIN(88, "AUXIN1"),
  229. MT7622_PIN(89, "AUXIN2"),
  230. MT7622_PIN(90, "AUXIN3"),
  231. MT7622_PIN(91, "TXD4"),
  232. MT7622_PIN(92, "RXD4"),
  233. MT7622_PIN(93, "RTS4_N"),
  234. MT7622_PIN(94, "CTS4_N"),
  235. MT7622_PIN(95, "PWM1"),
  236. MT7622_PIN(96, "PWM2"),
  237. MT7622_PIN(97, "PWM3"),
  238. MT7622_PIN(98, "PWM4"),
  239. MT7622_PIN(99, "PWM5"),
  240. MT7622_PIN(100, "PWM6"),
  241. MT7622_PIN(101, "PWM7"),
  242. MT7622_PIN(102, "GPIO_E"),
  243. };
  244. /* List all groups consisting of these pins dedicated to the enablement of
  245. * certain hardware block and the corresponding mode for all of the pins. The
  246. * hardware probably has multiple combinations of these pinouts.
  247. */
  248. /* ANTSEL */
  249. static int mt7622_antsel0_pins[] = { 91, };
  250. static int mt7622_antsel0_funcs[] = { 5, };
  251. static int mt7622_antsel1_pins[] = { 92, };
  252. static int mt7622_antsel1_funcs[] = { 5, };
  253. static int mt7622_antsel2_pins[] = { 93, };
  254. static int mt7622_antsel2_funcs[] = { 5, };
  255. static int mt7622_antsel3_pins[] = { 94, };
  256. static int mt7622_antsel3_funcs[] = { 5, };
  257. static int mt7622_antsel4_pins[] = { 95, };
  258. static int mt7622_antsel4_funcs[] = { 5, };
  259. static int mt7622_antsel5_pins[] = { 96, };
  260. static int mt7622_antsel5_funcs[] = { 5, };
  261. static int mt7622_antsel6_pins[] = { 97, };
  262. static int mt7622_antsel6_funcs[] = { 5, };
  263. static int mt7622_antsel7_pins[] = { 98, };
  264. static int mt7622_antsel7_funcs[] = { 5, };
  265. static int mt7622_antsel8_pins[] = { 99, };
  266. static int mt7622_antsel8_funcs[] = { 5, };
  267. static int mt7622_antsel9_pins[] = { 100, };
  268. static int mt7622_antsel9_funcs[] = { 5, };
  269. static int mt7622_antsel10_pins[] = { 101, };
  270. static int mt7622_antsel10_funcs[] = { 5, };
  271. static int mt7622_antsel11_pins[] = { 102, };
  272. static int mt7622_antsel11_funcs[] = { 5, };
  273. static int mt7622_antsel12_pins[] = { 73, };
  274. static int mt7622_antsel12_funcs[] = { 5, };
  275. static int mt7622_antsel13_pins[] = { 74, };
  276. static int mt7622_antsel13_funcs[] = { 5, };
  277. static int mt7622_antsel14_pins[] = { 75, };
  278. static int mt7622_antsel14_funcs[] = { 5, };
  279. static int mt7622_antsel15_pins[] = { 76, };
  280. static int mt7622_antsel15_funcs[] = { 5, };
  281. static int mt7622_antsel16_pins[] = { 77, };
  282. static int mt7622_antsel16_funcs[] = { 5, };
  283. static int mt7622_antsel17_pins[] = { 22, };
  284. static int mt7622_antsel17_funcs[] = { 5, };
  285. static int mt7622_antsel18_pins[] = { 79, };
  286. static int mt7622_antsel18_funcs[] = { 5, };
  287. static int mt7622_antsel19_pins[] = { 80, };
  288. static int mt7622_antsel19_funcs[] = { 5, };
  289. static int mt7622_antsel20_pins[] = { 81, };
  290. static int mt7622_antsel20_funcs[] = { 5, };
  291. static int mt7622_antsel21_pins[] = { 82, };
  292. static int mt7622_antsel21_funcs[] = { 5, };
  293. static int mt7622_antsel22_pins[] = { 14, };
  294. static int mt7622_antsel22_funcs[] = { 5, };
  295. static int mt7622_antsel23_pins[] = { 15, };
  296. static int mt7622_antsel23_funcs[] = { 5, };
  297. static int mt7622_antsel24_pins[] = { 16, };
  298. static int mt7622_antsel24_funcs[] = { 5, };
  299. static int mt7622_antsel25_pins[] = { 17, };
  300. static int mt7622_antsel25_funcs[] = { 5, };
  301. static int mt7622_antsel26_pins[] = { 18, };
  302. static int mt7622_antsel26_funcs[] = { 5, };
  303. static int mt7622_antsel27_pins[] = { 19, };
  304. static int mt7622_antsel27_funcs[] = { 5, };
  305. static int mt7622_antsel28_pins[] = { 20, };
  306. static int mt7622_antsel28_funcs[] = { 5, };
  307. static int mt7622_antsel29_pins[] = { 21, };
  308. static int mt7622_antsel29_funcs[] = { 5, };
  309. /* EMMC */
  310. static int mt7622_emmc_pins[] = { 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, };
  311. static int mt7622_emmc_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, };
  312. static int mt7622_emmc_rst_pins[] = { 37, };
  313. static int mt7622_emmc_rst_funcs[] = { 1, };
  314. /* LED for EPHY */
  315. static int mt7622_ephy_leds_pins[] = { 86, 91, 92, 93, 94, };
  316. static int mt7622_ephy_leds_funcs[] = { 0, 0, 0, 0, 0, };
  317. static int mt7622_ephy0_led_pins[] = { 86, };
  318. static int mt7622_ephy0_led_funcs[] = { 0, };
  319. static int mt7622_ephy1_led_pins[] = { 91, };
  320. static int mt7622_ephy1_led_funcs[] = { 2, };
  321. static int mt7622_ephy2_led_pins[] = { 92, };
  322. static int mt7622_ephy2_led_funcs[] = { 2, };
  323. static int mt7622_ephy3_led_pins[] = { 93, };
  324. static int mt7622_ephy3_led_funcs[] = { 2, };
  325. static int mt7622_ephy4_led_pins[] = { 94, };
  326. static int mt7622_ephy4_led_funcs[] = { 2, };
  327. /* Embedded Switch */
  328. static int mt7622_esw_pins[] = { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
  329. 62, 63, 64, 65, 66, 67, 68, 69, 70, };
  330. static int mt7622_esw_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  331. 0, 0, 0, 0, 0, 0, 0, 0, 0, };
  332. static int mt7622_esw_p0_p1_pins[] = { 51, 52, 53, 54, 55, 56, 57, 58, };
  333. static int mt7622_esw_p0_p1_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, };
  334. static int mt7622_esw_p2_p3_p4_pins[] = { 59, 60, 61, 62, 63, 64, 65, 66, 67,
  335. 68, 69, 70, };
  336. static int mt7622_esw_p2_p3_p4_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0,
  337. 0, 0, 0, };
  338. /* RGMII via ESW */
  339. static int mt7622_rgmii_via_esw_pins[] = { 59, 60, 61, 62, 63, 64, 65, 66,
  340. 67, 68, 69, 70, };
  341. static int mt7622_rgmii_via_esw_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  342. 0, };
  343. /* RGMII via GMAC1 */
  344. static int mt7622_rgmii_via_gmac1_pins[] = { 59, 60, 61, 62, 63, 64, 65, 66,
  345. 67, 68, 69, 70, };
  346. static int mt7622_rgmii_via_gmac1_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  347. 2, };
  348. /* RGMII via GMAC2 */
  349. static int mt7622_rgmii_via_gmac2_pins[] = { 25, 26, 27, 28, 29, 30, 31, 32,
  350. 33, 34, 35, 36, };
  351. static int mt7622_rgmii_via_gmac2_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  352. 0, };
  353. /* I2C */
  354. static int mt7622_i2c0_pins[] = { 14, 15, };
  355. static int mt7622_i2c0_funcs[] = { 0, 0, };
  356. static int mt7622_i2c1_0_pins[] = { 55, 56, };
  357. static int mt7622_i2c1_0_funcs[] = { 0, 0, };
  358. static int mt7622_i2c1_1_pins[] = { 73, 74, };
  359. static int mt7622_i2c1_1_funcs[] = { 3, 3, };
  360. static int mt7622_i2c1_2_pins[] = { 87, 88, };
  361. static int mt7622_i2c1_2_funcs[] = { 0, 0, };
  362. static int mt7622_i2c2_0_pins[] = { 57, 58, };
  363. static int mt7622_i2c2_0_funcs[] = { 0, 0, };
  364. static int mt7622_i2c2_1_pins[] = { 75, 76, };
  365. static int mt7622_i2c2_1_funcs[] = { 3, 3, };
  366. static int mt7622_i2c2_2_pins[] = { 89, 90, };
  367. static int mt7622_i2c2_2_funcs[] = { 0, 0, };
  368. /* I2S */
  369. static int mt7622_i2s_in_mclk_bclk_ws_pins[] = { 3, 4, 5, };
  370. static int mt7622_i2s_in_mclk_bclk_ws_funcs[] = { 3, 3, 0, };
  371. static int mt7622_i2s1_in_data_pins[] = { 1, };
  372. static int mt7622_i2s1_in_data_funcs[] = { 0, };
  373. static int mt7622_i2s2_in_data_pins[] = { 16, };
  374. static int mt7622_i2s2_in_data_funcs[] = { 0, };
  375. static int mt7622_i2s3_in_data_pins[] = { 17, };
  376. static int mt7622_i2s3_in_data_funcs[] = { 0, };
  377. static int mt7622_i2s4_in_data_pins[] = { 18, };
  378. static int mt7622_i2s4_in_data_funcs[] = { 0, };
  379. static int mt7622_i2s_out_mclk_bclk_ws_pins[] = { 3, 4, 5, };
  380. static int mt7622_i2s_out_mclk_bclk_ws_funcs[] = { 0, 0, 0, };
  381. static int mt7622_i2s1_out_data_pins[] = { 2, };
  382. static int mt7622_i2s1_out_data_funcs[] = { 0, };
  383. static int mt7622_i2s2_out_data_pins[] = { 19, };
  384. static int mt7622_i2s2_out_data_funcs[] = { 0, };
  385. static int mt7622_i2s3_out_data_pins[] = { 20, };
  386. static int mt7622_i2s3_out_data_funcs[] = { 0, };
  387. static int mt7622_i2s4_out_data_pins[] = { 21, };
  388. static int mt7622_i2s4_out_data_funcs[] = { 0, };
  389. /* IR */
  390. static int mt7622_ir_0_tx_pins[] = { 16, };
  391. static int mt7622_ir_0_tx_funcs[] = { 4, };
  392. static int mt7622_ir_1_tx_pins[] = { 59, };
  393. static int mt7622_ir_1_tx_funcs[] = { 5, };
  394. static int mt7622_ir_2_tx_pins[] = { 99, };
  395. static int mt7622_ir_2_tx_funcs[] = { 3, };
  396. static int mt7622_ir_0_rx_pins[] = { 17, };
  397. static int mt7622_ir_0_rx_funcs[] = { 4, };
  398. static int mt7622_ir_1_rx_pins[] = { 60, };
  399. static int mt7622_ir_1_rx_funcs[] = { 5, };
  400. static int mt7622_ir_2_rx_pins[] = { 100, };
  401. static int mt7622_ir_2_rx_funcs[] = { 3, };
  402. /* MDIO */
  403. static int mt7622_mdc_mdio_pins[] = { 23, 24, };
  404. static int mt7622_mdc_mdio_funcs[] = { 0, 0, };
  405. /* PCIE */
  406. static int mt7622_pcie0_0_waken_pins[] = { 14, };
  407. static int mt7622_pcie0_0_waken_funcs[] = { 2, };
  408. static int mt7622_pcie0_0_clkreq_pins[] = { 15, };
  409. static int mt7622_pcie0_0_clkreq_funcs[] = { 2, };
  410. static int mt7622_pcie0_1_waken_pins[] = { 79, };
  411. static int mt7622_pcie0_1_waken_funcs[] = { 4, };
  412. static int mt7622_pcie0_1_clkreq_pins[] = { 80, };
  413. static int mt7622_pcie0_1_clkreq_funcs[] = { 4, };
  414. static int mt7622_pcie1_0_waken_pins[] = { 14, };
  415. static int mt7622_pcie1_0_waken_funcs[] = { 3, };
  416. static int mt7622_pcie1_0_clkreq_pins[] = { 15, };
  417. static int mt7622_pcie1_0_clkreq_funcs[] = { 3, };
  418. static int mt7622_pcie0_pad_perst_pins[] = { 83, };
  419. static int mt7622_pcie0_pad_perst_funcs[] = { 0, };
  420. static int mt7622_pcie1_pad_perst_pins[] = { 84, };
  421. static int mt7622_pcie1_pad_perst_funcs[] = { 0, };
  422. /* PMIC bus */
  423. static int mt7622_pmic_bus_pins[] = { 71, 72, };
  424. static int mt7622_pmic_bus_funcs[] = { 0, 0, };
  425. /* Parallel NAND */
  426. static int mt7622_pnand_pins[] = { 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
  427. 48, 49, 50, };
  428. static int mt7622_pnand_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  429. 0, };
  430. /* PWM */
  431. static int mt7622_pwm_ch1_0_pins[] = { 51, };
  432. static int mt7622_pwm_ch1_0_funcs[] = { 3, };
  433. static int mt7622_pwm_ch1_1_pins[] = { 73, };
  434. static int mt7622_pwm_ch1_1_funcs[] = { 4, };
  435. static int mt7622_pwm_ch1_2_pins[] = { 95, };
  436. static int mt7622_pwm_ch1_2_funcs[] = { 0, };
  437. static int mt7622_pwm_ch2_0_pins[] = { 52, };
  438. static int mt7622_pwm_ch2_0_funcs[] = { 3, };
  439. static int mt7622_pwm_ch2_1_pins[] = { 74, };
  440. static int mt7622_pwm_ch2_1_funcs[] = { 4, };
  441. static int mt7622_pwm_ch2_2_pins[] = { 96, };
  442. static int mt7622_pwm_ch2_2_funcs[] = { 0, };
  443. static int mt7622_pwm_ch3_0_pins[] = { 53, };
  444. static int mt7622_pwm_ch3_0_funcs[] = { 3, };
  445. static int mt7622_pwm_ch3_1_pins[] = { 75, };
  446. static int mt7622_pwm_ch3_1_funcs[] = { 4, };
  447. static int mt7622_pwm_ch3_2_pins[] = { 97, };
  448. static int mt7622_pwm_ch3_2_funcs[] = { 0, };
  449. static int mt7622_pwm_ch4_0_pins[] = { 54, };
  450. static int mt7622_pwm_ch4_0_funcs[] = { 3, };
  451. static int mt7622_pwm_ch4_1_pins[] = { 67, };
  452. static int mt7622_pwm_ch4_1_funcs[] = { 3, };
  453. static int mt7622_pwm_ch4_2_pins[] = { 76, };
  454. static int mt7622_pwm_ch4_2_funcs[] = { 4, };
  455. static int mt7622_pwm_ch4_3_pins[] = { 98, };
  456. static int mt7622_pwm_ch4_3_funcs[] = { 0, };
  457. static int mt7622_pwm_ch5_0_pins[] = { 68, };
  458. static int mt7622_pwm_ch5_0_funcs[] = { 3, };
  459. static int mt7622_pwm_ch5_1_pins[] = { 77, };
  460. static int mt7622_pwm_ch5_1_funcs[] = { 4, };
  461. static int mt7622_pwm_ch5_2_pins[] = { 99, };
  462. static int mt7622_pwm_ch5_2_funcs[] = { 0, };
  463. static int mt7622_pwm_ch6_0_pins[] = { 69, };
  464. static int mt7622_pwm_ch6_0_funcs[] = { 3, };
  465. static int mt7622_pwm_ch6_1_pins[] = { 78, };
  466. static int mt7622_pwm_ch6_1_funcs[] = { 4, };
  467. static int mt7622_pwm_ch6_2_pins[] = { 81, };
  468. static int mt7622_pwm_ch6_2_funcs[] = { 4, };
  469. static int mt7622_pwm_ch6_3_pins[] = { 100, };
  470. static int mt7622_pwm_ch6_3_funcs[] = { 0, };
  471. /* SD */
  472. static int mt7622_sd_0_pins[] = { 16, 17, 18, 19, 20, 21, };
  473. static int mt7622_sd_0_funcs[] = { 2, 2, 2, 2, 2, 2, };
  474. static int mt7622_sd_1_pins[] = { 25, 26, 27, 28, 29, 30, };
  475. static int mt7622_sd_1_funcs[] = { 2, 2, 2, 2, 2, 2, };
  476. /* Serial NAND */
  477. static int mt7622_snfi_pins[] = { 8, 9, 10, 11, 12, 13, };
  478. static int mt7622_snfi_funcs[] = { 2, 2, 2, 2, 2, 2, };
  479. /* SPI NOR */
  480. static int mt7622_spi_pins[] = { 8, 9, 10, 11, 12, 13 };
  481. static int mt7622_spi_funcs[] = { 0, 0, 0, 0, 0, 0, };
  482. /* SPIC */
  483. static int mt7622_spic0_0_pins[] = { 63, 64, 65, 66, };
  484. static int mt7622_spic0_0_funcs[] = { 4, 4, 4, 4, };
  485. static int mt7622_spic0_1_pins[] = { 79, 80, 81, 82, };
  486. static int mt7622_spic0_1_funcs[] = { 3, 3, 3, 3, };
  487. static int mt7622_spic1_0_pins[] = { 67, 68, 69, 70, };
  488. static int mt7622_spic1_0_funcs[] = { 4, 4, 4, 4, };
  489. static int mt7622_spic1_1_pins[] = { 73, 74, 75, 76, };
  490. static int mt7622_spic1_1_funcs[] = { 0, 0, 0, 0, };
  491. static int mt7622_spic2_0_pins[] = { 10, 11, 12, 13, };
  492. static int mt7622_spic2_0_funcs[] = { 0, 0, 0, 0, };
  493. static int mt7622_spic2_0_wp_hold_pins[] = { 8, 9, };
  494. static int mt7622_spic2_0_wp_hold_funcs[] = { 0, 0, };
  495. /* TDM */
  496. static int mt7622_tdm_0_out_mclk_bclk_ws_pins[] = { 8, 9, 10, };
  497. static int mt7622_tdm_0_out_mclk_bclk_ws_funcs[] = { 3, 3, 3, };
  498. static int mt7622_tdm_0_in_mclk_bclk_ws_pins[] = { 11, 12, 13, };
  499. static int mt7622_tdm_0_in_mclk_bclk_ws_funcs[] = { 3, 3, 3, };
  500. static int mt7622_tdm_0_out_data_pins[] = { 20, };
  501. static int mt7622_tdm_0_out_data_funcs[] = { 3, };
  502. static int mt7622_tdm_0_in_data_pins[] = { 21, };
  503. static int mt7622_tdm_0_in_data_funcs[] = { 3, };
  504. static int mt7622_tdm_1_out_mclk_bclk_ws_pins[] = { 57, 58, 59, };
  505. static int mt7622_tdm_1_out_mclk_bclk_ws_funcs[] = { 3, 3, 3, };
  506. static int mt7622_tdm_1_in_mclk_bclk_ws_pins[] = { 60, 61, 62, };
  507. static int mt7622_tdm_1_in_mclk_bclk_ws_funcs[] = { 3, 3, 3, };
  508. static int mt7622_tdm_1_out_data_pins[] = { 55, };
  509. static int mt7622_tdm_1_out_data_funcs[] = { 3, };
  510. static int mt7622_tdm_1_in_data_pins[] = { 56, };
  511. static int mt7622_tdm_1_in_data_funcs[] = { 3, };
  512. /* UART */
  513. static int mt7622_uart0_0_tx_rx_pins[] = { 6, 7, };
  514. static int mt7622_uart0_0_tx_rx_funcs[] = { 0, 0, };
  515. static int mt7622_uart1_0_tx_rx_pins[] = { 55, 56, };
  516. static int mt7622_uart1_0_tx_rx_funcs[] = { 2, 2, };
  517. static int mt7622_uart1_0_rts_cts_pins[] = { 57, 58, };
  518. static int mt7622_uart1_0_rts_cts_funcs[] = { 2, 2, };
  519. static int mt7622_uart1_1_tx_rx_pins[] = { 73, 74, };
  520. static int mt7622_uart1_1_tx_rx_funcs[] = { 2, 2, };
  521. static int mt7622_uart1_1_rts_cts_pins[] = { 75, 76, };
  522. static int mt7622_uart1_1_rts_cts_funcs[] = { 2, 2, };
  523. static int mt7622_uart2_0_tx_rx_pins[] = { 3, 4, };
  524. static int mt7622_uart2_0_tx_rx_funcs[] = { 2, 2, };
  525. static int mt7622_uart2_0_rts_cts_pins[] = { 1, 2, };
  526. static int mt7622_uart2_0_rts_cts_funcs[] = { 2, 2, };
  527. static int mt7622_uart2_1_tx_rx_pins[] = { 51, 52, };
  528. static int mt7622_uart2_1_tx_rx_funcs[] = { 0, 0, };
  529. static int mt7622_uart2_1_rts_cts_pins[] = { 53, 54, };
  530. static int mt7622_uart2_1_rts_cts_funcs[] = { 0, 0, };
  531. static int mt7622_uart2_2_tx_rx_pins[] = { 59, 60, };
  532. static int mt7622_uart2_2_tx_rx_funcs[] = { 4, 4, };
  533. static int mt7622_uart2_2_rts_cts_pins[] = { 61, 62, };
  534. static int mt7622_uart2_2_rts_cts_funcs[] = { 4, 4, };
  535. static int mt7622_uart2_3_tx_rx_pins[] = { 95, 96, };
  536. static int mt7622_uart2_3_tx_rx_funcs[] = { 3, 3, };
  537. static int mt7622_uart3_0_tx_rx_pins[] = { 57, 58, };
  538. static int mt7622_uart3_0_tx_rx_funcs[] = { 5, 5, };
  539. static int mt7622_uart3_1_tx_rx_pins[] = { 81, 82, };
  540. static int mt7622_uart3_1_tx_rx_funcs[] = { 0, 0, };
  541. static int mt7622_uart3_1_rts_cts_pins[] = { 79, 80, };
  542. static int mt7622_uart3_1_rts_cts_funcs[] = { 0, 0, };
  543. static int mt7622_uart4_0_tx_rx_pins[] = { 61, 62, };
  544. static int mt7622_uart4_0_tx_rx_funcs[] = { 5, 5, };
  545. static int mt7622_uart4_1_tx_rx_pins[] = { 91, 92, };
  546. static int mt7622_uart4_1_tx_rx_funcs[] = { 0, 0, };
  547. static int mt7622_uart4_1_rts_cts_pins[] = { 93, 94 };
  548. static int mt7622_uart4_1_rts_cts_funcs[] = { 0, 0, };
  549. static int mt7622_uart4_2_tx_rx_pins[] = { 97, 98, };
  550. static int mt7622_uart4_2_tx_rx_funcs[] = { 2, 2, };
  551. static int mt7622_uart4_2_rts_cts_pins[] = { 95, 96 };
  552. static int mt7622_uart4_2_rts_cts_funcs[] = { 2, 2, };
  553. /* Watchdog */
  554. static int mt7622_watchdog_pins[] = { 78, };
  555. static int mt7622_watchdog_funcs[] = { 0, };
  556. /* WLAN LED */
  557. static int mt7622_wled_pins[] = { 85, };
  558. static int mt7622_wled_funcs[] = { 0, };
  559. static const struct group_desc mt7622_groups[] = {
  560. PINCTRL_PIN_GROUP("antsel0", mt7622_antsel0),
  561. PINCTRL_PIN_GROUP("antsel1", mt7622_antsel1),
  562. PINCTRL_PIN_GROUP("antsel2", mt7622_antsel2),
  563. PINCTRL_PIN_GROUP("antsel3", mt7622_antsel3),
  564. PINCTRL_PIN_GROUP("antsel4", mt7622_antsel4),
  565. PINCTRL_PIN_GROUP("antsel5", mt7622_antsel5),
  566. PINCTRL_PIN_GROUP("antsel6", mt7622_antsel6),
  567. PINCTRL_PIN_GROUP("antsel7", mt7622_antsel7),
  568. PINCTRL_PIN_GROUP("antsel8", mt7622_antsel8),
  569. PINCTRL_PIN_GROUP("antsel9", mt7622_antsel9),
  570. PINCTRL_PIN_GROUP("antsel10", mt7622_antsel10),
  571. PINCTRL_PIN_GROUP("antsel11", mt7622_antsel11),
  572. PINCTRL_PIN_GROUP("antsel12", mt7622_antsel12),
  573. PINCTRL_PIN_GROUP("antsel13", mt7622_antsel13),
  574. PINCTRL_PIN_GROUP("antsel14", mt7622_antsel14),
  575. PINCTRL_PIN_GROUP("antsel15", mt7622_antsel15),
  576. PINCTRL_PIN_GROUP("antsel16", mt7622_antsel16),
  577. PINCTRL_PIN_GROUP("antsel17", mt7622_antsel17),
  578. PINCTRL_PIN_GROUP("antsel18", mt7622_antsel18),
  579. PINCTRL_PIN_GROUP("antsel19", mt7622_antsel19),
  580. PINCTRL_PIN_GROUP("antsel20", mt7622_antsel20),
  581. PINCTRL_PIN_GROUP("antsel21", mt7622_antsel21),
  582. PINCTRL_PIN_GROUP("antsel22", mt7622_antsel22),
  583. PINCTRL_PIN_GROUP("antsel23", mt7622_antsel23),
  584. PINCTRL_PIN_GROUP("antsel24", mt7622_antsel24),
  585. PINCTRL_PIN_GROUP("antsel25", mt7622_antsel25),
  586. PINCTRL_PIN_GROUP("antsel26", mt7622_antsel26),
  587. PINCTRL_PIN_GROUP("antsel27", mt7622_antsel27),
  588. PINCTRL_PIN_GROUP("antsel28", mt7622_antsel28),
  589. PINCTRL_PIN_GROUP("antsel29", mt7622_antsel29),
  590. PINCTRL_PIN_GROUP("emmc", mt7622_emmc),
  591. PINCTRL_PIN_GROUP("emmc_rst", mt7622_emmc_rst),
  592. PINCTRL_PIN_GROUP("ephy_leds", mt7622_ephy_leds),
  593. PINCTRL_PIN_GROUP("ephy0_led", mt7622_ephy0_led),
  594. PINCTRL_PIN_GROUP("ephy1_led", mt7622_ephy1_led),
  595. PINCTRL_PIN_GROUP("ephy2_led", mt7622_ephy2_led),
  596. PINCTRL_PIN_GROUP("ephy3_led", mt7622_ephy3_led),
  597. PINCTRL_PIN_GROUP("ephy4_led", mt7622_ephy4_led),
  598. PINCTRL_PIN_GROUP("esw", mt7622_esw),
  599. PINCTRL_PIN_GROUP("esw_p0_p1", mt7622_esw_p0_p1),
  600. PINCTRL_PIN_GROUP("esw_p2_p3_p4", mt7622_esw_p2_p3_p4),
  601. PINCTRL_PIN_GROUP("rgmii_via_esw", mt7622_rgmii_via_esw),
  602. PINCTRL_PIN_GROUP("rgmii_via_gmac1", mt7622_rgmii_via_gmac1),
  603. PINCTRL_PIN_GROUP("rgmii_via_gmac2", mt7622_rgmii_via_gmac2),
  604. PINCTRL_PIN_GROUP("i2c0", mt7622_i2c0),
  605. PINCTRL_PIN_GROUP("i2c1_0", mt7622_i2c1_0),
  606. PINCTRL_PIN_GROUP("i2c1_1", mt7622_i2c1_1),
  607. PINCTRL_PIN_GROUP("i2c1_2", mt7622_i2c1_2),
  608. PINCTRL_PIN_GROUP("i2c2_0", mt7622_i2c2_0),
  609. PINCTRL_PIN_GROUP("i2c2_1", mt7622_i2c2_1),
  610. PINCTRL_PIN_GROUP("i2c2_2", mt7622_i2c2_2),
  611. PINCTRL_PIN_GROUP("i2s_out_mclk_bclk_ws", mt7622_i2s_out_mclk_bclk_ws),
  612. PINCTRL_PIN_GROUP("i2s_in_mclk_bclk_ws", mt7622_i2s_in_mclk_bclk_ws),
  613. PINCTRL_PIN_GROUP("i2s1_in_data", mt7622_i2s1_in_data),
  614. PINCTRL_PIN_GROUP("i2s2_in_data", mt7622_i2s2_in_data),
  615. PINCTRL_PIN_GROUP("i2s3_in_data", mt7622_i2s3_in_data),
  616. PINCTRL_PIN_GROUP("i2s4_in_data", mt7622_i2s4_in_data),
  617. PINCTRL_PIN_GROUP("i2s1_out_data", mt7622_i2s1_out_data),
  618. PINCTRL_PIN_GROUP("i2s2_out_data", mt7622_i2s2_out_data),
  619. PINCTRL_PIN_GROUP("i2s3_out_data", mt7622_i2s3_out_data),
  620. PINCTRL_PIN_GROUP("i2s4_out_data", mt7622_i2s4_out_data),
  621. PINCTRL_PIN_GROUP("ir_0_tx", mt7622_ir_0_tx),
  622. PINCTRL_PIN_GROUP("ir_1_tx", mt7622_ir_1_tx),
  623. PINCTRL_PIN_GROUP("ir_2_tx", mt7622_ir_2_tx),
  624. PINCTRL_PIN_GROUP("ir_0_rx", mt7622_ir_0_rx),
  625. PINCTRL_PIN_GROUP("ir_1_rx", mt7622_ir_1_rx),
  626. PINCTRL_PIN_GROUP("ir_2_rx", mt7622_ir_2_rx),
  627. PINCTRL_PIN_GROUP("mdc_mdio", mt7622_mdc_mdio),
  628. PINCTRL_PIN_GROUP("pcie0_0_waken", mt7622_pcie0_0_waken),
  629. PINCTRL_PIN_GROUP("pcie0_0_clkreq", mt7622_pcie0_0_clkreq),
  630. PINCTRL_PIN_GROUP("pcie0_1_waken", mt7622_pcie0_1_waken),
  631. PINCTRL_PIN_GROUP("pcie0_1_clkreq", mt7622_pcie0_1_clkreq),
  632. PINCTRL_PIN_GROUP("pcie1_0_waken", mt7622_pcie1_0_waken),
  633. PINCTRL_PIN_GROUP("pcie1_0_clkreq", mt7622_pcie1_0_clkreq),
  634. PINCTRL_PIN_GROUP("pcie0_pad_perst", mt7622_pcie0_pad_perst),
  635. PINCTRL_PIN_GROUP("pcie1_pad_perst", mt7622_pcie1_pad_perst),
  636. PINCTRL_PIN_GROUP("par_nand", mt7622_pnand),
  637. PINCTRL_PIN_GROUP("pmic_bus", mt7622_pmic_bus),
  638. PINCTRL_PIN_GROUP("pwm_ch1_0", mt7622_pwm_ch1_0),
  639. PINCTRL_PIN_GROUP("pwm_ch1_1", mt7622_pwm_ch1_1),
  640. PINCTRL_PIN_GROUP("pwm_ch1_2", mt7622_pwm_ch1_2),
  641. PINCTRL_PIN_GROUP("pwm_ch2_0", mt7622_pwm_ch2_0),
  642. PINCTRL_PIN_GROUP("pwm_ch2_1", mt7622_pwm_ch2_1),
  643. PINCTRL_PIN_GROUP("pwm_ch2_2", mt7622_pwm_ch2_2),
  644. PINCTRL_PIN_GROUP("pwm_ch3_0", mt7622_pwm_ch3_0),
  645. PINCTRL_PIN_GROUP("pwm_ch3_1", mt7622_pwm_ch3_1),
  646. PINCTRL_PIN_GROUP("pwm_ch3_2", mt7622_pwm_ch3_2),
  647. PINCTRL_PIN_GROUP("pwm_ch4_0", mt7622_pwm_ch4_0),
  648. PINCTRL_PIN_GROUP("pwm_ch4_1", mt7622_pwm_ch4_1),
  649. PINCTRL_PIN_GROUP("pwm_ch4_2", mt7622_pwm_ch4_2),
  650. PINCTRL_PIN_GROUP("pwm_ch4_3", mt7622_pwm_ch4_3),
  651. PINCTRL_PIN_GROUP("pwm_ch5_0", mt7622_pwm_ch5_0),
  652. PINCTRL_PIN_GROUP("pwm_ch5_1", mt7622_pwm_ch5_1),
  653. PINCTRL_PIN_GROUP("pwm_ch5_2", mt7622_pwm_ch5_2),
  654. PINCTRL_PIN_GROUP("pwm_ch6_0", mt7622_pwm_ch6_0),
  655. PINCTRL_PIN_GROUP("pwm_ch6_1", mt7622_pwm_ch6_1),
  656. PINCTRL_PIN_GROUP("pwm_ch6_2", mt7622_pwm_ch6_2),
  657. PINCTRL_PIN_GROUP("pwm_ch6_3", mt7622_pwm_ch6_3),
  658. PINCTRL_PIN_GROUP("sd_0", mt7622_sd_0),
  659. PINCTRL_PIN_GROUP("sd_1", mt7622_sd_1),
  660. PINCTRL_PIN_GROUP("snfi", mt7622_snfi),
  661. PINCTRL_PIN_GROUP("spi_nor", mt7622_spi),
  662. PINCTRL_PIN_GROUP("spic0_0", mt7622_spic0_0),
  663. PINCTRL_PIN_GROUP("spic0_1", mt7622_spic0_1),
  664. PINCTRL_PIN_GROUP("spic1_0", mt7622_spic1_0),
  665. PINCTRL_PIN_GROUP("spic1_1", mt7622_spic1_1),
  666. PINCTRL_PIN_GROUP("spic2_0", mt7622_spic2_0),
  667. PINCTRL_PIN_GROUP("spic2_0_wp_hold", mt7622_spic2_0_wp_hold),
  668. PINCTRL_PIN_GROUP("tdm_0_out_mclk_bclk_ws",
  669. mt7622_tdm_0_out_mclk_bclk_ws),
  670. PINCTRL_PIN_GROUP("tdm_0_in_mclk_bclk_ws",
  671. mt7622_tdm_0_in_mclk_bclk_ws),
  672. PINCTRL_PIN_GROUP("tdm_0_out_data", mt7622_tdm_0_out_data),
  673. PINCTRL_PIN_GROUP("tdm_0_in_data", mt7622_tdm_0_in_data),
  674. PINCTRL_PIN_GROUP("tdm_1_out_mclk_bclk_ws",
  675. mt7622_tdm_1_out_mclk_bclk_ws),
  676. PINCTRL_PIN_GROUP("tdm_1_in_mclk_bclk_ws",
  677. mt7622_tdm_1_in_mclk_bclk_ws),
  678. PINCTRL_PIN_GROUP("tdm_1_out_data", mt7622_tdm_1_out_data),
  679. PINCTRL_PIN_GROUP("tdm_1_in_data", mt7622_tdm_1_in_data),
  680. PINCTRL_PIN_GROUP("uart0_0_tx_rx", mt7622_uart0_0_tx_rx),
  681. PINCTRL_PIN_GROUP("uart1_0_tx_rx", mt7622_uart1_0_tx_rx),
  682. PINCTRL_PIN_GROUP("uart1_0_rts_cts", mt7622_uart1_0_rts_cts),
  683. PINCTRL_PIN_GROUP("uart1_1_tx_rx", mt7622_uart1_1_tx_rx),
  684. PINCTRL_PIN_GROUP("uart1_1_rts_cts", mt7622_uart1_1_rts_cts),
  685. PINCTRL_PIN_GROUP("uart2_0_tx_rx", mt7622_uart2_0_tx_rx),
  686. PINCTRL_PIN_GROUP("uart2_0_rts_cts", mt7622_uart2_0_rts_cts),
  687. PINCTRL_PIN_GROUP("uart2_1_tx_rx", mt7622_uart2_1_tx_rx),
  688. PINCTRL_PIN_GROUP("uart2_1_rts_cts", mt7622_uart2_1_rts_cts),
  689. PINCTRL_PIN_GROUP("uart2_2_tx_rx", mt7622_uart2_2_tx_rx),
  690. PINCTRL_PIN_GROUP("uart2_2_rts_cts", mt7622_uart2_2_rts_cts),
  691. PINCTRL_PIN_GROUP("uart2_3_tx_rx", mt7622_uart2_3_tx_rx),
  692. PINCTRL_PIN_GROUP("uart3_0_tx_rx", mt7622_uart3_0_tx_rx),
  693. PINCTRL_PIN_GROUP("uart3_1_tx_rx", mt7622_uart3_1_tx_rx),
  694. PINCTRL_PIN_GROUP("uart3_1_rts_cts", mt7622_uart3_1_rts_cts),
  695. PINCTRL_PIN_GROUP("uart4_0_tx_rx", mt7622_uart4_0_tx_rx),
  696. PINCTRL_PIN_GROUP("uart4_1_tx_rx", mt7622_uart4_1_tx_rx),
  697. PINCTRL_PIN_GROUP("uart4_1_rts_cts", mt7622_uart4_1_rts_cts),
  698. PINCTRL_PIN_GROUP("uart4_2_tx_rx", mt7622_uart4_2_tx_rx),
  699. PINCTRL_PIN_GROUP("uart4_2_rts_cts", mt7622_uart4_2_rts_cts),
  700. PINCTRL_PIN_GROUP("watchdog", mt7622_watchdog),
  701. PINCTRL_PIN_GROUP("wled", mt7622_wled),
  702. };
  703. /* Joint those groups owning the same capability in user point of view which
  704. * allows that people tend to use through the device tree.
  705. */
  706. static const char *mt7622_antsel_groups[] = { "antsel0", "antsel1", "antsel2",
  707. "antsel3", "antsel4", "antsel5",
  708. "antsel6", "antsel7", "antsel8",
  709. "antsel9", "antsel10", "antsel11",
  710. "antsel12", "antsel13", "antsel14",
  711. "antsel15", "antsel16", "antsel17",
  712. "antsel18", "antsel19", "antsel20",
  713. "antsel21", "antsel22", "antsel23",
  714. "antsel24", "antsel25", "antsel26",
  715. "antsel27", "antsel28", "antsel29",};
  716. static const char *mt7622_emmc_groups[] = { "emmc", "emmc_rst", };
  717. static const char *mt7622_ethernet_groups[] = { "esw", "esw_p0_p1",
  718. "esw_p2_p3_p4", "mdc_mdio",
  719. "rgmii_via_gmac1",
  720. "rgmii_via_gmac2",
  721. "rgmii_via_esw", };
  722. static const char *mt7622_i2c_groups[] = { "i2c0", "i2c1_0", "i2c1_1",
  723. "i2c1_2", "i2c2_0", "i2c2_1",
  724. "i2c2_2", };
  725. static const char *mt7622_i2s_groups[] = { "i2s_out_mclk_bclk_ws",
  726. "i2s_in_mclk_bclk_ws",
  727. "i2s1_in_data", "i2s2_in_data",
  728. "i2s3_in_data", "i2s4_in_data",
  729. "i2s1_out_data", "i2s2_out_data",
  730. "i2s3_out_data", "i2s4_out_data", };
  731. static const char *mt7622_ir_groups[] = { "ir_0_tx", "ir_1_tx", "ir_2_tx",
  732. "ir_0_rx", "ir_1_rx", "ir_2_rx"};
  733. static const char *mt7622_led_groups[] = { "ephy_leds", "ephy0_led",
  734. "ephy1_led", "ephy2_led",
  735. "ephy3_led", "ephy4_led",
  736. "wled", };
  737. static const char *mt7622_flash_groups[] = { "par_nand", "snfi", "spi_nor"};
  738. static const char *mt7622_pcie_groups[] = { "pcie0_0_waken", "pcie0_0_clkreq",
  739. "pcie0_1_waken", "pcie0_1_clkreq",
  740. "pcie1_0_waken", "pcie1_0_clkreq",
  741. "pcie0_pad_perst",
  742. "pcie1_pad_perst", };
  743. static const char *mt7622_pmic_bus_groups[] = { "pmic_bus", };
  744. static const char *mt7622_pwm_groups[] = { "pwm_ch1_0", "pwm_ch1_1",
  745. "pwm_ch1_2", "pwm_ch2_0",
  746. "pwm_ch2_1", "pwm_ch2_2",
  747. "pwm_ch3_0", "pwm_ch3_1",
  748. "pwm_ch3_2", "pwm_ch4_0",
  749. "pwm_ch4_1", "pwm_ch4_2",
  750. "pwm_ch4_3", "pwm_ch5_0",
  751. "pwm_ch5_1", "pwm_ch5_2",
  752. "pwm_ch6_0", "pwm_ch6_1",
  753. "pwm_ch6_2", "pwm_ch6_3", };
  754. static const char *mt7622_sd_groups[] = { "sd_0", "sd_1", };
  755. static const char *mt7622_spic_groups[] = { "spic0_0", "spic0_1", "spic1_0",
  756. "spic1_1", "spic2_0",
  757. "spic2_0_wp_hold", };
  758. static const char *mt7622_tdm_groups[] = { "tdm_0_out_mclk_bclk_ws",
  759. "tdm_0_in_mclk_bclk_ws",
  760. "tdm_0_out_data",
  761. "tdm_0_in_data",
  762. "tdm_1_out_mclk_bclk_ws",
  763. "tdm_1_in_mclk_bclk_ws",
  764. "tdm_1_out_data",
  765. "tdm_1_in_data", };
  766. static const char *mt7622_uart_groups[] = { "uart0_0_tx_rx",
  767. "uart1_0_tx_rx", "uart1_0_rts_cts",
  768. "uart1_1_tx_rx", "uart1_1_rts_cts",
  769. "uart2_0_tx_rx", "uart2_0_rts_cts",
  770. "uart2_1_tx_rx", "uart2_1_rts_cts",
  771. "uart2_2_tx_rx", "uart2_2_rts_cts",
  772. "uart2_3_tx_rx",
  773. "uart3_0_tx_rx",
  774. "uart3_1_tx_rx", "uart3_1_rts_cts",
  775. "uart4_0_tx_rx",
  776. "uart4_1_tx_rx", "uart4_1_rts_cts",
  777. "uart4_2_tx_rx",
  778. "uart4_2_rts_cts",};
  779. static const char *mt7622_wdt_groups[] = { "watchdog", };
  780. static const struct function_desc mt7622_functions[] = {
  781. {"antsel", mt7622_antsel_groups, ARRAY_SIZE(mt7622_antsel_groups)},
  782. {"emmc", mt7622_emmc_groups, ARRAY_SIZE(mt7622_emmc_groups)},
  783. {"eth", mt7622_ethernet_groups, ARRAY_SIZE(mt7622_ethernet_groups)},
  784. {"i2c", mt7622_i2c_groups, ARRAY_SIZE(mt7622_i2c_groups)},
  785. {"i2s", mt7622_i2s_groups, ARRAY_SIZE(mt7622_i2s_groups)},
  786. {"ir", mt7622_ir_groups, ARRAY_SIZE(mt7622_ir_groups)},
  787. {"led", mt7622_led_groups, ARRAY_SIZE(mt7622_led_groups)},
  788. {"flash", mt7622_flash_groups, ARRAY_SIZE(mt7622_flash_groups)},
  789. {"pcie", mt7622_pcie_groups, ARRAY_SIZE(mt7622_pcie_groups)},
  790. {"pmic", mt7622_pmic_bus_groups, ARRAY_SIZE(mt7622_pmic_bus_groups)},
  791. {"pwm", mt7622_pwm_groups, ARRAY_SIZE(mt7622_pwm_groups)},
  792. {"sd", mt7622_sd_groups, ARRAY_SIZE(mt7622_sd_groups)},
  793. {"spi", mt7622_spic_groups, ARRAY_SIZE(mt7622_spic_groups)},
  794. {"tdm", mt7622_tdm_groups, ARRAY_SIZE(mt7622_tdm_groups)},
  795. {"uart", mt7622_uart_groups, ARRAY_SIZE(mt7622_uart_groups)},
  796. {"watchdog", mt7622_wdt_groups, ARRAY_SIZE(mt7622_wdt_groups)},
  797. };
  798. static const struct mtk_eint_hw mt7622_eint_hw = {
  799. .port_mask = 7,
  800. .ports = 7,
  801. .ap_num = ARRAY_SIZE(mt7622_pins),
  802. .db_cnt = 20,
  803. .db_time = debounce_time_mt6765,
  804. };
  805. static const struct mtk_pin_soc mt7622_data = {
  806. .reg_cal = mt7622_reg_cals,
  807. .pins = mt7622_pins,
  808. .npins = ARRAY_SIZE(mt7622_pins),
  809. .grps = mt7622_groups,
  810. .ngrps = ARRAY_SIZE(mt7622_groups),
  811. .funcs = mt7622_functions,
  812. .nfuncs = ARRAY_SIZE(mt7622_functions),
  813. .eint_hw = &mt7622_eint_hw,
  814. .gpio_m = 1,
  815. .ies_present = false,
  816. .base_names = mtk_default_register_base_names,
  817. .nbase_names = ARRAY_SIZE(mtk_default_register_base_names),
  818. .bias_disable_set = mtk_pinconf_bias_disable_set,
  819. .bias_disable_get = mtk_pinconf_bias_disable_get,
  820. .bias_set = mtk_pinconf_bias_set,
  821. .bias_get = mtk_pinconf_bias_get,
  822. .drive_set = mtk_pinconf_drive_set,
  823. .drive_get = mtk_pinconf_drive_get,
  824. };
  825. static const struct of_device_id mt7622_pinctrl_of_match[] = {
  826. { .compatible = "mediatek,mt7622-pinctrl", },
  827. { }
  828. };
  829. static int mt7622_pinctrl_probe(struct platform_device *pdev)
  830. {
  831. return mtk_moore_pinctrl_probe(pdev, &mt7622_data);
  832. }
  833. static struct platform_driver mt7622_pinctrl_driver = {
  834. .driver = {
  835. .name = "mt7622-pinctrl",
  836. .of_match_table = mt7622_pinctrl_of_match,
  837. },
  838. .probe = mt7622_pinctrl_probe,
  839. };
  840. static int __init mt7622_pinctrl_init(void)
  841. {
  842. return platform_driver_register(&mt7622_pinctrl_driver);
  843. }
  844. arch_initcall(mt7622_pinctrl_init);