1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (c) 2022 Collabora Ltd.
4  * Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
5  */
6 
7 #include "pinctrl-mtk-mt6795.h"
8 #include "pinctrl-paris.h"
9 
10 #define PIN_FIELD15(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)	\
11 	PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit,	\
12 		       _x_bits, 15, 0)
13 
14 #define PIN_FIELD16(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)	\
15 	PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit,	\
16 		       _x_bits, 16, 0)
17 
18 #define PINS_FIELD16(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)\
19 	PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit,	\
20 		       _x_bits, 16, 1)
21 
22 static const struct mtk_pin_field_calc mt6795_pin_dir_range[] = {
23 	PIN_FIELD16(0, 196, 0x0, 0x10, 0, 1),
24 };
25 
26 static const struct mtk_pin_field_calc mt6795_pin_pullen_range[] = {
27 	PIN_FIELD16(0, 196, 0x100, 0x10, 0, 1),
28 };
29 
30 static const struct mtk_pin_field_calc mt6795_pin_pullsel_range[] = {
31 	PIN_FIELD16(0, 196, 0x200, 0x10, 0, 1),
32 };
33 
34 static const struct mtk_pin_field_calc mt6795_pin_do_range[] = {
35 	PIN_FIELD16(0, 196, 0x400, 0x10, 0, 1),
36 };
37 
38 static const struct mtk_pin_field_calc mt6795_pin_di_range[] = {
39 	PIN_FIELD16(0, 196, 0x500, 0x10, 0, 1),
40 };
41 
42 static const struct mtk_pin_field_calc mt6795_pin_mode_range[] = {
43 	PIN_FIELD15(0, 196, 0x600, 0x10, 0, 3),
44 };
45 
46 static const struct mtk_pin_field_calc mt6795_pin_ies_range[] = {
47 	PINS_FIELD16(0, 4, 0x900, 0x10, 1, 1),
48 	PINS_FIELD16(5, 9, 0x900, 0x10, 2, 1),
49 	PINS_FIELD16(10, 15, 0x900, 0x10, 10, 1),
50 	PINS_FIELD16(16, 16, 0x900, 0x10, 2, 1),
51 	PINS_FIELD16(17, 19, 0x910, 0x10, 3, 1),
52 	PINS_FIELD16(20, 22, 0x910, 0x10, 4, 1),
53 	PINS_FIELD16(23, 26, 0xce0, 0x10, 14, 1),
54 	PINS_FIELD16(27, 27, 0xcc0, 0x10, 14, 1),
55 	PINS_FIELD16(28, 28, 0xcd0, 0x10, 14, 1),
56 	PINS_FIELD16(29, 32, 0x900, 0x10, 3, 1),
57 	PINS_FIELD16(33, 33, 0x900, 0x10, 4, 1),
58 	PINS_FIELD16(34, 36, 0x900, 0x10, 5, 1),
59 	PINS_FIELD16(37, 38, 0x900, 0x10, 6, 1),
60 	PINS_FIELD16(39, 39, 0x900, 0x10, 7, 1),
61 	PINS_FIELD16(40, 40, 0x900, 0x10, 8, 1),
62 	PINS_FIELD16(41, 42, 0x900, 0x10, 9, 1),
63 	PINS_FIELD16(43, 46, 0x900, 0x10, 11, 1),
64 	PINS_FIELD16(47, 61, 0x920, 0x10, 3, 1),
65 	PINS_FIELD16(62, 66, 0x920, 0x10, 4, 1),
66 	PINS_FIELD16(67, 67, 0x920, 0x10, 3, 1),
67 	PINS_FIELD16(68, 72, 0x920, 0x10, 5, 1),
68 	PINS_FIELD16(73, 77, 0x920, 0x10, 6, 1),
69 	PINS_FIELD16(78, 91, 0x920, 0x10, 7, 1),
70 	PINS_FIELD16(92, 92, 0x900, 0x10, 13, 1),
71 	PINS_FIELD16(93, 95, 0x900, 0x10, 14, 1),
72 	PINS_FIELD16(96, 99, 0x900, 0x10, 15, 1),
73 	PINS_FIELD16(100, 103, 0xca0, 0x10, 14, 1),
74 	PINS_FIELD16(104, 104, 0xc80, 0x10, 14, 1),
75 	PINS_FIELD16(105, 105, 0xc90, 0x10, 14, 1),
76 	PINS_FIELD16(106, 107, 0x910, 0x10, 0, 1),
77 	PINS_FIELD16(108, 112, 0x910, 0x10, 1, 1),
78 	PINS_FIELD16(113, 116, 0x910, 0x10, 2, 1),
79 	PINS_FIELD16(117, 118, 0x910, 0x10, 5, 1),
80 	PINS_FIELD16(119, 124, 0x910, 0x10, 6, 1),
81 	PINS_FIELD16(125, 126, 0x910, 0x10, 7, 1),
82 	PINS_FIELD16(129, 129, 0x910, 0x10, 8, 1),
83 	PINS_FIELD16(130, 131, 0x910, 0x10, 9, 1),
84 	PINS_FIELD16(132, 135, 0x910, 0x10, 8, 1),
85 	PINS_FIELD16(136, 137, 0x910, 0x10, 7, 1),
86 	PINS_FIELD16(154, 161, 0xc20, 0x10, 14, 1),
87 	PINS_FIELD16(162, 162, 0xc10, 0x10, 14, 1),
88 	PINS_FIELD16(163, 163, 0xc00, 0x10, 14, 1),
89 	PINS_FIELD16(164, 164, 0xd10, 0x10, 14, 1),
90 	PINS_FIELD16(165, 165, 0xd00, 0x10, 14, 1),
91 	PINS_FIELD16(166, 169, 0x910, 0x10, 14, 1),
92 	PINS_FIELD16(176, 179, 0x910, 0x10, 15, 1),
93 	PINS_FIELD16(180, 180, 0x920, 0x10, 0, 1),
94 	PINS_FIELD16(181, 184, 0x920, 0x10, 1, 1),
95 	PINS_FIELD16(185, 191, 0x920, 0x10, 2, 1),
96 	PINS_FIELD16(192, 192, 0x920, 0x10, 8, 1),
97 	PINS_FIELD16(193, 194, 0x920, 0x10, 9, 1),
98 	PINS_FIELD16(195, 196, 0x920, 0x10, 8, 1),
99 };
100 
101 static const struct mtk_pin_field_calc mt6795_pin_smt_range[] = {
102 	PINS_FIELD16(0, 4, 0x930, 0x10, 1, 1),
103 	PINS_FIELD16(5, 9, 0x930, 0x10, 2, 1),
104 	PINS_FIELD16(10, 15, 0x930, 0x10, 10, 1),
105 	PINS_FIELD16(16, 16, 0x930, 0x10, 2, 1),
106 	PINS_FIELD16(17, 19, 0x940, 0x10, 3, 1),
107 	PINS_FIELD16(20, 22, 0x940, 0x10, 4, 1),
108 	PINS_FIELD16(23, 26, 0xce0, 0x10, 13, 1),
109 	PINS_FIELD16(27, 27, 0xcc0, 0x10, 13, 1),
110 	PINS_FIELD16(28, 28, 0xcd0, 0x10, 13, 1),
111 	PINS_FIELD16(29, 32, 0x930, 0x10, 3, 1),
112 	PINS_FIELD16(33, 33, 0x930, 0x10, 4, 1),
113 	PINS_FIELD16(34, 36, 0x930, 0x10, 5, 1),
114 	PINS_FIELD16(37, 38, 0x930, 0x10, 6, 1),
115 	PINS_FIELD16(39, 39, 0x930, 0x10, 7, 1),
116 	PINS_FIELD16(40, 40, 0x930, 0x10, 8, 1),
117 	PINS_FIELD16(41, 42, 0x930, 0x10, 9, 1),
118 	PINS_FIELD16(43, 46, 0x930, 0x10, 11, 1),
119 	PINS_FIELD16(47, 61, 0x950, 0x10, 3, 1),
120 	PINS_FIELD16(62, 66, 0x950, 0x10, 4, 1),
121 	PINS_FIELD16(67, 67, 0x950, 0x10, 3, 1),
122 	PINS_FIELD16(68, 72, 0x950, 0x10, 5, 1),
123 	PINS_FIELD16(73, 77, 0x950, 0x10, 6, 1),
124 	PINS_FIELD16(78, 91, 0x950, 0x10, 7, 1),
125 	PINS_FIELD16(92, 92, 0x930, 0x10, 13, 1),
126 	PINS_FIELD16(93, 95, 0x930, 0x10, 14, 1),
127 	PINS_FIELD16(96, 99, 0x930, 0x10, 15, 1),
128 	PINS_FIELD16(100, 103, 0xca0, 0x10, 13, 1),
129 	PINS_FIELD16(104, 104, 0xc80, 0x10, 13, 1),
130 	PINS_FIELD16(105, 105, 0xc90, 0x10, 13, 1),
131 	PINS_FIELD16(106, 107, 0x940, 0x10, 0, 1),
132 	PINS_FIELD16(108, 112, 0x940, 0x10, 1, 1),
133 	PINS_FIELD16(113, 116, 0x940, 0x10, 2, 1),
134 	PINS_FIELD16(117, 118, 0x940, 0x10, 5, 1),
135 	PINS_FIELD16(119, 124, 0x940, 0x10, 6, 1),
136 	PINS_FIELD16(125, 126, 0x940, 0x10, 7, 1),
137 	PINS_FIELD16(129, 129, 0x940, 0x10, 8, 1),
138 	PINS_FIELD16(130, 131, 0x940, 0x10, 9, 1),
139 	PINS_FIELD16(132, 135, 0x940, 0x10, 8, 1),
140 	PINS_FIELD16(136, 137, 0x940, 0x10, 7, 1),
141 	PINS_FIELD16(154, 161, 0xc20, 0x10, 13, 1),
142 	PINS_FIELD16(162, 162, 0xc10, 0x10, 13, 1),
143 	PINS_FIELD16(163, 163, 0xc00, 0x10, 13, 1),
144 	PINS_FIELD16(164, 164, 0xd10, 0x10, 13, 1),
145 	PINS_FIELD16(165, 165, 0xd00, 0x10, 13, 1),
146 	PINS_FIELD16(166, 169, 0x940, 0x10, 14, 1),
147 	PINS_FIELD16(176, 179, 0x940, 0x10, 15, 1),
148 	PINS_FIELD16(180, 180, 0x950, 0x10, 0, 1),
149 	PINS_FIELD16(181, 184, 0x950, 0x10, 1, 1),
150 	PINS_FIELD16(185, 191, 0x950, 0x10, 2, 1),
151 	PINS_FIELD16(192, 192, 0x950, 0x10, 8, 1),
152 	PINS_FIELD16(193, 194, 0x950, 0x10, 9, 1),
153 	PINS_FIELD16(195, 196, 0x950, 0x10, 8, 1),
154 };
155 
156 
157 static const struct mtk_pin_field_calc mt6795_pin_pupd_range[] = {
158 	/* KROW */
159 	PIN_FIELD16(119, 119, 0xe00, 0x10, 2, 1),	/* KROW0 */
160 	PIN_FIELD16(120, 120, 0xe00, 0x10, 6, 1),	/* KROW1 */
161 	PIN_FIELD16(121, 121, 0xe00, 0x10, 10, 1),	/* KROW2 */
162 	PIN_FIELD16(122, 122, 0xe10, 0x10, 2, 1),	/* KCOL0 */
163 	PIN_FIELD16(123, 123, 0xe10, 0x10, 6, 1),	/* KCOL1 */
164 	PIN_FIELD16(124, 124, 0xe10, 0x10, 10, 1),	/* KCOL2 */
165 
166 	/* DPI */
167 	PIN_FIELD16(138, 138, 0xd50, 0x10, 2, 1),	/* CK */
168 	PIN_FIELD16(139, 139, 0xd60, 0x10, 1, 1),	/* DE */
169 	PIN_FIELD16(140, 140, 0xd70, 0x10, 1, 1),	/* data0 */
170 	PIN_FIELD16(141, 141, 0xd70, 0x10, 3, 1),	/* data1 */
171 	PIN_FIELD16(142, 142, 0xd70, 0x10, 5, 1),	/* data2 */
172 	PIN_FIELD16(143, 143, 0xd70, 0x10, 7, 1),	/* data3 */
173 	PIN_FIELD16(144, 144, 0xd50, 0x10, 5, 1),	/* data4 */
174 	PIN_FIELD16(145, 145, 0xd50, 0x10, 7, 1),	/* data5 */
175 	PIN_FIELD16(146, 146, 0xd60, 0x10, 7, 1),	/* data6 */
176 	PIN_FIELD16(147, 147, 0xed0, 0x10, 6, 1),	/* data7 */
177 	PIN_FIELD16(148, 148, 0xed0, 0x10, 8, 1),	/* data8 */
178 	PIN_FIELD16(149, 149, 0xed0, 0x10, 10, 1),	/* data9 */
179 	PIN_FIELD16(150, 150, 0xed0, 0x10, 12, 1),	/* data10 */
180 	PIN_FIELD16(151, 151, 0xed0, 0x10, 14, 1),	/* data11 */
181 	PIN_FIELD16(152, 152, 0xd60, 0x10, 3, 1),	/* hsync */
182 	PIN_FIELD16(153, 153, 0xd60, 0x10, 5, 1),	/* vsync */
183 
184 	/* MSDC0 */
185 	PIN_FIELD16(154, 154, 0xc20, 0x10, 2, 1),	/* DATA 0-7 */
186 	PIN_FIELD16(155, 155, 0xc20, 0x10, 2, 1),	/* DATA 0-7 */
187 	PIN_FIELD16(156, 156, 0xc20, 0x10, 2, 1),	/* DATA 0-7 */
188 	PIN_FIELD16(157, 157, 0xc20, 0x10, 2, 1),	/* DATA 0-7 */
189 	PIN_FIELD16(158, 158, 0xc20, 0x10, 2, 1),	/* DATA 0-7 */
190 	PIN_FIELD16(159, 159, 0xc20, 0x10, 2, 1),	/* DATA 0-7 */
191 	PIN_FIELD16(160, 160, 0xc20, 0x10, 2, 1),	/* DATA 0-7 */
192 	PIN_FIELD16(161, 161, 0xc20, 0x10, 2, 1),	/* DATA 0-7 */
193 	PIN_FIELD16(162, 162, 0xc10, 0x10, 2, 1),	/* CMD */
194 	PIN_FIELD16(163, 163, 0xc00, 0x10, 2, 1),	/* CLK */
195 	PIN_FIELD16(164, 164, 0xd10, 0x10, 2, 1),	/* DS  */
196 	PIN_FIELD16(165, 165, 0xd00, 0x10, 2, 1),	/* RST */
197 
198 	/* MSDC1 */
199 	PIN_FIELD16(170, 170, 0xc50, 0x10, 2, 1),	/* CMD */
200 	PIN_FIELD16(171, 171, 0xd20, 0x10, 2, 1),	/* DAT0 */
201 	PIN_FIELD16(172, 172, 0xd20, 0x10, 6, 1),	/* DAT1 */
202 	PIN_FIELD16(173, 173, 0xd20, 0x10, 10, 1),	/* DAT2 */
203 	PIN_FIELD16(174, 174, 0xd20, 0x10, 14, 1),	/* DAT3 */
204 	PIN_FIELD16(175, 175, 0xc40, 0x10, 2, 1),	/* CLK */
205 
206 	/* MSDC2 */
207 	PIN_FIELD16(100, 100, 0xd30, 0x10, 2, 1),	/* DAT0 */
208 	PIN_FIELD16(101, 101, 0xd30, 0x10, 6, 1),	/* DAT1 */
209 	PIN_FIELD16(102, 102, 0xd30, 0x10, 10, 1),	/* DAT2 */
210 	PIN_FIELD16(103, 103, 0xd30, 0x10, 14, 1),	/* DAT3 */
211 	PIN_FIELD16(104, 104, 0xc80, 0x10, 2, 1),	/* CLK */
212 	PIN_FIELD16(105, 105, 0xc90, 0x10, 2, 1),	/* CMD */
213 
214 	/* MSDC3 */
215 	PIN_FIELD16(23, 23, 0xd40, 0x10, 2, 1),		/* DAT0 */
216 	PIN_FIELD16(24, 24, 0xd40, 0x10, 6, 5),		/* DAT1 */
217 	PIN_FIELD16(25, 25, 0xd40, 0x10, 10, 9),	/* DAT2 */
218 	PIN_FIELD16(26, 26, 0xd40, 0x10, 14, 13),	/* DAT3 */
219 	PIN_FIELD16(27, 27, 0xcc0, 0x10, 2, 1),		/* CLK */
220 	PIN_FIELD16(28, 28, 0xcd0, 0x10, 2, 1)		/* CMD */
221 };
222 
223 static const struct mtk_pin_field_calc mt6795_pin_r0_range[] = {
224 	PIN_FIELD16(23, 23, 0xd40, 0x10, 0, 1),
225 	PIN_FIELD16(24, 24, 0xd40, 0x10, 4, 1),
226 	PIN_FIELD16(25, 25, 0xd40, 0x10, 8, 1),
227 	PIN_FIELD16(26, 26, 0xd40, 0x10, 12, 1),
228 	PIN_FIELD16(27, 27, 0xcc0, 0x10, 0, 1),
229 	PIN_FIELD16(28, 28, 0xcd0, 0x10, 0, 1),
230 	PIN_FIELD16(100, 100, 0xd30, 0x10, 0, 1),
231 	PIN_FIELD16(101, 101, 0xd30, 0x10, 4, 1),
232 	PIN_FIELD16(102, 102, 0xd30, 0x10, 8, 1),
233 	PIN_FIELD16(103, 103, 0xd30, 0x10, 12, 1),
234 	PIN_FIELD16(104, 104, 0xc80, 0x10, 0, 1),
235 	PIN_FIELD16(105, 105, 0xc90, 0x10, 0, 1),
236 	PIN_FIELD16(119, 119, 0xe00, 0x10, 0, 1),
237 	PIN_FIELD16(120, 120, 0xe00, 0x10, 4, 1),
238 	PIN_FIELD16(121, 121, 0xe00, 0x10, 8, 1),
239 	PIN_FIELD16(122, 122, 0xe10, 0x10, 0, 1),
240 	PIN_FIELD16(123, 123, 0xe10, 0x10, 4, 1),
241 	PIN_FIELD16(124, 124, 0xe10, 0x10, 8, 1),
242 	PIN_FIELD16(138, 138, 0xd50, 0x10, 0, 1),
243 	PIN_FIELD16(139, 139, 0xd60, 0x10, 0, 1),
244 	PIN_FIELD16(140, 140, 0xd70, 0x10, 0, 1),
245 	PIN_FIELD16(141, 141, 0xd70, 0x10, 1, 1),
246 	PIN_FIELD16(142, 142, 0xd70, 0x10, 3, 1),
247 	PIN_FIELD16(143, 143, 0xd70, 0x10, 5, 1),
248 	PIN_FIELD16(144, 144, 0xd50, 0x10, 3, 1),
249 	PIN_FIELD16(145, 145, 0xd50, 0x10, 5, 1),
250 	PIN_FIELD16(146, 146, 0xd60, 0x10, 5, 1),
251 	PIN_FIELD16(147, 147, 0xed0, 0x10, 4, 1),
252 	PIN_FIELD16(148, 148, 0xed0, 0x10, 6, 1),
253 	PIN_FIELD16(149, 149, 0xed0, 0x10, 8, 1),
254 	PIN_FIELD16(150, 150, 0xed0, 0x10, 10, 1),
255 	PIN_FIELD16(151, 151, 0xed0, 0x10, 12, 1),
256 	PIN_FIELD16(152, 152, 0xd60, 0x10, 1, 1),
257 	PIN_FIELD16(153, 153, 0xd60, 0x10, 3, 1),
258 	PIN_FIELD16(154, 155, 0xc20, 0x10, 0, 1),
259 	PIN_FIELD16(155, 156, 0xc20, 0x10, 0, 1),
260 	PIN_FIELD16(156, 157, 0xc20, 0x10, 0, 1),
261 	PIN_FIELD16(157, 158, 0xc20, 0x10, 0, 1),
262 	PIN_FIELD16(158, 159, 0xc20, 0x10, 0, 1),
263 	PIN_FIELD16(159, 160, 0xc20, 0x10, 0, 1),
264 	PIN_FIELD16(160, 161, 0xc20, 0x10, 0, 1),
265 	PIN_FIELD16(161, 161, 0xc20, 0x10, 0, 1),
266 	PIN_FIELD16(162, 162, 0xc10, 0x10, 0, 1),
267 	PIN_FIELD16(163, 163, 0xc00, 0x10, 0, 1),
268 	PIN_FIELD16(164, 164, 0xd10, 0x10, 0, 1),
269 	PIN_FIELD16(165, 165, 0xd00, 0x10, 0, 1),
270 	PIN_FIELD16(170, 170, 0xc50, 0x10, 0, 1),
271 	PIN_FIELD16(171, 171, 0xd20, 0x10, 0, 1),
272 	PIN_FIELD16(172, 172, 0xd20, 0x10, 4, 1),
273 	PIN_FIELD16(173, 173, 0xd20, 0x10, 8, 1),
274 	PIN_FIELD16(174, 174, 0xd20, 0x10, 12, 1),
275 	PIN_FIELD16(175, 175, 0xc40, 0x10, 0, 1),
276 };
277 
278 static const struct mtk_pin_field_calc mt6795_pin_r1_range[] = {
279 	PIN_FIELD16(23, 23, 0xd40, 0x10, 1, 1),
280 	PIN_FIELD16(24, 24, 0xd40, 0x10, 5, 1),
281 	PIN_FIELD16(25, 25, 0xd40, 0x10, 9, 1),
282 	PIN_FIELD16(26, 26, 0xd40, 0x10, 13, 1),
283 	PIN_FIELD16(27, 27, 0xcc0, 0x10, 1, 1),
284 	PIN_FIELD16(28, 28, 0xcd0, 0x10, 1, 1),
285 	PIN_FIELD16(100, 100, 0xd30, 0x10, 1, 1),
286 	PIN_FIELD16(101, 101, 0xd30, 0x10, 5, 1),
287 	PIN_FIELD16(102, 102, 0xd30, 0x10, 9, 1),
288 	PIN_FIELD16(103, 103, 0xd30, 0x10, 13, 1),
289 	PIN_FIELD16(104, 104, 0xc80, 0x10, 1, 1),
290 	PIN_FIELD16(105, 105, 0xc90, 0x10, 1, 1),
291 	PIN_FIELD16(119, 119, 0xe00, 0x10, 1, 1),
292 	PIN_FIELD16(120, 120, 0xe00, 0x10, 5, 1),
293 	PIN_FIELD16(121, 121, 0xe00, 0x10, 9, 1),
294 	PIN_FIELD16(122, 122, 0xe10, 0x10, 1, 1),
295 	PIN_FIELD16(123, 123, 0xe10, 0x10, 5, 1),
296 	PIN_FIELD16(124, 124, 0xe10, 0x10, 9, 1),
297 	PIN_FIELD16(138, 138, 0xd50, 0x10, 1, 1),
298 	PIN_FIELD16(139, 139, 0xd60, 0x10, 0, 1),
299 	PIN_FIELD16(140, 140, 0xd70, 0x10, 0, 1),
300 	PIN_FIELD16(141, 141, 0xd70, 0x10, 2, 1),
301 	PIN_FIELD16(142, 142, 0xd70, 0x10, 4, 1),
302 	PIN_FIELD16(143, 143, 0xd70, 0x10, 6, 1),
303 	PIN_FIELD16(144, 144, 0xd50, 0x10, 4, 1),
304 	PIN_FIELD16(145, 145, 0xd50, 0x10, 6, 1),
305 	PIN_FIELD16(146, 146, 0xd60, 0x10, 6, 1),
306 	PIN_FIELD16(147, 147, 0xed0, 0x10, 5, 1),
307 	PIN_FIELD16(148, 148, 0xed0, 0x10, 7, 1),
308 	PIN_FIELD16(149, 149, 0xed0, 0x10, 9, 1),
309 	PIN_FIELD16(150, 150, 0xed0, 0x10, 11, 1),
310 	PIN_FIELD16(151, 151, 0xed0, 0x10, 13, 1),
311 	PIN_FIELD16(152, 152, 0xd60, 0x10, 2, 1),
312 	PIN_FIELD16(153, 153, 0xd60, 0x10, 4, 1),
313 	PIN_FIELD16(154, 155, 0xc20, 0x10, 1, 1),
314 	PIN_FIELD16(155, 156, 0xc20, 0x10, 1, 1),
315 	PIN_FIELD16(156, 157, 0xc20, 0x10, 1, 1),
316 	PIN_FIELD16(157, 158, 0xc20, 0x10, 1, 1),
317 	PIN_FIELD16(158, 159, 0xc20, 0x10, 1, 1),
318 	PIN_FIELD16(159, 160, 0xc20, 0x10, 1, 1),
319 	PIN_FIELD16(160, 161, 0xc20, 0x10, 1, 1),
320 	PIN_FIELD16(161, 161, 0xc20, 0x10, 1, 1),
321 	PIN_FIELD16(162, 162, 0xc10, 0x10, 1, 1),
322 	PIN_FIELD16(163, 163, 0xc00, 0x10, 1, 1),
323 	PIN_FIELD16(164, 164, 0xd10, 0x10, 1, 1),
324 	PIN_FIELD16(165, 165, 0xd00, 0x10, 1, 1),
325 	PIN_FIELD16(170, 170, 0xc50, 0x10, 1, 1),
326 	PIN_FIELD16(171, 171, 0xd20, 0x10, 1, 1),
327 	PIN_FIELD16(172, 172, 0xd20, 0x10, 5, 1),
328 	PIN_FIELD16(173, 173, 0xd20, 0x10, 9, 1),
329 	PIN_FIELD16(174, 174, 0xd20, 0x10, 13, 1),
330 	PIN_FIELD16(175, 175, 0xc40, 0x10, 1, 1),
331 };
332 
333 static const struct mtk_pin_field_calc mt6795_pin_drv_range[] = {
334 	PINS_FIELD16(0, 4, 0xb30, 0x10, 13, 2),
335 	PINS_FIELD16(5, 9, 0xb30, 0x10, 1, 2),
336 	PINS_FIELD16(10, 15, 0xb30, 0x10, 5, 2),
337 	PIN_FIELD16(16, 16, 0xb30, 0x10, 1, 2),
338 	PINS_FIELD16(17, 19, 0xb70, 0x10, 5, 2),
339 	PINS_FIELD16(20, 22, 0xb70, 0x10, 9, 2),
340 	PINS_FIELD16(23, 26, 0xce0, 0x10, 8, 2),
341 	PIN_FIELD16(27, 27, 0xcc0, 0x10, 8, 2),
342 	PIN_FIELD16(28, 28, 0xcd0, 0x10, 8, 2),
343 	PINS_FIELD16(29, 32, 0xb80, 0x10, 13, 2),
344 	PIN_FIELD16(33, 33, 0xb10, 0x10, 13, 2),
345 	PINS_FIELD16(34, 36, 0xb10, 0x10, 9, 2),
346 	PINS_FIELD16(37, 38, 0xb10, 0x10, 5, 2),
347 	PIN_FIELD16(39, 39, 0xb20, 0x10, 1, 2),
348 	PIN_FIELD16(40, 40, 0xb20, 0x10, 5, 2),
349 	PINS_FIELD16(41, 42, 0xb20, 0x10, 9, 2),
350 	PINS_FIELD16(47, 61, 0xb00, 0x10, 9, 2),
351 	PINS_FIELD16(62, 66, 0xb70, 0x10, 1, 2),
352 	PINS_FIELD16(67, 67, 0xb00, 0x10, 9, 2),
353 	PINS_FIELD16(68, 72, 0xb60, 0x10, 13, 2),
354 	PINS_FIELD16(73, 77, 0xb40, 0x10, 13, 2),
355 	PIN_FIELD16(78, 78, 0xb00, 0x10, 12, 3),
356 	PINS_FIELD16(79, 91, 0xb00, 0x10, 13, 2),
357 	PIN_FIELD16(92, 92, 0xb60, 0x10, 5, 2),
358 	PINS_FIELD16(93, 95, 0xb60, 0x10, 1, 2),
359 	PINS_FIELD16(96, 99, 0xb80, 0x10, 9, 2),
360 	PINS_FIELD16(100, 103, 0xca0, 0x10, 8, 2),
361 	PIN_FIELD16(104, 104, 0xc80, 0x10, 8, 2),
362 	PIN_FIELD16(105, 105, 0xc90, 0x10, 8, 2),
363 	PINS_FIELD16(106, 107, 0xb50, 0x10, 9, 2),
364 	PINS_FIELD16(108, 112, 0xb50, 0x10, 1, 2),
365 	PINS_FIELD16(113, 116, 0xb80, 0x10, 5, 2),
366 	PINS_FIELD16(117, 118, 0xb90, 0x10, 1, 2),
367 	PINS_FIELD16(119, 124, 0xb50, 0x10, 5, 2),
368 	PIN_FIELD16(127, 127, 0xb70, 0x10, 5, 2),
369 	PIN_FIELD16(128, 128, 0xb70, 0x10, 9, 2),
370 	PIN_FIELD16(129, 129, 0xb40, 0x10, 9, 2),
371 	PINS_FIELD16(130, 131, 0xb40, 0x10, 13, 2),
372 	PINS_FIELD16(132, 135, 0xb40, 0x10, 9, 2),
373 	PIN_FIELD16(138, 138, 0xb50, 0x10, 8, 2),
374 	PIN_FIELD16(139, 139, 0xb60, 0x10, 8, 2),
375 	PINS_FIELD16(140, 151, 0xb70, 0x10, 8, 2),
376 	PINS_FIELD16(152, 153, 0xb60, 0x10, 8, 2),
377 	PINS_FIELD16(153, 153, 0xb60, 0x10, 8, 2),
378 	PINS_FIELD16(154, 161, 0xc20, 0x10, 8, 2),
379 	PIN_FIELD16(162, 162, 0xc10, 0x10, 8, 2),
380 	PIN_FIELD16(163, 163, 0xc00, 0x10, 8, 2),
381 	PIN_FIELD16(164, 164, 0xd10, 0x10, 8, 2),
382 	PIN_FIELD16(165, 165, 0xd00, 0x10, 8, 2),
383 	PINS_FIELD16(166, 169, 0xb80, 0x10, 1, 2),
384 	PINS_FIELD16(170, 173, 0xc60, 0x10, 8, 2),
385 	PIN_FIELD16(174, 174, 0xc40, 0x10, 8, 2),
386 	PIN_FIELD16(175, 175, 0xc50, 0x10, 8, 2),
387 	PINS_FIELD16(176, 179, 0xb70, 0x10, 13, 2),
388 	PIN_FIELD16(180, 180, 0xb00, 0x10, 5, 2),
389 	PINS_FIELD16(181, 184, 0xb00, 0x10, 1, 2),
390 	PINS_FIELD16(185, 191, 0xb60, 0x10, 9, 2),
391 	PIN_FIELD16(192, 192, 0xb40, 0x10, 1, 2),
392 	PINS_FIELD16(193, 194, 0xb40, 0x10, 5, 2),
393 	PINS_FIELD16(195, 196, 0xb40, 0x10, 1, 2),
394 };
395 
396 static const struct mtk_pin_field_calc mt6795_pin_sr_range[] = {
397 	PINS_FIELD16(0, 4, 0xb30, 0x10, 15, 1),
398 	PINS_FIELD16(5, 9, 0xb30, 0x10, 3, 1),
399 	PINS_FIELD16(10, 15, 0xb30, 0x10, 7, 1),
400 	PIN_FIELD16(16, 16, 0xb30, 0x10, 5, 1),
401 	PINS_FIELD16(23, 26, 0xce0, 0x10, 12, 1),
402 	PIN_FIELD16(27, 27, 0xcc0, 0x10, 12, 1),
403 	PIN_FIELD16(28, 28, 0xcd0, 0x10, 12, 1),
404 	PINS_FIELD16(29, 32, 0xb80, 0x10, 15, 1),
405 	PIN_FIELD16(33, 33, 0xb10, 0x10, 15, 1),
406 	PINS_FIELD16(34, 36, 0xb10, 0x10, 11, 1),
407 	PINS_FIELD16(37, 38, 0xb10, 0x10, 7, 1),
408 	PIN_FIELD16(39, 39, 0xb20, 0x10, 3, 1),
409 	PIN_FIELD16(40, 40, 0xb20, 0x10, 7, 1),
410 	PINS_FIELD16(41, 42, 0xb20, 0x10, 11, 1),
411 	PINS_FIELD16(47, 61, 0xb00, 0x10, 11, 1),
412 	PINS_FIELD16(62, 66, 0xb70, 0x10, 3, 1),
413 	PINS_FIELD16(67, 67, 0xb00, 0x10, 11, 1),
414 	PINS_FIELD16(68, 72, 0xb60, 0x10, 15, 1),
415 	PINS_FIELD16(73, 77, 0xb40, 0x10, 15, 1),
416 	PIN_FIELD16(78, 78, 0xb00, 0x10, 15, 3),
417 	PINS_FIELD16(79, 91, 0xb00, 0x10, 15, 1),
418 	PIN_FIELD16(92, 92, 0xb60, 0x10, 7, 1),
419 	PINS_FIELD16(93, 95, 0xb60, 0x10, 3, 1),
420 	PINS_FIELD16(96, 99, 0xb80, 0x10, 11, 1),
421 	PINS_FIELD16(100, 103, 0xca0, 0x10, 12, 1),
422 	PIN_FIELD16(104, 104, 0xc80, 0x10, 12, 1),
423 	PIN_FIELD16(105, 105, 0xc90, 0x10, 12, 1),
424 	PINS_FIELD16(106, 107, 0xb50, 0x10, 11, 1),
425 	PINS_FIELD16(108, 112, 0xb50, 0x10, 3, 1),
426 	PINS_FIELD16(113, 116, 0xb80, 0x10, 7, 1),
427 	PINS_FIELD16(117, 118, 0xb90, 0x10, 3, 1),
428 	PINS_FIELD16(119, 124, 0xb50, 0x10, 7, 1),
429 	PIN_FIELD16(127, 127, 0xb70, 0x10, 7, 1),
430 	PIN_FIELD16(128, 128, 0xb70, 0x10, 11, 1),
431 	PIN_FIELD16(129, 129, 0xb40, 0x10, 11, 1),
432 	PINS_FIELD16(130, 131, 0xb40, 0x10, 15, 1),
433 	PINS_FIELD16(132, 135, 0xb40, 0x10, 11, 1),
434 	PIN_FIELD16(138, 138, 0xb50, 0x10, 12, 1),
435 	PIN_FIELD16(139, 139, 0xb60, 0x10, 12, 1),
436 	PINS_FIELD16(140, 151, 0xb70, 0x10, 12, 1),
437 	PINS_FIELD16(152, 153, 0xb60, 0x10, 12, 1),
438 	PINS_FIELD16(153, 153, 0xb60, 0x10, 12, 1),
439 	PINS_FIELD16(154, 161, 0xc20, 0x10, 12, 1),
440 	PIN_FIELD16(162, 162, 0xc10, 0x10, 12, 1),
441 	PIN_FIELD16(163, 163, 0xc00, 0x10, 12, 1),
442 	PIN_FIELD16(164, 164, 0xd10, 0x10, 12, 1),
443 	PIN_FIELD16(165, 165, 0xd00, 0x10, 12, 1),
444 	PINS_FIELD16(166, 169, 0xb80, 0x10, 3, 1),
445 	PINS_FIELD16(170, 173, 0xc60, 0x10, 12, 1),
446 	PIN_FIELD16(174, 174, 0xc40, 0x10, 12, 1),
447 	PIN_FIELD16(175, 175, 0xc50, 0x10, 12, 1),
448 	PINS_FIELD16(176, 179, 0xb70, 0x10, 15, 1),
449 	PIN_FIELD16(180, 180, 0xb00, 0x10, 7, 1),
450 	PINS_FIELD16(181, 184, 0xb00, 0x10, 3, 1),
451 	PINS_FIELD16(185, 191, 0xb60, 0x10, 11, 1),
452 	PIN_FIELD16(192, 192, 0xb40, 0x10, 3, 1),
453 	PINS_FIELD16(193, 194, 0xb40, 0x10, 7, 1),
454 	PINS_FIELD16(195, 196, 0xb40, 0x10, 3, 1),
455 };
456 
457 static const struct mtk_pin_reg_calc mt6795_reg_cals[PINCTRL_PIN_REG_MAX] = {
458 	[PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt6795_pin_mode_range),
459 	[PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt6795_pin_dir_range),
460 	[PINCTRL_PIN_REG_DI] = MTK_RANGE(mt6795_pin_di_range),
461 	[PINCTRL_PIN_REG_DO] = MTK_RANGE(mt6795_pin_do_range),
462 	[PINCTRL_PIN_REG_SR] = MTK_RANGE(mt6795_pin_sr_range),
463 	[PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt6795_pin_smt_range),
464 	[PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt6795_pin_drv_range),
465 	[PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt6795_pin_pupd_range),
466 	[PINCTRL_PIN_REG_R0] = MTK_RANGE(mt6795_pin_r0_range),
467 	[PINCTRL_PIN_REG_R1] = MTK_RANGE(mt6795_pin_r1_range),
468 	[PINCTRL_PIN_REG_IES] = MTK_RANGE(mt6795_pin_ies_range),
469 	[PINCTRL_PIN_REG_PULLEN] = MTK_RANGE(mt6795_pin_pullen_range),
470 	[PINCTRL_PIN_REG_PULLSEL] = MTK_RANGE(mt6795_pin_pullsel_range),
471 };
472 
473 static const struct mtk_eint_hw mt6795_eint_hw = {
474 	.port_mask = 7,
475 	.ports     = 7,
476 	.ap_num    = 224,
477 	.db_cnt    = 32,
478 	.db_time   = debounce_time_mt6795,
479 };
480 
481 static const unsigned int mt6795_pull_type[] = {
482 	MTK_PULL_PULLSEL_TYPE,/*0*/		MTK_PULL_PULLSEL_TYPE,/*1*/
483 	MTK_PULL_PULLSEL_TYPE,/*2*/		MTK_PULL_PULLSEL_TYPE,/*3*/
484 	MTK_PULL_PULLSEL_TYPE,/*4*/		MTK_PULL_PULLSEL_TYPE,/*5*/
485 	MTK_PULL_PULLSEL_TYPE,/*6*/		MTK_PULL_PULLSEL_TYPE,/*7*/
486 	MTK_PULL_PULLSEL_TYPE,/*8*/		MTK_PULL_PULLSEL_TYPE,/*9*/
487 	MTK_PULL_PULLSEL_TYPE,/*10*/		MTK_PULL_PULLSEL_TYPE,/*11*/
488 	MTK_PULL_PULLSEL_TYPE,/*12*/		MTK_PULL_PULLSEL_TYPE,/*13*/
489 	MTK_PULL_PULLSEL_TYPE,/*14*/		MTK_PULL_PULLSEL_TYPE,/*15*/
490 	MTK_PULL_PULLSEL_TYPE,/*16*/		MTK_PULL_PULLSEL_TYPE,/*17*/
491 	MTK_PULL_PULLSEL_TYPE,/*18*/		MTK_PULL_PULLSEL_TYPE,/*19*/
492 	MTK_PULL_PULLSEL_TYPE,/*20*/		MTK_PULL_PULLSEL_TYPE,/*21*/
493 	MTK_PULL_PULLSEL_TYPE,/*22*/		MTK_PULL_PUPD_R1R0_TYPE,/*23*/
494 	MTK_PULL_PUPD_R1R0_TYPE,/*24*/		MTK_PULL_PUPD_R1R0_TYPE,/*25*/
495 	MTK_PULL_PUPD_R1R0_TYPE,/*26*/		MTK_PULL_PUPD_R1R0_TYPE,/*27*/
496 	MTK_PULL_PUPD_R1R0_TYPE,/*28*/		MTK_PULL_PULLSEL_TYPE,/*29*/
497 	MTK_PULL_PULLSEL_TYPE,/*30*/		MTK_PULL_PULLSEL_TYPE,/*31*/
498 	MTK_PULL_PULLSEL_TYPE,/*32*/		MTK_PULL_PULLSEL_TYPE,/*33*/
499 	MTK_PULL_PULLSEL_TYPE,/*34*/		MTK_PULL_PULLSEL_TYPE,/*35*/
500 	MTK_PULL_PULLSEL_TYPE,/*36*/		MTK_PULL_PULLSEL_TYPE,/*37*/
501 	MTK_PULL_PULLSEL_TYPE,/*38*/		MTK_PULL_PULLSEL_TYPE,/*39*/
502 	MTK_PULL_PULLSEL_TYPE,/*40*/		MTK_PULL_PULLSEL_TYPE,/*41*/
503 	MTK_PULL_PULLSEL_TYPE,/*42*/		MTK_PULL_PULLSEL_TYPE,/*43*/
504 	MTK_PULL_PULLSEL_TYPE,/*44*/		MTK_PULL_PULLSEL_TYPE,/*45*/
505 	MTK_PULL_PULLSEL_TYPE,/*46*/		MTK_PULL_PULLSEL_TYPE,/*47*/
506 	MTK_PULL_PULLSEL_TYPE,/*48*/		MTK_PULL_PULLSEL_TYPE,/*49*/
507 	MTK_PULL_PULLSEL_TYPE,/*50*/		MTK_PULL_PULLSEL_TYPE,/*51*/
508 	MTK_PULL_PULLSEL_TYPE,/*52*/		MTK_PULL_PULLSEL_TYPE,/*53*/
509 	MTK_PULL_PULLSEL_TYPE,/*54*/		MTK_PULL_PULLSEL_TYPE,/*55*/
510 	MTK_PULL_PULLSEL_TYPE,/*56*/		MTK_PULL_PULLSEL_TYPE,/*57*/
511 	MTK_PULL_PULLSEL_TYPE,/*58*/		MTK_PULL_PULLSEL_TYPE,/*59*/
512 	MTK_PULL_PULLSEL_TYPE,/*60*/		MTK_PULL_PULLSEL_TYPE,/*61*/
513 	MTK_PULL_PULLSEL_TYPE,/*62*/		MTK_PULL_PULLSEL_TYPE,/*63*/
514 	MTK_PULL_PULLSEL_TYPE,/*64*/		MTK_PULL_PULLSEL_TYPE,/*65*/
515 	MTK_PULL_PULLSEL_TYPE,/*66*/		MTK_PULL_PUPD_R1R0_TYPE,/*67*/
516 	MTK_PULL_PUPD_R1R0_TYPE,/*68*/		MTK_PULL_PUPD_R1R0_TYPE,/*69*/
517 	MTK_PULL_PUPD_R1R0_TYPE,/*70*/		MTK_PULL_PUPD_R1R0_TYPE,/*71*/
518 	MTK_PULL_PUPD_R1R0_TYPE,/*72*/		MTK_PULL_PUPD_R1R0_TYPE,/*73*/
519 	MTK_PULL_PUPD_R1R0_TYPE,/*74*/		MTK_PULL_PUPD_R1R0_TYPE,/*75*/
520 	MTK_PULL_PUPD_R1R0_TYPE,/*76*/		MTK_PULL_PUPD_R1R0_TYPE,/*77*/
521 	MTK_PULL_PUPD_R1R0_TYPE,/*78*/		MTK_PULL_PUPD_R1R0_TYPE,/*79*/
522 	MTK_PULL_PUPD_R1R0_TYPE,/*80*/		MTK_PULL_PUPD_R1R0_TYPE,/*81*/
523 	MTK_PULL_PUPD_R1R0_TYPE,/*82*/		MTK_PULL_PULLSEL_TYPE,/*83*/
524 	MTK_PULL_PUPD_R1R0_TYPE,/*84*/		MTK_PULL_PUPD_R1R0_TYPE,/*85*/
525 	MTK_PULL_PUPD_R1R0_TYPE,/*86*/		MTK_PULL_PUPD_R1R0_TYPE,/*87*/
526 	MTK_PULL_PUPD_R1R0_TYPE,/*88*/		MTK_PULL_PUPD_R1R0_TYPE,/*89*/
527 	MTK_PULL_PULLSEL_TYPE,/*90*/		MTK_PULL_PULLSEL_TYPE,/*91*/
528 	MTK_PULL_PULLSEL_TYPE,/*92*/		MTK_PULL_PULLSEL_TYPE,/*93*/
529 	MTK_PULL_PULLSEL_TYPE,/*94*/		MTK_PULL_PULLSEL_TYPE,/*95*/
530 	MTK_PULL_PULLSEL_TYPE,/*96*/		MTK_PULL_PULLSEL_TYPE,/*97*/
531 	MTK_PULL_PULLSEL_TYPE,/*98*/		MTK_PULL_PULLSEL_TYPE,/*99*/
532 	MTK_PULL_PUPD_R1R0_TYPE,/*100*/		MTK_PULL_PUPD_R1R0_TYPE,/*101*/
533 	MTK_PULL_PUPD_R1R0_TYPE,/*102*/		MTK_PULL_PUPD_R1R0_TYPE,/*103*/
534 	MTK_PULL_PUPD_R1R0_TYPE,/*104*/		MTK_PULL_PUPD_R1R0_TYPE,/*105*/
535 	MTK_PULL_PULLSEL_TYPE,/*106*/		MTK_PULL_PULLSEL_TYPE,/*107*/
536 	MTK_PULL_PULLSEL_TYPE,/*108*/		MTK_PULL_PULLSEL_TYPE,/*109*/
537 	MTK_PULL_PULLSEL_TYPE,/*110*/		MTK_PULL_PULLSEL_TYPE,/*111*/
538 	MTK_PULL_PULLSEL_TYPE,/*112*/		MTK_PULL_PULLSEL_TYPE,/*113*/
539 	MTK_PULL_PULLSEL_TYPE,/*114*/		MTK_PULL_PULLSEL_TYPE,/*115*/
540 	MTK_PULL_PULLSEL_TYPE,/*116*/		MTK_PULL_PULLSEL_TYPE,/*117*/
541 	MTK_PULL_PULLSEL_TYPE,/*118*/		MTK_PULL_PUPD_R1R0_TYPE,/*119*/
542 	MTK_PULL_PUPD_R1R0_TYPE,/*120*/		MTK_PULL_PUPD_R1R0_TYPE,/*121*/
543 	MTK_PULL_PUPD_R1R0_TYPE,/*122*/		MTK_PULL_PUPD_R1R0_TYPE,/*123*/
544 	MTK_PULL_PUPD_R1R0_TYPE,/*124*/		MTK_PULL_PULLSEL_TYPE,/*125*/
545 	MTK_PULL_PULLSEL_TYPE,/*126*/		MTK_PULL_PULLSEL_TYPE,/*127*/
546 	MTK_PULL_PULLSEL_TYPE,/*128*/		MTK_PULL_PULLSEL_TYPE,/*129*/
547 	MTK_PULL_PULLSEL_TYPE,/*130*/		MTK_PULL_PULLSEL_TYPE,/*131*/
548 	MTK_PULL_PULLSEL_TYPE,/*132*/		MTK_PULL_PULLSEL_TYPE,/*133*/
549 	MTK_PULL_PULLSEL_TYPE,/*134*/		MTK_PULL_PULLSEL_TYPE,/*135*/
550 	MTK_PULL_PULLSEL_TYPE,/*136*/		MTK_PULL_PULLSEL_TYPE,/*137*/
551 	MTK_PULL_PUPD_R1R0_TYPE,/*138*/		MTK_PULL_PUPD_R1R0_TYPE,/*139*/
552 	MTK_PULL_PUPD_R1R0_TYPE,/*140*/		MTK_PULL_PUPD_R1R0_TYPE,/*141*/
553 	MTK_PULL_PUPD_R1R0_TYPE,/*142*/		MTK_PULL_PUPD_R1R0_TYPE,/*143*/
554 	MTK_PULL_PUPD_R1R0_TYPE,/*144*/		MTK_PULL_PUPD_R1R0_TYPE,/*145*/
555 	MTK_PULL_PUPD_R1R0_TYPE,/*146*/		MTK_PULL_PUPD_R1R0_TYPE,/*147*/
556 	MTK_PULL_PUPD_R1R0_TYPE,/*148*/		MTK_PULL_PUPD_R1R0_TYPE,/*149*/
557 	MTK_PULL_PUPD_R1R0_TYPE,/*150*/		MTK_PULL_PUPD_R1R0_TYPE,/*151*/
558 	MTK_PULL_PUPD_R1R0_TYPE,/*152*/		MTK_PULL_PUPD_R1R0_TYPE,/*153*/
559 	MTK_PULL_PUPD_R1R0_TYPE,/*154*/		MTK_PULL_PUPD_R1R0_TYPE,/*155*/
560 	MTK_PULL_PUPD_R1R0_TYPE,/*156*/		MTK_PULL_PUPD_R1R0_TYPE,/*157*/
561 	MTK_PULL_PUPD_R1R0_TYPE,/*158*/		MTK_PULL_PUPD_R1R0_TYPE,/*159*/
562 	MTK_PULL_PUPD_R1R0_TYPE,/*160*/		MTK_PULL_PUPD_R1R0_TYPE,/*161*/
563 	MTK_PULL_PUPD_R1R0_TYPE,/*162*/		MTK_PULL_PUPD_R1R0_TYPE,/*163*/
564 	MTK_PULL_PUPD_R1R0_TYPE,/*164*/		MTK_PULL_PUPD_R1R0_TYPE,/*165*/
565 	MTK_PULL_PULLSEL_TYPE,/*166*/		MTK_PULL_PULLSEL_TYPE,/*167*/
566 	MTK_PULL_PULLSEL_TYPE,/*168*/		MTK_PULL_PULLSEL_TYPE,/*169*/
567 	MTK_PULL_PUPD_R1R0_TYPE,/*170*/		MTK_PULL_PUPD_R1R0_TYPE,/*171*/
568 	MTK_PULL_PUPD_R1R0_TYPE,/*172*/		MTK_PULL_PUPD_R1R0_TYPE,/*173*/
569 	MTK_PULL_PUPD_R1R0_TYPE,/*174*/		MTK_PULL_PUPD_R1R0_TYPE,/*175*/
570 	MTK_PULL_PULLSEL_TYPE,/*176*/		MTK_PULL_PULLSEL_TYPE,/*177*/
571 	MTK_PULL_PULLSEL_TYPE,/*178*/		MTK_PULL_PULLSEL_TYPE,/*179*/
572 	MTK_PULL_PULLSEL_TYPE,/*180*/		MTK_PULL_PULLSEL_TYPE,/*181*/
573 	MTK_PULL_PULLSEL_TYPE,/*182*/		MTK_PULL_PULLSEL_TYPE,/*183*/
574 	MTK_PULL_PULLSEL_TYPE,/*184*/		MTK_PULL_PULLSEL_TYPE,/*185*/
575 	MTK_PULL_PULLSEL_TYPE,/*186*/		MTK_PULL_PULLSEL_TYPE,/*187*/
576 	MTK_PULL_PULLSEL_TYPE,/*188*/		MTK_PULL_PULLSEL_TYPE,/*189*/
577 	MTK_PULL_PULLSEL_TYPE,/*190*/		MTK_PULL_PULLSEL_TYPE,/*191*/
578 	MTK_PULL_PULLSEL_TYPE,/*192*/		MTK_PULL_PULLSEL_TYPE,/*193*/
579 	MTK_PULL_PULLSEL_TYPE,/*194*/		MTK_PULL_PULLSEL_TYPE,/*195*/
580 	MTK_PULL_PULLSEL_TYPE,/*196*/
581 };
582 
583 static const struct mtk_pin_soc mt6795_data = {
584 	.reg_cal = mt6795_reg_cals,
585 	.pins = mtk_pins_mt6795,
586 	.npins = ARRAY_SIZE(mtk_pins_mt6795),
587 	.ngrps = ARRAY_SIZE(mtk_pins_mt6795),
588 	.nfuncs = 8,
589 	.eint_hw = &mt6795_eint_hw,
590 	.gpio_m = 0,
591 	.base_names = mtk_default_register_base_names,
592 	.nbase_names = ARRAY_SIZE(mtk_default_register_base_names),
593 	.pull_type = mt6795_pull_type,
594 	.bias_disable_set = mtk_pinconf_bias_disable_set_rev1,
595 	.bias_disable_get = mtk_pinconf_bias_disable_get_rev1,
596 	.bias_set = mtk_pinconf_bias_set_rev1,
597 	.bias_get = mtk_pinconf_bias_get_rev1,
598 	.bias_set_combo = mtk_pinconf_bias_set_combo,
599 	.bias_get_combo = mtk_pinconf_bias_get_combo,
600 	.drive_set = mtk_pinconf_drive_set_rev1,
601 	.drive_get = mtk_pinconf_drive_get_rev1,
602 	.adv_pull_get = mtk_pinconf_adv_pull_get,
603 	.adv_pull_set = mtk_pinconf_adv_pull_set,
604 };
605 
606 static const struct of_device_id mt6795_pctrl_match[] = {
607 	{ .compatible = "mediatek,mt6795-pinctrl", .data = &mt6795_data },
608 	{ }
609 };
610 
611 static struct platform_driver mt6795_pinctrl_driver = {
612 	.driver = {
613 		.name = "mt6795-pinctrl",
614 		.of_match_table = mt6795_pctrl_match,
615 		.pm = &mtk_paris_pinctrl_pm_ops,
616 	},
617 	.probe = mtk_paris_pinctrl_probe,
618 };
619 
mtk_pinctrl_init(void)620 static int __init mtk_pinctrl_init(void)
621 {
622 	return platform_driver_register(&mt6795_pinctrl_driver);
623 }
624 arch_initcall(mtk_pinctrl_init);
625