pinctrl-mt7623.c 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * The MT7623 driver based on Linux generic pinctrl binding.
  4. *
  5. * Copyright (C) 2015 - 2018 MediaTek Inc.
  6. * Author: Biao Huang <biao.huang@mediatek.com>
  7. * Ryder Lee <ryder.lee@mediatek.com>
  8. * Sean Wang <sean.wang@mediatek.com>
  9. */
  10. #include "pinctrl-moore.h"
  11. #define PIN_BOND_REG0 0xb10
  12. #define PIN_BOND_REG1 0xf20
  13. #define PIN_BOND_REG2 0xef0
  14. #define BOND_PCIE_CLR (0x77 << 3)
  15. #define BOND_I2S_CLR 0x3
  16. #define BOND_MSDC0E_CLR 0x1
  17. #define PIN_FIELD15(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \
  18. PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit, \
  19. _x_bits, 15, false)
  20. #define PIN_FIELD16(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \
  21. PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit, \
  22. _x_bits, 16, 0)
  23. #define PINS_FIELD16(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \
  24. PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit, \
  25. _x_bits, 16, 1)
  26. #define MT7623_PIN(_number, _name, _eint_n, _drv_grp) \
  27. MTK_PIN(_number, _name, 0, _eint_n, _drv_grp)
  28. static const struct mtk_pin_field_calc mt7623_pin_mode_range[] = {
  29. PIN_FIELD15(0, 278, 0x760, 0x10, 0, 3),
  30. };
  31. static const struct mtk_pin_field_calc mt7623_pin_dir_range[] = {
  32. PIN_FIELD16(0, 175, 0x0, 0x10, 0, 1),
  33. PIN_FIELD16(176, 278, 0xc0, 0x10, 0, 1),
  34. };
  35. static const struct mtk_pin_field_calc mt7623_pin_di_range[] = {
  36. PIN_FIELD16(0, 278, 0x630, 0x10, 0, 1),
  37. };
  38. static const struct mtk_pin_field_calc mt7623_pin_do_range[] = {
  39. PIN_FIELD16(0, 278, 0x500, 0x10, 0, 1),
  40. };
  41. static const struct mtk_pin_field_calc mt7623_pin_ies_range[] = {
  42. PINS_FIELD16(0, 6, 0xb20, 0x10, 0, 1),
  43. PINS_FIELD16(7, 9, 0xb20, 0x10, 1, 1),
  44. PINS_FIELD16(10, 13, 0xb30, 0x10, 3, 1),
  45. PINS_FIELD16(14, 15, 0xb30, 0x10, 13, 1),
  46. PINS_FIELD16(16, 17, 0xb40, 0x10, 7, 1),
  47. PINS_FIELD16(18, 29, 0xb40, 0x10, 13, 1),
  48. PINS_FIELD16(30, 32, 0xb40, 0x10, 7, 1),
  49. PINS_FIELD16(33, 37, 0xb40, 0x10, 13, 1),
  50. PIN_FIELD16(38, 38, 0xb20, 0x10, 13, 1),
  51. PINS_FIELD16(39, 42, 0xb40, 0x10, 13, 1),
  52. PINS_FIELD16(43, 45, 0xb20, 0x10, 10, 1),
  53. PINS_FIELD16(47, 48, 0xb20, 0x10, 11, 1),
  54. PIN_FIELD16(49, 49, 0xb20, 0x10, 12, 1),
  55. PINS_FIELD16(50, 52, 0xb20, 0x10, 13, 1),
  56. PINS_FIELD16(53, 56, 0xb20, 0x10, 14, 1),
  57. PINS_FIELD16(57, 58, 0xb20, 0x10, 15, 1),
  58. PIN_FIELD16(59, 59, 0xb30, 0x10, 10, 1),
  59. PINS_FIELD16(60, 62, 0xb30, 0x10, 0, 1),
  60. PINS_FIELD16(63, 65, 0xb30, 0x10, 1, 1),
  61. PINS_FIELD16(66, 71, 0xb30, 0x10, 2, 1),
  62. PINS_FIELD16(72, 74, 0xb20, 0x10, 12, 1),
  63. PINS_FIELD16(75, 76, 0xb30, 0x10, 3, 1),
  64. PINS_FIELD16(77, 78, 0xb30, 0x10, 4, 1),
  65. PINS_FIELD16(79, 82, 0xb30, 0x10, 5, 1),
  66. PINS_FIELD16(83, 84, 0xb30, 0x10, 2, 1),
  67. PIN_FIELD16(85, 85, 0xda0, 0x10, 4, 1),
  68. PIN_FIELD16(86, 86, 0xd90, 0x10, 4, 1),
  69. PINS_FIELD16(87, 90, 0xdb0, 0x10, 4, 1),
  70. PINS_FIELD16(101, 104, 0xb30, 0x10, 6, 1),
  71. PIN_FIELD16(105, 105, 0xd40, 0x10, 4, 1),
  72. PIN_FIELD16(106, 106, 0xd30, 0x10, 4, 1),
  73. PINS_FIELD16(107, 110, 0xd50, 0x10, 4, 1),
  74. PINS_FIELD16(111, 115, 0xce0, 0x10, 4, 1),
  75. PIN_FIELD16(116, 116, 0xcd0, 0x10, 4, 1),
  76. PIN_FIELD16(117, 117, 0xcc0, 0x10, 4, 1),
  77. PINS_FIELD16(118, 121, 0xce0, 0x10, 4, 1),
  78. PINS_FIELD16(122, 125, 0xb30, 0x10, 7, 1),
  79. PIN_FIELD16(126, 126, 0xb20, 0x10, 12, 1),
  80. PINS_FIELD16(127, 142, 0xb30, 0x10, 9, 1),
  81. PINS_FIELD16(143, 160, 0xb30, 0x10, 10, 1),
  82. PINS_FIELD16(161, 168, 0xb30, 0x10, 12, 1),
  83. PINS_FIELD16(169, 183, 0xb30, 0x10, 10, 1),
  84. PINS_FIELD16(184, 186, 0xb30, 0x10, 9, 1),
  85. PIN_FIELD16(187, 187, 0xb30, 0x10, 14, 1),
  86. PIN_FIELD16(188, 188, 0xb20, 0x10, 13, 1),
  87. PINS_FIELD16(189, 193, 0xb30, 0x10, 15, 1),
  88. PINS_FIELD16(194, 198, 0xb40, 0x10, 0, 1),
  89. PIN_FIELD16(199, 199, 0xb20, 0x10, 1, 1),
  90. PINS_FIELD16(200, 202, 0xb40, 0x10, 1, 1),
  91. PINS_FIELD16(203, 207, 0xb40, 0x10, 2, 1),
  92. PINS_FIELD16(208, 209, 0xb40, 0x10, 3, 1),
  93. PIN_FIELD16(210, 210, 0xb40, 0x10, 4, 1),
  94. PINS_FIELD16(211, 235, 0xb40, 0x10, 5, 1),
  95. PINS_FIELD16(236, 241, 0xb40, 0x10, 6, 1),
  96. PINS_FIELD16(242, 243, 0xb40, 0x10, 7, 1),
  97. PINS_FIELD16(244, 247, 0xb40, 0x10, 8, 1),
  98. PIN_FIELD16(248, 248, 0xb40, 0x10, 9, 1),
  99. PINS_FIELD16(249, 257, 0xfc0, 0x10, 4, 1),
  100. PIN_FIELD16(258, 258, 0xcb0, 0x10, 4, 1),
  101. PIN_FIELD16(259, 259, 0xc90, 0x10, 4, 1),
  102. PIN_FIELD16(260, 260, 0x3a0, 0x10, 4, 1),
  103. PIN_FIELD16(261, 261, 0xd50, 0x10, 4, 1),
  104. PINS_FIELD16(262, 277, 0xb40, 0x10, 12, 1),
  105. PIN_FIELD16(278, 278, 0xb40, 0x10, 13, 1),
  106. };
  107. static const struct mtk_pin_field_calc mt7623_pin_smt_range[] = {
  108. PINS_FIELD16(0, 6, 0xb50, 0x10, 0, 1),
  109. PINS_FIELD16(7, 9, 0xb50, 0x10, 1, 1),
  110. PINS_FIELD16(10, 13, 0xb60, 0x10, 3, 1),
  111. PINS_FIELD16(14, 15, 0xb60, 0x10, 13, 1),
  112. PINS_FIELD16(16, 17, 0xb70, 0x10, 7, 1),
  113. PINS_FIELD16(18, 29, 0xb70, 0x10, 13, 1),
  114. PINS_FIELD16(30, 32, 0xb70, 0x10, 7, 1),
  115. PINS_FIELD16(33, 37, 0xb70, 0x10, 13, 1),
  116. PIN_FIELD16(38, 38, 0xb50, 0x10, 13, 1),
  117. PINS_FIELD16(39, 42, 0xb70, 0x10, 13, 1),
  118. PINS_FIELD16(43, 45, 0xb50, 0x10, 10, 1),
  119. PINS_FIELD16(47, 48, 0xb50, 0x10, 11, 1),
  120. PIN_FIELD16(49, 49, 0xb50, 0x10, 12, 1),
  121. PINS_FIELD16(50, 52, 0xb50, 0x10, 13, 1),
  122. PINS_FIELD16(53, 56, 0xb50, 0x10, 14, 1),
  123. PINS_FIELD16(57, 58, 0xb50, 0x10, 15, 1),
  124. PIN_FIELD16(59, 59, 0xb60, 0x10, 10, 1),
  125. PINS_FIELD16(60, 62, 0xb60, 0x10, 0, 1),
  126. PINS_FIELD16(63, 65, 0xb60, 0x10, 1, 1),
  127. PINS_FIELD16(66, 71, 0xb60, 0x10, 2, 1),
  128. PINS_FIELD16(72, 74, 0xb50, 0x10, 12, 1),
  129. PINS_FIELD16(75, 76, 0xb60, 0x10, 3, 1),
  130. PINS_FIELD16(77, 78, 0xb60, 0x10, 4, 1),
  131. PINS_FIELD16(79, 82, 0xb60, 0x10, 5, 1),
  132. PINS_FIELD16(83, 84, 0xb60, 0x10, 2, 1),
  133. PIN_FIELD16(85, 85, 0xda0, 0x10, 11, 1),
  134. PIN_FIELD16(86, 86, 0xd90, 0x10, 11, 1),
  135. PIN_FIELD16(87, 87, 0xdc0, 0x10, 3, 1),
  136. PIN_FIELD16(88, 88, 0xdc0, 0x10, 7, 1),
  137. PIN_FIELD16(89, 89, 0xdc0, 0x10, 11, 1),
  138. PIN_FIELD16(90, 90, 0xdc0, 0x10, 15, 1),
  139. PINS_FIELD16(101, 104, 0xb60, 0x10, 6, 1),
  140. PIN_FIELD16(105, 105, 0xd40, 0x10, 11, 1),
  141. PIN_FIELD16(106, 106, 0xd30, 0x10, 11, 1),
  142. PIN_FIELD16(107, 107, 0xd60, 0x10, 3, 1),
  143. PIN_FIELD16(108, 108, 0xd60, 0x10, 7, 1),
  144. PIN_FIELD16(109, 109, 0xd60, 0x10, 11, 1),
  145. PIN_FIELD16(110, 110, 0xd60, 0x10, 15, 1),
  146. PIN_FIELD16(111, 111, 0xd00, 0x10, 15, 1),
  147. PIN_FIELD16(112, 112, 0xd00, 0x10, 11, 1),
  148. PIN_FIELD16(113, 113, 0xd00, 0x10, 7, 1),
  149. PIN_FIELD16(114, 114, 0xd00, 0x10, 3, 1),
  150. PIN_FIELD16(115, 115, 0xd10, 0x10, 3, 1),
  151. PIN_FIELD16(116, 116, 0xcd0, 0x10, 11, 1),
  152. PIN_FIELD16(117, 117, 0xcc0, 0x10, 11, 1),
  153. PIN_FIELD16(118, 118, 0xcf0, 0x10, 15, 1),
  154. PIN_FIELD16(119, 119, 0xcf0, 0x10, 7, 1),
  155. PIN_FIELD16(120, 120, 0xcf0, 0x10, 3, 1),
  156. PIN_FIELD16(121, 121, 0xcf0, 0x10, 7, 1),
  157. PINS_FIELD16(122, 125, 0xb60, 0x10, 7, 1),
  158. PIN_FIELD16(126, 126, 0xb50, 0x10, 12, 1),
  159. PINS_FIELD16(127, 142, 0xb60, 0x10, 9, 1),
  160. PINS_FIELD16(143, 160, 0xb60, 0x10, 10, 1),
  161. PINS_FIELD16(161, 168, 0xb60, 0x10, 12, 1),
  162. PINS_FIELD16(169, 183, 0xb60, 0x10, 10, 1),
  163. PINS_FIELD16(184, 186, 0xb60, 0x10, 9, 1),
  164. PIN_FIELD16(187, 187, 0xb60, 0x10, 14, 1),
  165. PIN_FIELD16(188, 188, 0xb50, 0x10, 13, 1),
  166. PINS_FIELD16(189, 193, 0xb60, 0x10, 15, 1),
  167. PINS_FIELD16(194, 198, 0xb70, 0x10, 0, 1),
  168. PIN_FIELD16(199, 199, 0xb50, 0x10, 1, 1),
  169. PINS_FIELD16(200, 202, 0xb70, 0x10, 1, 1),
  170. PINS_FIELD16(203, 207, 0xb70, 0x10, 2, 1),
  171. PINS_FIELD16(208, 209, 0xb70, 0x10, 3, 1),
  172. PIN_FIELD16(210, 210, 0xb70, 0x10, 4, 1),
  173. PINS_FIELD16(211, 235, 0xb70, 0x10, 5, 1),
  174. PINS_FIELD16(236, 241, 0xb70, 0x10, 6, 1),
  175. PINS_FIELD16(242, 243, 0xb70, 0x10, 7, 1),
  176. PINS_FIELD16(244, 247, 0xb70, 0x10, 8, 1),
  177. PIN_FIELD16(248, 248, 0xb70, 0x10, 9, 10),
  178. PIN_FIELD16(249, 249, 0x140, 0x10, 3, 1),
  179. PIN_FIELD16(250, 250, 0x130, 0x10, 15, 1),
  180. PIN_FIELD16(251, 251, 0x130, 0x10, 11, 1),
  181. PIN_FIELD16(252, 252, 0x130, 0x10, 7, 1),
  182. PIN_FIELD16(253, 253, 0x130, 0x10, 3, 1),
  183. PIN_FIELD16(254, 254, 0xf40, 0x10, 15, 1),
  184. PIN_FIELD16(255, 255, 0xf40, 0x10, 11, 1),
  185. PIN_FIELD16(256, 256, 0xf40, 0x10, 7, 1),
  186. PIN_FIELD16(257, 257, 0xf40, 0x10, 3, 1),
  187. PIN_FIELD16(258, 258, 0xcb0, 0x10, 11, 1),
  188. PIN_FIELD16(259, 259, 0xc90, 0x10, 11, 1),
  189. PIN_FIELD16(260, 260, 0x3a0, 0x10, 11, 1),
  190. PIN_FIELD16(261, 261, 0x0b0, 0x10, 3, 1),
  191. PINS_FIELD16(262, 277, 0xb70, 0x10, 12, 1),
  192. PIN_FIELD16(278, 278, 0xb70, 0x10, 13, 1),
  193. };
  194. static const struct mtk_pin_field_calc mt7623_pin_pullen_range[] = {
  195. PIN_FIELD16(0, 278, 0x150, 0x10, 0, 1),
  196. };
  197. static const struct mtk_pin_field_calc mt7623_pin_pullsel_range[] = {
  198. PIN_FIELD16(0, 278, 0x280, 0x10, 0, 1),
  199. };
  200. static const struct mtk_pin_field_calc mt7623_pin_drv_range[] = {
  201. PINS_FIELD16(0, 6, 0xf50, 0x10, 0, 4),
  202. PINS_FIELD16(7, 9, 0xf50, 0x10, 4, 4),
  203. PINS_FIELD16(10, 13, 0xf50, 0x10, 4, 4),
  204. PINS_FIELD16(14, 15, 0xf50, 0x10, 12, 4),
  205. PINS_FIELD16(16, 17, 0xf60, 0x10, 0, 4),
  206. PINS_FIELD16(18, 21, 0xf60, 0x10, 0, 4),
  207. PINS_FIELD16(22, 26, 0xf60, 0x10, 8, 4),
  208. PINS_FIELD16(27, 29, 0xf60, 0x10, 12, 4),
  209. PINS_FIELD16(30, 32, 0xf60, 0x10, 0, 4),
  210. PINS_FIELD16(33, 37, 0xf70, 0x10, 0, 4),
  211. PIN_FIELD16(38, 38, 0xf70, 0x10, 4, 4),
  212. PINS_FIELD16(39, 42, 0xf70, 0x10, 8, 4),
  213. PINS_FIELD16(43, 45, 0xf70, 0x10, 12, 4),
  214. PINS_FIELD16(47, 48, 0xf80, 0x10, 0, 4),
  215. PIN_FIELD16(49, 49, 0xf80, 0x10, 4, 4),
  216. PINS_FIELD16(50, 52, 0xf70, 0x10, 4, 4),
  217. PINS_FIELD16(53, 56, 0xf80, 0x10, 12, 4),
  218. PINS_FIELD16(60, 62, 0xf90, 0x10, 8, 4),
  219. PINS_FIELD16(63, 65, 0xf90, 0x10, 12, 4),
  220. PINS_FIELD16(66, 71, 0xfa0, 0x10, 0, 4),
  221. PINS_FIELD16(72, 74, 0xf80, 0x10, 4, 4),
  222. PIN_FIELD16(85, 85, 0xda0, 0x10, 0, 4),
  223. PIN_FIELD16(86, 86, 0xd90, 0x10, 0, 4),
  224. PINS_FIELD16(87, 90, 0xdb0, 0x10, 0, 4),
  225. PIN_FIELD16(105, 105, 0xd40, 0x10, 0, 4),
  226. PIN_FIELD16(106, 106, 0xd30, 0x10, 0, 4),
  227. PINS_FIELD16(107, 110, 0xd50, 0x10, 0, 4),
  228. PINS_FIELD16(111, 115, 0xce0, 0x10, 0, 4),
  229. PIN_FIELD16(116, 116, 0xcd0, 0x10, 0, 4),
  230. PIN_FIELD16(117, 117, 0xcc0, 0x10, 0, 4),
  231. PINS_FIELD16(118, 121, 0xce0, 0x10, 0, 4),
  232. PIN_FIELD16(126, 126, 0xf80, 0x10, 4, 4),
  233. PIN_FIELD16(188, 188, 0xf70, 0x10, 4, 4),
  234. PINS_FIELD16(189, 193, 0xfe0, 0x10, 8, 4),
  235. PINS_FIELD16(194, 198, 0xfe0, 0x10, 12, 4),
  236. PIN_FIELD16(199, 199, 0xf50, 0x10, 4, 4),
  237. PINS_FIELD16(200, 202, 0xfd0, 0x10, 0, 4),
  238. PINS_FIELD16(203, 207, 0xfd0, 0x10, 4, 4),
  239. PINS_FIELD16(208, 209, 0xfd0, 0x10, 8, 4),
  240. PIN_FIELD16(210, 210, 0xfd0, 0x10, 12, 4),
  241. PINS_FIELD16(211, 235, 0xff0, 0x10, 0, 4),
  242. PINS_FIELD16(236, 241, 0xff0, 0x10, 4, 4),
  243. PINS_FIELD16(242, 243, 0xff0, 0x10, 8, 4),
  244. PIN_FIELD16(248, 248, 0xf00, 0x10, 0, 4),
  245. PINS_FIELD16(249, 256, 0xfc0, 0x10, 0, 4),
  246. PIN_FIELD16(257, 257, 0xce0, 0x10, 0, 4),
  247. PIN_FIELD16(258, 258, 0xcb0, 0x10, 0, 4),
  248. PIN_FIELD16(259, 259, 0xc90, 0x10, 0, 4),
  249. PIN_FIELD16(260, 260, 0x3a0, 0x10, 0, 4),
  250. PIN_FIELD16(261, 261, 0xd50, 0x10, 0, 4),
  251. PINS_FIELD16(262, 277, 0xf00, 0x10, 8, 4),
  252. PIN_FIELD16(278, 278, 0xf70, 0x10, 8, 4),
  253. };
  254. static const struct mtk_pin_field_calc mt7623_pin_tdsel_range[] = {
  255. PINS_FIELD16(262, 276, 0x4c0, 0x10, 0, 4),
  256. };
  257. static const struct mtk_pin_field_calc mt7623_pin_pupd_range[] = {
  258. /* MSDC0 */
  259. PIN_FIELD16(111, 111, 0xd00, 0x10, 12, 1),
  260. PIN_FIELD16(112, 112, 0xd00, 0x10, 8, 1),
  261. PIN_FIELD16(113, 113, 0xd00, 0x10, 4, 1),
  262. PIN_FIELD16(114, 114, 0xd00, 0x10, 0, 1),
  263. PIN_FIELD16(115, 115, 0xd10, 0x10, 0, 1),
  264. PIN_FIELD16(116, 116, 0xcd0, 0x10, 8, 1),
  265. PIN_FIELD16(117, 117, 0xcc0, 0x10, 8, 1),
  266. PIN_FIELD16(118, 118, 0xcf0, 0x10, 12, 1),
  267. PIN_FIELD16(119, 119, 0xcf0, 0x10, 8, 1),
  268. PIN_FIELD16(120, 120, 0xcf0, 0x10, 4, 1),
  269. PIN_FIELD16(121, 121, 0xcf0, 0x10, 0, 1),
  270. /* MSDC1 */
  271. PIN_FIELD16(105, 105, 0xd40, 0x10, 8, 1),
  272. PIN_FIELD16(106, 106, 0xd30, 0x10, 8, 1),
  273. PIN_FIELD16(107, 107, 0xd60, 0x10, 0, 1),
  274. PIN_FIELD16(108, 108, 0xd60, 0x10, 10, 1),
  275. PIN_FIELD16(109, 109, 0xd60, 0x10, 4, 1),
  276. PIN_FIELD16(110, 110, 0xc60, 0x10, 12, 1),
  277. /* MSDC1 */
  278. PIN_FIELD16(85, 85, 0xda0, 0x10, 8, 1),
  279. PIN_FIELD16(86, 86, 0xd90, 0x10, 8, 1),
  280. PIN_FIELD16(87, 87, 0xdc0, 0x10, 0, 1),
  281. PIN_FIELD16(88, 88, 0xdc0, 0x10, 10, 1),
  282. PIN_FIELD16(89, 89, 0xdc0, 0x10, 4, 1),
  283. PIN_FIELD16(90, 90, 0xdc0, 0x10, 12, 1),
  284. /* MSDC0E */
  285. PIN_FIELD16(249, 249, 0x140, 0x10, 0, 1),
  286. PIN_FIELD16(250, 250, 0x130, 0x10, 12, 1),
  287. PIN_FIELD16(251, 251, 0x130, 0x10, 8, 1),
  288. PIN_FIELD16(252, 252, 0x130, 0x10, 4, 1),
  289. PIN_FIELD16(253, 253, 0x130, 0x10, 0, 1),
  290. PIN_FIELD16(254, 254, 0xf40, 0x10, 12, 1),
  291. PIN_FIELD16(255, 255, 0xf40, 0x10, 8, 1),
  292. PIN_FIELD16(256, 256, 0xf40, 0x10, 4, 1),
  293. PIN_FIELD16(257, 257, 0xf40, 0x10, 0, 1),
  294. PIN_FIELD16(258, 258, 0xcb0, 0x10, 8, 1),
  295. PIN_FIELD16(259, 259, 0xc90, 0x10, 8, 1),
  296. PIN_FIELD16(261, 261, 0x140, 0x10, 8, 1),
  297. };
  298. static const struct mtk_pin_field_calc mt7623_pin_r1_range[] = {
  299. /* MSDC0 */
  300. PIN_FIELD16(111, 111, 0xd00, 0x10, 13, 1),
  301. PIN_FIELD16(112, 112, 0xd00, 0x10, 9, 1),
  302. PIN_FIELD16(113, 113, 0xd00, 0x10, 5, 1),
  303. PIN_FIELD16(114, 114, 0xd00, 0x10, 1, 1),
  304. PIN_FIELD16(115, 115, 0xd10, 0x10, 1, 1),
  305. PIN_FIELD16(116, 116, 0xcd0, 0x10, 9, 1),
  306. PIN_FIELD16(117, 117, 0xcc0, 0x10, 9, 1),
  307. PIN_FIELD16(118, 118, 0xcf0, 0x10, 13, 1),
  308. PIN_FIELD16(119, 119, 0xcf0, 0x10, 9, 1),
  309. PIN_FIELD16(120, 120, 0xcf0, 0x10, 5, 1),
  310. PIN_FIELD16(121, 121, 0xcf0, 0x10, 1, 1),
  311. /* MSDC1 */
  312. PIN_FIELD16(105, 105, 0xd40, 0x10, 9, 1),
  313. PIN_FIELD16(106, 106, 0xd30, 0x10, 9, 1),
  314. PIN_FIELD16(107, 107, 0xd60, 0x10, 1, 1),
  315. PIN_FIELD16(108, 108, 0xd60, 0x10, 9, 1),
  316. PIN_FIELD16(109, 109, 0xd60, 0x10, 5, 1),
  317. PIN_FIELD16(110, 110, 0xc60, 0x10, 13, 1),
  318. /* MSDC2 */
  319. PIN_FIELD16(85, 85, 0xda0, 0x10, 9, 1),
  320. PIN_FIELD16(86, 86, 0xd90, 0x10, 9, 1),
  321. PIN_FIELD16(87, 87, 0xdc0, 0x10, 1, 1),
  322. PIN_FIELD16(88, 88, 0xdc0, 0x10, 9, 1),
  323. PIN_FIELD16(89, 89, 0xdc0, 0x10, 5, 1),
  324. PIN_FIELD16(90, 90, 0xdc0, 0x10, 13, 1),
  325. /* MSDC0E */
  326. PIN_FIELD16(249, 249, 0x140, 0x10, 1, 1),
  327. PIN_FIELD16(250, 250, 0x130, 0x10, 13, 1),
  328. PIN_FIELD16(251, 251, 0x130, 0x10, 9, 1),
  329. PIN_FIELD16(252, 252, 0x130, 0x10, 5, 1),
  330. PIN_FIELD16(253, 253, 0x130, 0x10, 1, 1),
  331. PIN_FIELD16(254, 254, 0xf40, 0x10, 13, 1),
  332. PIN_FIELD16(255, 255, 0xf40, 0x10, 9, 1),
  333. PIN_FIELD16(256, 256, 0xf40, 0x10, 5, 1),
  334. PIN_FIELD16(257, 257, 0xf40, 0x10, 1, 1),
  335. PIN_FIELD16(258, 258, 0xcb0, 0x10, 9, 1),
  336. PIN_FIELD16(259, 259, 0xc90, 0x10, 9, 1),
  337. PIN_FIELD16(261, 261, 0x140, 0x10, 9, 1),
  338. };
  339. static const struct mtk_pin_field_calc mt7623_pin_r0_range[] = {
  340. /* MSDC0 */
  341. PIN_FIELD16(111, 111, 0xd00, 0x10, 14, 1),
  342. PIN_FIELD16(112, 112, 0xd00, 0x10, 10, 1),
  343. PIN_FIELD16(113, 113, 0xd00, 0x10, 6, 1),
  344. PIN_FIELD16(114, 114, 0xd00, 0x10, 2, 1),
  345. PIN_FIELD16(115, 115, 0xd10, 0x10, 2, 1),
  346. PIN_FIELD16(116, 116, 0xcd0, 0x10, 10, 1),
  347. PIN_FIELD16(117, 117, 0xcc0, 0x10, 10, 1),
  348. PIN_FIELD16(118, 118, 0xcf0, 0x10, 14, 1),
  349. PIN_FIELD16(119, 119, 0xcf0, 0x10, 10, 1),
  350. PIN_FIELD16(120, 120, 0xcf0, 0x10, 6, 1),
  351. PIN_FIELD16(121, 121, 0xcf0, 0x10, 2, 1),
  352. /* MSDC1 */
  353. PIN_FIELD16(105, 105, 0xd40, 0x10, 10, 1),
  354. PIN_FIELD16(106, 106, 0xd30, 0x10, 10, 1),
  355. PIN_FIELD16(107, 107, 0xd60, 0x10, 2, 1),
  356. PIN_FIELD16(108, 108, 0xd60, 0x10, 8, 1),
  357. PIN_FIELD16(109, 109, 0xd60, 0x10, 6, 1),
  358. PIN_FIELD16(110, 110, 0xc60, 0x10, 14, 1),
  359. /* MSDC2 */
  360. PIN_FIELD16(85, 85, 0xda0, 0x10, 10, 1),
  361. PIN_FIELD16(86, 86, 0xd90, 0x10, 10, 1),
  362. PIN_FIELD16(87, 87, 0xdc0, 0x10, 2, 1),
  363. PIN_FIELD16(88, 88, 0xdc0, 0x10, 8, 1),
  364. PIN_FIELD16(89, 89, 0xdc0, 0x10, 6, 1),
  365. PIN_FIELD16(90, 90, 0xdc0, 0x10, 14, 1),
  366. /* MSDC0E */
  367. PIN_FIELD16(249, 249, 0x140, 0x10, 2, 1),
  368. PIN_FIELD16(250, 250, 0x130, 0x10, 14, 1),
  369. PIN_FIELD16(251, 251, 0x130, 0x10, 10, 1),
  370. PIN_FIELD16(252, 252, 0x130, 0x10, 6, 1),
  371. PIN_FIELD16(253, 253, 0x130, 0x10, 2, 1),
  372. PIN_FIELD16(254, 254, 0xf40, 0x10, 14, 1),
  373. PIN_FIELD16(255, 255, 0xf40, 0x10, 10, 1),
  374. PIN_FIELD16(256, 256, 0xf40, 0x10, 6, 1),
  375. PIN_FIELD16(257, 257, 0xf40, 0x10, 5, 1),
  376. PIN_FIELD16(258, 258, 0xcb0, 0x10, 10, 1),
  377. PIN_FIELD16(259, 259, 0xc90, 0x10, 10, 1),
  378. PIN_FIELD16(261, 261, 0x140, 0x10, 10, 1),
  379. };
  380. static const struct mtk_pin_reg_calc mt7623_reg_cals[] = {
  381. [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7623_pin_mode_range),
  382. [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7623_pin_dir_range),
  383. [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt7623_pin_di_range),
  384. [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt7623_pin_do_range),
  385. [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt7623_pin_smt_range),
  386. [PINCTRL_PIN_REG_PULLSEL] = MTK_RANGE(mt7623_pin_pullsel_range),
  387. [PINCTRL_PIN_REG_PULLEN] = MTK_RANGE(mt7623_pin_pullen_range),
  388. [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt7623_pin_drv_range),
  389. [PINCTRL_PIN_REG_TDSEL] = MTK_RANGE(mt7623_pin_tdsel_range),
  390. [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt7623_pin_ies_range),
  391. [PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt7623_pin_pupd_range),
  392. [PINCTRL_PIN_REG_R0] = MTK_RANGE(mt7623_pin_r0_range),
  393. [PINCTRL_PIN_REG_R1] = MTK_RANGE(mt7623_pin_r1_range),
  394. };
  395. static const struct mtk_pin_desc mt7623_pins[] = {
  396. MT7623_PIN(0, "PWRAP_SPI0_MI", 148, DRV_GRP3),
  397. MT7623_PIN(1, "PWRAP_SPI0_MO", 149, DRV_GRP3),
  398. MT7623_PIN(2, "PWRAP_INT", 150, DRV_GRP3),
  399. MT7623_PIN(3, "PWRAP_SPI0_CK", 151, DRV_GRP3),
  400. MT7623_PIN(4, "PWRAP_SPI0_CSN", 152, DRV_GRP3),
  401. MT7623_PIN(5, "PWRAP_SPI0_CK2", 153, DRV_GRP3),
  402. MT7623_PIN(6, "PWRAP_SPI0_CSN2", 154, DRV_GRP3),
  403. MT7623_PIN(7, "SPI1_CSN", 155, DRV_GRP3),
  404. MT7623_PIN(8, "SPI1_MI", 156, DRV_GRP3),
  405. MT7623_PIN(9, "SPI1_MO", 157, DRV_GRP3),
  406. MT7623_PIN(10, "RTC32K_CK", 158, DRV_GRP3),
  407. MT7623_PIN(11, "WATCHDOG", 159, DRV_GRP3),
  408. MT7623_PIN(12, "SRCLKENA", 160, DRV_GRP3),
  409. MT7623_PIN(13, "SRCLKENAI", 161, DRV_GRP3),
  410. MT7623_PIN(14, "URXD2", 162, DRV_GRP1),
  411. MT7623_PIN(15, "UTXD2", 163, DRV_GRP1),
  412. MT7623_PIN(16, "I2S5_DATA_IN", 164, DRV_GRP1),
  413. MT7623_PIN(17, "I2S5_BCK", 165, DRV_GRP1),
  414. MT7623_PIN(18, "PCM_CLK", 166, DRV_GRP1),
  415. MT7623_PIN(19, "PCM_SYNC", 167, DRV_GRP1),
  416. MT7623_PIN(20, "PCM_RX", EINT_NA, DRV_GRP1),
  417. MT7623_PIN(21, "PCM_TX", EINT_NA, DRV_GRP1),
  418. MT7623_PIN(22, "EINT0", 0, DRV_GRP1),
  419. MT7623_PIN(23, "EINT1", 1, DRV_GRP1),
  420. MT7623_PIN(24, "EINT2", 2, DRV_GRP1),
  421. MT7623_PIN(25, "EINT3", 3, DRV_GRP1),
  422. MT7623_PIN(26, "EINT4", 4, DRV_GRP1),
  423. MT7623_PIN(27, "EINT5", 5, DRV_GRP1),
  424. MT7623_PIN(28, "EINT6", 6, DRV_GRP1),
  425. MT7623_PIN(29, "EINT7", 7, DRV_GRP1),
  426. MT7623_PIN(30, "I2S5_LRCK", 12, DRV_GRP1),
  427. MT7623_PIN(31, "I2S5_MCLK", 13, DRV_GRP1),
  428. MT7623_PIN(32, "I2S5_DATA", 14, DRV_GRP1),
  429. MT7623_PIN(33, "I2S1_DATA", 15, DRV_GRP1),
  430. MT7623_PIN(34, "I2S1_DATA_IN", 16, DRV_GRP1),
  431. MT7623_PIN(35, "I2S1_BCK", 17, DRV_GRP1),
  432. MT7623_PIN(36, "I2S1_LRCK", 18, DRV_GRP1),
  433. MT7623_PIN(37, "I2S1_MCLK", 19, DRV_GRP1),
  434. MT7623_PIN(38, "I2S2_DATA", 20, DRV_GRP1),
  435. MT7623_PIN(39, "JTMS", 21, DRV_GRP3),
  436. MT7623_PIN(40, "JTCK", 22, DRV_GRP3),
  437. MT7623_PIN(41, "JTDI", 23, DRV_GRP3),
  438. MT7623_PIN(42, "JTDO", 24, DRV_GRP3),
  439. MT7623_PIN(43, "NCLE", 25, DRV_GRP1),
  440. MT7623_PIN(44, "NCEB1", 26, DRV_GRP1),
  441. MT7623_PIN(45, "NCEB0", 27, DRV_GRP1),
  442. MT7623_PIN(46, "IR", 28, DRV_FIXED),
  443. MT7623_PIN(47, "NREB", 29, DRV_GRP1),
  444. MT7623_PIN(48, "NRNB", 30, DRV_GRP1),
  445. MT7623_PIN(49, "I2S0_DATA", 31, DRV_GRP1),
  446. MT7623_PIN(50, "I2S2_BCK", 32, DRV_GRP1),
  447. MT7623_PIN(51, "I2S2_DATA_IN", 33, DRV_GRP1),
  448. MT7623_PIN(52, "I2S2_LRCK", 34, DRV_GRP1),
  449. MT7623_PIN(53, "SPI0_CSN", 35, DRV_GRP1),
  450. MT7623_PIN(54, "SPI0_CK", 36, DRV_GRP1),
  451. MT7623_PIN(55, "SPI0_MI", 37, DRV_GRP1),
  452. MT7623_PIN(56, "SPI0_MO", 38, DRV_GRP1),
  453. MT7623_PIN(57, "SDA1", 39, DRV_FIXED),
  454. MT7623_PIN(58, "SCL1", 40, DRV_FIXED),
  455. MT7623_PIN(59, "RAMBUF_I_CLK", EINT_NA, DRV_FIXED),
  456. MT7623_PIN(60, "WB_RSTB", 41, DRV_GRP3),
  457. MT7623_PIN(61, "F2W_DATA", 42, DRV_GRP3),
  458. MT7623_PIN(62, "F2W_CLK", 43, DRV_GRP3),
  459. MT7623_PIN(63, "WB_SCLK", 44, DRV_GRP3),
  460. MT7623_PIN(64, "WB_SDATA", 45, DRV_GRP3),
  461. MT7623_PIN(65, "WB_SEN", 46, DRV_GRP3),
  462. MT7623_PIN(66, "WB_CRTL0", 47, DRV_GRP3),
  463. MT7623_PIN(67, "WB_CRTL1", 48, DRV_GRP3),
  464. MT7623_PIN(68, "WB_CRTL2", 49, DRV_GRP3),
  465. MT7623_PIN(69, "WB_CRTL3", 50, DRV_GRP3),
  466. MT7623_PIN(70, "WB_CRTL4", 51, DRV_GRP3),
  467. MT7623_PIN(71, "WB_CRTL5", 52, DRV_GRP3),
  468. MT7623_PIN(72, "I2S0_DATA_IN", 53, DRV_GRP1),
  469. MT7623_PIN(73, "I2S0_LRCK", 54, DRV_GRP1),
  470. MT7623_PIN(74, "I2S0_BCK", 55, DRV_GRP1),
  471. MT7623_PIN(75, "SDA0", 56, DRV_FIXED),
  472. MT7623_PIN(76, "SCL0", 57, DRV_FIXED),
  473. MT7623_PIN(77, "SDA2", 58, DRV_FIXED),
  474. MT7623_PIN(78, "SCL2", 59, DRV_FIXED),
  475. MT7623_PIN(79, "URXD0", 60, DRV_FIXED),
  476. MT7623_PIN(80, "UTXD0", 61, DRV_FIXED),
  477. MT7623_PIN(81, "URXD1", 62, DRV_FIXED),
  478. MT7623_PIN(82, "UTXD1", 63, DRV_FIXED),
  479. MT7623_PIN(83, "LCM_RST", 64, DRV_FIXED),
  480. MT7623_PIN(84, "DSI_TE", 65, DRV_FIXED),
  481. MT7623_PIN(85, "MSDC2_CMD", 66, DRV_GRP4),
  482. MT7623_PIN(86, "MSDC2_CLK", 67, DRV_GRP4),
  483. MT7623_PIN(87, "MSDC2_DAT0", 68, DRV_GRP4),
  484. MT7623_PIN(88, "MSDC2_DAT1", 69, DRV_GRP4),
  485. MT7623_PIN(89, "MSDC2_DAT2", 70, DRV_GRP4),
  486. MT7623_PIN(90, "MSDC2_DAT3", 71, DRV_GRP4),
  487. MT7623_PIN(91, "TDN3", EINT_NA, DRV_FIXED),
  488. MT7623_PIN(92, "TDP3", EINT_NA, DRV_FIXED),
  489. MT7623_PIN(93, "TDN2", EINT_NA, DRV_FIXED),
  490. MT7623_PIN(94, "TDP2", EINT_NA, DRV_FIXED),
  491. MT7623_PIN(95, "TCN", EINT_NA, DRV_FIXED),
  492. MT7623_PIN(96, "TCP", EINT_NA, DRV_FIXED),
  493. MT7623_PIN(97, "TDN1", EINT_NA, DRV_FIXED),
  494. MT7623_PIN(98, "TDP1", EINT_NA, DRV_FIXED),
  495. MT7623_PIN(99, "TDN0", EINT_NA, DRV_FIXED),
  496. MT7623_PIN(100, "TDP0", EINT_NA, DRV_FIXED),
  497. MT7623_PIN(101, "SPI2_CSN", 74, DRV_FIXED),
  498. MT7623_PIN(102, "SPI2_MI", 75, DRV_FIXED),
  499. MT7623_PIN(103, "SPI2_MO", 76, DRV_FIXED),
  500. MT7623_PIN(104, "SPI2_CLK", 77, DRV_FIXED),
  501. MT7623_PIN(105, "MSDC1_CMD", 78, DRV_GRP4),
  502. MT7623_PIN(106, "MSDC1_CLK", 79, DRV_GRP4),
  503. MT7623_PIN(107, "MSDC1_DAT0", 80, DRV_GRP4),
  504. MT7623_PIN(108, "MSDC1_DAT1", 81, DRV_GRP4),
  505. MT7623_PIN(109, "MSDC1_DAT2", 82, DRV_GRP4),
  506. MT7623_PIN(110, "MSDC1_DAT3", 83, DRV_GRP4),
  507. MT7623_PIN(111, "MSDC0_DAT7", 84, DRV_GRP4),
  508. MT7623_PIN(112, "MSDC0_DAT6", 85, DRV_GRP4),
  509. MT7623_PIN(113, "MSDC0_DAT5", 86, DRV_GRP4),
  510. MT7623_PIN(114, "MSDC0_DAT4", 87, DRV_GRP4),
  511. MT7623_PIN(115, "MSDC0_RSTB", 88, DRV_GRP4),
  512. MT7623_PIN(116, "MSDC0_CMD", 89, DRV_GRP4),
  513. MT7623_PIN(117, "MSDC0_CLK", 90, DRV_GRP4),
  514. MT7623_PIN(118, "MSDC0_DAT3", 91, DRV_GRP4),
  515. MT7623_PIN(119, "MSDC0_DAT2", 92, DRV_GRP4),
  516. MT7623_PIN(120, "MSDC0_DAT1", 93, DRV_GRP4),
  517. MT7623_PIN(121, "MSDC0_DAT0", 94, DRV_GRP4),
  518. MT7623_PIN(122, "CEC", 95, DRV_FIXED),
  519. MT7623_PIN(123, "HTPLG", 96, DRV_FIXED),
  520. MT7623_PIN(124, "HDMISCK", 97, DRV_FIXED),
  521. MT7623_PIN(125, "HDMISD", 98, DRV_FIXED),
  522. MT7623_PIN(126, "I2S0_MCLK", 99, DRV_GRP1),
  523. MT7623_PIN(127, "RAMBUF_IDATA0", EINT_NA, DRV_FIXED),
  524. MT7623_PIN(128, "RAMBUF_IDATA1", EINT_NA, DRV_FIXED),
  525. MT7623_PIN(129, "RAMBUF_IDATA2", EINT_NA, DRV_FIXED),
  526. MT7623_PIN(130, "RAMBUF_IDATA3", EINT_NA, DRV_FIXED),
  527. MT7623_PIN(131, "RAMBUF_IDATA4", EINT_NA, DRV_FIXED),
  528. MT7623_PIN(132, "RAMBUF_IDATA5", EINT_NA, DRV_FIXED),
  529. MT7623_PIN(133, "RAMBUF_IDATA6", EINT_NA, DRV_FIXED),
  530. MT7623_PIN(134, "RAMBUF_IDATA7", EINT_NA, DRV_FIXED),
  531. MT7623_PIN(135, "RAMBUF_IDATA8", EINT_NA, DRV_FIXED),
  532. MT7623_PIN(136, "RAMBUF_IDATA9", EINT_NA, DRV_FIXED),
  533. MT7623_PIN(137, "RAMBUF_IDATA10", EINT_NA, DRV_FIXED),
  534. MT7623_PIN(138, "RAMBUF_IDATA11", EINT_NA, DRV_FIXED),
  535. MT7623_PIN(139, "RAMBUF_IDATA12", EINT_NA, DRV_FIXED),
  536. MT7623_PIN(140, "RAMBUF_IDATA13", EINT_NA, DRV_FIXED),
  537. MT7623_PIN(141, "RAMBUF_IDATA14", EINT_NA, DRV_FIXED),
  538. MT7623_PIN(142, "RAMBUF_IDATA15", EINT_NA, DRV_FIXED),
  539. MT7623_PIN(143, "RAMBUF_ODATA0", EINT_NA, DRV_FIXED),
  540. MT7623_PIN(144, "RAMBUF_ODATA1", EINT_NA, DRV_FIXED),
  541. MT7623_PIN(145, "RAMBUF_ODATA2", EINT_NA, DRV_FIXED),
  542. MT7623_PIN(146, "RAMBUF_ODATA3", EINT_NA, DRV_FIXED),
  543. MT7623_PIN(147, "RAMBUF_ODATA4", EINT_NA, DRV_FIXED),
  544. MT7623_PIN(148, "RAMBUF_ODATA5", EINT_NA, DRV_FIXED),
  545. MT7623_PIN(149, "RAMBUF_ODATA6", EINT_NA, DRV_FIXED),
  546. MT7623_PIN(150, "RAMBUF_ODATA7", EINT_NA, DRV_FIXED),
  547. MT7623_PIN(151, "RAMBUF_ODATA8", EINT_NA, DRV_FIXED),
  548. MT7623_PIN(152, "RAMBUF_ODATA9", EINT_NA, DRV_FIXED),
  549. MT7623_PIN(153, "RAMBUF_ODATA10", EINT_NA, DRV_FIXED),
  550. MT7623_PIN(154, "RAMBUF_ODATA11", EINT_NA, DRV_FIXED),
  551. MT7623_PIN(155, "RAMBUF_ODATA12", EINT_NA, DRV_FIXED),
  552. MT7623_PIN(156, "RAMBUF_ODATA13", EINT_NA, DRV_FIXED),
  553. MT7623_PIN(157, "RAMBUF_ODATA14", EINT_NA, DRV_FIXED),
  554. MT7623_PIN(158, "RAMBUF_ODATA15", EINT_NA, DRV_FIXED),
  555. MT7623_PIN(159, "RAMBUF_BE0", EINT_NA, DRV_FIXED),
  556. MT7623_PIN(160, "RAMBUF_BE1", EINT_NA, DRV_FIXED),
  557. MT7623_PIN(161, "AP2PT_INT", EINT_NA, DRV_FIXED),
  558. MT7623_PIN(162, "AP2PT_INT_CLR", EINT_NA, DRV_FIXED),
  559. MT7623_PIN(163, "PT2AP_INT", EINT_NA, DRV_FIXED),
  560. MT7623_PIN(164, "PT2AP_INT_CLR", EINT_NA, DRV_FIXED),
  561. MT7623_PIN(165, "AP2UP_INT", EINT_NA, DRV_FIXED),
  562. MT7623_PIN(166, "AP2UP_INT_CLR", EINT_NA, DRV_FIXED),
  563. MT7623_PIN(167, "UP2AP_INT", EINT_NA, DRV_FIXED),
  564. MT7623_PIN(168, "UP2AP_INT_CLR", EINT_NA, DRV_FIXED),
  565. MT7623_PIN(169, "RAMBUF_ADDR0", EINT_NA, DRV_FIXED),
  566. MT7623_PIN(170, "RAMBUF_ADDR1", EINT_NA, DRV_FIXED),
  567. MT7623_PIN(171, "RAMBUF_ADDR2", EINT_NA, DRV_FIXED),
  568. MT7623_PIN(172, "RAMBUF_ADDR3", EINT_NA, DRV_FIXED),
  569. MT7623_PIN(173, "RAMBUF_ADDR4", EINT_NA, DRV_FIXED),
  570. MT7623_PIN(174, "RAMBUF_ADDR5", EINT_NA, DRV_FIXED),
  571. MT7623_PIN(175, "RAMBUF_ADDR6", EINT_NA, DRV_FIXED),
  572. MT7623_PIN(176, "RAMBUF_ADDR7", EINT_NA, DRV_FIXED),
  573. MT7623_PIN(177, "RAMBUF_ADDR8", EINT_NA, DRV_FIXED),
  574. MT7623_PIN(178, "RAMBUF_ADDR9", EINT_NA, DRV_FIXED),
  575. MT7623_PIN(179, "RAMBUF_ADDR10", EINT_NA, DRV_FIXED),
  576. MT7623_PIN(180, "RAMBUF_RW", EINT_NA, DRV_FIXED),
  577. MT7623_PIN(181, "RAMBUF_LAST", EINT_NA, DRV_FIXED),
  578. MT7623_PIN(182, "RAMBUF_HP", EINT_NA, DRV_FIXED),
  579. MT7623_PIN(183, "RAMBUF_REQ", EINT_NA, DRV_FIXED),
  580. MT7623_PIN(184, "RAMBUF_ALE", EINT_NA, DRV_FIXED),
  581. MT7623_PIN(185, "RAMBUF_DLE", EINT_NA, DRV_FIXED),
  582. MT7623_PIN(186, "RAMBUF_WDLE", EINT_NA, DRV_FIXED),
  583. MT7623_PIN(187, "RAMBUF_O_CLK", EINT_NA, DRV_FIXED),
  584. MT7623_PIN(188, "I2S2_MCLK", 100, DRV_GRP1),
  585. MT7623_PIN(189, "I2S3_DATA", 101, DRV_GRP1),
  586. MT7623_PIN(190, "I2S3_DATA_IN", 102, DRV_GRP1),
  587. MT7623_PIN(191, "I2S3_BCK", 103, DRV_GRP1),
  588. MT7623_PIN(192, "I2S3_LRCK", 104, DRV_GRP1),
  589. MT7623_PIN(193, "I2S3_MCLK", 105, DRV_GRP1),
  590. MT7623_PIN(194, "I2S4_DATA", 106, DRV_GRP1),
  591. MT7623_PIN(195, "I2S4_DATA_IN", 107, DRV_GRP1),
  592. MT7623_PIN(196, "I2S4_BCK", 108, DRV_GRP1),
  593. MT7623_PIN(197, "I2S4_LRCK", 109, DRV_GRP1),
  594. MT7623_PIN(198, "I2S4_MCLK", 110, DRV_GRP1),
  595. MT7623_PIN(199, "SPI1_CLK", 111, DRV_GRP3),
  596. MT7623_PIN(200, "SPDIF_OUT", 112, DRV_GRP1),
  597. MT7623_PIN(201, "SPDIF_IN0", 113, DRV_GRP1),
  598. MT7623_PIN(202, "SPDIF_IN1", 114, DRV_GRP1),
  599. MT7623_PIN(203, "PWM0", 115, DRV_GRP1),
  600. MT7623_PIN(204, "PWM1", 116, DRV_GRP1),
  601. MT7623_PIN(205, "PWM2", 117, DRV_GRP1),
  602. MT7623_PIN(206, "PWM3", 118, DRV_GRP1),
  603. MT7623_PIN(207, "PWM4", 119, DRV_GRP1),
  604. MT7623_PIN(208, "AUD_EXT_CK1", 120, DRV_GRP1),
  605. MT7623_PIN(209, "AUD_EXT_CK2", 121, DRV_GRP1),
  606. MT7623_PIN(210, "AUD_CLOCK", EINT_NA, DRV_GRP3),
  607. MT7623_PIN(211, "DVP_RESET", EINT_NA, DRV_GRP3),
  608. MT7623_PIN(212, "DVP_CLOCK", EINT_NA, DRV_GRP3),
  609. MT7623_PIN(213, "DVP_CS", EINT_NA, DRV_GRP3),
  610. MT7623_PIN(214, "DVP_CK", EINT_NA, DRV_GRP3),
  611. MT7623_PIN(215, "DVP_DI", EINT_NA, DRV_GRP3),
  612. MT7623_PIN(216, "DVP_DO", EINT_NA, DRV_GRP3),
  613. MT7623_PIN(217, "AP_CS", EINT_NA, DRV_GRP3),
  614. MT7623_PIN(218, "AP_CK", EINT_NA, DRV_GRP3),
  615. MT7623_PIN(219, "AP_DI", EINT_NA, DRV_GRP3),
  616. MT7623_PIN(220, "AP_DO", EINT_NA, DRV_GRP3),
  617. MT7623_PIN(221, "DVD_BCLK", EINT_NA, DRV_GRP3),
  618. MT7623_PIN(222, "T8032_CLK", EINT_NA, DRV_GRP3),
  619. MT7623_PIN(223, "AP_BCLK", EINT_NA, DRV_GRP3),
  620. MT7623_PIN(224, "HOST_CS", EINT_NA, DRV_GRP3),
  621. MT7623_PIN(225, "HOST_CK", EINT_NA, DRV_GRP3),
  622. MT7623_PIN(226, "HOST_DO0", EINT_NA, DRV_GRP3),
  623. MT7623_PIN(227, "HOST_DO1", EINT_NA, DRV_GRP3),
  624. MT7623_PIN(228, "SLV_CS", EINT_NA, DRV_GRP3),
  625. MT7623_PIN(229, "SLV_CK", EINT_NA, DRV_GRP3),
  626. MT7623_PIN(230, "SLV_DI0", EINT_NA, DRV_GRP3),
  627. MT7623_PIN(231, "SLV_DI1", EINT_NA, DRV_GRP3),
  628. MT7623_PIN(232, "AP2DSP_INT", EINT_NA, DRV_GRP3),
  629. MT7623_PIN(233, "AP2DSP_INT_CLR", EINT_NA, DRV_GRP3),
  630. MT7623_PIN(234, "DSP2AP_INT", EINT_NA, DRV_GRP3),
  631. MT7623_PIN(235, "DSP2AP_INT_CLR", EINT_NA, DRV_GRP3),
  632. MT7623_PIN(236, "EXT_SDIO3", 122, DRV_GRP1),
  633. MT7623_PIN(237, "EXT_SDIO2", 123, DRV_GRP1),
  634. MT7623_PIN(238, "EXT_SDIO1", 124, DRV_GRP1),
  635. MT7623_PIN(239, "EXT_SDIO0", 125, DRV_GRP1),
  636. MT7623_PIN(240, "EXT_XCS", 126, DRV_GRP1),
  637. MT7623_PIN(241, "EXT_SCK", 127, DRV_GRP1),
  638. MT7623_PIN(242, "URTS2", 128, DRV_GRP1),
  639. MT7623_PIN(243, "UCTS2", 129, DRV_GRP1),
  640. MT7623_PIN(244, "HDMI_SDA_RX", 130, DRV_FIXED),
  641. MT7623_PIN(245, "HDMI_SCL_RX", 131, DRV_FIXED),
  642. MT7623_PIN(246, "MHL_SENCE", 132, DRV_FIXED),
  643. MT7623_PIN(247, "HDMI_HPD_CBUS_RX", 69, DRV_FIXED),
  644. MT7623_PIN(248, "HDMI_TESTOUTP_RX", 133, DRV_GRP1),
  645. MT7623_PIN(249, "MSDC0E_RSTB", 134, DRV_GRP4),
  646. MT7623_PIN(250, "MSDC0E_DAT7", 135, DRV_GRP4),
  647. MT7623_PIN(251, "MSDC0E_DAT6", 136, DRV_GRP4),
  648. MT7623_PIN(252, "MSDC0E_DAT5", 137, DRV_GRP4),
  649. MT7623_PIN(253, "MSDC0E_DAT4", 138, DRV_GRP4),
  650. MT7623_PIN(254, "MSDC0E_DAT3", 139, DRV_GRP4),
  651. MT7623_PIN(255, "MSDC0E_DAT2", 140, DRV_GRP4),
  652. MT7623_PIN(256, "MSDC0E_DAT1", 141, DRV_GRP4),
  653. MT7623_PIN(257, "MSDC0E_DAT0", 142, DRV_GRP4),
  654. MT7623_PIN(258, "MSDC0E_CMD", 143, DRV_GRP4),
  655. MT7623_PIN(259, "MSDC0E_CLK", 144, DRV_GRP4),
  656. MT7623_PIN(260, "MSDC0E_DSL", 145, DRV_GRP4),
  657. MT7623_PIN(261, "MSDC1_INS", 146, DRV_GRP4),
  658. MT7623_PIN(262, "G2_TXEN", 8, DRV_GRP1),
  659. MT7623_PIN(263, "G2_TXD3", 9, DRV_GRP1),
  660. MT7623_PIN(264, "G2_TXD2", 10, DRV_GRP1),
  661. MT7623_PIN(265, "G2_TXD1", 11, DRV_GRP1),
  662. MT7623_PIN(266, "G2_TXD0", EINT_NA, DRV_GRP1),
  663. MT7623_PIN(267, "G2_TXC", EINT_NA, DRV_GRP1),
  664. MT7623_PIN(268, "G2_RXC", EINT_NA, DRV_GRP1),
  665. MT7623_PIN(269, "G2_RXD0", EINT_NA, DRV_GRP1),
  666. MT7623_PIN(270, "G2_RXD1", EINT_NA, DRV_GRP1),
  667. MT7623_PIN(271, "G2_RXD2", EINT_NA, DRV_GRP1),
  668. MT7623_PIN(272, "G2_RXD3", EINT_NA, DRV_GRP1),
  669. MT7623_PIN(273, "ESW_INT", 168, DRV_GRP1),
  670. MT7623_PIN(274, "G2_RXDV", EINT_NA, DRV_GRP1),
  671. MT7623_PIN(275, "MDC", EINT_NA, DRV_GRP1),
  672. MT7623_PIN(276, "MDIO", EINT_NA, DRV_GRP1),
  673. MT7623_PIN(277, "ESW_RST", EINT_NA, DRV_GRP1),
  674. MT7623_PIN(278, "JTAG_RESET", 147, DRV_GRP3),
  675. MT7623_PIN(279, "USB3_RES_BOND", EINT_NA, DRV_GRP1),
  676. };
  677. /* List all groups consisting of these pins dedicated to the enablement of
  678. * certain hardware block and the corresponding mode for all of the pins.
  679. * The hardware probably has multiple combinations of these pinouts.
  680. */
  681. /* AUDIO EXT CLK */
  682. static int mt7623_aud_ext_clk0_pins[] = { 208, };
  683. static int mt7623_aud_ext_clk0_funcs[] = { 1, };
  684. static int mt7623_aud_ext_clk1_pins[] = { 209, };
  685. static int mt7623_aud_ext_clk1_funcs[] = { 1, };
  686. /* DISP PWM */
  687. static int mt7623_disp_pwm_0_pins[] = { 72, };
  688. static int mt7623_disp_pwm_0_funcs[] = { 5, };
  689. static int mt7623_disp_pwm_1_pins[] = { 203, };
  690. static int mt7623_disp_pwm_1_funcs[] = { 2, };
  691. static int mt7623_disp_pwm_2_pins[] = { 208, };
  692. static int mt7623_disp_pwm_2_funcs[] = { 5, };
  693. /* ESW */
  694. static int mt7623_esw_int_pins[] = { 273, };
  695. static int mt7623_esw_int_funcs[] = { 1, };
  696. static int mt7623_esw_rst_pins[] = { 277, };
  697. static int mt7623_esw_rst_funcs[] = { 1, };
  698. /* EPHY */
  699. static int mt7623_ephy_pins[] = { 262, 263, 264, 265, 266, 267, 268,
  700. 269, 270, 271, 272, 274, };
  701. static int mt7623_ephy_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, };
  702. /* EXT_SDIO */
  703. static int mt7623_ext_sdio_pins[] = { 236, 237, 238, 239, 240, 241, };
  704. static int mt7623_ext_sdio_funcs[] = { 1, 1, 1, 1, 1, 1, };
  705. /* HDMI RX */
  706. static int mt7623_hdmi_rx_pins[] = { 247, 248, };
  707. static int mt7623_hdmi_rx_funcs[] = { 1, 1 };
  708. static int mt7623_hdmi_rx_i2c_pins[] = { 244, 245, };
  709. static int mt7623_hdmi_rx_i2c_funcs[] = { 1, 1 };
  710. /* HDMI TX */
  711. static int mt7623_hdmi_cec_pins[] = { 122, };
  712. static int mt7623_hdmi_cec_funcs[] = { 1, };
  713. static int mt7623_hdmi_htplg_pins[] = { 123, };
  714. static int mt7623_hdmi_htplg_funcs[] = { 1, };
  715. static int mt7623_hdmi_i2c_pins[] = { 124, 125, };
  716. static int mt7623_hdmi_i2c_funcs[] = { 1, 1 };
  717. /* I2C */
  718. static int mt7623_i2c0_pins[] = { 75, 76, };
  719. static int mt7623_i2c0_funcs[] = { 1, 1, };
  720. static int mt7623_i2c1_0_pins[] = { 57, 58, };
  721. static int mt7623_i2c1_0_funcs[] = { 1, 1, };
  722. static int mt7623_i2c1_1_pins[] = { 242, 243, };
  723. static int mt7623_i2c1_1_funcs[] = { 4, 4, };
  724. static int mt7623_i2c1_2_pins[] = { 85, 86, };
  725. static int mt7623_i2c1_2_funcs[] = { 3, 3, };
  726. static int mt7623_i2c1_3_pins[] = { 105, 106, };
  727. static int mt7623_i2c1_3_funcs[] = { 3, 3, };
  728. static int mt7623_i2c1_4_pins[] = { 124, 125, };
  729. static int mt7623_i2c1_4_funcs[] = { 4, 4, };
  730. static int mt7623_i2c2_0_pins[] = { 77, 78, };
  731. static int mt7623_i2c2_0_funcs[] = { 1, 1, };
  732. static int mt7623_i2c2_1_pins[] = { 89, 90, };
  733. static int mt7623_i2c2_1_funcs[] = { 3, 3, };
  734. static int mt7623_i2c2_2_pins[] = { 109, 110, };
  735. static int mt7623_i2c2_2_funcs[] = { 3, 3, };
  736. static int mt7623_i2c2_3_pins[] = { 122, 123, };
  737. static int mt7623_i2c2_3_funcs[] = { 4, 4, };
  738. /* I2S */
  739. static int mt7623_i2s0_pins[] = { 49, 72, 73, 74, 126, };
  740. static int mt7623_i2s0_funcs[] = { 1, 1, 1, 1, 1, };
  741. static int mt7623_i2s1_pins[] = { 33, 34, 35, 36, 37, };
  742. static int mt7623_i2s1_funcs[] = { 1, 1, 1, 1, 1, };
  743. static int mt7623_i2s2_bclk_lrclk_mclk_pins[] = { 50, 52, 188, };
  744. static int mt7623_i2s2_bclk_lrclk_mclk_funcs[] = { 1, 1, 1, };
  745. static int mt7623_i2s2_data_in_pins[] = { 51, };
  746. static int mt7623_i2s2_data_in_funcs[] = { 1, };
  747. static int mt7623_i2s2_data_0_pins[] = { 203, };
  748. static int mt7623_i2s2_data_0_funcs[] = { 9, };
  749. static int mt7623_i2s2_data_1_pins[] = { 38, };
  750. static int mt7623_i2s2_data_1_funcs[] = { 4, };
  751. static int mt7623_i2s3_bclk_lrclk_mclk_pins[] = { 191, 192, 193, };
  752. static int mt7623_i2s3_bclk_lrclk_mclk_funcs[] = { 1, 1, 1, };
  753. static int mt7623_i2s3_data_in_pins[] = { 190, };
  754. static int mt7623_i2s3_data_in_funcs[] = { 1, };
  755. static int mt7623_i2s3_data_0_pins[] = { 204, };
  756. static int mt7623_i2s3_data_0_funcs[] = { 9, };
  757. static int mt7623_i2s3_data_1_pins[] = { 2, };
  758. static int mt7623_i2s3_data_1_funcs[] = { 0, };
  759. static int mt7623_i2s4_pins[] = { 194, 195, 196, 197, 198, };
  760. static int mt7623_i2s4_funcs[] = { 1, 1, 1, 1, 1, };
  761. static int mt7623_i2s5_pins[] = { 16, 17, 30, 31, 32, };
  762. static int mt7623_i2s5_funcs[] = { 1, 1, 1, 1, 1, };
  763. /* IR */
  764. static int mt7623_ir_pins[] = { 46, };
  765. static int mt7623_ir_funcs[] = { 1, };
  766. /* LCD */
  767. static int mt7623_mipi_tx_pins[] = { 91, 92, 93, 94, 95, 96, 97, 98,
  768. 99, 100, };
  769. static int mt7623_mipi_tx_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, };
  770. static int mt7623_dsi_te_pins[] = { 84, };
  771. static int mt7623_dsi_te_funcs[] = { 1, };
  772. static int mt7623_lcm_rst_pins[] = { 83, };
  773. static int mt7623_lcm_rst_funcs[] = { 1, };
  774. /* MDC/MDIO */
  775. static int mt7623_mdc_mdio_pins[] = { 275, 276, };
  776. static int mt7623_mdc_mdio_funcs[] = { 1, 1, };
  777. /* MSDC */
  778. static int mt7623_msdc0_pins[] = { 111, 112, 113, 114, 115, 116, 117, 118,
  779. 119, 120, 121, };
  780. static int mt7623_msdc0_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, };
  781. static int mt7623_msdc1_pins[] = { 105, 106, 107, 108, 109, 110, };
  782. static int mt7623_msdc1_funcs[] = { 1, 1, 1, 1, 1, 1, };
  783. static int mt7623_msdc1_ins_pins[] = { 261, };
  784. static int mt7623_msdc1_ins_funcs[] = { 1, };
  785. static int mt7623_msdc1_wp_0_pins[] = { 29, };
  786. static int mt7623_msdc1_wp_0_funcs[] = { 1, };
  787. static int mt7623_msdc1_wp_1_pins[] = { 55, };
  788. static int mt7623_msdc1_wp_1_funcs[] = { 3, };
  789. static int mt7623_msdc1_wp_2_pins[] = { 209, };
  790. static int mt7623_msdc1_wp_2_funcs[] = { 2, };
  791. static int mt7623_msdc2_pins[] = { 85, 86, 87, 88, 89, 90, };
  792. static int mt7623_msdc2_funcs[] = { 1, 1, 1, 1, 1, 1, };
  793. static int mt7623_msdc3_pins[] = { 249, 250, 251, 252, 253, 254, 255, 256,
  794. 257, 258, 259, 260, };
  795. static int mt7623_msdc3_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, };
  796. /* NAND */
  797. static int mt7623_nandc_pins[] = { 43, 47, 48, 111, 112, 113, 114, 115,
  798. 116, 117, 118, 119, 120, 121, };
  799. static int mt7623_nandc_funcs[] = { 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  800. 4, 4, };
  801. static int mt7623_nandc_ceb0_pins[] = { 45, };
  802. static int mt7623_nandc_ceb0_funcs[] = { 1, };
  803. static int mt7623_nandc_ceb1_pins[] = { 44, };
  804. static int mt7623_nandc_ceb1_funcs[] = { 1, };
  805. /* RTC */
  806. static int mt7623_rtc_pins[] = { 10, };
  807. static int mt7623_rtc_funcs[] = { 1, };
  808. /* OTG */
  809. static int mt7623_otg_iddig0_0_pins[] = { 29, };
  810. static int mt7623_otg_iddig0_0_funcs[] = { 1, };
  811. static int mt7623_otg_iddig0_1_pins[] = { 44, };
  812. static int mt7623_otg_iddig0_1_funcs[] = { 2, };
  813. static int mt7623_otg_iddig0_2_pins[] = { 236, };
  814. static int mt7623_otg_iddig0_2_funcs[] = { 2, };
  815. static int mt7623_otg_iddig1_0_pins[] = { 27, };
  816. static int mt7623_otg_iddig1_0_funcs[] = { 2, };
  817. static int mt7623_otg_iddig1_1_pins[] = { 47, };
  818. static int mt7623_otg_iddig1_1_funcs[] = { 2, };
  819. static int mt7623_otg_iddig1_2_pins[] = { 238, };
  820. static int mt7623_otg_iddig1_2_funcs[] = { 2, };
  821. static int mt7623_otg_drv_vbus0_0_pins[] = { 28, };
  822. static int mt7623_otg_drv_vbus0_0_funcs[] = { 1, };
  823. static int mt7623_otg_drv_vbus0_1_pins[] = { 45, };
  824. static int mt7623_otg_drv_vbus0_1_funcs[] = { 2, };
  825. static int mt7623_otg_drv_vbus0_2_pins[] = { 237, };
  826. static int mt7623_otg_drv_vbus0_2_funcs[] = { 2, };
  827. static int mt7623_otg_drv_vbus1_0_pins[] = { 26, };
  828. static int mt7623_otg_drv_vbus1_0_funcs[] = { 2, };
  829. static int mt7623_otg_drv_vbus1_1_pins[] = { 48, };
  830. static int mt7623_otg_drv_vbus1_1_funcs[] = { 2, };
  831. static int mt7623_otg_drv_vbus1_2_pins[] = { 239, };
  832. static int mt7623_otg_drv_vbus1_2_funcs[] = { 2, };
  833. /* PCIE */
  834. static int mt7623_pcie0_0_perst_pins[] = { 208, };
  835. static int mt7623_pcie0_0_perst_funcs[] = { 3, };
  836. static int mt7623_pcie0_1_perst_pins[] = { 22, };
  837. static int mt7623_pcie0_1_perst_funcs[] = { 2, };
  838. static int mt7623_pcie1_0_perst_pins[] = { 209, };
  839. static int mt7623_pcie1_0_perst_funcs[] = { 3, };
  840. static int mt7623_pcie1_1_perst_pins[] = { 23, };
  841. static int mt7623_pcie1_1_perst_funcs[] = { 2, };
  842. static int mt7623_pcie2_0_perst_pins[] = { 24, };
  843. static int mt7623_pcie2_0_perst_funcs[] = { 2, };
  844. static int mt7623_pcie2_1_perst_pins[] = { 29, };
  845. static int mt7623_pcie2_1_perst_funcs[] = { 6, };
  846. static int mt7623_pcie0_0_wake_pins[] = { 28, };
  847. static int mt7623_pcie0_0_wake_funcs[] = { 6, };
  848. static int mt7623_pcie0_1_wake_pins[] = { 251, };
  849. static int mt7623_pcie0_1_wake_funcs[] = { 6, };
  850. static int mt7623_pcie1_0_wake_pins[] = { 27, };
  851. static int mt7623_pcie1_0_wake_funcs[] = { 6, };
  852. static int mt7623_pcie1_1_wake_pins[] = { 253, };
  853. static int mt7623_pcie1_1_wake_funcs[] = { 6, };
  854. static int mt7623_pcie2_0_wake_pins[] = { 26, };
  855. static int mt7623_pcie2_0_wake_funcs[] = { 6, };
  856. static int mt7623_pcie2_1_wake_pins[] = { 255, };
  857. static int mt7623_pcie2_1_wake_funcs[] = { 6, };
  858. static int mt7623_pcie0_clkreq_pins[] = { 250, };
  859. static int mt7623_pcie0_clkreq_funcs[] = { 6, };
  860. static int mt7623_pcie1_clkreq_pins[] = { 252, };
  861. static int mt7623_pcie1_clkreq_funcs[] = { 6, };
  862. static int mt7623_pcie2_clkreq_pins[] = { 254, };
  863. static int mt7623_pcie2_clkreq_funcs[] = { 6, };
  864. /* the pcie_*_rev are only used for MT7623 */
  865. static int mt7623_pcie0_0_rev_perst_pins[] = { 208, };
  866. static int mt7623_pcie0_0_rev_perst_funcs[] = { 11, };
  867. static int mt7623_pcie0_1_rev_perst_pins[] = { 22, };
  868. static int mt7623_pcie0_1_rev_perst_funcs[] = { 10, };
  869. static int mt7623_pcie1_0_rev_perst_pins[] = { 209, };
  870. static int mt7623_pcie1_0_rev_perst_funcs[] = { 11, };
  871. static int mt7623_pcie1_1_rev_perst_pins[] = { 23, };
  872. static int mt7623_pcie1_1_rev_perst_funcs[] = { 10, };
  873. static int mt7623_pcie2_0_rev_perst_pins[] = { 24, };
  874. static int mt7623_pcie2_0_rev_perst_funcs[] = { 11, };
  875. static int mt7623_pcie2_1_rev_perst_pins[] = { 29, };
  876. static int mt7623_pcie2_1_rev_perst_funcs[] = { 14, };
  877. /* PCM */
  878. static int mt7623_pcm_clk_0_pins[] = { 18, };
  879. static int mt7623_pcm_clk_0_funcs[] = { 1, };
  880. static int mt7623_pcm_clk_1_pins[] = { 17, };
  881. static int mt7623_pcm_clk_1_funcs[] = { 3, };
  882. static int mt7623_pcm_clk_2_pins[] = { 35, };
  883. static int mt7623_pcm_clk_2_funcs[] = { 3, };
  884. static int mt7623_pcm_clk_3_pins[] = { 50, };
  885. static int mt7623_pcm_clk_3_funcs[] = { 3, };
  886. static int mt7623_pcm_clk_4_pins[] = { 74, };
  887. static int mt7623_pcm_clk_4_funcs[] = { 3, };
  888. static int mt7623_pcm_clk_5_pins[] = { 191, };
  889. static int mt7623_pcm_clk_5_funcs[] = { 3, };
  890. static int mt7623_pcm_clk_6_pins[] = { 196, };
  891. static int mt7623_pcm_clk_6_funcs[] = { 3, };
  892. static int mt7623_pcm_sync_0_pins[] = { 19, };
  893. static int mt7623_pcm_sync_0_funcs[] = { 1, };
  894. static int mt7623_pcm_sync_1_pins[] = { 30, };
  895. static int mt7623_pcm_sync_1_funcs[] = { 3, };
  896. static int mt7623_pcm_sync_2_pins[] = { 36, };
  897. static int mt7623_pcm_sync_2_funcs[] = { 3, };
  898. static int mt7623_pcm_sync_3_pins[] = { 52, };
  899. static int mt7623_pcm_sync_3_funcs[] = { 31, };
  900. static int mt7623_pcm_sync_4_pins[] = { 73, };
  901. static int mt7623_pcm_sync_4_funcs[] = { 3, };
  902. static int mt7623_pcm_sync_5_pins[] = { 192, };
  903. static int mt7623_pcm_sync_5_funcs[] = { 3, };
  904. static int mt7623_pcm_sync_6_pins[] = { 197, };
  905. static int mt7623_pcm_sync_6_funcs[] = { 3, };
  906. static int mt7623_pcm_rx_0_pins[] = { 20, };
  907. static int mt7623_pcm_rx_0_funcs[] = { 1, };
  908. static int mt7623_pcm_rx_1_pins[] = { 16, };
  909. static int mt7623_pcm_rx_1_funcs[] = { 3, };
  910. static int mt7623_pcm_rx_2_pins[] = { 34, };
  911. static int mt7623_pcm_rx_2_funcs[] = { 3, };
  912. static int mt7623_pcm_rx_3_pins[] = { 51, };
  913. static int mt7623_pcm_rx_3_funcs[] = { 3, };
  914. static int mt7623_pcm_rx_4_pins[] = { 72, };
  915. static int mt7623_pcm_rx_4_funcs[] = { 3, };
  916. static int mt7623_pcm_rx_5_pins[] = { 190, };
  917. static int mt7623_pcm_rx_5_funcs[] = { 3, };
  918. static int mt7623_pcm_rx_6_pins[] = { 195, };
  919. static int mt7623_pcm_rx_6_funcs[] = { 3, };
  920. static int mt7623_pcm_tx_0_pins[] = { 21, };
  921. static int mt7623_pcm_tx_0_funcs[] = { 1, };
  922. static int mt7623_pcm_tx_1_pins[] = { 32, };
  923. static int mt7623_pcm_tx_1_funcs[] = { 3, };
  924. static int mt7623_pcm_tx_2_pins[] = { 33, };
  925. static int mt7623_pcm_tx_2_funcs[] = { 3, };
  926. static int mt7623_pcm_tx_3_pins[] = { 38, };
  927. static int mt7623_pcm_tx_3_funcs[] = { 3, };
  928. static int mt7623_pcm_tx_4_pins[] = { 49, };
  929. static int mt7623_pcm_tx_4_funcs[] = { 3, };
  930. static int mt7623_pcm_tx_5_pins[] = { 189, };
  931. static int mt7623_pcm_tx_5_funcs[] = { 3, };
  932. static int mt7623_pcm_tx_6_pins[] = { 194, };
  933. static int mt7623_pcm_tx_6_funcs[] = { 3, };
  934. /* PWM */
  935. static int mt7623_pwm_ch1_0_pins[] = { 203, };
  936. static int mt7623_pwm_ch1_0_funcs[] = { 1, };
  937. static int mt7623_pwm_ch1_1_pins[] = { 208, };
  938. static int mt7623_pwm_ch1_1_funcs[] = { 2, };
  939. static int mt7623_pwm_ch1_2_pins[] = { 72, };
  940. static int mt7623_pwm_ch1_2_funcs[] = { 4, };
  941. static int mt7623_pwm_ch1_3_pins[] = { 88, };
  942. static int mt7623_pwm_ch1_3_funcs[] = { 3, };
  943. static int mt7623_pwm_ch1_4_pins[] = { 108, };
  944. static int mt7623_pwm_ch1_4_funcs[] = { 3, };
  945. static int mt7623_pwm_ch2_0_pins[] = { 204, };
  946. static int mt7623_pwm_ch2_0_funcs[] = { 1, };
  947. static int mt7623_pwm_ch2_1_pins[] = { 53, };
  948. static int mt7623_pwm_ch2_1_funcs[] = { 5, };
  949. static int mt7623_pwm_ch2_2_pins[] = { 88, };
  950. static int mt7623_pwm_ch2_2_funcs[] = { 6, };
  951. static int mt7623_pwm_ch2_3_pins[] = { 108, };
  952. static int mt7623_pwm_ch2_3_funcs[] = { 6, };
  953. static int mt7623_pwm_ch2_4_pins[] = { 209, };
  954. static int mt7623_pwm_ch2_4_funcs[] = { 5, };
  955. static int mt7623_pwm_ch3_0_pins[] = { 205, };
  956. static int mt7623_pwm_ch3_0_funcs[] = { 1, };
  957. static int mt7623_pwm_ch3_1_pins[] = { 55, };
  958. static int mt7623_pwm_ch3_1_funcs[] = { 5, };
  959. static int mt7623_pwm_ch3_2_pins[] = { 89, };
  960. static int mt7623_pwm_ch3_2_funcs[] = { 6, };
  961. static int mt7623_pwm_ch3_3_pins[] = { 109, };
  962. static int mt7623_pwm_ch3_3_funcs[] = { 6, };
  963. static int mt7623_pwm_ch4_0_pins[] = { 206, };
  964. static int mt7623_pwm_ch4_0_funcs[] = { 1, };
  965. static int mt7623_pwm_ch4_1_pins[] = { 90, };
  966. static int mt7623_pwm_ch4_1_funcs[] = { 6, };
  967. static int mt7623_pwm_ch4_2_pins[] = { 110, };
  968. static int mt7623_pwm_ch4_2_funcs[] = { 6, };
  969. static int mt7623_pwm_ch4_3_pins[] = { 124, };
  970. static int mt7623_pwm_ch4_3_funcs[] = { 5, };
  971. static int mt7623_pwm_ch5_0_pins[] = { 207, };
  972. static int mt7623_pwm_ch5_0_funcs[] = { 1, };
  973. static int mt7623_pwm_ch5_1_pins[] = { 125, };
  974. static int mt7623_pwm_ch5_1_funcs[] = { 5, };
  975. /* PWRAP */
  976. static int mt7623_pwrap_pins[] = { 0, 1, 2, 3, 4, 5, 6, };
  977. static int mt7623_pwrap_funcs[] = { 1, 1, 1, 1, 1, 1, 1, };
  978. /* SPDIF */
  979. static int mt7623_spdif_in0_0_pins[] = { 56, };
  980. static int mt7623_spdif_in0_0_funcs[] = { 3, };
  981. static int mt7623_spdif_in0_1_pins[] = { 201, };
  982. static int mt7623_spdif_in0_1_funcs[] = { 1, };
  983. static int mt7623_spdif_in1_0_pins[] = { 54, };
  984. static int mt7623_spdif_in1_0_funcs[] = { 3, };
  985. static int mt7623_spdif_in1_1_pins[] = { 202, };
  986. static int mt7623_spdif_in1_1_funcs[] = { 1, };
  987. static int mt7623_spdif_out_pins[] = { 202, };
  988. static int mt7623_spdif_out_funcs[] = { 1, };
  989. /* SPI */
  990. static int mt7623_spi0_pins[] = { 53, 54, 55, 56, };
  991. static int mt7623_spi0_funcs[] = { 1, 1, 1, 1, };
  992. static int mt7623_spi1_pins[] = { 7, 199, 8, 9, };
  993. static int mt7623_spi1_funcs[] = { 1, 1, 1, 1, };
  994. static int mt7623_spi2_pins[] = { 101, 104, 102, 103, };
  995. static int mt7623_spi2_funcs[] = { 1, 1, 1, 1, };
  996. /* UART */
  997. static int mt7623_uart0_0_txd_rxd_pins[] = { 79, 80, };
  998. static int mt7623_uart0_0_txd_rxd_funcs[] = { 1, 1, };
  999. static int mt7623_uart0_1_txd_rxd_pins[] = { 87, 88, };
  1000. static int mt7623_uart0_1_txd_rxd_funcs[] = { 5, 5, };
  1001. static int mt7623_uart0_2_txd_rxd_pins[] = { 107, 108, };
  1002. static int mt7623_uart0_2_txd_rxd_funcs[] = { 5, 5, };
  1003. static int mt7623_uart0_3_txd_rxd_pins[] = { 123, 122, };
  1004. static int mt7623_uart0_3_txd_rxd_funcs[] = { 5, 5, };
  1005. static int mt7623_uart0_rts_cts_pins[] = { 22, 23, };
  1006. static int mt7623_uart0_rts_cts_funcs[] = { 1, 1, };
  1007. static int mt7623_uart1_0_txd_rxd_pins[] = { 81, 82, };
  1008. static int mt7623_uart1_0_txd_rxd_funcs[] = { 1, 1, };
  1009. static int mt7623_uart1_1_txd_rxd_pins[] = { 89, 90, };
  1010. static int mt7623_uart1_1_txd_rxd_funcs[] = { 5, 5, };
  1011. static int mt7623_uart1_2_txd_rxd_pins[] = { 109, 110, };
  1012. static int mt7623_uart1_2_txd_rxd_funcs[] = { 5, 5, };
  1013. static int mt7623_uart1_rts_cts_pins[] = { 24, 25, };
  1014. static int mt7623_uart1_rts_cts_funcs[] = { 1, 1, };
  1015. static int mt7623_uart2_0_txd_rxd_pins[] = { 14, 15, };
  1016. static int mt7623_uart2_0_txd_rxd_funcs[] = { 1, 1, };
  1017. static int mt7623_uart2_1_txd_rxd_pins[] = { 200, 201, };
  1018. static int mt7623_uart2_1_txd_rxd_funcs[] = { 6, 6, };
  1019. static int mt7623_uart2_rts_cts_pins[] = { 242, 243, };
  1020. static int mt7623_uart2_rts_cts_funcs[] = { 1, 1, };
  1021. static int mt7623_uart3_txd_rxd_pins[] = { 242, 243, };
  1022. static int mt7623_uart3_txd_rxd_funcs[] = { 2, 2, };
  1023. static int mt7623_uart3_rts_cts_pins[] = { 26, 27, };
  1024. static int mt7623_uart3_rts_cts_funcs[] = { 1, 1, };
  1025. /* Watchdog */
  1026. static int mt7623_watchdog_0_pins[] = { 11, };
  1027. static int mt7623_watchdog_0_funcs[] = { 1, };
  1028. static int mt7623_watchdog_1_pins[] = { 121, };
  1029. static int mt7623_watchdog_1_funcs[] = { 5, };
  1030. static const struct group_desc mt7623_groups[] = {
  1031. PINCTRL_PIN_GROUP("aud_ext_clk0", mt7623_aud_ext_clk0),
  1032. PINCTRL_PIN_GROUP("aud_ext_clk1", mt7623_aud_ext_clk1),
  1033. PINCTRL_PIN_GROUP("dsi_te", mt7623_dsi_te),
  1034. PINCTRL_PIN_GROUP("disp_pwm_0", mt7623_disp_pwm_0),
  1035. PINCTRL_PIN_GROUP("disp_pwm_1", mt7623_disp_pwm_1),
  1036. PINCTRL_PIN_GROUP("disp_pwm_2", mt7623_disp_pwm_2),
  1037. PINCTRL_PIN_GROUP("ephy", mt7623_ephy),
  1038. PINCTRL_PIN_GROUP("esw_int", mt7623_esw_int),
  1039. PINCTRL_PIN_GROUP("esw_rst", mt7623_esw_rst),
  1040. PINCTRL_PIN_GROUP("ext_sdio", mt7623_ext_sdio),
  1041. PINCTRL_PIN_GROUP("hdmi_cec", mt7623_hdmi_cec),
  1042. PINCTRL_PIN_GROUP("hdmi_htplg", mt7623_hdmi_htplg),
  1043. PINCTRL_PIN_GROUP("hdmi_i2c", mt7623_hdmi_i2c),
  1044. PINCTRL_PIN_GROUP("hdmi_rx", mt7623_hdmi_rx),
  1045. PINCTRL_PIN_GROUP("hdmi_rx_i2c", mt7623_hdmi_rx_i2c),
  1046. PINCTRL_PIN_GROUP("i2c0", mt7623_i2c0),
  1047. PINCTRL_PIN_GROUP("i2c1_0", mt7623_i2c1_0),
  1048. PINCTRL_PIN_GROUP("i2c1_1", mt7623_i2c1_1),
  1049. PINCTRL_PIN_GROUP("i2c1_2", mt7623_i2c1_2),
  1050. PINCTRL_PIN_GROUP("i2c1_3", mt7623_i2c1_3),
  1051. PINCTRL_PIN_GROUP("i2c1_4", mt7623_i2c1_4),
  1052. PINCTRL_PIN_GROUP("i2c2_0", mt7623_i2c2_0),
  1053. PINCTRL_PIN_GROUP("i2c2_1", mt7623_i2c2_1),
  1054. PINCTRL_PIN_GROUP("i2c2_2", mt7623_i2c2_2),
  1055. PINCTRL_PIN_GROUP("i2c2_3", mt7623_i2c2_3),
  1056. PINCTRL_PIN_GROUP("i2s0", mt7623_i2s0),
  1057. PINCTRL_PIN_GROUP("i2s1", mt7623_i2s1),
  1058. PINCTRL_PIN_GROUP("i2s4", mt7623_i2s4),
  1059. PINCTRL_PIN_GROUP("i2s5", mt7623_i2s5),
  1060. PINCTRL_PIN_GROUP("i2s2_bclk_lrclk_mclk", mt7623_i2s2_bclk_lrclk_mclk),
  1061. PINCTRL_PIN_GROUP("i2s3_bclk_lrclk_mclk", mt7623_i2s3_bclk_lrclk_mclk),
  1062. PINCTRL_PIN_GROUP("i2s2_data_in", mt7623_i2s2_data_in),
  1063. PINCTRL_PIN_GROUP("i2s3_data_in", mt7623_i2s3_data_in),
  1064. PINCTRL_PIN_GROUP("i2s2_data_0", mt7623_i2s2_data_0),
  1065. PINCTRL_PIN_GROUP("i2s2_data_1", mt7623_i2s2_data_1),
  1066. PINCTRL_PIN_GROUP("i2s3_data_0", mt7623_i2s3_data_0),
  1067. PINCTRL_PIN_GROUP("i2s3_data_1", mt7623_i2s3_data_1),
  1068. PINCTRL_PIN_GROUP("ir", mt7623_ir),
  1069. PINCTRL_PIN_GROUP("lcm_rst", mt7623_lcm_rst),
  1070. PINCTRL_PIN_GROUP("mdc_mdio", mt7623_mdc_mdio),
  1071. PINCTRL_PIN_GROUP("mipi_tx", mt7623_mipi_tx),
  1072. PINCTRL_PIN_GROUP("msdc0", mt7623_msdc0),
  1073. PINCTRL_PIN_GROUP("msdc1", mt7623_msdc1),
  1074. PINCTRL_PIN_GROUP("msdc1_ins", mt7623_msdc1_ins),
  1075. PINCTRL_PIN_GROUP("msdc1_wp_0", mt7623_msdc1_wp_0),
  1076. PINCTRL_PIN_GROUP("msdc1_wp_1", mt7623_msdc1_wp_1),
  1077. PINCTRL_PIN_GROUP("msdc1_wp_2", mt7623_msdc1_wp_2),
  1078. PINCTRL_PIN_GROUP("msdc2", mt7623_msdc2),
  1079. PINCTRL_PIN_GROUP("msdc3", mt7623_msdc3),
  1080. PINCTRL_PIN_GROUP("nandc", mt7623_nandc),
  1081. PINCTRL_PIN_GROUP("nandc_ceb0", mt7623_nandc_ceb0),
  1082. PINCTRL_PIN_GROUP("nandc_ceb1", mt7623_nandc_ceb1),
  1083. PINCTRL_PIN_GROUP("otg_iddig0_0", mt7623_otg_iddig0_0),
  1084. PINCTRL_PIN_GROUP("otg_iddig0_1", mt7623_otg_iddig0_1),
  1085. PINCTRL_PIN_GROUP("otg_iddig0_2", mt7623_otg_iddig0_2),
  1086. PINCTRL_PIN_GROUP("otg_iddig1_0", mt7623_otg_iddig1_0),
  1087. PINCTRL_PIN_GROUP("otg_iddig1_1", mt7623_otg_iddig1_1),
  1088. PINCTRL_PIN_GROUP("otg_iddig1_2", mt7623_otg_iddig1_2),
  1089. PINCTRL_PIN_GROUP("otg_drv_vbus0_0", mt7623_otg_drv_vbus0_0),
  1090. PINCTRL_PIN_GROUP("otg_drv_vbus0_1", mt7623_otg_drv_vbus0_1),
  1091. PINCTRL_PIN_GROUP("otg_drv_vbus0_2", mt7623_otg_drv_vbus0_2),
  1092. PINCTRL_PIN_GROUP("otg_drv_vbus1_0", mt7623_otg_drv_vbus1_0),
  1093. PINCTRL_PIN_GROUP("otg_drv_vbus1_1", mt7623_otg_drv_vbus1_1),
  1094. PINCTRL_PIN_GROUP("otg_drv_vbus1_2", mt7623_otg_drv_vbus1_2),
  1095. PINCTRL_PIN_GROUP("pcie0_0_perst", mt7623_pcie0_0_perst),
  1096. PINCTRL_PIN_GROUP("pcie0_1_perst", mt7623_pcie0_1_perst),
  1097. PINCTRL_PIN_GROUP("pcie1_0_perst", mt7623_pcie1_0_perst),
  1098. PINCTRL_PIN_GROUP("pcie1_1_perst", mt7623_pcie1_1_perst),
  1099. PINCTRL_PIN_GROUP("pcie1_1_perst", mt7623_pcie1_1_perst),
  1100. PINCTRL_PIN_GROUP("pcie0_0_rev_perst", mt7623_pcie0_0_rev_perst),
  1101. PINCTRL_PIN_GROUP("pcie0_1_rev_perst", mt7623_pcie0_1_rev_perst),
  1102. PINCTRL_PIN_GROUP("pcie1_0_rev_perst", mt7623_pcie1_0_rev_perst),
  1103. PINCTRL_PIN_GROUP("pcie1_1_rev_perst", mt7623_pcie1_1_rev_perst),
  1104. PINCTRL_PIN_GROUP("pcie2_0_rev_perst", mt7623_pcie2_0_rev_perst),
  1105. PINCTRL_PIN_GROUP("pcie2_1_rev_perst", mt7623_pcie2_1_rev_perst),
  1106. PINCTRL_PIN_GROUP("pcie2_0_perst", mt7623_pcie2_0_perst),
  1107. PINCTRL_PIN_GROUP("pcie2_1_perst", mt7623_pcie2_1_perst),
  1108. PINCTRL_PIN_GROUP("pcie0_0_wake", mt7623_pcie0_0_wake),
  1109. PINCTRL_PIN_GROUP("pcie0_1_wake", mt7623_pcie0_1_wake),
  1110. PINCTRL_PIN_GROUP("pcie1_0_wake", mt7623_pcie1_0_wake),
  1111. PINCTRL_PIN_GROUP("pcie1_1_wake", mt7623_pcie1_1_wake),
  1112. PINCTRL_PIN_GROUP("pcie2_0_wake", mt7623_pcie2_0_wake),
  1113. PINCTRL_PIN_GROUP("pcie2_1_wake", mt7623_pcie2_1_wake),
  1114. PINCTRL_PIN_GROUP("pcie0_clkreq", mt7623_pcie0_clkreq),
  1115. PINCTRL_PIN_GROUP("pcie1_clkreq", mt7623_pcie1_clkreq),
  1116. PINCTRL_PIN_GROUP("pcie2_clkreq", mt7623_pcie2_clkreq),
  1117. PINCTRL_PIN_GROUP("pcm_clk_0", mt7623_pcm_clk_0),
  1118. PINCTRL_PIN_GROUP("pcm_clk_1", mt7623_pcm_clk_1),
  1119. PINCTRL_PIN_GROUP("pcm_clk_2", mt7623_pcm_clk_2),
  1120. PINCTRL_PIN_GROUP("pcm_clk_3", mt7623_pcm_clk_3),
  1121. PINCTRL_PIN_GROUP("pcm_clk_4", mt7623_pcm_clk_4),
  1122. PINCTRL_PIN_GROUP("pcm_clk_5", mt7623_pcm_clk_5),
  1123. PINCTRL_PIN_GROUP("pcm_clk_6", mt7623_pcm_clk_6),
  1124. PINCTRL_PIN_GROUP("pcm_sync_0", mt7623_pcm_sync_0),
  1125. PINCTRL_PIN_GROUP("pcm_sync_1", mt7623_pcm_sync_1),
  1126. PINCTRL_PIN_GROUP("pcm_sync_2", mt7623_pcm_sync_2),
  1127. PINCTRL_PIN_GROUP("pcm_sync_3", mt7623_pcm_sync_3),
  1128. PINCTRL_PIN_GROUP("pcm_sync_4", mt7623_pcm_sync_4),
  1129. PINCTRL_PIN_GROUP("pcm_sync_5", mt7623_pcm_sync_5),
  1130. PINCTRL_PIN_GROUP("pcm_sync_6", mt7623_pcm_sync_6),
  1131. PINCTRL_PIN_GROUP("pcm_rx_0", mt7623_pcm_rx_0),
  1132. PINCTRL_PIN_GROUP("pcm_rx_1", mt7623_pcm_rx_1),
  1133. PINCTRL_PIN_GROUP("pcm_rx_2", mt7623_pcm_rx_2),
  1134. PINCTRL_PIN_GROUP("pcm_rx_3", mt7623_pcm_rx_3),
  1135. PINCTRL_PIN_GROUP("pcm_rx_4", mt7623_pcm_rx_4),
  1136. PINCTRL_PIN_GROUP("pcm_rx_5", mt7623_pcm_rx_5),
  1137. PINCTRL_PIN_GROUP("pcm_rx_6", mt7623_pcm_rx_6),
  1138. PINCTRL_PIN_GROUP("pcm_tx_0", mt7623_pcm_tx_0),
  1139. PINCTRL_PIN_GROUP("pcm_tx_1", mt7623_pcm_tx_1),
  1140. PINCTRL_PIN_GROUP("pcm_tx_2", mt7623_pcm_tx_2),
  1141. PINCTRL_PIN_GROUP("pcm_tx_3", mt7623_pcm_tx_3),
  1142. PINCTRL_PIN_GROUP("pcm_tx_4", mt7623_pcm_tx_4),
  1143. PINCTRL_PIN_GROUP("pcm_tx_5", mt7623_pcm_tx_5),
  1144. PINCTRL_PIN_GROUP("pcm_tx_6", mt7623_pcm_tx_6),
  1145. PINCTRL_PIN_GROUP("pwm_ch1_0", mt7623_pwm_ch1_0),
  1146. PINCTRL_PIN_GROUP("pwm_ch1_1", mt7623_pwm_ch1_1),
  1147. PINCTRL_PIN_GROUP("pwm_ch1_2", mt7623_pwm_ch1_2),
  1148. PINCTRL_PIN_GROUP("pwm_ch1_3", mt7623_pwm_ch1_3),
  1149. PINCTRL_PIN_GROUP("pwm_ch1_4", mt7623_pwm_ch1_4),
  1150. PINCTRL_PIN_GROUP("pwm_ch2_0", mt7623_pwm_ch2_0),
  1151. PINCTRL_PIN_GROUP("pwm_ch2_1", mt7623_pwm_ch2_1),
  1152. PINCTRL_PIN_GROUP("pwm_ch2_2", mt7623_pwm_ch2_2),
  1153. PINCTRL_PIN_GROUP("pwm_ch2_3", mt7623_pwm_ch2_3),
  1154. PINCTRL_PIN_GROUP("pwm_ch2_4", mt7623_pwm_ch2_4),
  1155. PINCTRL_PIN_GROUP("pwm_ch3_0", mt7623_pwm_ch3_0),
  1156. PINCTRL_PIN_GROUP("pwm_ch3_1", mt7623_pwm_ch3_1),
  1157. PINCTRL_PIN_GROUP("pwm_ch3_2", mt7623_pwm_ch3_2),
  1158. PINCTRL_PIN_GROUP("pwm_ch3_3", mt7623_pwm_ch3_3),
  1159. PINCTRL_PIN_GROUP("pwm_ch4_0", mt7623_pwm_ch4_0),
  1160. PINCTRL_PIN_GROUP("pwm_ch4_1", mt7623_pwm_ch4_1),
  1161. PINCTRL_PIN_GROUP("pwm_ch4_2", mt7623_pwm_ch4_2),
  1162. PINCTRL_PIN_GROUP("pwm_ch4_3", mt7623_pwm_ch4_3),
  1163. PINCTRL_PIN_GROUP("pwm_ch5_0", mt7623_pwm_ch5_0),
  1164. PINCTRL_PIN_GROUP("pwm_ch5_1", mt7623_pwm_ch5_1),
  1165. PINCTRL_PIN_GROUP("pwrap", mt7623_pwrap),
  1166. PINCTRL_PIN_GROUP("rtc", mt7623_rtc),
  1167. PINCTRL_PIN_GROUP("spdif_in0_0", mt7623_spdif_in0_0),
  1168. PINCTRL_PIN_GROUP("spdif_in0_1", mt7623_spdif_in0_1),
  1169. PINCTRL_PIN_GROUP("spdif_in1_0", mt7623_spdif_in1_0),
  1170. PINCTRL_PIN_GROUP("spdif_in1_1", mt7623_spdif_in1_1),
  1171. PINCTRL_PIN_GROUP("spdif_out", mt7623_spdif_out),
  1172. PINCTRL_PIN_GROUP("spi0", mt7623_spi0),
  1173. PINCTRL_PIN_GROUP("spi1", mt7623_spi1),
  1174. PINCTRL_PIN_GROUP("spi2", mt7623_spi2),
  1175. PINCTRL_PIN_GROUP("uart0_0_txd_rxd", mt7623_uart0_0_txd_rxd),
  1176. PINCTRL_PIN_GROUP("uart0_1_txd_rxd", mt7623_uart0_1_txd_rxd),
  1177. PINCTRL_PIN_GROUP("uart0_2_txd_rxd", mt7623_uart0_2_txd_rxd),
  1178. PINCTRL_PIN_GROUP("uart0_3_txd_rxd", mt7623_uart0_3_txd_rxd),
  1179. PINCTRL_PIN_GROUP("uart1_0_txd_rxd", mt7623_uart1_0_txd_rxd),
  1180. PINCTRL_PIN_GROUP("uart1_1_txd_rxd", mt7623_uart1_1_txd_rxd),
  1181. PINCTRL_PIN_GROUP("uart1_2_txd_rxd", mt7623_uart1_2_txd_rxd),
  1182. PINCTRL_PIN_GROUP("uart2_0_txd_rxd", mt7623_uart2_0_txd_rxd),
  1183. PINCTRL_PIN_GROUP("uart2_1_txd_rxd", mt7623_uart2_1_txd_rxd),
  1184. PINCTRL_PIN_GROUP("uart3_txd_rxd", mt7623_uart3_txd_rxd),
  1185. PINCTRL_PIN_GROUP("uart0_rts_cts", mt7623_uart0_rts_cts),
  1186. PINCTRL_PIN_GROUP("uart1_rts_cts", mt7623_uart1_rts_cts),
  1187. PINCTRL_PIN_GROUP("uart2_rts_cts", mt7623_uart2_rts_cts),
  1188. PINCTRL_PIN_GROUP("uart3_rts_cts", mt7623_uart3_rts_cts),
  1189. PINCTRL_PIN_GROUP("watchdog_0", mt7623_watchdog_0),
  1190. PINCTRL_PIN_GROUP("watchdog_1", mt7623_watchdog_1),
  1191. };
  1192. /* Joint those groups owning the same capability in user point of view which
  1193. * allows that people tend to use through the device tree.
  1194. */
  1195. static const char *mt7623_aud_clk_groups[] = { "aud_ext_clk0",
  1196. "aud_ext_clk1", };
  1197. static const char *mt7623_disp_pwm_groups[] = { "disp_pwm_0", "disp_pwm_1",
  1198. "disp_pwm_2", };
  1199. static const char *mt7623_ethernet_groups[] = { "esw_int", "esw_rst",
  1200. "ephy", "mdc_mdio", };
  1201. static const char *mt7623_ext_sdio_groups[] = { "ext_sdio", };
  1202. static const char *mt7623_hdmi_groups[] = { "hdmi_cec", "hdmi_htplg",
  1203. "hdmi_i2c", "hdmi_rx",
  1204. "hdmi_rx_i2c", };
  1205. static const char *mt7623_i2c_groups[] = { "i2c0", "i2c1_0", "i2c1_1",
  1206. "i2c1_2", "i2c1_3", "i2c1_4",
  1207. "i2c2_0", "i2c2_1", "i2c2_2",
  1208. "i2c2_3", };
  1209. static const char *mt7623_i2s_groups[] = { "i2s0", "i2s1",
  1210. "i2s2_bclk_lrclk_mclk",
  1211. "i2s3_bclk_lrclk_mclk",
  1212. "i2s4", "i2s5",
  1213. "i2s2_data_in", "i2s3_data_in",
  1214. "i2s2_data_0", "i2s2_data_1",
  1215. "i2s3_data_0", "i2s3_data_1", };
  1216. static const char *mt7623_ir_groups[] = { "ir", };
  1217. static const char *mt7623_lcd_groups[] = { "dsi_te", "lcm_rst", "mipi_tx", };
  1218. static const char *mt7623_msdc_groups[] = { "msdc0", "msdc1", "msdc1_ins",
  1219. "msdc1_wp_0", "msdc1_wp_1",
  1220. "msdc1_wp_2", "msdc2",
  1221. "msdc3", };
  1222. static const char *mt7623_nandc_groups[] = { "nandc", "nandc_ceb0",
  1223. "nandc_ceb1", };
  1224. static const char *mt7623_otg_groups[] = { "otg_iddig0_0", "otg_iddig0_1",
  1225. "otg_iddig0_2", "otg_iddig1_0",
  1226. "otg_iddig1_1", "otg_iddig1_2",
  1227. "otg_drv_vbus0_0",
  1228. "otg_drv_vbus0_1",
  1229. "otg_drv_vbus0_2",
  1230. "otg_drv_vbus1_0",
  1231. "otg_drv_vbus1_1",
  1232. "otg_drv_vbus1_2", };
  1233. static const char *mt7623_pcie_groups[] = { "pcie0_0_perst", "pcie0_1_perst",
  1234. "pcie1_0_perst", "pcie1_1_perst",
  1235. "pcie2_0_perst", "pcie2_1_perst",
  1236. "pcie0_0_rev_perst",
  1237. "pcie0_1_rev_perst",
  1238. "pcie1_0_rev_perst",
  1239. "pcie1_1_rev_perst",
  1240. "pcie2_0_rev_perst",
  1241. "pcie2_1_rev_perst",
  1242. "pcie0_0_wake", "pcie0_1_wake",
  1243. "pcie2_0_wake", "pcie2_1_wake",
  1244. "pcie0_clkreq", "pcie1_clkreq",
  1245. "pcie2_clkreq", };
  1246. static const char *mt7623_pcm_groups[] = { "pcm_clk_0", "pcm_clk_1",
  1247. "pcm_clk_2", "pcm_clk_3",
  1248. "pcm_clk_4", "pcm_clk_5",
  1249. "pcm_clk_6", "pcm_sync_0",
  1250. "pcm_sync_1", "pcm_sync_2",
  1251. "pcm_sync_3", "pcm_sync_4",
  1252. "pcm_sync_5", "pcm_sync_6",
  1253. "pcm_rx_0", "pcm_rx_1",
  1254. "pcm_rx_2", "pcm_rx_3",
  1255. "pcm_rx_4", "pcm_rx_5",
  1256. "pcm_rx_6", "pcm_tx_0",
  1257. "pcm_tx_1", "pcm_tx_2",
  1258. "pcm_tx_3", "pcm_tx_4",
  1259. "pcm_tx_5", "pcm_tx_6", };
  1260. static const char *mt7623_pwm_groups[] = { "pwm_ch1_0", "pwm_ch1_1",
  1261. "pwm_ch1_2", "pwm_ch2_0",
  1262. "pwm_ch2_1", "pwm_ch2_2",
  1263. "pwm_ch3_0", "pwm_ch3_1",
  1264. "pwm_ch3_2", "pwm_ch4_0",
  1265. "pwm_ch4_1", "pwm_ch4_2",
  1266. "pwm_ch4_3", "pwm_ch5_0",
  1267. "pwm_ch5_1", "pwm_ch5_2",
  1268. "pwm_ch6_0", "pwm_ch6_1",
  1269. "pwm_ch6_2", "pwm_ch6_3",
  1270. "pwm_ch7_0", "pwm_ch7_1",
  1271. "pwm_ch7_2", };
  1272. static const char *mt7623_pwrap_groups[] = { "pwrap", };
  1273. static const char *mt7623_rtc_groups[] = { "rtc", };
  1274. static const char *mt7623_spi_groups[] = { "spi0", "spi2", "spi2", };
  1275. static const char *mt7623_spdif_groups[] = { "spdif_in0_0", "spdif_in0_1",
  1276. "spdif_in1_0", "spdif_in1_1",
  1277. "spdif_out", };
  1278. static const char *mt7623_uart_groups[] = { "uart0_0_txd_rxd",
  1279. "uart0_1_txd_rxd",
  1280. "uart0_2_txd_rxd",
  1281. "uart0_3_txd_rxd",
  1282. "uart1_0_txd_rxd",
  1283. "uart1_1_txd_rxd",
  1284. "uart1_2_txd_rxd",
  1285. "uart2_0_txd_rxd",
  1286. "uart2_1_txd_rxd",
  1287. "uart3_txd_rxd",
  1288. "uart0_rts_cts",
  1289. "uart1_rts_cts",
  1290. "uart2_rts_cts",
  1291. "uart3_rts_cts", };
  1292. static const char *mt7623_wdt_groups[] = { "watchdog_0", "watchdog_1", };
  1293. static const struct function_desc mt7623_functions[] = {
  1294. {"audck", mt7623_aud_clk_groups, ARRAY_SIZE(mt7623_aud_clk_groups)},
  1295. {"disp", mt7623_disp_pwm_groups, ARRAY_SIZE(mt7623_disp_pwm_groups)},
  1296. {"eth", mt7623_ethernet_groups, ARRAY_SIZE(mt7623_ethernet_groups)},
  1297. {"sdio", mt7623_ext_sdio_groups, ARRAY_SIZE(mt7623_ext_sdio_groups)},
  1298. {"hdmi", mt7623_hdmi_groups, ARRAY_SIZE(mt7623_hdmi_groups)},
  1299. {"i2c", mt7623_i2c_groups, ARRAY_SIZE(mt7623_i2c_groups)},
  1300. {"i2s", mt7623_i2s_groups, ARRAY_SIZE(mt7623_i2s_groups)},
  1301. {"ir", mt7623_ir_groups, ARRAY_SIZE(mt7623_ir_groups)},
  1302. {"lcd", mt7623_lcd_groups, ARRAY_SIZE(mt7623_lcd_groups)},
  1303. {"msdc", mt7623_msdc_groups, ARRAY_SIZE(mt7623_msdc_groups)},
  1304. {"nand", mt7623_nandc_groups, ARRAY_SIZE(mt7623_nandc_groups)},
  1305. {"otg", mt7623_otg_groups, ARRAY_SIZE(mt7623_otg_groups)},
  1306. {"pcie", mt7623_pcie_groups, ARRAY_SIZE(mt7623_pcie_groups)},
  1307. {"pcm", mt7623_pcm_groups, ARRAY_SIZE(mt7623_pcm_groups)},
  1308. {"pwm", mt7623_pwm_groups, ARRAY_SIZE(mt7623_pwm_groups)},
  1309. {"pwrap", mt7623_pwrap_groups, ARRAY_SIZE(mt7623_pwrap_groups)},
  1310. {"rtc", mt7623_rtc_groups, ARRAY_SIZE(mt7623_rtc_groups)},
  1311. {"spi", mt7623_spi_groups, ARRAY_SIZE(mt7623_spi_groups)},
  1312. {"spdif", mt7623_spdif_groups, ARRAY_SIZE(mt7623_spdif_groups)},
  1313. {"uart", mt7623_uart_groups, ARRAY_SIZE(mt7623_uart_groups)},
  1314. {"watchdog", mt7623_wdt_groups, ARRAY_SIZE(mt7623_wdt_groups)},
  1315. };
  1316. static const struct mtk_eint_hw mt7623_eint_hw = {
  1317. .port_mask = 6,
  1318. .ports = 6,
  1319. .ap_num = 169,
  1320. .db_cnt = 20,
  1321. };
  1322. static struct mtk_pin_soc mt7623_data = {
  1323. .reg_cal = mt7623_reg_cals,
  1324. .pins = mt7623_pins,
  1325. .npins = ARRAY_SIZE(mt7623_pins),
  1326. .grps = mt7623_groups,
  1327. .ngrps = ARRAY_SIZE(mt7623_groups),
  1328. .funcs = mt7623_functions,
  1329. .nfuncs = ARRAY_SIZE(mt7623_functions),
  1330. .eint_hw = &mt7623_eint_hw,
  1331. .gpio_m = 0,
  1332. .ies_present = true,
  1333. .base_names = mtk_default_register_base_names,
  1334. .nbase_names = ARRAY_SIZE(mtk_default_register_base_names),
  1335. .bias_disable_set = mtk_pinconf_bias_disable_set_rev1,
  1336. .bias_disable_get = mtk_pinconf_bias_disable_get_rev1,
  1337. .bias_set = mtk_pinconf_bias_set_rev1,
  1338. .bias_get = mtk_pinconf_bias_get_rev1,
  1339. .drive_set = mtk_pinconf_drive_set_rev1,
  1340. .drive_get = mtk_pinconf_drive_get_rev1,
  1341. .adv_pull_get = mtk_pinconf_adv_pull_get,
  1342. .adv_pull_set = mtk_pinconf_adv_pull_set,
  1343. };
  1344. /*
  1345. * There are some specific pins have mux functions greater than 8,
  1346. * and if we want to switch thees high modes we need to disable
  1347. * bonding constraints firstly.
  1348. */
  1349. static void mt7623_bonding_disable(struct platform_device *pdev)
  1350. {
  1351. struct mtk_pinctrl *hw = platform_get_drvdata(pdev);
  1352. mtk_rmw(hw, 0, PIN_BOND_REG0, BOND_PCIE_CLR, BOND_PCIE_CLR);
  1353. mtk_rmw(hw, 0, PIN_BOND_REG1, BOND_I2S_CLR, BOND_I2S_CLR);
  1354. mtk_rmw(hw, 0, PIN_BOND_REG2, BOND_MSDC0E_CLR, BOND_MSDC0E_CLR);
  1355. }
  1356. static const struct of_device_id mt7623_pctrl_match[] = {
  1357. { .compatible = "mediatek,mt7623-moore-pinctrl", },
  1358. {}
  1359. };
  1360. static int mt7623_pinctrl_probe(struct platform_device *pdev)
  1361. {
  1362. int err;
  1363. err = mtk_moore_pinctrl_probe(pdev, &mt7623_data);
  1364. if (err)
  1365. return err;
  1366. mt7623_bonding_disable(pdev);
  1367. return 0;
  1368. }
  1369. static struct platform_driver mtk_pinctrl_driver = {
  1370. .probe = mt7623_pinctrl_probe,
  1371. .driver = {
  1372. .name = "mt7623-moore-pinctrl",
  1373. .of_match_table = mt7623_pctrl_match,
  1374. },
  1375. };
  1376. static int __init mtk_pinctrl_init(void)
  1377. {
  1378. return platform_driver_register(&mtk_pinctrl_driver);
  1379. }
  1380. arch_initcall(mtk_pinctrl_init);