1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2018 MediaTek Inc.
4  *
5  * Author: Zhiyong Tao <zhiyong.tao@mediatek.com>
6  *
7  */
8 
9 #include "pinctrl-mtk-mt8183.h"
10 #include "pinctrl-paris.h"
11 
12 /* MT8183 have multiple bases to program pin configuration listed as the below:
13  * iocfg[0]:0x10005000, iocfg[1]:0x11F20000, iocfg[2]:0x11E80000,
14  * iocfg[3]:0x11E70000, iocfg[4]:0x11E90000, iocfg[5]:0x11D30000,
15  * iocfg[6]:0x11D20000, iocfg[7]:0x11C50000, iocfg[8]:0x11F30000.
16  * _i_based could be used to indicate what base the pin should be mapped into.
17  */
18 
19 #define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, _x_bits)	\
20 	PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,	\
21 		       _x_bits, 32, 0)
22 
23 #define PINS_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, _x_bits)	\
24 	PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,	\
25 		      _x_bits, 32, 1)
26 
27 static const struct mtk_pin_field_calc mt8183_pin_mode_range[] = {
28 	PIN_FIELD(0, 192, 0x300, 0x10, 0, 4),
29 };
30 
31 static const struct mtk_pin_field_calc mt8183_pin_dir_range[] = {
32 	PIN_FIELD(0, 192, 0x0, 0x10, 0, 1),
33 };
34 
35 static const struct mtk_pin_field_calc mt8183_pin_di_range[] = {
36 	PIN_FIELD(0, 192, 0x200, 0x10, 0, 1),
37 };
38 
39 static const struct mtk_pin_field_calc mt8183_pin_do_range[] = {
40 	PIN_FIELD(0, 192, 0x100, 0x10, 0, 1),
41 };
42 
43 static const struct mtk_pin_field_calc mt8183_pin_ies_range[] = {
44 	PINS_FIELD_BASE(0, 3, 6, 0x000, 0x10, 3, 1),
45 	PINS_FIELD_BASE(4, 7, 6, 0x000, 0x10, 5, 1),
46 	PIN_FIELD_BASE(8, 8, 6, 0x000, 0x10, 0, 1),
47 	PINS_FIELD_BASE(9, 10, 6, 0x000, 0x10, 12, 1),
48 	PIN_FIELD_BASE(11, 11, 1, 0x000, 0x10, 3, 1),
49 	PIN_FIELD_BASE(12, 12, 1, 0x000, 0x10, 7, 1),
50 	PINS_FIELD_BASE(13, 16, 2, 0x000, 0x10, 2, 1),
51 	PINS_FIELD_BASE(17, 20, 2, 0x000, 0x10, 3, 1),
52 	PINS_FIELD_BASE(21, 24, 2, 0x000, 0x10, 4, 1),
53 	PINS_FIELD_BASE(25, 28, 2, 0x000, 0x10, 5, 1),
54 	PIN_FIELD_BASE(29, 29, 2, 0x000, 0x10, 6, 1),
55 	PIN_FIELD_BASE(30, 30, 2, 0x000, 0x10, 7, 1),
56 	PINS_FIELD_BASE(31, 31, 2, 0x000, 0x10, 8, 1),
57 	PINS_FIELD_BASE(32, 34, 2, 0x000, 0x10, 7, 1),
58 	PINS_FIELD_BASE(35, 37, 3, 0x000, 0x10, 0, 1),
59 	PINS_FIELD_BASE(38, 40, 3, 0x000, 0x10, 1, 1),
60 	PINS_FIELD_BASE(41, 42, 3, 0x000, 0x10, 2, 1),
61 	PINS_FIELD_BASE(43, 45, 3, 0x000, 0x10, 3, 1),
62 	PINS_FIELD_BASE(46, 47, 3, 0x000, 0x10, 4, 1),
63 	PINS_FIELD_BASE(48, 49, 3, 0x000, 0x10, 5, 1),
64 	PINS_FIELD_BASE(50, 51, 4, 0x000, 0x10, 0, 1),
65 	PINS_FIELD_BASE(52, 57, 4, 0x000, 0x10, 1, 1),
66 	PINS_FIELD_BASE(58, 60, 4, 0x000, 0x10, 2, 1),
67 	PINS_FIELD_BASE(61, 64, 5, 0x000, 0x10, 0, 1),
68 	PINS_FIELD_BASE(65, 66, 5, 0x000, 0x10, 1, 1),
69 	PINS_FIELD_BASE(67, 68, 5, 0x000, 0x10, 2, 1),
70 	PINS_FIELD_BASE(69, 71, 5, 0x000, 0x10, 3, 1),
71 	PINS_FIELD_BASE(72, 76, 5, 0x000, 0x10, 4, 1),
72 	PINS_FIELD_BASE(77, 80, 5, 0x000, 0x10, 5, 1),
73 	PIN_FIELD_BASE(81, 81, 5, 0x000, 0x10, 6, 1),
74 	PINS_FIELD_BASE(82, 83, 5, 0x000, 0x10, 7, 1),
75 	PIN_FIELD_BASE(84, 84, 5, 0x000, 0x10, 6, 1),
76 	PINS_FIELD_BASE(85, 88, 5, 0x000, 0x10, 8, 1),
77 	PIN_FIELD_BASE(89, 89, 6, 0x000, 0x10, 11, 1),
78 	PIN_FIELD_BASE(90, 90, 6, 0x000, 0x10, 1, 1),
79 	PINS_FIELD_BASE(91, 94, 6, 0x000, 0x10, 2, 1),
80 	PINS_FIELD_BASE(95, 96, 6, 0x000, 0x10, 6, 1),
81 	PINS_FIELD_BASE(97, 98, 6, 0x000, 0x10, 7, 1),
82 	PIN_FIELD_BASE(99, 99, 6, 0x000, 0x10, 8, 1),
83 	PIN_FIELD_BASE(100, 100, 6, 0x000, 0x10, 9, 1),
84 	PINS_FIELD_BASE(101, 102, 6, 0x000, 0x10, 10, 1),
85 	PINS_FIELD_BASE(103, 104, 6, 0x000, 0x10, 13, 1),
86 	PINS_FIELD_BASE(105, 106, 6, 0x000, 0x10, 14, 1),
87 	PIN_FIELD_BASE(107, 107, 7, 0x000, 0x10, 0, 1),
88 	PIN_FIELD_BASE(108, 108, 7, 0x000, 0x10, 1, 1),
89 	PIN_FIELD_BASE(109, 109, 7, 0x000, 0x10, 2, 1),
90 	PIN_FIELD_BASE(110, 110, 7, 0x000, 0x10, 0, 1),
91 	PIN_FIELD_BASE(111, 111, 7, 0x000, 0x10, 3, 1),
92 	PIN_FIELD_BASE(112, 112, 7, 0x000, 0x10, 2, 1),
93 	PIN_FIELD_BASE(113, 113, 7, 0x000, 0x10, 4, 1),
94 	PIN_FIELD_BASE(114, 114, 7, 0x000, 0x10, 5, 1),
95 	PIN_FIELD_BASE(115, 115, 7, 0x000, 0x10, 6, 1),
96 	PIN_FIELD_BASE(116, 116, 7, 0x000, 0x10, 7, 1),
97 	PIN_FIELD_BASE(117, 117, 7, 0x000, 0x10, 8, 1),
98 	PIN_FIELD_BASE(118, 118, 7, 0x000, 0x10, 9, 1),
99 	PIN_FIELD_BASE(119, 119, 7, 0x000, 0x10, 10, 1),
100 	PIN_FIELD_BASE(120, 120, 7, 0x000, 0x10, 11, 1),
101 	PIN_FIELD_BASE(121, 121, 7, 0x000, 0x10, 12, 1),
102 	PIN_FIELD_BASE(122, 122, 8, 0x000, 0x10, 0, 1),
103 	PIN_FIELD_BASE(123, 123, 8, 0x000, 0x10, 1, 1),
104 	PIN_FIELD_BASE(124, 124, 8, 0x000, 0x10, 2, 1),
105 	PINS_FIELD_BASE(125, 130, 8, 0x000, 0x10, 1, 1),
106 	PIN_FIELD_BASE(131, 131, 8, 0x000, 0x10, 3, 1),
107 	PIN_FIELD_BASE(132, 132, 8, 0x000, 0x10, 1, 1),
108 	PIN_FIELD_BASE(133, 133, 8, 0x000, 0x10, 4, 1),
109 	PIN_FIELD_BASE(134, 134, 1, 0x000, 0x10, 0, 1),
110 	PIN_FIELD_BASE(135, 135, 1, 0x000, 0x10, 1, 1),
111 	PINS_FIELD_BASE(136, 143, 1, 0x000, 0x10, 2, 1),
112 	PINS_FIELD_BASE(144, 147, 1, 0x000, 0x10, 4, 1),
113 	PIN_FIELD_BASE(148, 148, 1, 0x000, 0x10, 5, 1),
114 	PIN_FIELD_BASE(149, 149, 1, 0x000, 0x10, 6, 1),
115 	PINS_FIELD_BASE(150, 153, 1, 0x000, 0x10, 8, 1),
116 	PIN_FIELD_BASE(154, 154, 1, 0x000, 0x10, 9, 1),
117 	PINS_FIELD_BASE(155, 157, 1, 0x000, 0x10, 10, 1),
118 	PINS_FIELD_BASE(158, 160, 1, 0x000, 0x10, 8, 1),
119 	PINS_FIELD_BASE(161, 164, 2, 0x000, 0x10, 0, 1),
120 	PINS_FIELD_BASE(165, 166, 2, 0x000, 0x10, 1, 1),
121 	PINS_FIELD_BASE(167, 168, 4, 0x000, 0x10, 2, 1),
122 	PIN_FIELD_BASE(169, 169, 4, 0x000, 0x10, 3, 1),
123 	PINS_FIELD_BASE(170, 174, 4, 0x000, 0x10, 4, 1),
124 	PINS_FIELD_BASE(175, 176, 4, 0x000, 0x10, 3, 1),
125 	PINS_FIELD_BASE(177, 179, 6, 0x000, 0x10, 4, 1),
126 };
127 
128 static const struct mtk_pin_field_calc mt8183_pin_smt_range[] = {
129 	PINS_FIELD_BASE(0, 3, 6, 0x010, 0x10, 3, 1),
130 	PINS_FIELD_BASE(4, 7, 6, 0x010, 0x10, 5, 1),
131 	PIN_FIELD_BASE(8, 8, 6, 0x010, 0x10, 0, 1),
132 	PINS_FIELD_BASE(9, 10, 6, 0x010, 0x10, 12, 1),
133 	PIN_FIELD_BASE(11, 11, 1, 0x010, 0x10, 3, 1),
134 	PIN_FIELD_BASE(12, 12, 1, 0x010, 0x10, 7, 1),
135 	PINS_FIELD_BASE(13, 16, 2, 0x010, 0x10, 2, 1),
136 	PINS_FIELD_BASE(17, 20, 2, 0x010, 0x10, 3, 1),
137 	PINS_FIELD_BASE(21, 24, 2, 0x010, 0x10, 4, 1),
138 	PINS_FIELD_BASE(25, 28, 2, 0x010, 0x10, 5, 1),
139 	PIN_FIELD_BASE(29, 29, 2, 0x010, 0x10, 6, 1),
140 	PIN_FIELD_BASE(30, 30, 2, 0x010, 0x10, 7, 1),
141 	PINS_FIELD_BASE(31, 31, 2, 0x010, 0x10, 8, 1),
142 	PINS_FIELD_BASE(32, 34, 2, 0x010, 0x10, 7, 1),
143 	PINS_FIELD_BASE(35, 37, 3, 0x010, 0x10, 0, 1),
144 	PINS_FIELD_BASE(38, 40, 3, 0x010, 0x10, 1, 1),
145 	PINS_FIELD_BASE(41, 42, 3, 0x010, 0x10, 2, 1),
146 	PINS_FIELD_BASE(43, 45, 3, 0x010, 0x10, 3, 1),
147 	PINS_FIELD_BASE(46, 47, 3, 0x010, 0x10, 4, 1),
148 	PINS_FIELD_BASE(48, 49, 3, 0x010, 0x10, 5, 1),
149 	PINS_FIELD_BASE(50, 51, 4, 0x010, 0x10, 0, 1),
150 	PINS_FIELD_BASE(52, 57, 4, 0x010, 0x10, 1, 1),
151 	PINS_FIELD_BASE(58, 60, 4, 0x010, 0x10, 2, 1),
152 	PINS_FIELD_BASE(61, 64, 5, 0x010, 0x10, 0, 1),
153 	PINS_FIELD_BASE(65, 66, 5, 0x010, 0x10, 1, 1),
154 	PINS_FIELD_BASE(67, 68, 5, 0x010, 0x10, 2, 1),
155 	PINS_FIELD_BASE(69, 71, 5, 0x010, 0x10, 3, 1),
156 	PINS_FIELD_BASE(72, 76, 5, 0x010, 0x10, 4, 1),
157 	PINS_FIELD_BASE(77, 80, 5, 0x010, 0x10, 5, 1),
158 	PIN_FIELD_BASE(81, 81, 5, 0x010, 0x10, 6, 1),
159 	PINS_FIELD_BASE(82, 83, 5, 0x010, 0x10, 7, 1),
160 	PIN_FIELD_BASE(84, 84, 5, 0x010, 0x10, 6, 1),
161 	PINS_FIELD_BASE(85, 88, 5, 0x010, 0x10, 8, 1),
162 	PIN_FIELD_BASE(89, 89, 6, 0x010, 0x10, 11, 1),
163 	PIN_FIELD_BASE(90, 90, 6, 0x010, 0x10, 1, 1),
164 	PINS_FIELD_BASE(91, 94, 6, 0x010, 0x10, 2, 1),
165 	PINS_FIELD_BASE(95, 96, 6, 0x010, 0x10, 6, 1),
166 	PINS_FIELD_BASE(97, 98, 6, 0x010, 0x10, 7, 1),
167 	PIN_FIELD_BASE(99, 99, 6, 0x010, 0x10, 8, 1),
168 	PIN_FIELD_BASE(100, 100, 6, 0x010, 0x10, 9, 1),
169 	PINS_FIELD_BASE(101, 102, 6, 0x010, 0x10, 10, 1),
170 	PINS_FIELD_BASE(103, 104, 6, 0x010, 0x10, 13, 1),
171 	PINS_FIELD_BASE(105, 106, 6, 0x010, 0x10, 14, 1),
172 	PIN_FIELD_BASE(107, 107, 7, 0x010, 0x10, 0, 1),
173 	PIN_FIELD_BASE(108, 108, 7, 0x010, 0x10, 1, 1),
174 	PIN_FIELD_BASE(109, 109, 7, 0x010, 0x10, 2, 1),
175 	PIN_FIELD_BASE(110, 110, 7, 0x010, 0x10, 0, 1),
176 	PIN_FIELD_BASE(111, 111, 7, 0x010, 0x10, 3, 1),
177 	PIN_FIELD_BASE(112, 112, 7, 0x010, 0x10, 2, 1),
178 	PIN_FIELD_BASE(113, 113, 7, 0x010, 0x10, 4, 1),
179 	PIN_FIELD_BASE(114, 114, 7, 0x010, 0x10, 5, 1),
180 	PIN_FIELD_BASE(115, 115, 7, 0x010, 0x10, 6, 1),
181 	PIN_FIELD_BASE(116, 116, 7, 0x010, 0x10, 7, 1),
182 	PIN_FIELD_BASE(117, 117, 7, 0x010, 0x10, 8, 1),
183 	PIN_FIELD_BASE(118, 118, 7, 0x010, 0x10, 9, 1),
184 	PIN_FIELD_BASE(119, 119, 7, 0x010, 0x10, 10, 1),
185 	PIN_FIELD_BASE(120, 120, 7, 0x010, 0x10, 11, 1),
186 	PIN_FIELD_BASE(121, 121, 7, 0x010, 0x10, 12, 1),
187 	PIN_FIELD_BASE(122, 122, 8, 0x010, 0x10, 0, 1),
188 	PIN_FIELD_BASE(123, 123, 8, 0x010, 0x10, 1, 1),
189 	PIN_FIELD_BASE(124, 124, 8, 0x010, 0x10, 2, 1),
190 	PINS_FIELD_BASE(125, 130, 8, 0x010, 0x10, 1, 1),
191 	PIN_FIELD_BASE(131, 131, 8, 0x010, 0x10, 3, 1),
192 	PIN_FIELD_BASE(132, 132, 8, 0x010, 0x10, 1, 1),
193 	PIN_FIELD_BASE(133, 133, 8, 0x010, 0x10, 4, 1),
194 	PIN_FIELD_BASE(134, 134, 1, 0x010, 0x10, 0, 1),
195 	PIN_FIELD_BASE(135, 135, 1, 0x010, 0x10, 1, 1),
196 	PINS_FIELD_BASE(136, 143, 1, 0x010, 0x10, 2, 1),
197 	PINS_FIELD_BASE(144, 147, 1, 0x010, 0x10, 4, 1),
198 	PIN_FIELD_BASE(148, 148, 1, 0x010, 0x10, 5, 1),
199 	PIN_FIELD_BASE(149, 149, 1, 0x010, 0x10, 6, 1),
200 	PINS_FIELD_BASE(150, 153, 1, 0x010, 0x10, 8, 1),
201 	PIN_FIELD_BASE(154, 154, 1, 0x010, 0x10, 9, 1),
202 	PINS_FIELD_BASE(155, 157, 1, 0x010, 0x10, 10, 1),
203 	PINS_FIELD_BASE(158, 160, 1, 0x010, 0x10, 8, 1),
204 	PINS_FIELD_BASE(161, 164, 2, 0x010, 0x10, 0, 1),
205 	PINS_FIELD_BASE(165, 166, 2, 0x010, 0x10, 1, 1),
206 	PINS_FIELD_BASE(167, 168, 4, 0x010, 0x10, 2, 1),
207 	PIN_FIELD_BASE(169, 169, 4, 0x010, 0x10, 3, 1),
208 	PINS_FIELD_BASE(170, 174, 4, 0x010, 0x10, 4, 1),
209 	PINS_FIELD_BASE(175, 176, 4, 0x010, 0x10, 3, 1),
210 	PINS_FIELD_BASE(177, 179, 6, 0x010, 0x10, 4, 1),
211 };
212 
213 static const struct mtk_pin_field_calc mt8183_pin_pullen_range[] = {
214 	PIN_FIELD_BASE(0, 3, 6, 0x060, 0x10, 6, 1),
215 	PIN_FIELD_BASE(4, 7, 6, 0x060, 0x10, 11, 1),
216 	PIN_FIELD_BASE(8, 8, 6, 0x060, 0x10, 0, 1),
217 	PIN_FIELD_BASE(9, 10, 6, 0x060, 0x10, 26, 1),
218 	PIN_FIELD_BASE(11, 11, 1, 0x060, 0x10, 10, 1),
219 	PIN_FIELD_BASE(12, 12, 1, 0x060, 0x10, 17, 1),
220 	PIN_FIELD_BASE(13, 28, 2, 0x060, 0x10, 6, 1),
221 	PIN_FIELD_BASE(43, 49, 3, 0x060, 0x10, 8, 1),
222 	PIN_FIELD_BASE(50, 60, 4, 0x060, 0x10, 0, 1),
223 	PIN_FIELD_BASE(61, 88, 5, 0x060, 0x10, 0, 1),
224 	PIN_FIELD_BASE(89, 89, 6, 0x060, 0x10, 24, 1),
225 	PIN_FIELD_BASE(90, 90, 6, 0x060, 0x10, 1, 1),
226 	PIN_FIELD_BASE(95, 95, 6, 0x060, 0x10, 15, 1),
227 	PIN_FIELD_BASE(96, 102, 6, 0x060, 0x10, 17, 1),
228 	PIN_FIELD_BASE(103, 106, 6, 0x060, 0x10, 28, 1),
229 	PIN_FIELD_BASE(107, 121, 7, 0x060, 0x10, 0, 1),
230 	PIN_FIELD_BASE(134, 143, 1, 0x060, 0x10, 0, 1),
231 	PIN_FIELD_BASE(144, 149, 1, 0x060, 0x10, 11, 1),
232 	PIN_FIELD_BASE(150, 160, 1, 0x060, 0x10, 18, 1),
233 	PIN_FIELD_BASE(161, 166, 2, 0x060, 0x10, 0, 1),
234 	PIN_FIELD_BASE(167, 176, 4, 0x060, 0x10, 11, 1),
235 	PIN_FIELD_BASE(177, 177, 6, 0x060, 0x10, 10, 1),
236 	PIN_FIELD_BASE(178, 178, 6, 0x060, 0x10, 16, 1),
237 	PIN_FIELD_BASE(179, 179, 6, 0x060, 0x10, 25, 1),
238 };
239 
240 static const struct mtk_pin_field_calc mt8183_pin_pullsel_range[] = {
241 	PIN_FIELD_BASE(0, 3, 6, 0x080, 0x10, 6, 1),
242 	PIN_FIELD_BASE(4, 7, 6, 0x080, 0x10, 11, 1),
243 	PIN_FIELD_BASE(8, 8, 6, 0x080, 0x10, 0, 1),
244 	PIN_FIELD_BASE(9, 10, 6, 0x080, 0x10, 26, 1),
245 	PIN_FIELD_BASE(11, 11, 1, 0x080, 0x10, 10, 1),
246 	PIN_FIELD_BASE(12, 12, 1, 0x080, 0x10, 17, 1),
247 	PIN_FIELD_BASE(13, 28, 2, 0x080, 0x10, 6, 1),
248 	PIN_FIELD_BASE(43, 49, 3, 0x080, 0x10, 8, 1),
249 	PIN_FIELD_BASE(50, 60, 4, 0x080, 0x10, 0, 1),
250 	PIN_FIELD_BASE(61, 88, 5, 0x080, 0x10, 0, 1),
251 	PIN_FIELD_BASE(89, 89, 6, 0x080, 0x10, 24, 1),
252 	PIN_FIELD_BASE(90, 90, 6, 0x080, 0x10, 1, 1),
253 	PIN_FIELD_BASE(95, 95, 6, 0x080, 0x10, 15, 1),
254 	PIN_FIELD_BASE(96, 102, 6, 0x080, 0x10, 17, 1),
255 	PIN_FIELD_BASE(103, 106, 6, 0x080, 0x10, 28, 1),
256 	PIN_FIELD_BASE(107, 121, 7, 0x080, 0x10, 0, 1),
257 	PIN_FIELD_BASE(134, 143, 1, 0x080, 0x10, 0, 1),
258 	PIN_FIELD_BASE(144, 149, 1, 0x080, 0x10, 11, 1),
259 	PIN_FIELD_BASE(150, 160, 1, 0x080, 0x10, 18, 1),
260 	PIN_FIELD_BASE(161, 166, 2, 0x080, 0x10, 0, 1),
261 	PIN_FIELD_BASE(167, 176, 4, 0x080, 0x10, 11, 1),
262 	PIN_FIELD_BASE(177, 177, 6, 0x080, 0x10, 10, 1),
263 	PIN_FIELD_BASE(178, 178, 6, 0x080, 0x10, 16, 1),
264 	PIN_FIELD_BASE(179, 179, 6, 0x080, 0x10, 25, 1),
265 };
266 
267 static const struct mtk_pin_field_calc mt8183_pin_drv_range[] = {
268 	PINS_FIELD_BASE(0, 3, 6, 0x0A0, 0x10, 12, 3),
269 	PINS_FIELD_BASE(4, 7, 6, 0x0A0, 0x10, 20, 3),
270 	PIN_FIELD_BASE(8, 8, 6, 0x0A0, 0x10, 0, 3),
271 	PINS_FIELD_BASE(9, 10, 6, 0x0B0, 0x10, 16, 3),
272 	PIN_FIELD_BASE(11, 11, 1, 0x0A0, 0x10, 12, 3),
273 	PIN_FIELD_BASE(12, 12, 1, 0x0A0, 0x10, 28, 3),
274 	PINS_FIELD_BASE(13, 16, 2, 0x0A0, 0x10, 8, 3),
275 	PINS_FIELD_BASE(17, 20, 2, 0x0A0, 0x10, 12, 3),
276 	PINS_FIELD_BASE(21, 24, 2, 0x0A0, 0x10, 16, 3),
277 	PINS_FIELD_BASE(25, 28, 2, 0x0A0, 0x10, 20, 3),
278 	PIN_FIELD_BASE(29, 29, 2, 0x0A0, 0x10, 24, 3),
279 	PIN_FIELD_BASE(30, 30, 2, 0x0A0, 0x10, 28, 3),
280 	PINS_FIELD_BASE(31, 31, 2, 0x0B0, 0x10, 0, 3),
281 	PINS_FIELD_BASE(32, 34, 2, 0x0A0, 0x10, 28, 3),
282 	PINS_FIELD_BASE(35, 37, 3, 0x0A0, 0x10, 0, 3),
283 	PINS_FIELD_BASE(38, 40, 3, 0x0A0, 0x10, 4, 3),
284 	PINS_FIELD_BASE(41, 42, 3, 0x0A0, 0x10, 8, 3),
285 	PINS_FIELD_BASE(43, 45, 3, 0x0A0, 0x10, 12, 3),
286 	PINS_FIELD_BASE(46, 47, 3, 0x0A0, 0x10, 16, 3),
287 	PINS_FIELD_BASE(48, 49, 3, 0x0A0, 0x10, 20, 3),
288 	PINS_FIELD_BASE(50, 51, 4, 0x0A0, 0x10, 0, 3),
289 	PINS_FIELD_BASE(52, 57, 4, 0x0A0, 0x10, 4, 3),
290 	PINS_FIELD_BASE(58, 60, 4, 0x0A0, 0x10, 8, 3),
291 	PINS_FIELD_BASE(61, 64, 5, 0x0A0, 0x10, 0, 3),
292 	PINS_FIELD_BASE(65, 66, 5, 0x0A0, 0x10, 4, 3),
293 	PINS_FIELD_BASE(67, 68, 5, 0x0A0, 0x10, 8, 3),
294 	PINS_FIELD_BASE(69, 71, 5, 0x0A0, 0x10, 12, 3),
295 	PINS_FIELD_BASE(72, 76, 5, 0x0A0, 0x10, 16, 3),
296 	PINS_FIELD_BASE(77, 80, 5, 0x0A0, 0x10, 20, 3),
297 	PIN_FIELD_BASE(81, 81, 5, 0x0A0, 0x10, 24, 3),
298 	PINS_FIELD_BASE(82, 83, 5, 0x0A0, 0x10, 28, 3),
299 	PIN_FIELD_BASE(84, 84, 5, 0x0A0, 0x10, 24, 3),
300 	PINS_FIELD_BASE(85, 88, 5, 0x0B0, 0x10, 0, 3),
301 	PIN_FIELD_BASE(89, 89, 6, 0x0B0, 0x10, 12, 3),
302 	PIN_FIELD_BASE(90, 90, 6, 0x0A0, 0x10, 4, 3),
303 	PINS_FIELD_BASE(91, 94, 6, 0x0A0, 0x10, 8, 3),
304 	PINS_FIELD_BASE(95, 96, 6, 0x0A0, 0x10, 24, 3),
305 	PINS_FIELD_BASE(97, 98, 6, 0x0A0, 0x10, 28, 3),
306 	PIN_FIELD_BASE(99, 99, 6, 0x0B0, 0x10, 0, 3),
307 	PIN_FIELD_BASE(100, 100, 6, 0x0B0, 0x10, 4, 3),
308 	PINS_FIELD_BASE(101, 102, 6, 0x0B0, 0x10, 8, 3),
309 	PINS_FIELD_BASE(103, 104, 6, 0x0B0, 0x10, 20, 3),
310 	PINS_FIELD_BASE(105, 106, 6, 0x0B0, 0x10, 24, 3),
311 	PIN_FIELD_BASE(107, 107, 7, 0x0A0, 0x10, 0, 3),
312 	PIN_FIELD_BASE(108, 108, 7, 0x0A0, 0x10, 4, 3),
313 	PIN_FIELD_BASE(109, 109, 7, 0x0A0, 0x10, 8, 3),
314 	PIN_FIELD_BASE(110, 110, 7, 0x0A0, 0x10, 0, 3),
315 	PIN_FIELD_BASE(111, 111, 7, 0x0A0, 0x10, 4, 3),
316 	PIN_FIELD_BASE(112, 112, 7, 0x0A0, 0x10, 8, 3),
317 	PIN_FIELD_BASE(113, 113, 7, 0x0A0, 0x10, 16, 3),
318 	PIN_FIELD_BASE(114, 114, 7, 0x0A0, 0x10, 20, 3),
319 	PIN_FIELD_BASE(115, 115, 7, 0x0A0, 0x10, 24, 3),
320 	PIN_FIELD_BASE(116, 116, 7, 0x0A0, 0x10, 28, 3),
321 	PIN_FIELD_BASE(117, 117, 7, 0x0B0, 0x10, 0, 3),
322 	PIN_FIELD_BASE(118, 118, 7, 0x0B0, 0x10, 4, 3),
323 	PIN_FIELD_BASE(119, 119, 7, 0x0B0, 0x10, 8, 3),
324 	PIN_FIELD_BASE(120, 120, 7, 0x0B0, 0x10, 12, 3),
325 	PIN_FIELD_BASE(121, 121, 7, 0x0B0, 0x10, 16, 3),
326 	PIN_FIELD_BASE(122, 122, 8, 0x0A0, 0x10, 0, 3),
327 	PIN_FIELD_BASE(123, 123, 8, 0x0A0, 0x10, 4, 3),
328 	PIN_FIELD_BASE(124, 124, 8, 0x0A0, 0x10, 8, 3),
329 	PINS_FIELD_BASE(125, 130, 8, 0x0A0, 0x10, 4, 3),
330 	PIN_FIELD_BASE(131, 131, 8, 0x0A0, 0x10, 12, 3),
331 	PIN_FIELD_BASE(132, 132, 8, 0x0A0, 0x10, 4, 3),
332 	PIN_FIELD_BASE(133, 133, 8, 0x0A0, 0x10, 16, 3),
333 	PIN_FIELD_BASE(134, 134, 1, 0x0A0, 0x10, 0, 3),
334 	PIN_FIELD_BASE(135, 135, 1, 0x0A0, 0x10, 4, 3),
335 	PINS_FIELD_BASE(136, 143, 1, 0x0A0, 0x10, 8, 3),
336 	PINS_FIELD_BASE(144, 147, 1, 0x0A0, 0x10, 16, 3),
337 	PIN_FIELD_BASE(148, 148, 1, 0x0A0, 0x10, 20, 3),
338 	PIN_FIELD_BASE(149, 149, 1, 0x0A0, 0x10, 24, 3),
339 	PINS_FIELD_BASE(150, 153, 1, 0x0B0, 0x10, 0, 3),
340 	PIN_FIELD_BASE(154, 154, 1, 0x0B0, 0x10, 4, 3),
341 	PINS_FIELD_BASE(155, 157, 1, 0x0B0, 0x10, 8, 3),
342 	PINS_FIELD_BASE(158, 160, 1, 0x0B0, 0x10, 0, 3),
343 	PINS_FIELD_BASE(161, 164, 2, 0x0A0, 0x10, 0, 3),
344 	PINS_FIELD_BASE(165, 166, 2, 0x0A0, 0x10, 4, 3),
345 	PINS_FIELD_BASE(167, 168, 4, 0x0A0, 0x10, 8, 3),
346 	PIN_FIELD_BASE(169, 169, 4, 0x0A0, 0x10, 12, 3),
347 	PINS_FIELD_BASE(170, 174, 4, 0x0A0, 0x10, 16, 3),
348 	PINS_FIELD_BASE(175, 176, 4, 0x0A0, 0x10, 12, 3),
349 	PINS_FIELD_BASE(177, 179, 6, 0x0A0, 0x10, 16, 3),
350 };
351 
352 static const struct mtk_pin_field_calc mt8183_pin_pupd_range[] = {
353 	PIN_FIELD_BASE(29, 29, 2, 0x0C0, 0x10, 2, 1),
354 	PIN_FIELD_BASE(30, 30, 2, 0x0C0, 0x10, 6, 1),
355 	PIN_FIELD_BASE(31, 31, 2, 0x0C0, 0x10, 10, 1),
356 	PIN_FIELD_BASE(32, 32, 2, 0x0C0, 0x10, 14, 1),
357 	PIN_FIELD_BASE(33, 33, 2, 0x0C0, 0x10, 18, 1),
358 	PIN_FIELD_BASE(34, 34, 2, 0x0C0, 0x10, 22, 1),
359 	PIN_FIELD_BASE(35, 35, 3, 0x0C0, 0x10, 2, 1),
360 	PIN_FIELD_BASE(36, 36, 3, 0x0C0, 0x10, 6, 1),
361 	PIN_FIELD_BASE(37, 37, 3, 0x0C0, 0x10, 10, 1),
362 	PIN_FIELD_BASE(38, 38, 3, 0x0C0, 0x10, 14, 1),
363 	PIN_FIELD_BASE(39, 39, 3, 0x0C0, 0x10, 18, 1),
364 	PIN_FIELD_BASE(40, 40, 3, 0x0C0, 0x10, 22, 1),
365 	PIN_FIELD_BASE(41, 41, 3, 0x0C0, 0x10, 26, 1),
366 	PIN_FIELD_BASE(42, 42, 3, 0x0C0, 0x10, 30, 1),
367 	PIN_FIELD_BASE(91, 91, 6, 0x0C0, 0x10, 2, 1),
368 	PIN_FIELD_BASE(92, 92, 6, 0x0C0, 0x10, 6, 1),
369 	PIN_FIELD_BASE(93, 93, 6, 0x0C0, 0x10, 10, 1),
370 	PIN_FIELD_BASE(94, 94, 6, 0x0C0, 0x10, 14, 1),
371 	PIN_FIELD_BASE(122, 122, 8, 0x0C0, 0x10, 2, 1),
372 	PIN_FIELD_BASE(123, 123, 8, 0x0C0, 0x10, 6, 1),
373 	PIN_FIELD_BASE(124, 124, 8, 0x0C0, 0x10, 10, 1),
374 	PIN_FIELD_BASE(125, 125, 8, 0x0C0, 0x10, 14, 1),
375 	PIN_FIELD_BASE(126, 126, 8, 0x0C0, 0x10, 18, 1),
376 	PIN_FIELD_BASE(127, 127, 8, 0x0C0, 0x10, 22, 1),
377 	PIN_FIELD_BASE(128, 128, 8, 0x0C0, 0x10, 26, 1),
378 	PIN_FIELD_BASE(129, 129, 8, 0x0C0, 0x10, 30, 1),
379 	PIN_FIELD_BASE(130, 130, 8, 0x0D0, 0x10, 2, 1),
380 	PIN_FIELD_BASE(131, 131, 8, 0x0D0, 0x10, 6, 1),
381 	PIN_FIELD_BASE(132, 132, 8, 0x0D0, 0x10, 10, 1),
382 	PIN_FIELD_BASE(133, 133, 8, 0x0D0, 0x10, 14, 1),
383 };
384 
385 static const struct mtk_pin_field_calc mt8183_pin_r0_range[] = {
386 	PIN_FIELD_BASE(29, 29, 2, 0x0C0, 0x10, 0, 1),
387 	PIN_FIELD_BASE(30, 30, 2, 0x0C0, 0x10, 4, 1),
388 	PIN_FIELD_BASE(31, 31, 2, 0x0C0, 0x10, 8, 1),
389 	PIN_FIELD_BASE(32, 32, 2, 0x0C0, 0x10, 12, 1),
390 	PIN_FIELD_BASE(33, 33, 2, 0x0C0, 0x10, 16, 1),
391 	PIN_FIELD_BASE(34, 34, 2, 0x0C0, 0x10, 20, 1),
392 	PIN_FIELD_BASE(35, 35, 3, 0x0C0, 0x10, 0, 1),
393 	PIN_FIELD_BASE(36, 36, 3, 0x0C0, 0x10, 4, 1),
394 	PIN_FIELD_BASE(37, 37, 3, 0x0C0, 0x10, 8, 1),
395 	PIN_FIELD_BASE(38, 38, 3, 0x0C0, 0x10, 12, 1),
396 	PIN_FIELD_BASE(39, 39, 3, 0x0C0, 0x10, 16, 1),
397 	PIN_FIELD_BASE(40, 40, 3, 0x0C0, 0x10, 20, 1),
398 	PIN_FIELD_BASE(41, 41, 3, 0x0C0, 0x10, 24, 1),
399 	PIN_FIELD_BASE(42, 42, 3, 0x0C0, 0x10, 28, 1),
400 	PIN_FIELD_BASE(48, 48, 3, 0x0F0, 0x10, 18, 1),
401 	PIN_FIELD_BASE(49, 49, 3, 0x0F0, 0x10, 13, 1),
402 	PIN_FIELD_BASE(50, 50, 4, 0x0F0, 0x10, 10, 1),
403 	PIN_FIELD_BASE(51, 51, 4, 0x0F0, 0x10, 5, 1),
404 	PIN_FIELD_BASE(81, 81, 5, 0x0F0, 0x10, 7, 1),
405 	PIN_FIELD_BASE(82, 82, 5, 0x0F0, 0x10, 5, 1),
406 	PIN_FIELD_BASE(83, 83, 5, 0x0F0, 0x10, 15, 1),
407 	PIN_FIELD_BASE(84, 84, 5, 0x0F0, 0x10, 17, 1),
408 	PIN_FIELD_BASE(91, 91, 6, 0x0C0, 0x10, 0, 1),
409 	PIN_FIELD_BASE(92, 92, 6, 0x0C0, 0x10, 4, 1),
410 	PIN_FIELD_BASE(93, 93, 6, 0x0C0, 0x10, 8, 1),
411 	PIN_FIELD_BASE(94, 94, 6, 0x0C0, 0x10, 12, 1),
412 	PIN_FIELD_BASE(103, 103, 6, 0x0F0, 0x10, 20, 1),
413 	PIN_FIELD_BASE(104, 104, 6, 0x0F0, 0x10, 10, 1),
414 	PIN_FIELD_BASE(105, 105, 6, 0x0F0, 0x10, 22, 1),
415 	PIN_FIELD_BASE(106, 106, 6, 0x0F0, 0x10, 12, 1),
416 	PIN_FIELD_BASE(122, 122, 8, 0x0C0, 0x10, 0, 1),
417 	PIN_FIELD_BASE(123, 123, 8, 0x0C0, 0x10, 4, 1),
418 	PIN_FIELD_BASE(124, 124, 8, 0x0C0, 0x10, 8, 1),
419 	PIN_FIELD_BASE(125, 125, 8, 0x0C0, 0x10, 12, 1),
420 	PIN_FIELD_BASE(126, 126, 8, 0x0C0, 0x10, 16, 1),
421 	PIN_FIELD_BASE(127, 127, 8, 0x0C0, 0x10, 20, 1),
422 	PIN_FIELD_BASE(128, 128, 8, 0x0C0, 0x10, 24, 1),
423 	PIN_FIELD_BASE(129, 129, 8, 0x0C0, 0x10, 28, 1),
424 	PIN_FIELD_BASE(130, 130, 8, 0x0D0, 0x10, 0, 1),
425 	PIN_FIELD_BASE(131, 131, 8, 0x0D0, 0x10, 4, 1),
426 	PIN_FIELD_BASE(132, 132, 8, 0x0D0, 0x10, 8, 1),
427 	PIN_FIELD_BASE(133, 133, 8, 0x0D0, 0x10, 12, 1),
428 };
429 
430 static const struct mtk_pin_field_calc mt8183_pin_r1_range[] = {
431 	PIN_FIELD_BASE(29, 29, 2, 0x0C0, 0x10, 1, 1),
432 	PIN_FIELD_BASE(30, 30, 2, 0x0C0, 0x10, 5, 1),
433 	PIN_FIELD_BASE(31, 31, 2, 0x0C0, 0x10, 9, 1),
434 	PIN_FIELD_BASE(32, 32, 2, 0x0C0, 0x10, 13, 1),
435 	PIN_FIELD_BASE(33, 33, 2, 0x0C0, 0x10, 17, 1),
436 	PIN_FIELD_BASE(34, 34, 2, 0x0C0, 0x10, 21, 1),
437 	PIN_FIELD_BASE(35, 35, 3, 0x0C0, 0x10, 1, 1),
438 	PIN_FIELD_BASE(36, 36, 3, 0x0C0, 0x10, 5, 1),
439 	PIN_FIELD_BASE(37, 37, 3, 0x0C0, 0x10, 9, 1),
440 	PIN_FIELD_BASE(38, 38, 3, 0x0C0, 0x10, 13, 1),
441 	PIN_FIELD_BASE(39, 39, 3, 0x0C0, 0x10, 17, 1),
442 	PIN_FIELD_BASE(40, 40, 3, 0x0C0, 0x10, 21, 1),
443 	PIN_FIELD_BASE(41, 41, 3, 0x0C0, 0x10, 25, 1),
444 	PIN_FIELD_BASE(42, 42, 3, 0x0C0, 0x10, 29, 1),
445 	PIN_FIELD_BASE(48, 48, 3, 0x0F0, 0x10, 19, 1),
446 	PIN_FIELD_BASE(49, 49, 3, 0x0F0, 0x10, 14, 1),
447 	PIN_FIELD_BASE(50, 50, 4, 0x0F0, 0x10, 11, 1),
448 	PIN_FIELD_BASE(51, 51, 4, 0x0F0, 0x10, 6, 1),
449 	PIN_FIELD_BASE(81, 81, 5, 0x0F0, 0x10, 8, 1),
450 	PIN_FIELD_BASE(82, 82, 5, 0x0F0, 0x10, 6, 1),
451 	PIN_FIELD_BASE(83, 83, 5, 0x0F0, 0x10, 16, 1),
452 	PIN_FIELD_BASE(84, 84, 5, 0x0F0, 0x10, 18, 1),
453 	PIN_FIELD_BASE(91, 91, 6, 0x0C0, 0x10, 1, 1),
454 	PIN_FIELD_BASE(92, 92, 6, 0x0C0, 0x10, 5, 1),
455 	PIN_FIELD_BASE(93, 93, 6, 0x0C0, 0x10, 9, 1),
456 	PIN_FIELD_BASE(94, 94, 6, 0x0C0, 0x10, 13, 1),
457 	PIN_FIELD_BASE(103, 103, 6, 0x0F0, 0x10, 21, 1),
458 	PIN_FIELD_BASE(104, 104, 6, 0x0F0, 0x10, 11, 1),
459 	PIN_FIELD_BASE(105, 105, 6, 0x0F0, 0x10, 23, 1),
460 	PIN_FIELD_BASE(106, 106, 6, 0x0F0, 0x10, 13, 1),
461 	PIN_FIELD_BASE(122, 122, 8, 0x0C0, 0x10, 1, 1),
462 	PIN_FIELD_BASE(123, 123, 8, 0x0C0, 0x10, 5, 1),
463 	PIN_FIELD_BASE(124, 124, 8, 0x0C0, 0x10, 9, 1),
464 	PIN_FIELD_BASE(125, 125, 8, 0x0C0, 0x10, 13, 1),
465 	PIN_FIELD_BASE(126, 126, 8, 0x0C0, 0x10, 17, 1),
466 	PIN_FIELD_BASE(127, 127, 8, 0x0C0, 0x10, 21, 1),
467 	PIN_FIELD_BASE(128, 128, 8, 0x0C0, 0x10, 25, 1),
468 	PIN_FIELD_BASE(129, 129, 8, 0x0C0, 0x10, 29, 1),
469 	PIN_FIELD_BASE(130, 130, 8, 0x0D0, 0x10, 1, 1),
470 	PIN_FIELD_BASE(131, 131, 8, 0x0D0, 0x10, 5, 1),
471 	PIN_FIELD_BASE(132, 132, 8, 0x0D0, 0x10, 9, 1),
472 	PIN_FIELD_BASE(133, 133, 8, 0x0D0, 0x10, 13, 1),
473 };
474 
475 static const struct mtk_pin_field_calc mt8183_pin_e1e0en_range[] = {
476 	PIN_FIELD_BASE(48, 48, 3, 0x0F0, 0x10, 20, 1),
477 	PIN_FIELD_BASE(49, 49, 3, 0x0F0, 0x10, 15, 1),
478 	PIN_FIELD_BASE(50, 50, 4, 0x0F0, 0x10, 12, 1),
479 	PIN_FIELD_BASE(51, 51, 4, 0x0F0, 0x10, 7, 1),
480 	PIN_FIELD_BASE(81, 81, 5, 0x0F0, 0x10, 12, 1),
481 	PIN_FIELD_BASE(82, 82, 5, 0x0F0, 0x10, 9, 1),
482 	PIN_FIELD_BASE(83, 83, 5, 0x0F0, 0x10, 19, 1),
483 	PIN_FIELD_BASE(84, 84, 5, 0x0F0, 0x10, 22, 1),
484 	PIN_FIELD_BASE(103, 103, 6, 0x0F0, 0x10, 24, 1),
485 	PIN_FIELD_BASE(104, 104, 6, 0x0F0, 0x10, 14, 1),
486 	PIN_FIELD_BASE(105, 105, 6, 0x0F0, 0x10, 27, 1),
487 	PIN_FIELD_BASE(106, 106, 6, 0x0F0, 0x10, 17, 1),
488 };
489 
490 static const struct mtk_pin_field_calc mt8183_pin_e0_range[] = {
491 	PIN_FIELD_BASE(48, 48, 3, 0x0F0, 0x10, 21, 1),
492 	PIN_FIELD_BASE(49, 49, 3, 0x0F0, 0x10, 16, 1),
493 	PIN_FIELD_BASE(50, 50, 4, 0x0F0, 0x10, 13, 1),
494 	PIN_FIELD_BASE(51, 51, 4, 0x0F0, 0x10, 8, 1),
495 	PIN_FIELD_BASE(81, 81, 5, 0x0F0, 0x10, 13, 1),
496 	PIN_FIELD_BASE(82, 82, 5, 0x0F0, 0x10, 10, 1),
497 	PIN_FIELD_BASE(83, 83, 5, 0x0F0, 0x10, 20, 1),
498 	PIN_FIELD_BASE(84, 84, 5, 0x0F0, 0x10, 23, 1),
499 	PIN_FIELD_BASE(103, 103, 6, 0x0F0, 0x10, 25, 1),
500 	PIN_FIELD_BASE(104, 104, 6, 0x0F0, 0x10, 15, 1),
501 	PIN_FIELD_BASE(105, 105, 6, 0x0F0, 0x10, 28, 1),
502 	PIN_FIELD_BASE(106, 106, 6, 0x0F0, 0x10, 18, 1),
503 };
504 
505 static const struct mtk_pin_field_calc mt8183_pin_e1_range[] = {
506 	PIN_FIELD_BASE(48, 48, 3, 0x0F0, 0x10, 22, 1),
507 	PIN_FIELD_BASE(49, 49, 3, 0x0F0, 0x10, 17, 1),
508 	PIN_FIELD_BASE(50, 50, 4, 0x0F0, 0x10, 14, 1),
509 	PIN_FIELD_BASE(51, 51, 4, 0x0F0, 0x10, 9, 1),
510 	PIN_FIELD_BASE(81, 81, 5, 0x0F0, 0x10, 14, 1),
511 	PIN_FIELD_BASE(82, 82, 5, 0x0F0, 0x10, 11, 1),
512 	PIN_FIELD_BASE(83, 83, 5, 0x0F0, 0x10, 21, 1),
513 	PIN_FIELD_BASE(84, 84, 5, 0x0F0, 0x10, 24, 1),
514 	PIN_FIELD_BASE(103, 103, 6, 0x0F0, 0x10, 26, 1),
515 	PIN_FIELD_BASE(104, 104, 6, 0x0F0, 0x10, 16, 1),
516 	PIN_FIELD_BASE(105, 105, 6, 0x0F0, 0x10, 29, 1),
517 	PIN_FIELD_BASE(106, 106, 6, 0x0F0, 0x10, 19, 1),
518 };
519 
520 static const struct mtk_pin_reg_calc mt8183_reg_cals[PINCTRL_PIN_REG_MAX] = {
521 	[PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt8183_pin_mode_range),
522 	[PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8183_pin_dir_range),
523 	[PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8183_pin_di_range),
524 	[PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8183_pin_do_range),
525 	[PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8183_pin_smt_range),
526 	[PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8183_pin_ies_range),
527 	[PINCTRL_PIN_REG_PULLEN] = MTK_RANGE(mt8183_pin_pullen_range),
528 	[PINCTRL_PIN_REG_PULLSEL] = MTK_RANGE(mt8183_pin_pullsel_range),
529 	[PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt8183_pin_drv_range),
530 	[PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt8183_pin_pupd_range),
531 	[PINCTRL_PIN_REG_R0] = MTK_RANGE(mt8183_pin_r0_range),
532 	[PINCTRL_PIN_REG_R1] = MTK_RANGE(mt8183_pin_r1_range),
533 	[PINCTRL_PIN_REG_DRV_EN] = MTK_RANGE(mt8183_pin_e1e0en_range),
534 	[PINCTRL_PIN_REG_DRV_E0] = MTK_RANGE(mt8183_pin_e0_range),
535 	[PINCTRL_PIN_REG_DRV_E1] = MTK_RANGE(mt8183_pin_e1_range),
536 };
537 
538 static const char * const mt8183_pinctrl_register_base_names[] = {
539 	"iocfg0", "iocfg1", "iocfg2", "iocfg3", "iocfg4", "iocfg5",
540 	"iocfg6", "iocfg7", "iocfg8",
541 };
542 
543 static const struct mtk_eint_hw mt8183_eint_hw = {
544 	.port_mask = 7,
545 	.ports     = 6,
546 	.ap_num    = 212,
547 	.db_cnt    = 13,
548 	.db_time   = debounce_time_mt6765,
549 };
550 
551 static const struct mtk_pin_soc mt8183_data = {
552 	.reg_cal = mt8183_reg_cals,
553 	.pins = mtk_pins_mt8183,
554 	.npins = ARRAY_SIZE(mtk_pins_mt8183),
555 	.ngrps = ARRAY_SIZE(mtk_pins_mt8183),
556 	.eint_hw = &mt8183_eint_hw,
557 	.gpio_m = 0,
558 	.base_names = mt8183_pinctrl_register_base_names,
559 	.nbase_names = ARRAY_SIZE(mt8183_pinctrl_register_base_names),
560 	.bias_set_combo = mtk_pinconf_bias_set_combo,
561 	.bias_get_combo = mtk_pinconf_bias_get_combo,
562 	.drive_set = mtk_pinconf_drive_set_rev1,
563 	.drive_get = mtk_pinconf_drive_get_rev1,
564 	.adv_pull_get = mtk_pinconf_adv_pull_get,
565 	.adv_pull_set = mtk_pinconf_adv_pull_set,
566 	.adv_drive_get = mtk_pinconf_adv_drive_get,
567 	.adv_drive_set = mtk_pinconf_adv_drive_set,
568 };
569 
570 static const struct of_device_id mt8183_pinctrl_of_match[] = {
571 	{ .compatible = "mediatek,mt8183-pinctrl", .data = &mt8183_data },
572 	{ }
573 };
574 
575 static struct platform_driver mt8183_pinctrl_driver = {
576 	.driver = {
577 		.name = "mt8183-pinctrl",
578 		.of_match_table = mt8183_pinctrl_of_match,
579 		.pm = &mtk_paris_pinctrl_pm_ops,
580 	},
581 	.probe = mtk_paris_pinctrl_probe,
582 };
583 
584 static int __init mt8183_pinctrl_init(void)
585 {
586 	return platform_driver_register(&mt8183_pinctrl_driver);
587 }
588 arch_initcall(mt8183_pinctrl_init);
589