pinctrl-mt8173.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. /*
  2. * Copyright (c) 2014-2015 MediaTek Inc.
  3. * Author: Hongzhou.Yang <hongzhou.yang@mediatek.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/of.h>
  17. #include <linux/of_device.h>
  18. #include <linux/pinctrl/pinctrl.h>
  19. #include <linux/regmap.h>
  20. #include <linux/pinctrl/pinconf-generic.h>
  21. #include <dt-bindings/pinctrl/mt65xx.h>
  22. #include "pinctrl-mtk-common.h"
  23. #include "pinctrl-mtk-mt8173.h"
  24. #define DRV_BASE 0xb00
  25. static const struct mtk_pin_spec_pupd_set_samereg mt8173_spec_pupd[] = {
  26. MTK_PIN_PUPD_SPEC_SR(119, 0xe00, 2, 1, 0, 0), /* KROW0 */
  27. MTK_PIN_PUPD_SPEC_SR(120, 0xe00, 6, 5, 4, 0), /* KROW1 */
  28. MTK_PIN_PUPD_SPEC_SR(121, 0xe00, 10, 9, 8, 0), /* KROW2 */
  29. MTK_PIN_PUPD_SPEC_SR(122, 0xe10, 2, 1, 0, 0), /* KCOL0 */
  30. MTK_PIN_PUPD_SPEC_SR(123, 0xe10, 6, 5, 4, 0), /* KCOL1 */
  31. MTK_PIN_PUPD_SPEC_SR(124, 0xe10, 10, 9, 8, 0), /* KCOL2 */
  32. MTK_PIN_PUPD_SPEC_SR(67, 0xd10, 2, 1, 0, 0), /* ms0 DS */
  33. MTK_PIN_PUPD_SPEC_SR(68, 0xd00, 2, 1, 0, 0), /* ms0 RST */
  34. MTK_PIN_PUPD_SPEC_SR(66, 0xc10, 2, 1, 0, 0), /* ms0 cmd */
  35. MTK_PIN_PUPD_SPEC_SR(65, 0xc00, 2, 1, 0, 0), /* ms0 clk */
  36. MTK_PIN_PUPD_SPEC_SR(57, 0xc20, 2, 1, 0, 0), /* ms0 data0 */
  37. MTK_PIN_PUPD_SPEC_SR(58, 0xc20, 2, 1, 0, 0), /* ms0 data1 */
  38. MTK_PIN_PUPD_SPEC_SR(59, 0xc20, 2, 1, 0, 0), /* ms0 data2 */
  39. MTK_PIN_PUPD_SPEC_SR(60, 0xc20, 2, 1, 0, 0), /* ms0 data3 */
  40. MTK_PIN_PUPD_SPEC_SR(61, 0xc20, 2, 1, 0, 0), /* ms0 data4 */
  41. MTK_PIN_PUPD_SPEC_SR(62, 0xc20, 2, 1, 0, 0), /* ms0 data5 */
  42. MTK_PIN_PUPD_SPEC_SR(63, 0xc20, 2, 1, 0, 0), /* ms0 data6 */
  43. MTK_PIN_PUPD_SPEC_SR(64, 0xc20, 2, 1, 0, 0), /* ms0 data7 */
  44. MTK_PIN_PUPD_SPEC_SR(78, 0xc50, 2, 1, 0, 0), /* ms1 cmd */
  45. MTK_PIN_PUPD_SPEC_SR(73, 0xd20, 2, 1, 0, 0), /* ms1 dat0 */
  46. MTK_PIN_PUPD_SPEC_SR(74, 0xd20, 6, 5, 4, 0), /* ms1 dat1 */
  47. MTK_PIN_PUPD_SPEC_SR(75, 0xd20, 10, 9, 8, 0), /* ms1 dat2 */
  48. MTK_PIN_PUPD_SPEC_SR(76, 0xd20, 14, 13, 12, 0), /* ms1 dat3 */
  49. MTK_PIN_PUPD_SPEC_SR(77, 0xc40, 2, 1, 0, 0), /* ms1 clk */
  50. MTK_PIN_PUPD_SPEC_SR(100, 0xd40, 2, 1, 0, 0), /* ms2 dat0 */
  51. MTK_PIN_PUPD_SPEC_SR(101, 0xd40, 6, 5, 4, 0), /* ms2 dat1 */
  52. MTK_PIN_PUPD_SPEC_SR(102, 0xd40, 10, 9, 8, 0), /* ms2 dat2 */
  53. MTK_PIN_PUPD_SPEC_SR(103, 0xd40, 14, 13, 12, 0), /* ms2 dat3 */
  54. MTK_PIN_PUPD_SPEC_SR(104, 0xc80, 2, 1, 0, 0), /* ms2 clk */
  55. MTK_PIN_PUPD_SPEC_SR(105, 0xc90, 2, 1, 0, 0), /* ms2 cmd */
  56. MTK_PIN_PUPD_SPEC_SR(22, 0xd60, 2, 1, 0, 0), /* ms3 dat0 */
  57. MTK_PIN_PUPD_SPEC_SR(23, 0xd60, 6, 5, 4, 0), /* ms3 dat1 */
  58. MTK_PIN_PUPD_SPEC_SR(24, 0xd60, 10, 9, 8, 0), /* ms3 dat2 */
  59. MTK_PIN_PUPD_SPEC_SR(25, 0xd60, 14, 13, 12, 0), /* ms3 dat3 */
  60. MTK_PIN_PUPD_SPEC_SR(26, 0xcc0, 2, 1, 0, 0), /* ms3 clk */
  61. MTK_PIN_PUPD_SPEC_SR(27, 0xcd0, 2, 1, 0, 0) /* ms3 cmd */
  62. };
  63. static int mt8173_spec_pull_set(struct mtk_pinctrl *pctl,
  64. struct regmap *regmap, unsigned int pin,
  65. unsigned char align, bool isup, unsigned int r1r0)
  66. {
  67. return mtk_pctrl_spec_pull_set_samereg(pctl, regmap, mt8173_spec_pupd,
  68. ARRAY_SIZE(mt8173_spec_pupd), pin, align, isup, r1r0);
  69. }
  70. static const struct mtk_pin_ies_smt_set mt8173_smt_set[] = {
  71. MTK_PIN_IES_SMT_SPEC(0, 4, 0x930, 1),
  72. MTK_PIN_IES_SMT_SPEC(5, 9, 0x930, 2),
  73. MTK_PIN_IES_SMT_SPEC(10, 13, 0x930, 10),
  74. MTK_PIN_IES_SMT_SPEC(14, 15, 0x940, 10),
  75. MTK_PIN_IES_SMT_SPEC(16, 16, 0x930, 0),
  76. MTK_PIN_IES_SMT_SPEC(17, 17, 0x950, 2),
  77. MTK_PIN_IES_SMT_SPEC(18, 21, 0x940, 3),
  78. MTK_PIN_IES_SMT_SPEC(22, 25, 0xce0, 13),
  79. MTK_PIN_IES_SMT_SPEC(26, 26, 0xcc0, 13),
  80. MTK_PIN_IES_SMT_SPEC(27, 27, 0xcd0, 13),
  81. MTK_PIN_IES_SMT_SPEC(28, 28, 0xd70, 13),
  82. MTK_PIN_IES_SMT_SPEC(29, 32, 0x930, 3),
  83. MTK_PIN_IES_SMT_SPEC(33, 33, 0x930, 4),
  84. MTK_PIN_IES_SMT_SPEC(34, 36, 0x930, 5),
  85. MTK_PIN_IES_SMT_SPEC(37, 38, 0x930, 6),
  86. MTK_PIN_IES_SMT_SPEC(39, 39, 0x930, 7),
  87. MTK_PIN_IES_SMT_SPEC(40, 41, 0x930, 9),
  88. MTK_PIN_IES_SMT_SPEC(42, 42, 0x940, 0),
  89. MTK_PIN_IES_SMT_SPEC(43, 44, 0x930, 11),
  90. MTK_PIN_IES_SMT_SPEC(45, 46, 0x930, 12),
  91. MTK_PIN_IES_SMT_SPEC(57, 64, 0xc20, 13),
  92. MTK_PIN_IES_SMT_SPEC(65, 65, 0xc10, 13),
  93. MTK_PIN_IES_SMT_SPEC(66, 66, 0xc00, 13),
  94. MTK_PIN_IES_SMT_SPEC(67, 67, 0xd10, 13),
  95. MTK_PIN_IES_SMT_SPEC(68, 68, 0xd00, 13),
  96. MTK_PIN_IES_SMT_SPEC(69, 72, 0x940, 14),
  97. MTK_PIN_IES_SMT_SPEC(73, 76, 0xc60, 13),
  98. MTK_PIN_IES_SMT_SPEC(77, 77, 0xc40, 13),
  99. MTK_PIN_IES_SMT_SPEC(78, 78, 0xc50, 13),
  100. MTK_PIN_IES_SMT_SPEC(79, 82, 0x940, 15),
  101. MTK_PIN_IES_SMT_SPEC(83, 83, 0x950, 0),
  102. MTK_PIN_IES_SMT_SPEC(84, 85, 0x950, 1),
  103. MTK_PIN_IES_SMT_SPEC(86, 91, 0x950, 2),
  104. MTK_PIN_IES_SMT_SPEC(92, 92, 0x930, 13),
  105. MTK_PIN_IES_SMT_SPEC(93, 95, 0x930, 14),
  106. MTK_PIN_IES_SMT_SPEC(96, 99, 0x930, 15),
  107. MTK_PIN_IES_SMT_SPEC(100, 103, 0xca0, 13),
  108. MTK_PIN_IES_SMT_SPEC(104, 104, 0xc80, 13),
  109. MTK_PIN_IES_SMT_SPEC(105, 105, 0xc90, 13),
  110. MTK_PIN_IES_SMT_SPEC(106, 107, 0x940, 4),
  111. MTK_PIN_IES_SMT_SPEC(108, 112, 0x940, 1),
  112. MTK_PIN_IES_SMT_SPEC(113, 116, 0x940, 2),
  113. MTK_PIN_IES_SMT_SPEC(117, 118, 0x940, 5),
  114. MTK_PIN_IES_SMT_SPEC(119, 124, 0x940, 6),
  115. MTK_PIN_IES_SMT_SPEC(125, 126, 0x940, 7),
  116. MTK_PIN_IES_SMT_SPEC(127, 127, 0x940, 0),
  117. MTK_PIN_IES_SMT_SPEC(128, 128, 0x950, 8),
  118. MTK_PIN_IES_SMT_SPEC(129, 130, 0x950, 9),
  119. MTK_PIN_IES_SMT_SPEC(131, 132, 0x950, 8),
  120. MTK_PIN_IES_SMT_SPEC(133, 134, 0x910, 8)
  121. };
  122. static const struct mtk_pin_ies_smt_set mt8173_ies_set[] = {
  123. MTK_PIN_IES_SMT_SPEC(0, 4, 0x900, 1),
  124. MTK_PIN_IES_SMT_SPEC(5, 9, 0x900, 2),
  125. MTK_PIN_IES_SMT_SPEC(10, 13, 0x900, 10),
  126. MTK_PIN_IES_SMT_SPEC(14, 15, 0x910, 10),
  127. MTK_PIN_IES_SMT_SPEC(16, 16, 0x900, 0),
  128. MTK_PIN_IES_SMT_SPEC(17, 17, 0x920, 2),
  129. MTK_PIN_IES_SMT_SPEC(18, 21, 0x910, 3),
  130. MTK_PIN_IES_SMT_SPEC(22, 25, 0xce0, 14),
  131. MTK_PIN_IES_SMT_SPEC(26, 26, 0xcc0, 14),
  132. MTK_PIN_IES_SMT_SPEC(27, 27, 0xcd0, 14),
  133. MTK_PIN_IES_SMT_SPEC(28, 28, 0xd70, 14),
  134. MTK_PIN_IES_SMT_SPEC(29, 32, 0x900, 3),
  135. MTK_PIN_IES_SMT_SPEC(33, 33, 0x900, 4),
  136. MTK_PIN_IES_SMT_SPEC(34, 36, 0x900, 5),
  137. MTK_PIN_IES_SMT_SPEC(37, 38, 0x900, 6),
  138. MTK_PIN_IES_SMT_SPEC(39, 39, 0x900, 7),
  139. MTK_PIN_IES_SMT_SPEC(40, 41, 0x900, 9),
  140. MTK_PIN_IES_SMT_SPEC(42, 42, 0x910, 0),
  141. MTK_PIN_IES_SMT_SPEC(43, 44, 0x900, 11),
  142. MTK_PIN_IES_SMT_SPEC(45, 46, 0x900, 12),
  143. MTK_PIN_IES_SMT_SPEC(57, 64, 0xc20, 14),
  144. MTK_PIN_IES_SMT_SPEC(65, 65, 0xc10, 14),
  145. MTK_PIN_IES_SMT_SPEC(66, 66, 0xc00, 14),
  146. MTK_PIN_IES_SMT_SPEC(67, 67, 0xd10, 14),
  147. MTK_PIN_IES_SMT_SPEC(68, 68, 0xd00, 14),
  148. MTK_PIN_IES_SMT_SPEC(69, 72, 0x910, 14),
  149. MTK_PIN_IES_SMT_SPEC(73, 76, 0xc60, 14),
  150. MTK_PIN_IES_SMT_SPEC(77, 77, 0xc40, 14),
  151. MTK_PIN_IES_SMT_SPEC(78, 78, 0xc50, 14),
  152. MTK_PIN_IES_SMT_SPEC(79, 82, 0x910, 15),
  153. MTK_PIN_IES_SMT_SPEC(83, 83, 0x920, 0),
  154. MTK_PIN_IES_SMT_SPEC(84, 85, 0x920, 1),
  155. MTK_PIN_IES_SMT_SPEC(86, 91, 0x920, 2),
  156. MTK_PIN_IES_SMT_SPEC(92, 92, 0x900, 13),
  157. MTK_PIN_IES_SMT_SPEC(93, 95, 0x900, 14),
  158. MTK_PIN_IES_SMT_SPEC(96, 99, 0x900, 15),
  159. MTK_PIN_IES_SMT_SPEC(100, 103, 0xca0, 14),
  160. MTK_PIN_IES_SMT_SPEC(104, 104, 0xc80, 14),
  161. MTK_PIN_IES_SMT_SPEC(105, 105, 0xc90, 14),
  162. MTK_PIN_IES_SMT_SPEC(106, 107, 0x910, 4),
  163. MTK_PIN_IES_SMT_SPEC(108, 112, 0x910, 1),
  164. MTK_PIN_IES_SMT_SPEC(113, 116, 0x910, 2),
  165. MTK_PIN_IES_SMT_SPEC(117, 118, 0x910, 5),
  166. MTK_PIN_IES_SMT_SPEC(119, 124, 0x910, 6),
  167. MTK_PIN_IES_SMT_SPEC(125, 126, 0x910, 7),
  168. MTK_PIN_IES_SMT_SPEC(127, 127, 0x910, 0),
  169. MTK_PIN_IES_SMT_SPEC(128, 128, 0x920, 8),
  170. MTK_PIN_IES_SMT_SPEC(129, 130, 0x920, 9),
  171. MTK_PIN_IES_SMT_SPEC(131, 132, 0x920, 8),
  172. MTK_PIN_IES_SMT_SPEC(133, 134, 0x910, 8)
  173. };
  174. static int mt8173_ies_smt_set(struct mtk_pinctrl *pctl,
  175. struct regmap *regmap, unsigned int pin,
  176. unsigned char align, int value, enum pin_config_param arg)
  177. {
  178. if (arg == PIN_CONFIG_INPUT_ENABLE)
  179. return mtk_pconf_spec_set_ies_smt_range(regmap, mt8173_ies_set,
  180. ARRAY_SIZE(mt8173_ies_set), pin, align, value);
  181. else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
  182. return mtk_pconf_spec_set_ies_smt_range(regmap, mt8173_smt_set,
  183. ARRAY_SIZE(mt8173_smt_set), pin, align, value);
  184. return -EINVAL;
  185. }
  186. static const struct mtk_drv_group_desc mt8173_drv_grp[] = {
  187. /* 0E4E8SR 4/8/12/16 */
  188. MTK_DRV_GRP(4, 16, 1, 2, 4),
  189. /* 0E2E4SR 2/4/6/8 */
  190. MTK_DRV_GRP(2, 8, 1, 2, 2),
  191. /* E8E4E2 2/4/6/8/10/12/14/16 */
  192. MTK_DRV_GRP(2, 16, 0, 2, 2)
  193. };
  194. static const struct mtk_pin_drv_grp mt8173_pin_drv[] = {
  195. MTK_PIN_DRV_GRP(0, DRV_BASE+0x20, 12, 0),
  196. MTK_PIN_DRV_GRP(1, DRV_BASE+0x20, 12, 0),
  197. MTK_PIN_DRV_GRP(2, DRV_BASE+0x20, 12, 0),
  198. MTK_PIN_DRV_GRP(3, DRV_BASE+0x20, 12, 0),
  199. MTK_PIN_DRV_GRP(4, DRV_BASE+0x20, 12, 0),
  200. MTK_PIN_DRV_GRP(5, DRV_BASE+0x30, 0, 0),
  201. MTK_PIN_DRV_GRP(6, DRV_BASE+0x30, 0, 0),
  202. MTK_PIN_DRV_GRP(7, DRV_BASE+0x30, 0, 0),
  203. MTK_PIN_DRV_GRP(8, DRV_BASE+0x30, 0, 0),
  204. MTK_PIN_DRV_GRP(9, DRV_BASE+0x30, 0, 0),
  205. MTK_PIN_DRV_GRP(10, DRV_BASE+0x30, 4, 1),
  206. MTK_PIN_DRV_GRP(11, DRV_BASE+0x30, 4, 1),
  207. MTK_PIN_DRV_GRP(12, DRV_BASE+0x30, 4, 1),
  208. MTK_PIN_DRV_GRP(13, DRV_BASE+0x30, 4, 1),
  209. MTK_PIN_DRV_GRP(14, DRV_BASE+0x40, 8, 1),
  210. MTK_PIN_DRV_GRP(15, DRV_BASE+0x40, 8, 1),
  211. MTK_PIN_DRV_GRP(16, DRV_BASE, 8, 1),
  212. MTK_PIN_DRV_GRP(17, 0xce0, 8, 2),
  213. MTK_PIN_DRV_GRP(22, 0xce0, 8, 2),
  214. MTK_PIN_DRV_GRP(23, 0xce0, 8, 2),
  215. MTK_PIN_DRV_GRP(24, 0xce0, 8, 2),
  216. MTK_PIN_DRV_GRP(25, 0xce0, 8, 2),
  217. MTK_PIN_DRV_GRP(26, 0xcc0, 8, 2),
  218. MTK_PIN_DRV_GRP(27, 0xcd0, 8, 2),
  219. MTK_PIN_DRV_GRP(28, 0xd70, 8, 2),
  220. MTK_PIN_DRV_GRP(29, DRV_BASE+0x80, 12, 1),
  221. MTK_PIN_DRV_GRP(30, DRV_BASE+0x80, 12, 1),
  222. MTK_PIN_DRV_GRP(31, DRV_BASE+0x80, 12, 1),
  223. MTK_PIN_DRV_GRP(32, DRV_BASE+0x80, 12, 1),
  224. MTK_PIN_DRV_GRP(33, DRV_BASE+0x10, 12, 1),
  225. MTK_PIN_DRV_GRP(34, DRV_BASE+0x10, 8, 1),
  226. MTK_PIN_DRV_GRP(35, DRV_BASE+0x10, 8, 1),
  227. MTK_PIN_DRV_GRP(36, DRV_BASE+0x10, 8, 1),
  228. MTK_PIN_DRV_GRP(37, DRV_BASE+0x10, 4, 1),
  229. MTK_PIN_DRV_GRP(38, DRV_BASE+0x10, 4, 1),
  230. MTK_PIN_DRV_GRP(39, DRV_BASE+0x20, 0, 0),
  231. MTK_PIN_DRV_GRP(40, DRV_BASE+0x20, 8, 0),
  232. MTK_PIN_DRV_GRP(41, DRV_BASE+0x20, 8, 0),
  233. MTK_PIN_DRV_GRP(42, DRV_BASE+0x50, 8, 1),
  234. MTK_PIN_DRV_GRP(57, 0xc20, 8, 2),
  235. MTK_PIN_DRV_GRP(58, 0xc20, 8, 2),
  236. MTK_PIN_DRV_GRP(59, 0xc20, 8, 2),
  237. MTK_PIN_DRV_GRP(60, 0xc20, 8, 2),
  238. MTK_PIN_DRV_GRP(61, 0xc20, 8, 2),
  239. MTK_PIN_DRV_GRP(62, 0xc20, 8, 2),
  240. MTK_PIN_DRV_GRP(63, 0xc20, 8, 2),
  241. MTK_PIN_DRV_GRP(64, 0xc20, 8, 2),
  242. MTK_PIN_DRV_GRP(65, 0xc00, 8, 2),
  243. MTK_PIN_DRV_GRP(66, 0xc10, 8, 2),
  244. MTK_PIN_DRV_GRP(67, 0xd10, 8, 2),
  245. MTK_PIN_DRV_GRP(68, 0xd00, 8, 2),
  246. MTK_PIN_DRV_GRP(69, DRV_BASE+0x80, 0, 1),
  247. MTK_PIN_DRV_GRP(70, DRV_BASE+0x80, 0, 1),
  248. MTK_PIN_DRV_GRP(71, DRV_BASE+0x80, 0, 1),
  249. MTK_PIN_DRV_GRP(72, DRV_BASE+0x80, 0, 1),
  250. MTK_PIN_DRV_GRP(73, 0xc60, 8, 2),
  251. MTK_PIN_DRV_GRP(74, 0xc60, 8, 2),
  252. MTK_PIN_DRV_GRP(75, 0xc60, 8, 2),
  253. MTK_PIN_DRV_GRP(76, 0xc60, 8, 2),
  254. MTK_PIN_DRV_GRP(77, 0xc40, 8, 2),
  255. MTK_PIN_DRV_GRP(78, 0xc50, 8, 2),
  256. MTK_PIN_DRV_GRP(79, DRV_BASE+0x70, 12, 1),
  257. MTK_PIN_DRV_GRP(80, DRV_BASE+0x70, 12, 1),
  258. MTK_PIN_DRV_GRP(81, DRV_BASE+0x70, 12, 1),
  259. MTK_PIN_DRV_GRP(82, DRV_BASE+0x70, 12, 1),
  260. MTK_PIN_DRV_GRP(83, DRV_BASE, 4, 1),
  261. MTK_PIN_DRV_GRP(84, DRV_BASE, 0, 1),
  262. MTK_PIN_DRV_GRP(85, DRV_BASE, 0, 1),
  263. MTK_PIN_DRV_GRP(85, DRV_BASE+0x60, 8, 1),
  264. MTK_PIN_DRV_GRP(86, DRV_BASE+0x60, 8, 1),
  265. MTK_PIN_DRV_GRP(87, DRV_BASE+0x60, 8, 1),
  266. MTK_PIN_DRV_GRP(88, DRV_BASE+0x60, 8, 1),
  267. MTK_PIN_DRV_GRP(89, DRV_BASE+0x60, 8, 1),
  268. MTK_PIN_DRV_GRP(90, DRV_BASE+0x60, 8, 1),
  269. MTK_PIN_DRV_GRP(91, DRV_BASE+0x60, 8, 1),
  270. MTK_PIN_DRV_GRP(92, DRV_BASE+0x60, 4, 0),
  271. MTK_PIN_DRV_GRP(93, DRV_BASE+0x60, 0, 0),
  272. MTK_PIN_DRV_GRP(94, DRV_BASE+0x60, 0, 0),
  273. MTK_PIN_DRV_GRP(95, DRV_BASE+0x60, 0, 0),
  274. MTK_PIN_DRV_GRP(96, DRV_BASE+0x80, 8, 1),
  275. MTK_PIN_DRV_GRP(97, DRV_BASE+0x80, 8, 1),
  276. MTK_PIN_DRV_GRP(98, DRV_BASE+0x80, 8, 1),
  277. MTK_PIN_DRV_GRP(99, DRV_BASE+0x80, 8, 1),
  278. MTK_PIN_DRV_GRP(100, 0xca0, 8, 2),
  279. MTK_PIN_DRV_GRP(101, 0xca0, 8, 2),
  280. MTK_PIN_DRV_GRP(102, 0xca0, 8, 2),
  281. MTK_PIN_DRV_GRP(103, 0xca0, 8, 2),
  282. MTK_PIN_DRV_GRP(104, 0xc80, 8, 2),
  283. MTK_PIN_DRV_GRP(105, 0xc90, 8, 2),
  284. MTK_PIN_DRV_GRP(108, DRV_BASE+0x50, 0, 1),
  285. MTK_PIN_DRV_GRP(109, DRV_BASE+0x50, 0, 1),
  286. MTK_PIN_DRV_GRP(110, DRV_BASE+0x50, 0, 1),
  287. MTK_PIN_DRV_GRP(111, DRV_BASE+0x50, 0, 1),
  288. MTK_PIN_DRV_GRP(112, DRV_BASE+0x50, 0, 1),
  289. MTK_PIN_DRV_GRP(113, DRV_BASE+0x80, 4, 1),
  290. MTK_PIN_DRV_GRP(114, DRV_BASE+0x80, 4, 1),
  291. MTK_PIN_DRV_GRP(115, DRV_BASE+0x80, 4, 1),
  292. MTK_PIN_DRV_GRP(116, DRV_BASE+0x80, 4, 1),
  293. MTK_PIN_DRV_GRP(117, DRV_BASE+0x90, 0, 1),
  294. MTK_PIN_DRV_GRP(118, DRV_BASE+0x90, 0, 1),
  295. MTK_PIN_DRV_GRP(119, DRV_BASE+0x50, 4, 1),
  296. MTK_PIN_DRV_GRP(120, DRV_BASE+0x50, 4, 1),
  297. MTK_PIN_DRV_GRP(121, DRV_BASE+0x50, 4, 1),
  298. MTK_PIN_DRV_GRP(122, DRV_BASE+0x50, 4, 1),
  299. MTK_PIN_DRV_GRP(123, DRV_BASE+0x50, 4, 1),
  300. MTK_PIN_DRV_GRP(124, DRV_BASE+0x50, 4, 1),
  301. MTK_PIN_DRV_GRP(125, DRV_BASE+0x30, 12, 1),
  302. MTK_PIN_DRV_GRP(126, DRV_BASE+0x30, 12, 1),
  303. MTK_PIN_DRV_GRP(127, DRV_BASE+0x50, 8, 1),
  304. MTK_PIN_DRV_GRP(128, DRV_BASE+0x40, 0, 1),
  305. MTK_PIN_DRV_GRP(129, DRV_BASE+0x40, 0, 1),
  306. MTK_PIN_DRV_GRP(130, DRV_BASE+0x40, 0, 1),
  307. MTK_PIN_DRV_GRP(131, DRV_BASE+0x40, 0, 1),
  308. MTK_PIN_DRV_GRP(132, DRV_BASE+0x40, 0, 1)
  309. };
  310. static const struct mtk_pinctrl_devdata mt8173_pinctrl_data = {
  311. .pins = mtk_pins_mt8173,
  312. .npins = ARRAY_SIZE(mtk_pins_mt8173),
  313. .grp_desc = mt8173_drv_grp,
  314. .n_grp_cls = ARRAY_SIZE(mt8173_drv_grp),
  315. .pin_drv_grp = mt8173_pin_drv,
  316. .n_pin_drv_grps = ARRAY_SIZE(mt8173_pin_drv),
  317. .spec_pull_set = mt8173_spec_pull_set,
  318. .spec_ies_smt_set = mt8173_ies_smt_set,
  319. .dir_offset = 0x0000,
  320. .pullen_offset = 0x0100,
  321. .pullsel_offset = 0x0200,
  322. .dout_offset = 0x0400,
  323. .din_offset = 0x0500,
  324. .pinmux_offset = 0x0600,
  325. .type1_start = 135,
  326. .type1_end = 135,
  327. .regmap_num = 1,
  328. .port_shf = 4,
  329. .port_mask = 0xf,
  330. .port_align = 4,
  331. .port_pin_shf = 4,
  332. .eint_offsets = {
  333. .name = "mt8173_eint",
  334. .stat = 0x000,
  335. .ack = 0x040,
  336. .mask = 0x080,
  337. .mask_set = 0x0c0,
  338. .mask_clr = 0x100,
  339. .sens = 0x140,
  340. .sens_set = 0x180,
  341. .sens_clr = 0x1c0,
  342. .soft = 0x200,
  343. .soft_set = 0x240,
  344. .soft_clr = 0x280,
  345. .pol = 0x300,
  346. .pol_set = 0x340,
  347. .pol_clr = 0x380,
  348. .dom_en = 0x400,
  349. .dbnc_ctrl = 0x500,
  350. .dbnc_set = 0x600,
  351. .dbnc_clr = 0x700,
  352. .port_mask = 7,
  353. .ports = 6,
  354. },
  355. .ap_num = 224,
  356. .db_cnt = 16,
  357. };
  358. static int mt8173_pinctrl_probe(struct platform_device *pdev)
  359. {
  360. return mtk_pctrl_init(pdev, &mt8173_pinctrl_data, NULL);
  361. }
  362. static const struct of_device_id mt8173_pctrl_match[] = {
  363. {
  364. .compatible = "mediatek,mt8173-pinctrl",
  365. },
  366. { }
  367. };
  368. static struct platform_driver mtk_pinctrl_driver = {
  369. .probe = mt8173_pinctrl_probe,
  370. .driver = {
  371. .name = "mediatek-mt8173-pinctrl",
  372. .of_match_table = mt8173_pctrl_match,
  373. .pm = &mtk_eint_pm_ops,
  374. },
  375. };
  376. static int __init mtk_pinctrl_init(void)
  377. {
  378. return platform_driver_register(&mtk_pinctrl_driver);
  379. }
  380. arch_initcall(mtk_pinctrl_init);