pinctrl-mt8127.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. /*
  2. * Copyright (c) 2015 MediaTek Inc.
  3. * Author: Hongzhou.Yang <hongzhou.yang@mediatek.com>
  4. * Yingjoe Chen <yingjoe.chen@mediatek.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include <linux/module.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/of.h>
  18. #include <linux/of_device.h>
  19. #include <linux/pinctrl/pinctrl.h>
  20. #include <linux/regmap.h>
  21. #include <dt-bindings/pinctrl/mt65xx.h>
  22. #include "pinctrl-mtk-common.h"
  23. #include "pinctrl-mtk-mt8127.h"
  24. static const struct mtk_drv_group_desc mt8127_drv_grp[] = {
  25. /* 0E4E8SR 4/8/12/16 */
  26. MTK_DRV_GRP(4, 16, 1, 2, 4),
  27. /* 0E2E4SR 2/4/6/8 */
  28. MTK_DRV_GRP(2, 8, 1, 2, 2),
  29. /* E8E4E2 2/4/6/8/10/12/14/16 */
  30. MTK_DRV_GRP(2, 16, 0, 2, 2)
  31. };
  32. static const struct mtk_pin_drv_grp mt8127_pin_drv[] = {
  33. MTK_PIN_DRV_GRP(0, 0xb00, 0, 1),
  34. MTK_PIN_DRV_GRP(1, 0xb00, 0, 1),
  35. MTK_PIN_DRV_GRP(2, 0xb00, 0, 1),
  36. MTK_PIN_DRV_GRP(3, 0xb00, 0, 1),
  37. MTK_PIN_DRV_GRP(4, 0xb00, 0, 1),
  38. MTK_PIN_DRV_GRP(5, 0xb00, 0, 1),
  39. MTK_PIN_DRV_GRP(6, 0xb00, 0, 1),
  40. MTK_PIN_DRV_GRP(7, 0xb00, 12, 1),
  41. MTK_PIN_DRV_GRP(8, 0xb00, 12, 1),
  42. MTK_PIN_DRV_GRP(9, 0xb00, 12, 1),
  43. MTK_PIN_DRV_GRP(10, 0xb00, 8, 1),
  44. MTK_PIN_DRV_GRP(11, 0xb00, 8, 1),
  45. MTK_PIN_DRV_GRP(12, 0xb00, 8, 1),
  46. MTK_PIN_DRV_GRP(13, 0xb00, 8, 1),
  47. MTK_PIN_DRV_GRP(14, 0xb10, 4, 0),
  48. MTK_PIN_DRV_GRP(15, 0xb10, 4, 0),
  49. MTK_PIN_DRV_GRP(16, 0xb10, 4, 0),
  50. MTK_PIN_DRV_GRP(17, 0xb10, 4, 0),
  51. MTK_PIN_DRV_GRP(18, 0xb10, 8, 0),
  52. MTK_PIN_DRV_GRP(19, 0xb10, 8, 0),
  53. MTK_PIN_DRV_GRP(20, 0xb10, 8, 0),
  54. MTK_PIN_DRV_GRP(21, 0xb10, 8, 0),
  55. MTK_PIN_DRV_GRP(22, 0xb20, 0, 0),
  56. MTK_PIN_DRV_GRP(23, 0xb20, 0, 0),
  57. MTK_PIN_DRV_GRP(24, 0xb20, 0, 0),
  58. MTK_PIN_DRV_GRP(25, 0xb20, 0, 0),
  59. MTK_PIN_DRV_GRP(26, 0xb20, 0, 0),
  60. MTK_PIN_DRV_GRP(27, 0xb20, 4, 0),
  61. MTK_PIN_DRV_GRP(28, 0xb20, 4, 0),
  62. MTK_PIN_DRV_GRP(29, 0xb20, 4, 0),
  63. MTK_PIN_DRV_GRP(30, 0xb20, 4, 0),
  64. MTK_PIN_DRV_GRP(31, 0xb20, 4, 0),
  65. MTK_PIN_DRV_GRP(32, 0xb20, 4, 0),
  66. MTK_PIN_DRV_GRP(33, 0xb30, 4, 1),
  67. MTK_PIN_DRV_GRP(34, 0xb30, 8, 1),
  68. MTK_PIN_DRV_GRP(35, 0xb30, 8, 1),
  69. MTK_PIN_DRV_GRP(36, 0xb30, 8, 1),
  70. MTK_PIN_DRV_GRP(37, 0xb30, 8, 1),
  71. MTK_PIN_DRV_GRP(38, 0xb30, 8, 1),
  72. MTK_PIN_DRV_GRP(39, 0xb30, 12, 1),
  73. MTK_PIN_DRV_GRP(40, 0xb30, 12, 1),
  74. MTK_PIN_DRV_GRP(41, 0xb30, 12, 1),
  75. MTK_PIN_DRV_GRP(42, 0xb30, 12, 1),
  76. MTK_PIN_DRV_GRP(43, 0xb40, 12, 0),
  77. MTK_PIN_DRV_GRP(44, 0xb40, 12, 0),
  78. MTK_PIN_DRV_GRP(45, 0xb40, 12, 0),
  79. MTK_PIN_DRV_GRP(46, 0xb50, 0, 2),
  80. MTK_PIN_DRV_GRP(47, 0xb50, 0, 2),
  81. MTK_PIN_DRV_GRP(48, 0xb50, 0, 2),
  82. MTK_PIN_DRV_GRP(49, 0xb50, 0, 2),
  83. MTK_PIN_DRV_GRP(50, 0xb70, 0, 1),
  84. MTK_PIN_DRV_GRP(51, 0xb70, 0, 1),
  85. MTK_PIN_DRV_GRP(52, 0xb70, 0, 1),
  86. MTK_PIN_DRV_GRP(53, 0xb50, 12, 1),
  87. MTK_PIN_DRV_GRP(54, 0xb50, 12, 1),
  88. MTK_PIN_DRV_GRP(55, 0xb50, 12, 1),
  89. MTK_PIN_DRV_GRP(56, 0xb50, 12, 1),
  90. MTK_PIN_DRV_GRP(59, 0xb40, 4, 1),
  91. MTK_PIN_DRV_GRP(60, 0xb40, 0, 1),
  92. MTK_PIN_DRV_GRP(61, 0xb40, 0, 1),
  93. MTK_PIN_DRV_GRP(62, 0xb40, 0, 1),
  94. MTK_PIN_DRV_GRP(63, 0xb40, 4, 1),
  95. MTK_PIN_DRV_GRP(64, 0xb40, 4, 1),
  96. MTK_PIN_DRV_GRP(65, 0xb40, 4, 1),
  97. MTK_PIN_DRV_GRP(66, 0xb40, 8, 1),
  98. MTK_PIN_DRV_GRP(67, 0xb40, 8, 1),
  99. MTK_PIN_DRV_GRP(68, 0xb40, 8, 1),
  100. MTK_PIN_DRV_GRP(69, 0xb40, 8, 1),
  101. MTK_PIN_DRV_GRP(70, 0xb40, 8, 1),
  102. MTK_PIN_DRV_GRP(71, 0xb40, 8, 1),
  103. MTK_PIN_DRV_GRP(72, 0xb50, 4, 1),
  104. MTK_PIN_DRV_GRP(73, 0xb50, 4, 1),
  105. MTK_PIN_DRV_GRP(74, 0xb50, 4, 1),
  106. MTK_PIN_DRV_GRP(79, 0xb50, 8, 1),
  107. MTK_PIN_DRV_GRP(80, 0xb50, 8, 1),
  108. MTK_PIN_DRV_GRP(81, 0xb50, 8, 1),
  109. MTK_PIN_DRV_GRP(82, 0xb50, 8, 1),
  110. MTK_PIN_DRV_GRP(83, 0xb50, 8, 1),
  111. MTK_PIN_DRV_GRP(84, 0xb50, 8, 1),
  112. MTK_PIN_DRV_GRP(85, 0xce0, 0, 2),
  113. MTK_PIN_DRV_GRP(86, 0xcd0, 0, 2),
  114. MTK_PIN_DRV_GRP(87, 0xcf0, 0, 2),
  115. MTK_PIN_DRV_GRP(88, 0xcf0, 0, 2),
  116. MTK_PIN_DRV_GRP(89, 0xcf0, 0, 2),
  117. MTK_PIN_DRV_GRP(90, 0xcf0, 0, 2),
  118. MTK_PIN_DRV_GRP(117, 0xb60, 12, 1),
  119. MTK_PIN_DRV_GRP(118, 0xb60, 12, 1),
  120. MTK_PIN_DRV_GRP(119, 0xb60, 12, 1),
  121. MTK_PIN_DRV_GRP(120, 0xb60, 12, 1),
  122. MTK_PIN_DRV_GRP(121, 0xc80, 0, 2),
  123. MTK_PIN_DRV_GRP(122, 0xc70, 0, 2),
  124. MTK_PIN_DRV_GRP(123, 0xc90, 0, 2),
  125. MTK_PIN_DRV_GRP(124, 0xc90, 0, 2),
  126. MTK_PIN_DRV_GRP(125, 0xc90, 0, 2),
  127. MTK_PIN_DRV_GRP(126, 0xc90, 0, 2),
  128. MTK_PIN_DRV_GRP(127, 0xc20, 0, 2),
  129. MTK_PIN_DRV_GRP(128, 0xc20, 0, 2),
  130. MTK_PIN_DRV_GRP(129, 0xc20, 0, 2),
  131. MTK_PIN_DRV_GRP(130, 0xc20, 0, 2),
  132. MTK_PIN_DRV_GRP(131, 0xc20, 0, 2),
  133. MTK_PIN_DRV_GRP(132, 0xc10, 0, 2),
  134. MTK_PIN_DRV_GRP(133, 0xc00, 0, 2),
  135. MTK_PIN_DRV_GRP(134, 0xc20, 0, 2),
  136. MTK_PIN_DRV_GRP(135, 0xc20, 0, 2),
  137. MTK_PIN_DRV_GRP(136, 0xc20, 0, 2),
  138. MTK_PIN_DRV_GRP(137, 0xc20, 0, 2),
  139. MTK_PIN_DRV_GRP(142, 0xb50, 0, 2),
  140. };
  141. static const struct mtk_pin_spec_pupd_set_samereg mt8127_spec_pupd[] = {
  142. MTK_PIN_PUPD_SPEC_SR(33, 0xd90, 2, 0, 1), /* KPROW0 */
  143. MTK_PIN_PUPD_SPEC_SR(34, 0xd90, 6, 4, 5), /* KPROW1 */
  144. MTK_PIN_PUPD_SPEC_SR(35, 0xd90, 10, 8, 9), /* KPROW2 */
  145. MTK_PIN_PUPD_SPEC_SR(36, 0xda0, 2, 0, 1), /* KPCOL0 */
  146. MTK_PIN_PUPD_SPEC_SR(37, 0xda0, 6, 4, 5), /* KPCOL1 */
  147. MTK_PIN_PUPD_SPEC_SR(38, 0xda0, 10, 8, 9), /* KPCOL2 */
  148. MTK_PIN_PUPD_SPEC_SR(46, 0xdb0, 2, 0, 1), /* EINT14 */
  149. MTK_PIN_PUPD_SPEC_SR(47, 0xdb0, 6, 4, 5), /* EINT15 */
  150. MTK_PIN_PUPD_SPEC_SR(48, 0xdb0, 10, 8, 9), /* EINT16 */
  151. MTK_PIN_PUPD_SPEC_SR(49, 0xdb0, 14, 12, 13), /* EINT17 */
  152. MTK_PIN_PUPD_SPEC_SR(85, 0xce0, 8, 10, 9), /* MSDC2_CMD */
  153. MTK_PIN_PUPD_SPEC_SR(86, 0xcd0, 8, 10, 9), /* MSDC2_CLK */
  154. MTK_PIN_PUPD_SPEC_SR(87, 0xd00, 0, 2, 1), /* MSDC2_DAT0 */
  155. MTK_PIN_PUPD_SPEC_SR(88, 0xd00, 4, 6, 5), /* MSDC2_DAT1 */
  156. MTK_PIN_PUPD_SPEC_SR(89, 0xd00, 8, 10, 9), /* MSDC2_DAT2 */
  157. MTK_PIN_PUPD_SPEC_SR(90, 0xd00, 12, 14, 13), /* MSDC2_DAT3 */
  158. MTK_PIN_PUPD_SPEC_SR(121, 0xc80, 8, 10, 9), /* MSDC1_CMD */
  159. MTK_PIN_PUPD_SPEC_SR(122, 0xc70, 8, 10, 9), /* MSDC1_CLK */
  160. MTK_PIN_PUPD_SPEC_SR(123, 0xca0, 0, 2, 1), /* MSDC1_DAT0 */
  161. MTK_PIN_PUPD_SPEC_SR(124, 0xca0, 4, 6, 5), /* MSDC1_DAT1 */
  162. MTK_PIN_PUPD_SPEC_SR(125, 0xca0, 8, 10, 9), /* MSDC1_DAT2 */
  163. MTK_PIN_PUPD_SPEC_SR(126, 0xca0, 12, 14, 13), /* MSDC1_DAT3 */
  164. MTK_PIN_PUPD_SPEC_SR(127, 0xc40, 12, 14, 13), /* MSDC0_DAT7 */
  165. MTK_PIN_PUPD_SPEC_SR(128, 0xc40, 8, 10, 9), /* MSDC0_DAT6 */
  166. MTK_PIN_PUPD_SPEC_SR(129, 0xc40, 4, 6, 5), /* MSDC0_DAT5 */
  167. MTK_PIN_PUPD_SPEC_SR(130, 0xc40, 0, 2, 1), /* MSDC0_DAT4 */
  168. MTK_PIN_PUPD_SPEC_SR(131, 0xc50, 0, 2, 1), /* MSDC0_RSTB */
  169. MTK_PIN_PUPD_SPEC_SR(132, 0xc10, 8, 10, 9), /* MSDC0_CMD */
  170. MTK_PIN_PUPD_SPEC_SR(133, 0xc00, 8, 10, 9), /* MSDC0_CLK */
  171. MTK_PIN_PUPD_SPEC_SR(134, 0xc30, 12, 14, 13), /* MSDC0_DAT3 */
  172. MTK_PIN_PUPD_SPEC_SR(135, 0xc30, 8, 10, 9), /* MSDC0_DAT2 */
  173. MTK_PIN_PUPD_SPEC_SR(136, 0xc30, 4, 6, 5), /* MSDC0_DAT1 */
  174. MTK_PIN_PUPD_SPEC_SR(137, 0xc30, 0, 2, 1), /* MSDC0_DAT0 */
  175. MTK_PIN_PUPD_SPEC_SR(142, 0xdc0, 2, 0, 1), /* EINT21 */
  176. };
  177. static int mt8127_spec_pull_set(struct regmap *regmap, unsigned int pin,
  178. unsigned char align, bool isup, unsigned int r1r0)
  179. {
  180. return mtk_pctrl_spec_pull_set_samereg(regmap, mt8127_spec_pupd,
  181. ARRAY_SIZE(mt8127_spec_pupd), pin, align, isup, r1r0);
  182. }
  183. static const struct mtk_pin_ies_smt_set mt8127_ies_set[] = {
  184. MTK_PIN_IES_SMT_SPEC(0, 9, 0x900, 0),
  185. MTK_PIN_IES_SMT_SPEC(10, 13, 0x900, 1),
  186. MTK_PIN_IES_SMT_SPEC(14, 28, 0x900, 2),
  187. MTK_PIN_IES_SMT_SPEC(29, 32, 0x900, 3),
  188. MTK_PIN_IES_SMT_SPEC(33, 33, 0x910, 11),
  189. MTK_PIN_IES_SMT_SPEC(34, 38, 0x900, 10),
  190. MTK_PIN_IES_SMT_SPEC(39, 42, 0x900, 11),
  191. MTK_PIN_IES_SMT_SPEC(43, 45, 0x900, 12),
  192. MTK_PIN_IES_SMT_SPEC(46, 49, 0x900, 13),
  193. MTK_PIN_IES_SMT_SPEC(50, 52, 0x910, 10),
  194. MTK_PIN_IES_SMT_SPEC(53, 56, 0x900, 14),
  195. MTK_PIN_IES_SMT_SPEC(57, 58, 0x910, 0),
  196. MTK_PIN_IES_SMT_SPEC(59, 65, 0x910, 2),
  197. MTK_PIN_IES_SMT_SPEC(66, 71, 0x910, 3),
  198. MTK_PIN_IES_SMT_SPEC(72, 74, 0x910, 4),
  199. MTK_PIN_IES_SMT_SPEC(75, 76, 0x900, 15),
  200. MTK_PIN_IES_SMT_SPEC(77, 78, 0x910, 1),
  201. MTK_PIN_IES_SMT_SPEC(79, 82, 0x910, 5),
  202. MTK_PIN_IES_SMT_SPEC(83, 84, 0x910, 6),
  203. MTK_PIN_IES_SMT_SPEC(117, 120, 0x910, 7),
  204. MTK_PIN_IES_SMT_SPEC(121, 121, 0xc80, 4),
  205. MTK_PIN_IES_SMT_SPEC(122, 122, 0xc70, 4),
  206. MTK_PIN_IES_SMT_SPEC(123, 126, 0xc90, 4),
  207. MTK_PIN_IES_SMT_SPEC(127, 131, 0xc20, 4),
  208. MTK_PIN_IES_SMT_SPEC(132, 132, 0xc10, 4),
  209. MTK_PIN_IES_SMT_SPEC(133, 133, 0xc00, 4),
  210. MTK_PIN_IES_SMT_SPEC(134, 137, 0xc20, 4),
  211. MTK_PIN_IES_SMT_SPEC(138, 141, 0x910, 9),
  212. MTK_PIN_IES_SMT_SPEC(142, 142, 0x900, 13),
  213. };
  214. static const struct mtk_pin_ies_smt_set mt8127_smt_set[] = {
  215. MTK_PIN_IES_SMT_SPEC(0, 9, 0x920, 0),
  216. MTK_PIN_IES_SMT_SPEC(10, 13, 0x920, 1),
  217. MTK_PIN_IES_SMT_SPEC(14, 28, 0x920, 2),
  218. MTK_PIN_IES_SMT_SPEC(29, 32, 0x920, 3),
  219. MTK_PIN_IES_SMT_SPEC(33, 33, 0x930, 11),
  220. MTK_PIN_IES_SMT_SPEC(34, 38, 0x920, 10),
  221. MTK_PIN_IES_SMT_SPEC(39, 42, 0x920, 11),
  222. MTK_PIN_IES_SMT_SPEC(43, 45, 0x920, 12),
  223. MTK_PIN_IES_SMT_SPEC(46, 49, 0x920, 13),
  224. MTK_PIN_IES_SMT_SPEC(50, 52, 0x930, 10),
  225. MTK_PIN_IES_SMT_SPEC(53, 56, 0x920, 14),
  226. MTK_PIN_IES_SMT_SPEC(57, 58, 0x930, 0),
  227. MTK_PIN_IES_SMT_SPEC(59, 65, 0x930, 2),
  228. MTK_PIN_IES_SMT_SPEC(66, 71, 0x930, 3),
  229. MTK_PIN_IES_SMT_SPEC(72, 74, 0x930, 4),
  230. MTK_PIN_IES_SMT_SPEC(75, 76, 0x920, 15),
  231. MTK_PIN_IES_SMT_SPEC(77, 78, 0x930, 1),
  232. MTK_PIN_IES_SMT_SPEC(79, 82, 0x930, 5),
  233. MTK_PIN_IES_SMT_SPEC(83, 84, 0x930, 6),
  234. MTK_PIN_IES_SMT_SPEC(85, 85, 0xce0, 11),
  235. MTK_PIN_IES_SMT_SPEC(86, 86, 0xcd0, 11),
  236. MTK_PIN_IES_SMT_SPEC(87, 87, 0xd00, 3),
  237. MTK_PIN_IES_SMT_SPEC(88, 88, 0xd00, 7),
  238. MTK_PIN_IES_SMT_SPEC(89, 89, 0xd00, 11),
  239. MTK_PIN_IES_SMT_SPEC(90, 90, 0xd00, 15),
  240. MTK_PIN_IES_SMT_SPEC(117, 120, 0x930, 7),
  241. MTK_PIN_IES_SMT_SPEC(121, 121, 0xc80, 11),
  242. MTK_PIN_IES_SMT_SPEC(122, 122, 0xc70, 11),
  243. MTK_PIN_IES_SMT_SPEC(123, 123, 0xca0, 3),
  244. MTK_PIN_IES_SMT_SPEC(124, 124, 0xca0, 7),
  245. MTK_PIN_IES_SMT_SPEC(125, 125, 0xca0, 11),
  246. MTK_PIN_IES_SMT_SPEC(126, 126, 0xca0, 15),
  247. MTK_PIN_IES_SMT_SPEC(127, 127, 0xc40, 15),
  248. MTK_PIN_IES_SMT_SPEC(128, 128, 0xc40, 11),
  249. MTK_PIN_IES_SMT_SPEC(129, 129, 0xc40, 7),
  250. MTK_PIN_IES_SMT_SPEC(130, 130, 0xc40, 3),
  251. MTK_PIN_IES_SMT_SPEC(131, 131, 0xc50, 3),
  252. MTK_PIN_IES_SMT_SPEC(132, 132, 0xc10, 11),
  253. MTK_PIN_IES_SMT_SPEC(133, 133, 0xc00, 11),
  254. MTK_PIN_IES_SMT_SPEC(134, 134, 0xc30, 15),
  255. MTK_PIN_IES_SMT_SPEC(135, 135, 0xc30, 11),
  256. MTK_PIN_IES_SMT_SPEC(136, 136, 0xc30, 7),
  257. MTK_PIN_IES_SMT_SPEC(137, 137, 0xc30, 3),
  258. MTK_PIN_IES_SMT_SPEC(138, 141, 0x930, 9),
  259. MTK_PIN_IES_SMT_SPEC(142, 142, 0x920, 13),
  260. };
  261. static int mt8127_ies_smt_set(struct regmap *regmap, unsigned int pin,
  262. unsigned char align, int value, enum pin_config_param arg)
  263. {
  264. if (arg == PIN_CONFIG_INPUT_ENABLE)
  265. return mtk_pconf_spec_set_ies_smt_range(regmap, mt8127_ies_set,
  266. ARRAY_SIZE(mt8127_ies_set), pin, align, value);
  267. else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
  268. return mtk_pconf_spec_set_ies_smt_range(regmap, mt8127_smt_set,
  269. ARRAY_SIZE(mt8127_smt_set), pin, align, value);
  270. return -EINVAL;
  271. }
  272. static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = {
  273. .pins = mtk_pins_mt8127,
  274. .npins = ARRAY_SIZE(mtk_pins_mt8127),
  275. .grp_desc = mt8127_drv_grp,
  276. .n_grp_cls = ARRAY_SIZE(mt8127_drv_grp),
  277. .pin_drv_grp = mt8127_pin_drv,
  278. .n_pin_drv_grps = ARRAY_SIZE(mt8127_pin_drv),
  279. .spec_pull_set = mt8127_spec_pull_set,
  280. .spec_ies_smt_set = mt8127_ies_smt_set,
  281. .dir_offset = 0x0000,
  282. .pullen_offset = 0x0100,
  283. .pullsel_offset = 0x0200,
  284. .dout_offset = 0x0400,
  285. .din_offset = 0x0500,
  286. .pinmux_offset = 0x0600,
  287. .type1_start = 143,
  288. .type1_end = 143,
  289. .port_shf = 4,
  290. .port_mask = 0xf,
  291. .port_align = 4,
  292. .eint_offsets = {
  293. .name = "mt8127_eint",
  294. .stat = 0x000,
  295. .ack = 0x040,
  296. .mask = 0x080,
  297. .mask_set = 0x0c0,
  298. .mask_clr = 0x100,
  299. .sens = 0x140,
  300. .sens_set = 0x180,
  301. .sens_clr = 0x1c0,
  302. .soft = 0x200,
  303. .soft_set = 0x240,
  304. .soft_clr = 0x280,
  305. .pol = 0x300,
  306. .pol_set = 0x340,
  307. .pol_clr = 0x380,
  308. .dom_en = 0x400,
  309. .dbnc_ctrl = 0x500,
  310. .dbnc_set = 0x600,
  311. .dbnc_clr = 0x700,
  312. .port_mask = 7,
  313. .ports = 6,
  314. },
  315. .ap_num = 143,
  316. .db_cnt = 16,
  317. };
  318. static int mt8127_pinctrl_probe(struct platform_device *pdev)
  319. {
  320. return mtk_pctrl_init(pdev, &mt8127_pinctrl_data, NULL);
  321. }
  322. static const struct of_device_id mt8127_pctrl_match[] = {
  323. { .compatible = "mediatek,mt8127-pinctrl", },
  324. { }
  325. };
  326. MODULE_DEVICE_TABLE(of, mt8127_pctrl_match);
  327. static struct platform_driver mtk_pinctrl_driver = {
  328. .probe = mt8127_pinctrl_probe,
  329. .driver = {
  330. .name = "mediatek-mt8127-pinctrl",
  331. .of_match_table = mt8127_pctrl_match,
  332. },
  333. };
  334. static int __init mtk_pinctrl_init(void)
  335. {
  336. return platform_driver_register(&mtk_pinctrl_driver);
  337. }
  338. module_init(mtk_pinctrl_init);
  339. MODULE_LICENSE("GPL v2");
  340. MODULE_DESCRIPTION("MediaTek MT8127 Pinctrl Driver");
  341. MODULE_AUTHOR("Yingjoe Chen <yingjoe.chen@mediatek.com>");