2
0

101-15-pinctrl-mediatek-add-pinctrl-driver-for-MT7988-SoC.patch 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315
  1. From 5e821f4ebd9da4ccf3c8871e402996f6a6eb8d1c Mon Sep 17 00:00:00 2001
  2. From: Weijie Gao <[email protected]>
  3. Date: Wed, 19 Jul 2023 17:16:50 +0800
  4. Subject: [PATCH 15/29] pinctrl: mediatek: add pinctrl driver for MT7988 SoC
  5. This patch adds pinctrl and gpio support for MT7988 SoC
  6. Signed-off-by: Weijie Gao <[email protected]>
  7. ---
  8. drivers/pinctrl/mediatek/Kconfig | 4 +
  9. drivers/pinctrl/mediatek/Makefile | 1 +
  10. drivers/pinctrl/mediatek/pinctrl-mt7988.c | 1274 +++++++++++++++++++++
  11. 3 files changed, 1279 insertions(+)
  12. create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt7988.c
  13. --- a/drivers/pinctrl/mediatek/Kconfig
  14. +++ b/drivers/pinctrl/mediatek/Kconfig
  15. @@ -24,6 +24,10 @@ config PINCTRL_MT7986
  16. bool "MT7986 SoC pinctrl driver"
  17. select PINCTRL_MTK
  18. +config PINCTRL_MT7988
  19. + bool "MT7988 SoC pinctrl driver"
  20. + select PINCTRL_MTK
  21. +
  22. config PINCTRL_MT8512
  23. bool "MT8512 SoC pinctrl driver"
  24. select PINCTRL_MTK
  25. --- a/drivers/pinctrl/mediatek/Makefile
  26. +++ b/drivers/pinctrl/mediatek/Makefile
  27. @@ -8,6 +8,7 @@ obj-$(CONFIG_PINCTRL_MT7623) += pinctrl-
  28. obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o
  29. obj-$(CONFIG_PINCTRL_MT7981) += pinctrl-mt7981.o
  30. obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7986.o
  31. +obj-$(CONFIG_PINCTRL_MT7988) += pinctrl-mt7988.o
  32. obj-$(CONFIG_PINCTRL_MT8512) += pinctrl-mt8512.o
  33. obj-$(CONFIG_PINCTRL_MT8516) += pinctrl-mt8516.o
  34. obj-$(CONFIG_PINCTRL_MT8518) += pinctrl-mt8518.o
  35. --- /dev/null
  36. +++ b/drivers/pinctrl/mediatek/pinctrl-mt7988.c
  37. @@ -0,0 +1,1274 @@
  38. +// SPDX-License-Identifier: GPL-2.0
  39. +/*
  40. + * Copyright (C) 2022 MediaTek Inc.
  41. + * Author: Sam Shih <[email protected]>
  42. + */
  43. +
  44. +#include <dm.h>
  45. +#include "pinctrl-mtk-common.h"
  46. +
  47. +enum MT7988_PINCTRL_REG_PAGE {
  48. + GPIO_BASE,
  49. + IOCFG_TR_BASE,
  50. + IOCFG_BR_BASE,
  51. + IOCFG_RB_BASE,
  52. + IOCFG_LB_BASE,
  53. + IOCFG_TL_BASE,
  54. +};
  55. +
  56. +#define MT7988_TYPE0_PIN(_number, _name) \
  57. + MTK_TYPED_PIN(_number, _name, DRV_GRP4, IO_TYPE_GRP0)
  58. +
  59. +#define MT7988_TYPE1_PIN(_number, _name) \
  60. + MTK_TYPED_PIN(_number, _name, DRV_GRP4, IO_TYPE_GRP1)
  61. +
  62. +#define MT7988_TYPE2_PIN(_number, _name) \
  63. + MTK_TYPED_PIN(_number, _name, DRV_FIXED, IO_TYPE_GRP2)
  64. +
  65. +#define PIN_FIELD_GPIO(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits) \
  66. + PIN_FIELD_BASE_CALC(_s_pin, _e_pin, GPIO_BASE, _s_addr, _x_addrs, \
  67. + _s_bit, _x_bits, 32, 0)
  68. +
  69. +#define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \
  70. + _x_bits) \
  71. + PIN_FIELD_BASE_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, \
  72. + _s_bit, _x_bits, 32, 0)
  73. +
  74. +#define PINS_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \
  75. + _x_bits) \
  76. + PIN_FIELD_BASE_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, \
  77. + _s_bit, _x_bits, 32, 1)
  78. +
  79. +static const struct mtk_pin_field_calc mt7988_pin_mode_range[] = {
  80. + PIN_FIELD_GPIO(0, 83, 0x300, 0x10, 0, 4),
  81. +};
  82. +
  83. +static const struct mtk_pin_field_calc mt7988_pin_dir_range[] = {
  84. + PIN_FIELD_GPIO(0, 83, 0x0, 0x10, 0, 1),
  85. +};
  86. +
  87. +static const struct mtk_pin_field_calc mt7988_pin_di_range[] = {
  88. + PIN_FIELD_GPIO(0, 83, 0x200, 0x10, 0, 1),
  89. +};
  90. +
  91. +static const struct mtk_pin_field_calc mt7988_pin_do_range[] = {
  92. + PIN_FIELD_GPIO(0, 83, 0x100, 0x10, 0, 1),
  93. +};
  94. +
  95. +static const struct mtk_pin_field_calc mt7988_pin_ies_range[] = {
  96. + PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x30, 0x10, 13, 1),
  97. + PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x30, 0x10, 14, 1),
  98. + PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x30, 0x10, 11, 1),
  99. + PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x30, 0x10, 12, 1),
  100. + PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x30, 0x10, 0, 1),
  101. + PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x30, 0x10, 9, 1),
  102. + PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x30, 0x10, 10, 1),
  103. +
  104. + PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0x30, 0x10, 8, 1),
  105. + PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0x30, 0x10, 6, 1),
  106. + PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0x30, 0x10, 5, 1),
  107. + PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0x30, 0x10, 3, 1),
  108. +
  109. + PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x40, 0x10, 0, 1),
  110. + PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x40, 0x10, 21, 1),
  111. + PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0x40, 0x10, 1, 1),
  112. + PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0x40, 0x10, 2, 1),
  113. +
  114. + PIN_FIELD_BASE(15, 15, IOCFG_TL_BASE, 0x30, 0x10, 7, 1),
  115. + PIN_FIELD_BASE(16, 16, IOCFG_TL_BASE, 0x30, 0x10, 8, 1),
  116. + PIN_FIELD_BASE(17, 17, IOCFG_TL_BASE, 0x30, 0x10, 3, 1),
  117. + PIN_FIELD_BASE(18, 18, IOCFG_TL_BASE, 0x30, 0x10, 4, 1),
  118. +
  119. + PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x30, 0x10, 7, 1),
  120. + PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x30, 0x10, 4, 1),
  121. +
  122. + PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x50, 0x10, 17, 1),
  123. + PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x50, 0x10, 23, 1),
  124. + PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x50, 0x10, 20, 1),
  125. + PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x50, 0x10, 19, 1),
  126. + PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x50, 0x10, 21, 1),
  127. + PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x50, 0x10, 22, 1),
  128. + PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x50, 0x10, 18, 1),
  129. + PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x50, 0x10, 25, 1),
  130. + PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x50, 0x10, 26, 1),
  131. + PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x50, 0x10, 27, 1),
  132. + PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x50, 0x10, 24, 1),
  133. + PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x50, 0x10, 28, 1),
  134. + PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0x60, 0x10, 0, 1),
  135. + PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x50, 0x10, 31, 1),
  136. + PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x50, 0x10, 29, 1),
  137. + PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x50, 0x10, 30, 1),
  138. + PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0x60, 0x10, 1, 1),
  139. + PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x50, 0x10, 11, 1),
  140. + PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x50, 0x10, 10, 1),
  141. + PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x50, 0x10, 0, 1),
  142. + PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x50, 0x10, 1, 1),
  143. + PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x50, 0x10, 9, 1),
  144. + PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x50, 0x10, 8, 1),
  145. + PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x50, 0x10, 7, 1),
  146. + PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x50, 0x10, 6, 1),
  147. + PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x50, 0x10, 5, 1),
  148. + PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x50, 0x10, 4, 1),
  149. + PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x50, 0x10, 3, 1),
  150. + PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x50, 0x10, 2, 1),
  151. + PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x50, 0x10, 15, 1),
  152. + PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x50, 0x10, 12, 1),
  153. + PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x50, 0x10, 13, 1),
  154. + PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x50, 0x10, 14, 1),
  155. + PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x50, 0x10, 16, 1),
  156. +
  157. + PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x40, 0x10, 14, 1),
  158. + PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x40, 0x10, 15, 1),
  159. + PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x40, 0x10, 13, 1),
  160. + PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x40, 0x10, 4, 1),
  161. + PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x40, 0x10, 5, 1),
  162. + PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x40, 0x10, 6, 1),
  163. + PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x40, 0x10, 3, 1),
  164. + PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x40, 0x10, 7, 1),
  165. + PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0x40, 0x10, 20, 1),
  166. + PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x40, 0x10, 8, 1),
  167. + PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x40, 0x10, 9, 1),
  168. + PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x40, 0x10, 10, 1),
  169. + PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x40, 0x10, 11, 1),
  170. + PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x40, 0x10, 12, 1),
  171. +
  172. + PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x30, 0x10, 1, 1),
  173. + PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x30, 0x10, 2, 1),
  174. + PIN_FIELD_BASE(71, 71, IOCFG_TL_BASE, 0x30, 0x10, 5, 1),
  175. + PIN_FIELD_BASE(72, 72, IOCFG_TL_BASE, 0x30, 0x10, 6, 1),
  176. +
  177. + PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x30, 0x10, 10, 1),
  178. + PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x30, 0x10, 1, 1),
  179. + PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0x30, 0x10, 11, 1),
  180. + PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0x30, 0x10, 9, 1),
  181. + PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0x30, 0x10, 2, 1),
  182. + PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0x30, 0x10, 0, 1),
  183. + PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0x30, 0x10, 12, 1),
  184. +
  185. + PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x40, 0x10, 18, 1),
  186. + PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x40, 0x10, 19, 1),
  187. + PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x40, 0x10, 16, 1),
  188. + PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x40, 0x10, 17, 1),
  189. +};
  190. +
  191. +static const struct mtk_pin_field_calc mt7988_pin_smt_range[] = {
  192. + PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0xc0, 0x10, 13, 1),
  193. + PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0xc0, 0x10, 14, 1),
  194. + PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0xc0, 0x10, 11, 1),
  195. + PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0xc0, 0x10, 12, 1),
  196. + PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0xc0, 0x10, 0, 1),
  197. + PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0xc0, 0x10, 9, 1),
  198. + PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0xc0, 0x10, 10, 1),
  199. +
  200. + PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0xb0, 0x10, 8, 1),
  201. + PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0xb0, 0x10, 6, 1),
  202. + PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0xb0, 0x10, 5, 1),
  203. + PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0xb0, 0x10, 3, 1),
  204. +
  205. + PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0xe0, 0x10, 0, 1),
  206. + PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0xe0, 0x10, 21, 1),
  207. + PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0xe0, 0x10, 1, 1),
  208. + PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0xe0, 0x10, 2, 1),
  209. +
  210. + PIN_FIELD_BASE(15, 15, IOCFG_TL_BASE, 0xc0, 0x10, 7, 1),
  211. + PIN_FIELD_BASE(16, 16, IOCFG_TL_BASE, 0xc0, 0x10, 8, 1),
  212. + PIN_FIELD_BASE(17, 17, IOCFG_TL_BASE, 0xc0, 0x10, 3, 1),
  213. + PIN_FIELD_BASE(18, 18, IOCFG_TL_BASE, 0xc0, 0x10, 4, 1),
  214. +
  215. + PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0xb0, 0x10, 7, 1),
  216. + PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0xb0, 0x10, 4, 1),
  217. +
  218. + PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x140, 0x10, 17, 1),
  219. + PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x140, 0x10, 23, 1),
  220. + PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x140, 0x10, 20, 1),
  221. + PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x140, 0x10, 19, 1),
  222. + PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x140, 0x10, 21, 1),
  223. + PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x140, 0x10, 22, 1),
  224. + PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x140, 0x10, 18, 1),
  225. + PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x140, 0x10, 25, 1),
  226. + PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x140, 0x10, 26, 1),
  227. + PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x140, 0x10, 27, 1),
  228. + PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x140, 0x10, 24, 1),
  229. + PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x140, 0x10, 28, 1),
  230. + PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0x150, 0x10, 0, 1),
  231. + PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x140, 0x10, 31, 1),
  232. + PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x140, 0x10, 29, 1),
  233. + PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x140, 0x10, 30, 1),
  234. + PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0x150, 0x10, 1, 1),
  235. + PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x140, 0x10, 11, 1),
  236. + PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x140, 0x10, 10, 1),
  237. + PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x140, 0x10, 0, 1),
  238. + PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x140, 0x10, 1, 1),
  239. + PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x140, 0x10, 9, 1),
  240. + PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x140, 0x10, 8, 1),
  241. + PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x140, 0x10, 7, 1),
  242. + PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x140, 0x10, 6, 1),
  243. + PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x140, 0x10, 5, 1),
  244. + PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x140, 0x10, 4, 1),
  245. + PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x140, 0x10, 3, 1),
  246. + PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x140, 0x10, 2, 1),
  247. + PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x140, 0x10, 15, 1),
  248. + PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x140, 0x10, 12, 1),
  249. + PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x140, 0x10, 13, 1),
  250. + PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x140, 0x10, 14, 1),
  251. + PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x140, 0x10, 16, 1),
  252. +
  253. + PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0xe0, 0x10, 14, 1),
  254. + PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0xe0, 0x10, 15, 1),
  255. + PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0xe0, 0x10, 13, 1),
  256. + PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0xe0, 0x10, 4, 1),
  257. + PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0xe0, 0x10, 5, 1),
  258. + PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0xe0, 0x10, 6, 1),
  259. + PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0xe0, 0x10, 3, 1),
  260. + PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0xe0, 0x10, 7, 1),
  261. + PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0xe0, 0x10, 20, 1),
  262. + PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0xe0, 0x10, 8, 1),
  263. + PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0xe0, 0x10, 9, 1),
  264. + PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0xe0, 0x10, 10, 1),
  265. + PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0xe0, 0x10, 11, 1),
  266. + PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0xe0, 0x10, 12, 1),
  267. +
  268. + PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0xc0, 0x10, 1, 1),
  269. + PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0xc0, 0x10, 2, 1),
  270. + PIN_FIELD_BASE(71, 71, IOCFG_TL_BASE, 0xc0, 0x10, 5, 1),
  271. + PIN_FIELD_BASE(72, 72, IOCFG_TL_BASE, 0xc0, 0x10, 6, 1),
  272. +
  273. + PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0xb0, 0x10, 10, 1),
  274. + PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0xb0, 0x10, 1, 1),
  275. + PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0xb0, 0x10, 11, 1),
  276. + PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0xb0, 0x10, 9, 1),
  277. + PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0xb0, 0x10, 2, 1),
  278. + PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0xb0, 0x10, 0, 1),
  279. + PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0xb0, 0x10, 12, 1),
  280. +
  281. + PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0xe0, 0x10, 18, 1),
  282. + PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0xe0, 0x10, 19, 1),
  283. + PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0xe0, 0x10, 16, 1),
  284. + PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0xe0, 0x10, 17, 1),
  285. +};
  286. +
  287. +static const struct mtk_pin_field_calc mt7988_pin_pu_range[] = {
  288. + PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0x60, 0x10, 5, 1),
  289. + PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0x60, 0x10, 4, 1),
  290. + PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0x60, 0x10, 3, 1),
  291. + PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0x60, 0x10, 2, 1),
  292. +
  293. + PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0x70, 0x10, 0, 1),
  294. + PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0x70, 0x10, 1, 1),
  295. + PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0x70, 0x10, 2, 1),
  296. +
  297. + PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0x60, 0x10, 7, 1),
  298. + PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0x60, 0x10, 6, 1),
  299. + PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0x60, 0x10, 1, 1),
  300. + PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0x60, 0x10, 0, 1),
  301. + PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0x60, 0x10, 8, 1),
  302. +};
  303. +
  304. +static const struct mtk_pin_field_calc mt7988_pin_pd_range[] = {
  305. + PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0x40, 0x10, 5, 1),
  306. + PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0x40, 0x10, 4, 1),
  307. + PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0x40, 0x10, 3, 1),
  308. + PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0x40, 0x10, 2, 1),
  309. +
  310. + PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0x50, 0x10, 0, 1),
  311. + PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0x50, 0x10, 1, 1),
  312. +
  313. + PIN_FIELD_BASE(15, 15, IOCFG_TL_BASE, 0x40, 0x10, 4, 1),
  314. + PIN_FIELD_BASE(16, 16, IOCFG_TL_BASE, 0x40, 0x10, 5, 1),
  315. + PIN_FIELD_BASE(17, 17, IOCFG_TL_BASE, 0x40, 0x10, 0, 1),
  316. + PIN_FIELD_BASE(18, 18, IOCFG_TL_BASE, 0x40, 0x10, 1, 1),
  317. +
  318. + PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0x50, 0x10, 2, 1),
  319. + PIN_FIELD_BASE(71, 71, IOCFG_TL_BASE, 0x40, 0x10, 2, 1),
  320. + PIN_FIELD_BASE(72, 72, IOCFG_TL_BASE, 0x40, 0x10, 3, 1),
  321. +
  322. + PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0x40, 0x10, 7, 1),
  323. + PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0x40, 0x10, 6, 1),
  324. + PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0x40, 0x10, 1, 1),
  325. + PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0x40, 0x10, 0, 1),
  326. + PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0x40, 0x10, 8, 1),
  327. +};
  328. +
  329. +static const struct mtk_pin_field_calc mt7988_pin_drv_range[] = {
  330. + PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x00, 0x10, 21, 3),
  331. + PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x00, 0x10, 24, 3),
  332. + PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x00, 0x10, 15, 3),
  333. + PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x00, 0x10, 18, 3),
  334. + PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x00, 0x10, 0, 3),
  335. + PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x00, 0x10, 9, 3),
  336. + PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x00, 0x10, 12, 3),
  337. +
  338. + PIN_FIELD_BASE(7, 7, IOCFG_LB_BASE, 0x00, 0x10, 24, 3),
  339. + PIN_FIELD_BASE(8, 8, IOCFG_LB_BASE, 0x00, 0x10, 28, 3),
  340. + PIN_FIELD_BASE(9, 9, IOCFG_LB_BASE, 0x00, 0x10, 15, 3),
  341. + PIN_FIELD_BASE(10, 10, IOCFG_LB_BASE, 0x00, 0x10, 9, 3),
  342. +
  343. + PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x00, 0x10, 0, 3),
  344. + PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x20, 0x10, 3, 3),
  345. + PIN_FIELD_BASE(13, 13, IOCFG_TR_BASE, 0x00, 0x10, 3, 3),
  346. + PIN_FIELD_BASE(14, 14, IOCFG_TR_BASE, 0x00, 0x10, 6, 3),
  347. +
  348. + PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x00, 0x10, 21, 3),
  349. + PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x00, 0x10, 12, 3),
  350. +
  351. + PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x10, 0x10, 21, 3),
  352. + PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x20, 0x10, 9, 3),
  353. + PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x20, 0x10, 0, 3),
  354. + PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x10, 0x10, 27, 3),
  355. + PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x20, 0x10, 3, 3),
  356. + PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x20, 0x10, 6, 3),
  357. + PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x10, 0x10, 24, 3),
  358. + PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x20, 0x10, 15, 3),
  359. + PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x20, 0x10, 18, 3),
  360. + PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x20, 0x10, 21, 3),
  361. + PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x20, 0x10, 12, 3),
  362. + PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x20, 0x10, 24, 3),
  363. + PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0x30, 0x10, 6, 3),
  364. + PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x30, 0x10, 3, 3),
  365. + PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x20, 0x10, 27, 3),
  366. + PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x30, 0x10, 0, 3),
  367. + PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0x30, 0x10, 9, 3),
  368. + PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x10, 0x10, 3, 3),
  369. + PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x10, 0x10, 0, 3),
  370. + PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x00, 0x10, 0, 3),
  371. + PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x00, 0x10, 3, 3),
  372. + PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x00, 0x10, 27, 3),
  373. + PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x00, 0x10, 24, 3),
  374. + PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x00, 0x10, 21, 3),
  375. + PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x00, 0x10, 18, 3),
  376. + PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x00, 0x10, 15, 3),
  377. + PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x00, 0x10, 12, 3),
  378. + PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x00, 0x10, 9, 3),
  379. + PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x00, 0x10, 6, 3),
  380. + PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x10, 0x10, 15, 3),
  381. + PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x10, 0x10, 6, 3),
  382. + PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x10, 0x10, 9, 3),
  383. + PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x10, 0x10, 12, 3),
  384. + PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x10, 0x10, 18, 3),
  385. +
  386. + PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x10, 0x10, 12, 3),
  387. + PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x10, 0x10, 15, 3),
  388. + PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x10, 0x10, 9, 3),
  389. + PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x00, 0x10, 12, 3),
  390. + PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x00, 0x10, 15, 3),
  391. + PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x00, 0x10, 18, 3),
  392. + PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x00, 0x10, 9, 3),
  393. + PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x00, 0x10, 21, 3),
  394. + PIN_FIELD_BASE(63, 63, IOCFG_TR_BASE, 0x20, 0x10, 0, 3),
  395. + PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x00, 0x10, 24, 3),
  396. + PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x00, 0x10, 27, 3),
  397. + PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x10, 0x10, 0, 3),
  398. + PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x10, 0x10, 3, 3),
  399. + PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x10, 0x10, 6, 3),
  400. +
  401. + PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x00, 0x10, 3, 3),
  402. + PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x00, 0x10, 6, 3),
  403. +
  404. + PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x10, 0x10, 0, 3),
  405. + PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x00, 0x10, 3, 3),
  406. + PIN_FIELD_BASE(75, 75, IOCFG_LB_BASE, 0x10, 0x10, 3, 3),
  407. + PIN_FIELD_BASE(76, 76, IOCFG_LB_BASE, 0x00, 0x10, 27, 3),
  408. + PIN_FIELD_BASE(77, 77, IOCFG_LB_BASE, 0x00, 0x10, 6, 3),
  409. + PIN_FIELD_BASE(78, 78, IOCFG_LB_BASE, 0x00, 0x10, 0, 3),
  410. + PIN_FIELD_BASE(79, 79, IOCFG_LB_BASE, 0x10, 0x10, 6, 3),
  411. +
  412. + PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x10, 0x10, 24, 3),
  413. + PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x10, 0x10, 27, 3),
  414. + PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x10, 0x10, 18, 3),
  415. + PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x10, 0x10, 21, 3),
  416. +};
  417. +
  418. +static const struct mtk_pin_field_calc mt7988_pin_pupd_range[] = {
  419. + PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x50, 0x10, 7, 1),
  420. + PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x50, 0x10, 8, 1),
  421. + PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x50, 0x10, 5, 1),
  422. + PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x50, 0x10, 6, 1),
  423. + PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x50, 0x10, 0, 1),
  424. + PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x50, 0x10, 3, 1),
  425. + PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x50, 0x10, 4, 1),
  426. +
  427. + PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x60, 0x10, 0, 1),
  428. + PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x60, 0x10, 18, 1),
  429. +
  430. + PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x50, 0x10, 2, 1),
  431. + PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x50, 0x10, 1, 1),
  432. +
  433. + PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x70, 0x10, 17, 1),
  434. + PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x70, 0x10, 23, 1),
  435. + PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x70, 0x10, 20, 1),
  436. + PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x70, 0x10, 19, 1),
  437. + PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x70, 0x10, 21, 1),
  438. + PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x70, 0x10, 22, 1),
  439. + PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x70, 0x10, 18, 1),
  440. + PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x70, 0x10, 25, 1),
  441. + PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x70, 0x10, 26, 1),
  442. + PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x70, 0x10, 27, 1),
  443. + PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x70, 0x10, 24, 1),
  444. + PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x70, 0x10, 28, 1),
  445. + PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0x80, 0x10, 0, 1),
  446. + PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x70, 0x10, 31, 1),
  447. + PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x70, 0x10, 29, 1),
  448. + PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x70, 0x10, 30, 1),
  449. + PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0x80, 0x10, 1, 1),
  450. + PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x70, 0x10, 11, 1),
  451. + PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x70, 0x10, 10, 1),
  452. + PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x70, 0x10, 0, 1),
  453. + PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x70, 0x10, 1, 1),
  454. + PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x70, 0x10, 9, 1),
  455. + PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x70, 0x10, 8, 1),
  456. + PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x70, 0x10, 7, 1),
  457. + PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x70, 0x10, 6, 1),
  458. + PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x70, 0x10, 5, 1),
  459. + PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x70, 0x10, 4, 1),
  460. + PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x70, 0x10, 3, 1),
  461. + PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x70, 0x10, 2, 1),
  462. + PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x70, 0x10, 15, 1),
  463. + PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x70, 0x10, 12, 1),
  464. + PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x70, 0x10, 13, 1),
  465. + PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x70, 0x10, 14, 1),
  466. + PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x70, 0x10, 16, 1),
  467. +
  468. + PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x60, 0x10, 12, 1),
  469. + PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x60, 0x10, 13, 1),
  470. + PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x60, 0x10, 11, 1),
  471. + PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x60, 0x10, 2, 1),
  472. + PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x60, 0x10, 3, 1),
  473. + PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x60, 0x10, 4, 1),
  474. + PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x60, 0x10, 1, 1),
  475. + PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x60, 0x10, 5, 1),
  476. + PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x60, 0x10, 6, 1),
  477. + PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x60, 0x10, 7, 1),
  478. + PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x60, 0x10, 8, 1),
  479. + PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x60, 0x10, 9, 1),
  480. + PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x60, 0x10, 10, 1),
  481. +
  482. + PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x50, 0x10, 1, 1),
  483. + PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x50, 0x10, 2, 1),
  484. +
  485. + PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x50, 0x10, 3, 1),
  486. + PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x50, 0x10, 0, 1),
  487. +
  488. + PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x60, 0x10, 16, 1),
  489. + PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x60, 0x10, 17, 1),
  490. + PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x60, 0x10, 14, 1),
  491. + PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x60, 0x10, 15, 1),
  492. +};
  493. +
  494. +static const struct mtk_pin_field_calc mt7988_pin_r0_range[] = {
  495. + PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x60, 0x10, 7, 1),
  496. + PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x60, 0x10, 8, 1),
  497. + PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x60, 0x10, 5, 1),
  498. + PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x60, 0x10, 6, 1),
  499. + PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x60, 0x10, 0, 1),
  500. + PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x60, 0x10, 3, 1),
  501. + PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x60, 0x10, 4, 1),
  502. +
  503. + PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x80, 0x10, 0, 1),
  504. + PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x80, 0x10, 18, 1),
  505. +
  506. + PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x70, 0x10, 2, 1),
  507. + PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x70, 0x10, 1, 1),
  508. +
  509. + PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0x90, 0x10, 17, 1),
  510. + PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0x90, 0x10, 23, 1),
  511. + PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0x90, 0x10, 20, 1),
  512. + PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0x90, 0x10, 19, 1),
  513. + PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0x90, 0x10, 21, 1),
  514. + PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0x90, 0x10, 22, 1),
  515. + PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0x90, 0x10, 18, 1),
  516. + PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0x90, 0x10, 25, 1),
  517. + PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0x90, 0x10, 26, 1),
  518. + PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0x90, 0x10, 27, 1),
  519. + PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0x90, 0x10, 24, 1),
  520. + PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0x90, 0x10, 28, 1),
  521. + PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0xa0, 0x10, 0, 1),
  522. + PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0x90, 0x10, 31, 1),
  523. + PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0x90, 0x10, 29, 1),
  524. + PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0x90, 0x10, 30, 1),
  525. + PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0xa0, 0x10, 1, 1),
  526. + PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0x90, 0x10, 11, 1),
  527. + PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0x90, 0x10, 10, 1),
  528. + PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0x90, 0x10, 0, 1),
  529. + PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0x90, 0x10, 1, 1),
  530. + PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0x90, 0x10, 9, 1),
  531. + PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0x90, 0x10, 8, 1),
  532. + PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0x90, 0x10, 7, 1),
  533. + PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0x90, 0x10, 6, 1),
  534. + PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0x90, 0x10, 5, 1),
  535. + PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0x90, 0x10, 4, 1),
  536. + PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0x90, 0x10, 3, 1),
  537. + PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0x90, 0x10, 2, 1),
  538. + PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0x90, 0x10, 15, 1),
  539. + PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0x90, 0x10, 12, 1),
  540. + PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0x90, 0x10, 13, 1),
  541. + PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0x90, 0x10, 14, 1),
  542. + PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0x90, 0x10, 16, 1),
  543. +
  544. + PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x80, 0x10, 12, 1),
  545. + PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x80, 0x10, 13, 1),
  546. + PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x80, 0x10, 11, 1),
  547. + PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x80, 0x10, 2, 1),
  548. + PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x80, 0x10, 3, 1),
  549. + PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x80, 0x10, 4, 1),
  550. + PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x80, 0x10, 1, 1),
  551. + PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x80, 0x10, 5, 1),
  552. + PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x80, 0x10, 6, 1),
  553. + PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x80, 0x10, 7, 1),
  554. + PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x80, 0x10, 8, 1),
  555. + PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x80, 0x10, 9, 1),
  556. + PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x80, 0x10, 10, 1),
  557. +
  558. + PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x60, 0x10, 1, 1),
  559. + PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x60, 0x10, 2, 1),
  560. +
  561. + PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x70, 0x10, 3, 1),
  562. + PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x70, 0x10, 0, 1),
  563. +
  564. + PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x80, 0x10, 16, 1),
  565. + PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x80, 0x10, 17, 1),
  566. + PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x80, 0x10, 14, 1),
  567. + PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x80, 0x10, 15, 1),
  568. +};
  569. +
  570. +static const struct mtk_pin_field_calc mt7988_pin_r1_range[] = {
  571. + PIN_FIELD_BASE(0, 0, IOCFG_TL_BASE, 0x70, 0x10, 7, 1),
  572. + PIN_FIELD_BASE(1, 1, IOCFG_TL_BASE, 0x70, 0x10, 8, 1),
  573. + PIN_FIELD_BASE(2, 2, IOCFG_TL_BASE, 0x70, 0x10, 5, 1),
  574. + PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x70, 0x10, 6, 1),
  575. + PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x70, 0x10, 0, 1),
  576. + PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x70, 0x10, 3, 1),
  577. + PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x70, 0x10, 4, 1),
  578. +
  579. + PIN_FIELD_BASE(11, 11, IOCFG_TR_BASE, 0x90, 0x10, 0, 1),
  580. + PIN_FIELD_BASE(12, 12, IOCFG_TR_BASE, 0x90, 0x10, 18, 1),
  581. +
  582. + PIN_FIELD_BASE(19, 19, IOCFG_LB_BASE, 0x80, 0x10, 2, 1),
  583. + PIN_FIELD_BASE(20, 20, IOCFG_LB_BASE, 0x80, 0x10, 1, 1),
  584. +
  585. + PIN_FIELD_BASE(21, 21, IOCFG_RB_BASE, 0xb0, 0x10, 17, 1),
  586. + PIN_FIELD_BASE(22, 22, IOCFG_RB_BASE, 0xb0, 0x10, 23, 1),
  587. + PIN_FIELD_BASE(23, 23, IOCFG_RB_BASE, 0xb0, 0x10, 20, 1),
  588. + PIN_FIELD_BASE(24, 24, IOCFG_RB_BASE, 0xb0, 0x10, 19, 1),
  589. + PIN_FIELD_BASE(25, 25, IOCFG_RB_BASE, 0xb0, 0x10, 21, 1),
  590. + PIN_FIELD_BASE(26, 26, IOCFG_RB_BASE, 0xb0, 0x10, 22, 1),
  591. + PIN_FIELD_BASE(27, 27, IOCFG_RB_BASE, 0xb0, 0x10, 18, 1),
  592. + PIN_FIELD_BASE(28, 28, IOCFG_RB_BASE, 0xb0, 0x10, 25, 1),
  593. + PIN_FIELD_BASE(29, 29, IOCFG_RB_BASE, 0xb0, 0x10, 26, 1),
  594. + PIN_FIELD_BASE(30, 30, IOCFG_RB_BASE, 0xb0, 0x10, 27, 1),
  595. + PIN_FIELD_BASE(31, 31, IOCFG_RB_BASE, 0xb0, 0x10, 24, 1),
  596. + PIN_FIELD_BASE(32, 32, IOCFG_RB_BASE, 0xb0, 0x10, 28, 1),
  597. + PIN_FIELD_BASE(33, 33, IOCFG_RB_BASE, 0xc0, 0x10, 0, 1),
  598. + PIN_FIELD_BASE(34, 34, IOCFG_RB_BASE, 0xb0, 0x10, 31, 1),
  599. + PIN_FIELD_BASE(35, 35, IOCFG_RB_BASE, 0xb0, 0x10, 29, 1),
  600. + PIN_FIELD_BASE(36, 36, IOCFG_RB_BASE, 0xb0, 0x10, 30, 1),
  601. + PIN_FIELD_BASE(37, 37, IOCFG_RB_BASE, 0xc0, 0x10, 1, 1),
  602. + PIN_FIELD_BASE(38, 38, IOCFG_RB_BASE, 0xb0, 0x10, 11, 1),
  603. + PIN_FIELD_BASE(39, 39, IOCFG_RB_BASE, 0xb0, 0x10, 10, 1),
  604. + PIN_FIELD_BASE(40, 40, IOCFG_RB_BASE, 0xb0, 0x10, 0, 1),
  605. + PIN_FIELD_BASE(41, 41, IOCFG_RB_BASE, 0xb0, 0x10, 1, 1),
  606. + PIN_FIELD_BASE(42, 42, IOCFG_RB_BASE, 0xb0, 0x10, 9, 1),
  607. + PIN_FIELD_BASE(43, 43, IOCFG_RB_BASE, 0xb0, 0x10, 8, 1),
  608. + PIN_FIELD_BASE(44, 44, IOCFG_RB_BASE, 0xb0, 0x10, 7, 1),
  609. + PIN_FIELD_BASE(45, 45, IOCFG_RB_BASE, 0xb0, 0x10, 6, 1),
  610. + PIN_FIELD_BASE(46, 46, IOCFG_RB_BASE, 0xb0, 0x10, 5, 1),
  611. + PIN_FIELD_BASE(47, 47, IOCFG_RB_BASE, 0xb0, 0x10, 4, 1),
  612. + PIN_FIELD_BASE(48, 48, IOCFG_RB_BASE, 0xb0, 0x10, 3, 1),
  613. + PIN_FIELD_BASE(49, 49, IOCFG_RB_BASE, 0xb0, 0x10, 2, 1),
  614. + PIN_FIELD_BASE(50, 50, IOCFG_RB_BASE, 0xb0, 0x10, 15, 1),
  615. + PIN_FIELD_BASE(51, 51, IOCFG_RB_BASE, 0xb0, 0x10, 12, 1),
  616. + PIN_FIELD_BASE(52, 52, IOCFG_RB_BASE, 0xb0, 0x10, 13, 1),
  617. + PIN_FIELD_BASE(53, 53, IOCFG_RB_BASE, 0xb0, 0x10, 14, 1),
  618. + PIN_FIELD_BASE(54, 54, IOCFG_RB_BASE, 0xb0, 0x10, 16, 1),
  619. +
  620. + PIN_FIELD_BASE(55, 55, IOCFG_TR_BASE, 0x90, 0x10, 12, 1),
  621. + PIN_FIELD_BASE(56, 56, IOCFG_TR_BASE, 0x90, 0x10, 13, 1),
  622. + PIN_FIELD_BASE(57, 57, IOCFG_TR_BASE, 0x90, 0x10, 11, 1),
  623. + PIN_FIELD_BASE(58, 58, IOCFG_TR_BASE, 0x90, 0x10, 2, 1),
  624. + PIN_FIELD_BASE(59, 59, IOCFG_TR_BASE, 0x90, 0x10, 3, 1),
  625. + PIN_FIELD_BASE(60, 60, IOCFG_TR_BASE, 0x90, 0x10, 4, 1),
  626. + PIN_FIELD_BASE(61, 61, IOCFG_TR_BASE, 0x90, 0x10, 1, 1),
  627. + PIN_FIELD_BASE(62, 62, IOCFG_TR_BASE, 0x90, 0x10, 5, 1),
  628. + PIN_FIELD_BASE(64, 64, IOCFG_TR_BASE, 0x90, 0x10, 6, 1),
  629. + PIN_FIELD_BASE(65, 65, IOCFG_TR_BASE, 0x90, 0x10, 7, 1),
  630. + PIN_FIELD_BASE(66, 66, IOCFG_TR_BASE, 0x90, 0x10, 8, 1),
  631. + PIN_FIELD_BASE(67, 67, IOCFG_TR_BASE, 0x90, 0x10, 9, 1),
  632. + PIN_FIELD_BASE(68, 68, IOCFG_TR_BASE, 0x90, 0x10, 10, 1),
  633. +
  634. + PIN_FIELD_BASE(69, 69, IOCFG_TL_BASE, 0x70, 0x10, 1, 1),
  635. + PIN_FIELD_BASE(70, 70, IOCFG_TL_BASE, 0x70, 0x10, 2, 1),
  636. +
  637. + PIN_FIELD_BASE(73, 73, IOCFG_LB_BASE, 0x80, 0x10, 3, 1),
  638. + PIN_FIELD_BASE(74, 74, IOCFG_LB_BASE, 0x80, 0x10, 0, 1),
  639. +
  640. + PIN_FIELD_BASE(80, 80, IOCFG_TR_BASE, 0x90, 0x10, 16, 1),
  641. + PIN_FIELD_BASE(81, 81, IOCFG_TR_BASE, 0x90, 0x10, 17, 1),
  642. + PIN_FIELD_BASE(82, 82, IOCFG_TR_BASE, 0x90, 0x10, 14, 1),
  643. + PIN_FIELD_BASE(83, 83, IOCFG_TR_BASE, 0x90, 0x10, 15, 1),
  644. +};
  645. +
  646. +static const struct mtk_pin_reg_calc mt7988_reg_cals[] = {
  647. + [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7988_pin_mode_range),
  648. + [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7988_pin_dir_range),
  649. + [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt7988_pin_di_range),
  650. + [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt7988_pin_do_range),
  651. + [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt7988_pin_smt_range),
  652. + [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt7988_pin_ies_range),
  653. + [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt7988_pin_pu_range),
  654. + [PINCTRL_PIN_REG_PD] = MTK_RANGE(mt7988_pin_pd_range),
  655. + [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt7988_pin_drv_range),
  656. + [PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt7988_pin_pupd_range),
  657. + [PINCTRL_PIN_REG_R0] = MTK_RANGE(mt7988_pin_r0_range),
  658. + [PINCTRL_PIN_REG_R1] = MTK_RANGE(mt7988_pin_r1_range),
  659. +};
  660. +
  661. +static const struct mtk_pin_desc mt7988_pins[] = {
  662. + MT7988_TYPE0_PIN(0, "UART2_RXD"),
  663. + MT7988_TYPE0_PIN(1, "UART2_TXD"),
  664. + MT7988_TYPE0_PIN(2, "UART2_CTS"),
  665. + MT7988_TYPE0_PIN(3, "UART2_RTS"),
  666. + MT7988_TYPE0_PIN(4, "GPIO_A"),
  667. + MT7988_TYPE0_PIN(5, "SMI_0_MDC"),
  668. + MT7988_TYPE0_PIN(6, "SMI_0_MDIO"),
  669. + MT7988_TYPE1_PIN(7, "PCIE30_2L_0_WAKE_N"),
  670. + MT7988_TYPE1_PIN(8, "PCIE30_2L_0_CLKREQ_N"),
  671. + MT7988_TYPE1_PIN(9, "PCIE30_1L_1_WAKE_N"),
  672. + MT7988_TYPE1_PIN(10, "PCIE30_1L_1_CLKREQ_N"),
  673. + MT7988_TYPE0_PIN(11, "GPIO_P"),
  674. + MT7988_TYPE0_PIN(12, "WATCHDOG"),
  675. + MT7988_TYPE1_PIN(13, "GPIO_RESET"),
  676. + MT7988_TYPE1_PIN(14, "GPIO_WPS"),
  677. + MT7988_TYPE2_PIN(15, "PMIC_I2C_SCL"),
  678. + MT7988_TYPE2_PIN(16, "PMIC_I2C_SDA"),
  679. + MT7988_TYPE2_PIN(17, "I2C_1_SCL"),
  680. + MT7988_TYPE2_PIN(18, "I2C_1_SDA"),
  681. + MT7988_TYPE0_PIN(19, "PCIE30_2L_0_PRESET_N"),
  682. + MT7988_TYPE0_PIN(20, "PCIE30_1L_1_PRESET_N"),
  683. + MT7988_TYPE0_PIN(21, "PWMD1"),
  684. + MT7988_TYPE0_PIN(22, "SPI0_WP"),
  685. + MT7988_TYPE0_PIN(23, "SPI0_HOLD"),
  686. + MT7988_TYPE0_PIN(24, "SPI0_CSB"),
  687. + MT7988_TYPE0_PIN(25, "SPI0_MISO"),
  688. + MT7988_TYPE0_PIN(26, "SPI0_MOSI"),
  689. + MT7988_TYPE0_PIN(27, "SPI0_CLK"),
  690. + MT7988_TYPE0_PIN(28, "SPI1_CSB"),
  691. + MT7988_TYPE0_PIN(29, "SPI1_MISO"),
  692. + MT7988_TYPE0_PIN(30, "SPI1_MOSI"),
  693. + MT7988_TYPE0_PIN(31, "SPI1_CLK"),
  694. + MT7988_TYPE0_PIN(32, "SPI2_CLK"),
  695. + MT7988_TYPE0_PIN(33, "SPI2_MOSI"),
  696. + MT7988_TYPE0_PIN(34, "SPI2_MISO"),
  697. + MT7988_TYPE0_PIN(35, "SPI2_CSB"),
  698. + MT7988_TYPE0_PIN(36, "SPI2_HOLD"),
  699. + MT7988_TYPE0_PIN(37, "SPI2_WP"),
  700. + MT7988_TYPE0_PIN(38, "EMMC_RSTB"),
  701. + MT7988_TYPE0_PIN(39, "EMMC_DSL"),
  702. + MT7988_TYPE0_PIN(40, "EMMC_CK"),
  703. + MT7988_TYPE0_PIN(41, "EMMC_CMD"),
  704. + MT7988_TYPE0_PIN(42, "EMMC_DATA_7"),
  705. + MT7988_TYPE0_PIN(43, "EMMC_DATA_6"),
  706. + MT7988_TYPE0_PIN(44, "EMMC_DATA_5"),
  707. + MT7988_TYPE0_PIN(45, "EMMC_DATA_4"),
  708. + MT7988_TYPE0_PIN(46, "EMMC_DATA_3"),
  709. + MT7988_TYPE0_PIN(47, "EMMC_DATA_2"),
  710. + MT7988_TYPE0_PIN(48, "EMMC_DATA_1"),
  711. + MT7988_TYPE0_PIN(49, "EMMC_DATA_0"),
  712. + MT7988_TYPE0_PIN(50, "PCM_FS_I2S_LRCK"),
  713. + MT7988_TYPE0_PIN(51, "PCM_CLK_I2S_BCLK"),
  714. + MT7988_TYPE0_PIN(52, "PCM_DRX_I2S_DIN"),
  715. + MT7988_TYPE0_PIN(53, "PCM_DTX_I2S_DOUT"),
  716. + MT7988_TYPE0_PIN(54, "PCM_MCK_I2S_MCLK"),
  717. + MT7988_TYPE0_PIN(55, "UART0_RXD"),
  718. + MT7988_TYPE0_PIN(56, "UART0_TXD"),
  719. + MT7988_TYPE0_PIN(57, "PWMD0"),
  720. + MT7988_TYPE0_PIN(58, "JTAG_JTDI"),
  721. + MT7988_TYPE0_PIN(59, "JTAG_JTDO"),
  722. + MT7988_TYPE0_PIN(60, "JTAG_JTMS"),
  723. + MT7988_TYPE0_PIN(61, "JTAG_JTCLK"),
  724. + MT7988_TYPE0_PIN(62, "JTAG_JTRST_N"),
  725. + MT7988_TYPE1_PIN(63, "USB_DRV_VBUS_P1"),
  726. + MT7988_TYPE0_PIN(64, "LED_A"),
  727. + MT7988_TYPE0_PIN(65, "LED_B"),
  728. + MT7988_TYPE0_PIN(66, "LED_C"),
  729. + MT7988_TYPE0_PIN(67, "LED_D"),
  730. + MT7988_TYPE0_PIN(68, "LED_E"),
  731. + MT7988_TYPE0_PIN(69, "GPIO_B"),
  732. + MT7988_TYPE0_PIN(70, "GPIO_C"),
  733. + MT7988_TYPE2_PIN(71, "I2C_2_SCL"),
  734. + MT7988_TYPE2_PIN(72, "I2C_2_SDA"),
  735. + MT7988_TYPE0_PIN(73, "PCIE30_2L_1_PRESET_N"),
  736. + MT7988_TYPE0_PIN(74, "PCIE30_1L_0_PRESET_N"),
  737. + MT7988_TYPE1_PIN(75, "PCIE30_2L_1_WAKE_N"),
  738. + MT7988_TYPE1_PIN(76, "PCIE30_2L_1_CLKREQ_N"),
  739. + MT7988_TYPE1_PIN(77, "PCIE30_1L_0_WAKE_N"),
  740. + MT7988_TYPE1_PIN(78, "PCIE30_1L_0_CLKREQ_N"),
  741. + MT7988_TYPE1_PIN(79, "USB_DRV_VBUS_P0"),
  742. + MT7988_TYPE0_PIN(80, "UART1_RXD"),
  743. + MT7988_TYPE0_PIN(81, "UART1_TXD"),
  744. + MT7988_TYPE0_PIN(82, "UART1_CTS"),
  745. + MT7988_TYPE0_PIN(83, "UART1_RTS"),
  746. +};
  747. +
  748. +/* jtag */
  749. +static const int mt7988_tops_jtag0_0_pins[] = { 0, 1, 2, 3, 4 };
  750. +static const int mt7988_tops_jtag0_0_funcs[] = { 2, 2, 2, 2, 2 };
  751. +
  752. +static const int mt7988_wo0_jtag_pins[] = { 50, 51, 52, 53, 54 };
  753. +static const int mt7988_wo0_jtag_funcs[] = { 3, 3, 3, 3, 3 };
  754. +
  755. +static const int mt7988_wo1_jtag_pins[] = { 50, 51, 52, 53, 54 };
  756. +static const int mt7988_wo1_jtag_funcs[] = { 4, 4, 4, 4, 4 };
  757. +
  758. +static const int mt7988_wo2_jtag_pins[] = { 50, 51, 52, 53, 54 };
  759. +static const int mt7988_wo2_jtag_funcs[] = { 5, 5, 5, 5, 5 };
  760. +
  761. +static const int mt7988_jtag_pins[] = { 58, 59, 60, 61, 62 };
  762. +static const int mt7988_jtag_funcs[] = { 1, 1, 1, 1, 1 };
  763. +
  764. +static const int mt7988_tops_jtag0_1_pins[] = { 58, 59, 60, 61, 62 };
  765. +static const int mt7988_tops_jtag0_1_funcs[] = { 4, 4, 4, 4, 4 };
  766. +
  767. +/* int_usxgmii */
  768. +static const int mt7988_int_usxgmii_pins[] = { 2, 3 };
  769. +static const int mt7988_int_usxgmii_funcs[] = { 3, 3 };
  770. +
  771. +/* pwm */
  772. +static const int mt7988_pwm0_pins[] = { 57 };
  773. +static const int mt7988_pwm0_funcs[] = { 1 };
  774. +
  775. +static const int mt7988_pwm1_pins[] = { 21 };
  776. +static const int mt7988_pwm1_funcs[] = { 1 };
  777. +
  778. +static const int mt7988_pwm2_pins[] = { 80 };
  779. +static const int mt7988_pwm2_funcs[] = { 2 };
  780. +
  781. +static const int mt7988_pwm3_pins[] = { 81 };
  782. +static const int mt7988_pwm3_funcs[] = { 2 };
  783. +
  784. +static const int mt7988_pwm4_pins[] = { 82 };
  785. +static const int mt7988_pwm4_funcs[] = { 2 };
  786. +
  787. +static const int mt7988_pwm5_pins[] = { 83 };
  788. +static const int mt7988_pwm5_funcs[] = { 2 };
  789. +
  790. +static const int mt7988_pwm6_pins[] = { 69 };
  791. +static const int mt7988_pwm6_funcs[] = { 3 };
  792. +
  793. +static const int mt7988_pwm7_pins[] = { 70 };
  794. +static const int mt7988_pwm7_funcs[] = { 3 };
  795. +
  796. +/* dfd */
  797. +static const int mt7988_dfd_pins[] = { 0, 1, 2, 3, 4 };
  798. +static const int mt7988_dfd_funcs[] = { 4, 4, 4, 4, 4 };
  799. +
  800. +/* i2c */
  801. +static const int mt7988_xfi_phy0_i2c0_pins[] = { 0, 1 };
  802. +static const int mt7988_xfi_phy0_i2c0_funcs[] = { 5, 5 };
  803. +
  804. +static const int mt7988_xfi_phy1_i2c0_pins[] = { 0, 1 };
  805. +static const int mt7988_xfi_phy1_i2c0_funcs[] = { 6, 6 };
  806. +
  807. +static const int mt7988_xfi_phy_pll_i2c0_pins[] = { 3, 4 };
  808. +static const int mt7988_xfi_phy_pll_i2c0_funcs[] = { 5, 5 };
  809. +
  810. +static const int mt7988_xfi_phy_pll_i2c1_pins[] = { 3, 4 };
  811. +static const int mt7988_xfi_phy_pll_i2c1_funcs[] = { 6, 6 };
  812. +
  813. +static const int mt7988_i2c0_0_pins[] = { 5, 6 };
  814. +static const int mt7988_i2c0_0_funcs[] = { 2, 2 };
  815. +
  816. +static const int mt7988_i2c1_sfp_pins[] = { 5, 6 };
  817. +static const int mt7988_i2c1_sfp_funcs[] = { 4, 4 };
  818. +
  819. +static const int mt7988_xfi_pextp_phy0_i2c_pins[] = { 5, 6 };
  820. +static const int mt7988_xfi_pextp_phy0_i2c_funcs[] = { 5, 5 };
  821. +
  822. +static const int mt7988_xfi_pextp_phy1_i2c_pins[] = { 5, 6 };
  823. +static const int mt7988_xfi_pextp_phy1_i2c_funcs[] = { 6, 6 };
  824. +
  825. +static const int mt7988_i2c0_1_pins[] = { 15, 16 };
  826. +static const int mt7988_i2c0_1_funcs[] = { 1, 1 };
  827. +
  828. +static const int mt7988_u30_phy_i2c0_pins[] = { 15, 16 };
  829. +static const int mt7988_u30_phy_i2c0_funcs[] = { 2, 2 };
  830. +
  831. +static const int mt7988_u32_phy_i2c0_pins[] = { 15, 16 };
  832. +static const int mt7988_u32_phy_i2c0_funcs[] = { 3, 3 };
  833. +
  834. +static const int mt7988_xfi_phy0_i2c1_pins[] = { 15, 16 };
  835. +static const int mt7988_xfi_phy0_i2c1_funcs[] = { 5, 5 };
  836. +
  837. +static const int mt7988_xfi_phy1_i2c1_pins[] = { 15, 16 };
  838. +static const int mt7988_xfi_phy1_i2c1_funcs[] = { 6, 6 };
  839. +
  840. +static const int mt7988_xfi_phy_pll_i2c2_pins[] = { 15, 16 };
  841. +static const int mt7988_xfi_phy_pll_i2c2_funcs[] = { 7, 7 };
  842. +
  843. +static const int mt7988_i2c1_0_pins[] = { 17, 18 };
  844. +static const int mt7988_i2c1_0_funcs[] = { 1, 1 };
  845. +
  846. +static const int mt7988_u30_phy_i2c1_pins[] = { 17, 18 };
  847. +static const int mt7988_u30_phy_i2c1_funcs[] = { 2, 2 };
  848. +
  849. +static const int mt7988_u32_phy_i2c1_pins[] = { 17, 18 };
  850. +static const int mt7988_u32_phy_i2c1_funcs[] = { 3, 3 };
  851. +
  852. +static const int mt7988_xfi_phy_pll_i2c3_pins[] = { 17, 18 };
  853. +static const int mt7988_xfi_phy_pll_i2c3_funcs[] = { 4, 4 };
  854. +
  855. +static const int mt7988_sgmii0_i2c_pins[] = { 17, 18 };
  856. +static const int mt7988_sgmii0_i2c_funcs[] = { 5, 5 };
  857. +
  858. +static const int mt7988_sgmii1_i2c_pins[] = { 17, 18 };
  859. +static const int mt7988_sgmii1_i2c_funcs[] = { 6, 6 };
  860. +
  861. +static const int mt7988_i2c1_2_pins[] = { 69, 70 };
  862. +static const int mt7988_i2c1_2_funcs[] = { 2, 2 };
  863. +
  864. +static const int mt7988_i2c2_0_pins[] = { 69, 70 };
  865. +static const int mt7988_i2c2_0_funcs[] = { 4, 4 };
  866. +
  867. +static const int mt7988_i2c2_1_pins[] = { 71, 72 };
  868. +static const int mt7988_i2c2_1_funcs[] = { 1, 1 };
  869. +
  870. +/* eth */
  871. +static const int mt7988_mdc_mdio0_pins[] = { 5, 6 };
  872. +static const int mt7988_mdc_mdio0_funcs[] = { 1, 1 };
  873. +
  874. +static const int mt7988_2p5g_ext_mdio_pins[] = { 28, 29 };
  875. +static const int mt7988_2p5g_ext_mdio_funcs[] = { 6, 6 };
  876. +
  877. +static const int mt7988_gbe_ext_mdio_pins[] = { 30, 31 };
  878. +static const int mt7988_gbe_ext_mdio_funcs[] = { 6, 6 };
  879. +
  880. +static const int mt7988_mdc_mdio1_pins[] = { 69, 70 };
  881. +static const int mt7988_mdc_mdio1_funcs[] = { 1, 1 };
  882. +
  883. +/* pcie */
  884. +static const int mt7988_pcie_wake_n0_0_pins[] = { 7 };
  885. +static const int mt7988_pcie_wake_n0_0_funcs[] = { 1 };
  886. +
  887. +static const int mt7988_pcie_clk_req_n0_0_pins[] = { 8 };
  888. +static const int mt7988_pcie_clk_req_n0_0_funcs[] = { 1 };
  889. +
  890. +static const int mt7988_pcie_wake_n3_0_pins[] = { 9 };
  891. +static const int mt7988_pcie_wake_n3_0_funcs[] = { 1 };
  892. +
  893. +static const int mt7988_pcie_clk_req_n3_pins[] = { 10 };
  894. +static const int mt7988_pcie_clk_req_n3_funcs[] = { 1 };
  895. +
  896. +static const int mt7988_pcie_clk_req_n0_1_pins[] = { 10 };
  897. +static const int mt7988_pcie_clk_req_n0_1_funcs[] = { 2 };
  898. +
  899. +static const int mt7988_pcie_p0_phy_i2c_pins[] = { 7, 8 };
  900. +static const int mt7988_pcie_p0_phy_i2c_funcs[] = { 3, 3 };
  901. +
  902. +static const int mt7988_pcie_p1_phy_i2c_pins[] = { 7, 8 };
  903. +static const int mt7988_pcie_p1_phy_i2c_funcs[] = { 4, 4 };
  904. +
  905. +static const int mt7988_pcie_p3_phy_i2c_pins[] = { 9, 10 };
  906. +static const int mt7988_pcie_p3_phy_i2c_funcs[] = { 4, 4 };
  907. +
  908. +static const int mt7988_pcie_p2_phy_i2c_pins[] = { 7, 8 };
  909. +static const int mt7988_pcie_p2_phy_i2c_funcs[] = { 5, 5 };
  910. +
  911. +static const int mt7988_ckm_phy_i2c_pins[] = { 9, 10 };
  912. +static const int mt7988_ckm_phy_i2c_funcs[] = { 5, 5 };
  913. +
  914. +static const int mt7988_pcie_wake_n0_1_pins[] = { 13 };
  915. +static const int mt7988_pcie_wake_n0_1_funcs[] = { 2 };
  916. +
  917. +static const int mt7988_pcie_wake_n3_1_pins[] = { 14 };
  918. +static const int mt7988_pcie_wake_n3_1_funcs[] = { 2 };
  919. +
  920. +static const int mt7988_pcie_2l_0_pereset_pins[] = { 19 };
  921. +static const int mt7988_pcie_2l_0_pereset_funcs[] = { 1 };
  922. +
  923. +static const int mt7988_pcie_1l_1_pereset_pins[] = { 20 };
  924. +static const int mt7988_pcie_1l_1_pereset_funcs[] = { 1 };
  925. +
  926. +static const int mt7988_pcie_clk_req_n2_1_pins[] = { 63 };
  927. +static const int mt7988_pcie_clk_req_n2_1_funcs[] = { 2 };
  928. +
  929. +static const int mt7988_pcie_2l_1_pereset_pins[] = { 73 };
  930. +static const int mt7988_pcie_2l_1_pereset_funcs[] = { 1 };
  931. +
  932. +static const int mt7988_pcie_1l_0_pereset_pins[] = { 74 };
  933. +static const int mt7988_pcie_1l_0_pereset_funcs[] = { 1 };
  934. +
  935. +static const int mt7988_pcie_wake_n1_0_pins[] = { 75 };
  936. +static const int mt7988_pcie_wake_n1_0_funcs[] = { 1 };
  937. +
  938. +static const int mt7988_pcie_clk_req_n1_pins[] = { 76 };
  939. +static const int mt7988_pcie_clk_req_n1_funcs[] = { 1 };
  940. +
  941. +static const int mt7988_pcie_wake_n2_0_pins[] = { 77 };
  942. +static const int mt7988_pcie_wake_n2_0_funcs[] = { 1 };
  943. +
  944. +static const int mt7988_pcie_clk_req_n2_0_pins[] = { 78 };
  945. +static const int mt7988_pcie_clk_req_n2_0_funcs[] = { 1 };
  946. +
  947. +static const int mt7988_pcie_wake_n2_1_pins[] = { 79 };
  948. +static const int mt7988_pcie_wake_n2_1_funcs[] = { 2 };
  949. +
  950. +/* pmic */
  951. +static const int mt7988_pmic_pins[] = { 11 };
  952. +static const int mt7988_pmic_funcs[] = { 1 };
  953. +
  954. +/* watchdog */
  955. +static const int mt7988_watchdog_pins[] = { 12 };
  956. +static const int mt7988_watchdog_funcs[] = { 1 };
  957. +
  958. +/* spi */
  959. +static const int mt7988_spi0_wp_hold_pins[] = { 22, 23 };
  960. +static const int mt7988_spi0_wp_hold_funcs[] = { 1, 1 };
  961. +
  962. +static const int mt7988_spi0_pins[] = { 24, 25, 26, 27 };
  963. +static const int mt7988_spi0_funcs[] = { 1, 1, 1, 1 };
  964. +
  965. +static const int mt7988_spi1_pins[] = { 28, 29, 30, 31 };
  966. +static const int mt7988_spi1_funcs[] = { 1, 1, 1, 1 };
  967. +
  968. +static const int mt7988_spi2_pins[] = { 32, 33, 34, 35 };
  969. +static const int mt7988_spi2_funcs[] = { 1, 1, 1, 1 };
  970. +
  971. +static const int mt7988_spi2_wp_hold_pins[] = { 36, 37 };
  972. +static const int mt7988_spi2_wp_hold_funcs[] = { 1, 1 };
  973. +
  974. +/* flash */
  975. +static const int mt7988_snfi_pins[] = { 22, 23, 24, 25, 26, 27 };
  976. +static const int mt7988_snfi_funcs[] = { 2, 2, 2, 2, 2, 2 };
  977. +
  978. +static const int mt7988_emmc_45_pins[] = {
  979. + 21, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37 };
  980. +static const int mt7988_emmc_45_funcs[] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };
  981. +
  982. +static const int mt7988_emmc_51_pins[] = {
  983. + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
  984. +static const int mt7988_emmc_51_funcs[] = {
  985. + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
  986. +
  987. +/* uart */
  988. +static const int mt7988_uart2_pins[] = { 0, 1, 2, 3 };
  989. +static const int mt7988_uart2_funcs[] = { 1, 1, 1, 1 };
  990. +
  991. +static const int mt7988_tops_uart0_0_pins[] = { 22, 23 };
  992. +static const int mt7988_tops_uart0_0_funcs[] = { 3, 3 };
  993. +
  994. +static const int mt7988_uart2_0_pins[] = { 28, 29, 30, 31 };
  995. +static const int mt7988_uart2_0_funcs[] = { 2, 2, 2, 2 };
  996. +
  997. +static const int mt7988_uart1_0_pins[] = { 32, 33, 34, 35 };
  998. +static const int mt7988_uart1_0_funcs[] = { 2, 2, 2, 2 };
  999. +
  1000. +static const int mt7988_uart2_1_pins[] = { 32, 33, 34, 35 };
  1001. +static const int mt7988_uart2_1_funcs[] = { 3, 3, 3, 3 };
  1002. +
  1003. +static const int mt7988_net_wo0_uart_txd_0_pins[] = { 28 };
  1004. +static const int mt7988_net_wo0_uart_txd_0_funcs[] = { 3 };
  1005. +
  1006. +static const int mt7988_net_wo1_uart_txd_0_pins[] = { 29 };
  1007. +static const int mt7988_net_wo1_uart_txd_0_funcs[] = { 3 };
  1008. +
  1009. +static const int mt7988_net_wo2_uart_txd_0_pins[] = { 30 };
  1010. +static const int mt7988_net_wo2_uart_txd_0_funcs[] = { 3 };
  1011. +
  1012. +static const int mt7988_tops_uart1_0_pins[] = { 28, 29 };
  1013. +static const int mt7988_tops_uart1_0_funcs[] = { 4, 4 };
  1014. +
  1015. +static const int mt7988_tops_uart0_1_pins[] = { 30, 31 };
  1016. +static const int mt7988_tops_uart0_1_funcs[] = { 4, 4 };
  1017. +
  1018. +static const int mt7988_tops_uart1_1_pins[] = { 36, 37 };
  1019. +static const int mt7988_tops_uart1_1_funcs[] = { 3, 3 };
  1020. +
  1021. +static const int mt7988_uart0_pins[] = { 55, 56 };
  1022. +static const int mt7988_uart0_funcs[] = { 1, 1 };
  1023. +
  1024. +static const int mt7988_tops_uart0_2_pins[] = { 55, 56 };
  1025. +static const int mt7988_tops_uart0_2_funcs[] = { 2, 2 };
  1026. +
  1027. +static const int mt7988_uart2_2_pins[] = { 50, 51, 52, 53 };
  1028. +static const int mt7988_uart2_2_funcs[] = { 2, 2, 2, 2 };
  1029. +
  1030. +static const int mt7988_uart1_1_pins[] = { 58, 59, 60, 61 };
  1031. +static const int mt7988_uart1_1_funcs[] = { 2, 2, 2, 2 };
  1032. +
  1033. +static const int mt7988_uart2_3_pins[] = { 58, 59, 60, 61 };
  1034. +static const int mt7988_uart2_3_funcs[] = { 3, 3, 3, 3 };
  1035. +
  1036. +static const int mt7988_uart1_2_pins[] = { 80, 81, 82, 83 };
  1037. +static const int mt7988_uart1_2_funcs[] = { 1, 1, 1, 1 };
  1038. +
  1039. +static const int mt7988_tops_uart1_2_pins[] = { 80, 81 };
  1040. +static const int mt7988_tops_uart1_2_funcs[] = { 4, 4, };
  1041. +
  1042. +static const int mt7988_net_wo0_uart_txd_1_pins[] = { 80 };
  1043. +static const int mt7988_net_wo0_uart_txd_1_funcs[] = { 3 };
  1044. +
  1045. +static const int mt7988_net_wo1_uart_txd_1_pins[] = { 81 };
  1046. +static const int mt7988_net_wo1_uart_txd_1_funcs[] = { 3 };
  1047. +
  1048. +static const int mt7988_net_wo2_uart_txd_1_pins[] = { 82 };
  1049. +static const int mt7988_net_wo2_uart_txd_1_funcs[] = { 3 };
  1050. +
  1051. +/* udi */
  1052. +static const int mt7988_udi_pins[] = { 32, 33, 34, 35, 36 };
  1053. +static const int mt7988_udi_funcs[] = { 4, 4, 4, 4, 4 };
  1054. +
  1055. +/* pcm */
  1056. +static const int mt7988_pcm_pins[] = { 50, 51, 52, 53, 54 };
  1057. +static const int mt7988_pcm_funcs[] = { 1, 1, 1, 1, 1 };
  1058. +
  1059. +/* led */
  1060. +static const int mt7988_gbe_led1_pins[] = { 58, 59, 60, 61 };
  1061. +static const int mt7988_gbe_led1_funcs[] = { 6, 6, 6, 6 };
  1062. +
  1063. +static const int mt7988_2p5gbe_led1_pins[] = { 62 };
  1064. +static const int mt7988_2p5gbe_led1_funcs[] = { 6 };
  1065. +
  1066. +static const int mt7988_gbe_led0_pins[] = { 64, 65, 66, 67 };
  1067. +static const int mt7988_gbe_led0_funcs[] = { 1, 1, 1, 1 };
  1068. +
  1069. +static const int mt7988_2p5gbe_led0_pins[] = { 68 };
  1070. +static const int mt7988_2p5gbe_led0_funcs[] = { 1 };
  1071. +
  1072. +/* usb */
  1073. +static const int mt7988_drv_vbus_p1_pins[] = { 63 };
  1074. +static const int mt7988_drv_vbus_p1_funcs[] = { 1 };
  1075. +
  1076. +static const int mt7988_drv_vbus_pins[] = { 79 };
  1077. +static const int mt7988_drv_vbus_funcs[] = { 1 };
  1078. +
  1079. +static const struct mtk_group_desc mt7988_groups[] = {
  1080. + PINCTRL_PIN_GROUP("uart2", mt7988_uart2),
  1081. + PINCTRL_PIN_GROUP("tops_jtag0_0", mt7988_tops_jtag0_0),
  1082. + PINCTRL_PIN_GROUP("int_usxgmii", mt7988_int_usxgmii),
  1083. + PINCTRL_PIN_GROUP("dfd", mt7988_dfd),
  1084. + PINCTRL_PIN_GROUP("xfi_phy0_i2c0", mt7988_xfi_phy0_i2c0),
  1085. + PINCTRL_PIN_GROUP("xfi_phy1_i2c0", mt7988_xfi_phy1_i2c0),
  1086. + PINCTRL_PIN_GROUP("xfi_phy_pll_i2c0", mt7988_xfi_phy_pll_i2c0),
  1087. + PINCTRL_PIN_GROUP("xfi_phy_pll_i2c1", mt7988_xfi_phy_pll_i2c1),
  1088. + PINCTRL_PIN_GROUP("i2c0_0", mt7988_i2c0_0),
  1089. + PINCTRL_PIN_GROUP("i2c1_sfp", mt7988_i2c1_sfp),
  1090. + PINCTRL_PIN_GROUP("xfi_pextp_phy0_i2c", mt7988_xfi_pextp_phy0_i2c),
  1091. + PINCTRL_PIN_GROUP("xfi_pextp_phy1_i2c", mt7988_xfi_pextp_phy1_i2c),
  1092. + PINCTRL_PIN_GROUP("mdc_mdio0", mt7988_mdc_mdio0),
  1093. + PINCTRL_PIN_GROUP("pcie_wake_n0_0", mt7988_pcie_wake_n0_0),
  1094. + PINCTRL_PIN_GROUP("pcie_clk_req_n0_0", mt7988_pcie_clk_req_n0_0),
  1095. + PINCTRL_PIN_GROUP("pcie_wake_n3_0", mt7988_pcie_wake_n3_0),
  1096. + PINCTRL_PIN_GROUP("pcie_clk_req_n3", mt7988_pcie_clk_req_n3),
  1097. + PINCTRL_PIN_GROUP("pcie_clk_req_n0_1", mt7988_pcie_clk_req_n0_1),
  1098. + PINCTRL_PIN_GROUP("pcie_p0_phy_i2c", mt7988_pcie_p0_phy_i2c),
  1099. + PINCTRL_PIN_GROUP("pcie_p1_phy_i2c", mt7988_pcie_p1_phy_i2c),
  1100. + PINCTRL_PIN_GROUP("pcie_p2_phy_i2c", mt7988_pcie_p2_phy_i2c),
  1101. + PINCTRL_PIN_GROUP("pcie_p3_phy_i2c", mt7988_pcie_p3_phy_i2c),
  1102. + PINCTRL_PIN_GROUP("ckm_phy_i2c", mt7988_ckm_phy_i2c),
  1103. + PINCTRL_PIN_GROUP("pcie_pmic", mt7988_pmic),
  1104. + PINCTRL_PIN_GROUP("watchdog", mt7988_watchdog),
  1105. + PINCTRL_PIN_GROUP("pcie_wake_n0_1", mt7988_pcie_wake_n0_1),
  1106. + PINCTRL_PIN_GROUP("pcie_wake_n3_1", mt7988_pcie_wake_n3_1),
  1107. + PINCTRL_PIN_GROUP("i2c0_1", mt7988_i2c0_1),
  1108. + PINCTRL_PIN_GROUP("u30_phy_i2c0", mt7988_u30_phy_i2c0),
  1109. + PINCTRL_PIN_GROUP("u32_phy_i2c0", mt7988_u32_phy_i2c0),
  1110. + PINCTRL_PIN_GROUP("xfi_phy0_i2c1", mt7988_xfi_phy0_i2c1),
  1111. + PINCTRL_PIN_GROUP("xfi_phy1_i2c1", mt7988_xfi_phy1_i2c1),
  1112. + PINCTRL_PIN_GROUP("xfi_phy_pll_i2c2", mt7988_xfi_phy_pll_i2c2),
  1113. + PINCTRL_PIN_GROUP("i2c1_0", mt7988_i2c1_0),
  1114. + PINCTRL_PIN_GROUP("u30_phy_i2c1", mt7988_u30_phy_i2c1),
  1115. + PINCTRL_PIN_GROUP("u32_phy_i2c1", mt7988_u32_phy_i2c1),
  1116. + PINCTRL_PIN_GROUP("xfi_phy_pll_i2c3", mt7988_xfi_phy_pll_i2c3),
  1117. + PINCTRL_PIN_GROUP("sgmii0_i2c", mt7988_sgmii0_i2c),
  1118. + PINCTRL_PIN_GROUP("sgmii1_i2c", mt7988_sgmii1_i2c),
  1119. + PINCTRL_PIN_GROUP("pcie_2l_0_pereset", mt7988_pcie_2l_0_pereset),
  1120. + PINCTRL_PIN_GROUP("pcie_1l_1_pereset", mt7988_pcie_1l_1_pereset),
  1121. + PINCTRL_PIN_GROUP("pwm1", mt7988_pwm1),
  1122. + PINCTRL_PIN_GROUP("spi0_wp_hold", mt7988_spi0_wp_hold),
  1123. + PINCTRL_PIN_GROUP("spi0", mt7988_spi0),
  1124. + PINCTRL_PIN_GROUP("spi1", mt7988_spi1),
  1125. + PINCTRL_PIN_GROUP("spi2", mt7988_spi2),
  1126. + PINCTRL_PIN_GROUP("spi2_wp_hold", mt7988_spi2_wp_hold),
  1127. + PINCTRL_PIN_GROUP("snfi", mt7988_snfi),
  1128. + PINCTRL_PIN_GROUP("tops_uart0_0", mt7988_tops_uart0_0),
  1129. + PINCTRL_PIN_GROUP("uart2_0", mt7988_uart2_0),
  1130. + PINCTRL_PIN_GROUP("uart1_0", mt7988_uart1_0),
  1131. + PINCTRL_PIN_GROUP("uart2_1", mt7988_uart2_1),
  1132. + PINCTRL_PIN_GROUP("net_wo0_uart_txd_0", mt7988_net_wo0_uart_txd_0),
  1133. + PINCTRL_PIN_GROUP("net_wo1_uart_txd_0", mt7988_net_wo1_uart_txd_0),
  1134. + PINCTRL_PIN_GROUP("net_wo2_uart_txd_0", mt7988_net_wo2_uart_txd_0),
  1135. + PINCTRL_PIN_GROUP("tops_uart0_0", mt7988_tops_uart1_0),
  1136. + PINCTRL_PIN_GROUP("tops_uart0_1", mt7988_tops_uart0_1),
  1137. + PINCTRL_PIN_GROUP("tops_uart1_1", mt7988_tops_uart1_1),
  1138. + PINCTRL_PIN_GROUP("udi", mt7988_udi),
  1139. + PINCTRL_PIN_GROUP("emmc_45", mt7988_emmc_45),
  1140. + PINCTRL_PIN_GROUP("emmc_51", mt7988_emmc_51),
  1141. + PINCTRL_PIN_GROUP("2p5g_ext_mdio", mt7988_2p5g_ext_mdio),
  1142. + PINCTRL_PIN_GROUP("gbe_ext_mdio", mt7988_gbe_ext_mdio),
  1143. + PINCTRL_PIN_GROUP("pcm", mt7988_pcm),
  1144. + PINCTRL_PIN_GROUP("uart0", mt7988_uart0),
  1145. + PINCTRL_PIN_GROUP("tops_uart0_2", mt7988_tops_uart0_2),
  1146. + PINCTRL_PIN_GROUP("uart2_2", mt7988_uart2_2),
  1147. + PINCTRL_PIN_GROUP("wo0_jtag", mt7988_wo0_jtag),
  1148. + PINCTRL_PIN_GROUP("wo1_jtag", mt7988_wo1_jtag),
  1149. + PINCTRL_PIN_GROUP("wo2_jtag", mt7988_wo2_jtag),
  1150. + PINCTRL_PIN_GROUP("pwm0", mt7988_pwm0),
  1151. + PINCTRL_PIN_GROUP("jtag", mt7988_jtag),
  1152. + PINCTRL_PIN_GROUP("tops_jtag0_1", mt7988_tops_jtag0_1),
  1153. + PINCTRL_PIN_GROUP("uart2_3", mt7988_uart2_3),
  1154. + PINCTRL_PIN_GROUP("uart1_1", mt7988_uart1_1),
  1155. + PINCTRL_PIN_GROUP("gbe_led1", mt7988_gbe_led1),
  1156. + PINCTRL_PIN_GROUP("2p5gbe_led1", mt7988_2p5gbe_led1),
  1157. + PINCTRL_PIN_GROUP("gbe_led0", mt7988_gbe_led0),
  1158. + PINCTRL_PIN_GROUP("2p5gbe_led0", mt7988_2p5gbe_led0),
  1159. + PINCTRL_PIN_GROUP("drv_vbus_p1", mt7988_drv_vbus_p1),
  1160. + PINCTRL_PIN_GROUP("pcie_clk_req_n2_1", mt7988_pcie_clk_req_n2_1),
  1161. + PINCTRL_PIN_GROUP("mdc_mdio1", mt7988_mdc_mdio1),
  1162. + PINCTRL_PIN_GROUP("i2c1_2", mt7988_i2c1_2),
  1163. + PINCTRL_PIN_GROUP("pwm6", mt7988_pwm6),
  1164. + PINCTRL_PIN_GROUP("pwm7", mt7988_pwm7),
  1165. + PINCTRL_PIN_GROUP("i2c2_0", mt7988_i2c2_0),
  1166. + PINCTRL_PIN_GROUP("i2c2_1", mt7988_i2c2_1),
  1167. + PINCTRL_PIN_GROUP("pcie_2l_1_pereset", mt7988_pcie_2l_1_pereset),
  1168. + PINCTRL_PIN_GROUP("pcie_1l_0_pereset", mt7988_pcie_1l_0_pereset),
  1169. + PINCTRL_PIN_GROUP("pcie_wake_n1_0", mt7988_pcie_wake_n1_0),
  1170. + PINCTRL_PIN_GROUP("pcie_clk_req_n1", mt7988_pcie_clk_req_n1),
  1171. + PINCTRL_PIN_GROUP("pcie_wake_n2_0", mt7988_pcie_wake_n2_0),
  1172. + PINCTRL_PIN_GROUP("pcie_clk_req_n2_0", mt7988_pcie_clk_req_n2_0),
  1173. + PINCTRL_PIN_GROUP("drv_vbus", mt7988_drv_vbus),
  1174. + PINCTRL_PIN_GROUP("pcie_wake_n2_1", mt7988_pcie_wake_n2_1),
  1175. + PINCTRL_PIN_GROUP("uart1_2", mt7988_uart1_2),
  1176. + PINCTRL_PIN_GROUP("pwm2", mt7988_pwm2),
  1177. + PINCTRL_PIN_GROUP("pwm3", mt7988_pwm3),
  1178. + PINCTRL_PIN_GROUP("pwm4", mt7988_pwm4),
  1179. + PINCTRL_PIN_GROUP("pwm5", mt7988_pwm5),
  1180. + PINCTRL_PIN_GROUP("net_wo0_uart_txd_0", mt7988_net_wo0_uart_txd_0),
  1181. + PINCTRL_PIN_GROUP("net_wo1_uart_txd_0", mt7988_net_wo1_uart_txd_0),
  1182. + PINCTRL_PIN_GROUP("net_wo2_uart_txd_0", mt7988_net_wo2_uart_txd_0),
  1183. + PINCTRL_PIN_GROUP("tops_uart1_2", mt7988_tops_uart1_2),
  1184. + PINCTRL_PIN_GROUP("net_wo0_uart_txd_1", mt7988_net_wo0_uart_txd_1),
  1185. + PINCTRL_PIN_GROUP("net_wo1_uart_txd_1", mt7988_net_wo1_uart_txd_1),
  1186. + PINCTRL_PIN_GROUP("net_wo2_uart_txd_1", mt7988_net_wo2_uart_txd_1),
  1187. +};
  1188. +
  1189. +static const struct mtk_io_type_desc mt7988_io_type_desc[] = {
  1190. + [IO_TYPE_GRP0] = {
  1191. + .name = "18OD33",
  1192. + .bias_set = mtk_pinconf_bias_set_pupd_r1_r0,
  1193. + .drive_set = mtk_pinconf_drive_set_v1,
  1194. + .input_enable = mtk_pinconf_input_enable_v1,
  1195. + },
  1196. + [IO_TYPE_GRP1] = {
  1197. + .name = "18A01",
  1198. + .bias_set = mtk_pinconf_bias_set_pu_pd,
  1199. + .drive_set = mtk_pinconf_drive_set_v1,
  1200. + .input_enable = mtk_pinconf_input_enable_v1,
  1201. + },
  1202. + [IO_TYPE_GRP2] = {
  1203. + .name = "I2C",
  1204. + .input_enable = mtk_pinconf_input_enable_v1,
  1205. + },
  1206. +};
  1207. +
  1208. +/* Joint those groups owning the same capability in user point of view which
  1209. + * allows that people tend to use through the device tree.
  1210. + */
  1211. +static const char *const mt7988_jtag_groups[] = { "tops_jtag0_0", "wo0_jtag",
  1212. + "wo1_jtag", "wo2_jtag", "jtag", "tops_jtag0_1", };
  1213. +static const char *const mt7988_int_usxgmii_groups[] = { "int_usxgmii", };
  1214. +static const char *const mt7988_pwm_groups[] = { "pwm0", "pwm1", "pwm2", "pwm3",
  1215. + "pwm4", "pwm5", "pwm6", "pwm7" };
  1216. +static const char *const mt7988_dfd_groups[] = { "dfd", };
  1217. +static const char *const mt7988_i2c_groups[] = { "xfi_phy0_i2c0",
  1218. + "xfi_phy1_i2c0", "xfi_phy_pll_i2c0", "xfi_phy_pll_i2c1", "i2c0_0",
  1219. + "i2c1_sfp", "xfi_pextp_phy0_i2c", "xfi_pextp_phy1_i2c", "i2c0_1",
  1220. + "u30_phy_i2c0", "u32_phy_i2c0", "xfi_phy0_i2c1", "xfi_phy1_i2c1",
  1221. + "xfi_phy_pll_i2c2", "i2c1_0", "u30_phy_i2c1", "u32_phy_i2c1",
  1222. + "xfi_phy_pll_i2c3", "sgmii0_i2c", "sgmii1_i2c", "i2c1_2", "i2c2_0",
  1223. + "i2c2_1", };
  1224. +static const char *const mt7988_ethernet_groups[] = { "mdc_mdio0",
  1225. + "2p5g_ext_mdio", "gbe_ext_mdio", "mdc_mdio1", };
  1226. +static const char *const mt7988_pcie_groups[] = { "pcie_wake_n0_0",
  1227. + "pcie_clk_req_n0_0", "pcie_wake_n3_0", "pcie_clk_req_n3",
  1228. + "pcie_p0_phy_i2c", "pcie_p1_phy_i2c", "pcie_p3_phy_i2",
  1229. + "pcie_p2_phy_i2c", "ckm_phy_i2c", "pcie_wake_n0_1", "pcie_wake_n3_1",
  1230. + "pcie_2l_0_pereset", "pcie_1l_1_pereset", "pcie_clk_req_n2_1",
  1231. + "pcie_2l_1_perese", "pcie_1l_0_pereset", "pcie_wake_n1_0",
  1232. + "cie_clk_req_n1", "pcie_wake_n2_0", "pcie_wake_n2_1", };
  1233. +static const char *const mt7988_pmic_groups[] = { "pmic", };
  1234. +static const char *const mt7988_wdt_groups[] = { "watchdog", };
  1235. +static const char *const mt7988_spi_groups[] = { "spi0", "spi0_wp_hold",
  1236. + "spi1", "spi2", "spi2_wp_hold", };
  1237. +static const char *const mt7988_flash_groups[] = { "emmc_45", "snfi",
  1238. + "emmc_51" };
  1239. +static const char *const mt7988_uart_groups[] = { "uart2", "tops_uart0_0",
  1240. + "uart2_0", "uart1_0", "uart2_1",
  1241. + "net_wo0_uart_txd_0", "net_wo1_uart_txd_0", "net_wo2_uart_txd_0",
  1242. + "tops_uart1_0", "ops_uart0_1", "ops_uart1_1",
  1243. + "uart0", "tops_uart0_2", "uart1_1",
  1244. + "uart2_3", "uart1_2", "tops_uart1_2",
  1245. + "net_wo0_uart_txd_1", "net_wo1_uart_txd_1", "net_wo2_uart_txd_1", };
  1246. +static const char *const mt7988_udi_groups[] = { "udi", };
  1247. +static const char *const mt7988_pcm_groups[] = { "pcm", };
  1248. +static const char *const mt7988_led_groups[] = { "gbe_led1", "2p5gbe_led1",
  1249. + "gbe_led0", "2p5gbe_led0", "wf5g_led0", "wf5g_led1", };
  1250. +static const char *const mt7988_usb_groups[] = { "drv_vbus", "drv_vbus_p1", };
  1251. +
  1252. +static const struct mtk_function_desc mt7988_functions[] = {
  1253. + {"jtag", mt7988_jtag_groups, ARRAY_SIZE(mt7988_jtag_groups)},
  1254. + {"int_usxgmii", mt7988_int_usxgmii_groups,
  1255. + ARRAY_SIZE(mt7988_int_usxgmii_groups)},
  1256. + {"pwm", mt7988_pwm_groups, ARRAY_SIZE(mt7988_pwm_groups)},
  1257. + {"dfd", mt7988_dfd_groups, ARRAY_SIZE(mt7988_dfd_groups)},
  1258. + {"i2c", mt7988_i2c_groups, ARRAY_SIZE(mt7988_i2c_groups)},
  1259. + {"eth", mt7988_ethernet_groups, ARRAY_SIZE(mt7988_ethernet_groups)},
  1260. + {"pcie", mt7988_pcie_groups, ARRAY_SIZE(mt7988_pcie_groups)},
  1261. + {"pmic", mt7988_pmic_groups, ARRAY_SIZE(mt7988_pmic_groups)},
  1262. + {"watchdog", mt7988_wdt_groups, ARRAY_SIZE(mt7988_wdt_groups)},
  1263. + {"spi", mt7988_spi_groups, ARRAY_SIZE(mt7988_spi_groups)},
  1264. + {"flash", mt7988_flash_groups, ARRAY_SIZE(mt7988_flash_groups)},
  1265. + {"uart", mt7988_uart_groups, ARRAY_SIZE(mt7988_uart_groups)},
  1266. + {"udi", mt7988_udi_groups, ARRAY_SIZE(mt7988_udi_groups)},
  1267. + {"pcm", mt7988_pcm_groups, ARRAY_SIZE(mt7988_pcm_groups)},
  1268. + {"usb", mt7988_usb_groups, ARRAY_SIZE(mt7988_usb_groups)},
  1269. + {"led", mt7988_led_groups, ARRAY_SIZE(mt7988_led_groups)},
  1270. +};
  1271. +
  1272. +static const char *const mt7988_pinctrl_register_base_names[] = {
  1273. + "gpio_base", "iocfg_tr_base", "iocfg_br_base", "iocfg_rb_base",
  1274. + "iocfg_lb_base", "iocfg_tl_base",
  1275. +};
  1276. +
  1277. +static const struct mtk_pinctrl_soc mt7988_data = {
  1278. + .name = "mt7988_pinctrl",
  1279. + .reg_cal = mt7988_reg_cals,
  1280. + .pins = mt7988_pins,
  1281. + .npins = ARRAY_SIZE(mt7988_pins),
  1282. + .grps = mt7988_groups,
  1283. + .ngrps = ARRAY_SIZE(mt7988_groups),
  1284. + .funcs = mt7988_functions,
  1285. + .nfuncs = ARRAY_SIZE(mt7988_functions),
  1286. + .io_type = mt7988_io_type_desc,
  1287. + .ntype = ARRAY_SIZE(mt7988_io_type_desc),
  1288. + .gpio_mode = 0,
  1289. + .base_names = mt7988_pinctrl_register_base_names,
  1290. + .nbase_names = ARRAY_SIZE(mt7988_pinctrl_register_base_names),
  1291. + .base_calc = 1,
  1292. +};
  1293. +
  1294. +static int mtk_pinctrl_mt7988_probe(struct udevice *dev)
  1295. +{
  1296. + return mtk_pinctrl_common_probe(dev, &mt7988_data);
  1297. +}
  1298. +
  1299. +static const struct udevice_id mt7988_pctrl_match[] = {
  1300. + {.compatible = "mediatek,mt7988-pinctrl"},
  1301. + { /* sentinel */ }
  1302. +};
  1303. +
  1304. +U_BOOT_DRIVER(mt7988_pinctrl) = {
  1305. + .name = "mt7988_pinctrl",
  1306. + .id = UCLASS_PINCTRL,
  1307. + .of_match = mt7988_pctrl_match,
  1308. + .ops = &mtk_pinctrl_ops,
  1309. + .probe = mtk_pinctrl_mt7988_probe,
  1310. + .priv_auto = sizeof(struct mtk_pinctrl_priv),
  1311. +};