1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2021 MediaTek Inc.
4 *
5 * Author: Guodong Liu <guodong.liu@mediatek.com>
6 *
7 */
8
9 #include "pinctrl-mtk-mt8186.h"
10 #include "pinctrl-paris.h"
11
12 /* MT8186 have multiple bases to program pin configuration listed as the below:
13 * iocfg[0]:0x10005000, iocfg[1]:0x10002000, iocfg[2]:0x10002200,
14 * iocfg[3]:0x10002400, iocfg[4]:0x10002600, iocfg[5]:0x10002800,
15 * iocfg[6]:0x10002C00.
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, x_bits, 32, 0)
21
22 #define PINS_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \
23 PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, 32, 1)
24
25 static const struct mtk_pin_field_calc mt8186_pin_mode_range[] = {
26 PIN_FIELD(0, 184, 0x300, 0x10, 0, 4),
27 };
28
29 static const struct mtk_pin_field_calc mt8186_pin_dir_range[] = {
30 PIN_FIELD(0, 184, 0x0, 0x10, 0, 1),
31 };
32
33 static const struct mtk_pin_field_calc mt8186_pin_di_range[] = {
34 PIN_FIELD(0, 184, 0x200, 0x10, 0, 1),
35 };
36
37 static const struct mtk_pin_field_calc mt8186_pin_do_range[] = {
38 PIN_FIELD(0, 184, 0x100, 0x10, 0, 1),
39 };
40
41 static const struct mtk_pin_field_calc mt8186_pin_ies_range[] = {
42 PIN_FIELD_BASE(0, 0, 6, 0x0030, 0x10, 13, 1),
43 PIN_FIELD_BASE(1, 1, 6, 0x0030, 0x10, 14, 1),
44 PIN_FIELD_BASE(2, 2, 6, 0x0030, 0x10, 17, 1),
45 PIN_FIELD_BASE(3, 3, 6, 0x0030, 0x10, 18, 1),
46 PIN_FIELD_BASE(4, 4, 6, 0x0030, 0x10, 19, 1),
47 PIN_FIELD_BASE(5, 5, 6, 0x0030, 0x10, 20, 1),
48 PIN_FIELD_BASE(6, 6, 4, 0x0020, 0x10, 19, 1),
49 PIN_FIELD_BASE(7, 7, 4, 0x0020, 0x10, 20, 1),
50 PIN_FIELD_BASE(8, 8, 4, 0x0020, 0x10, 21, 1),
51 PIN_FIELD_BASE(9, 9, 4, 0x0020, 0x10, 22, 1),
52 PIN_FIELD_BASE(10, 10, 4, 0x0020, 0x10, 16, 1),
53 PIN_FIELD_BASE(11, 11, 4, 0x0020, 0x10, 17, 1),
54 PIN_FIELD_BASE(12, 12, 4, 0x0020, 0x10, 18, 1),
55 PIN_FIELD_BASE(13, 13, 3, 0x0040, 0x10, 0, 1),
56 PIN_FIELD_BASE(14, 14, 3, 0x0040, 0x10, 1, 1),
57 PIN_FIELD_BASE(15, 15, 6, 0x0030, 0x10, 15, 1),
58 PIN_FIELD_BASE(16, 16, 6, 0x0030, 0x10, 16, 1),
59 PIN_FIELD_BASE(17, 17, 5, 0x0050, 0x10, 9, 1),
60 PIN_FIELD_BASE(18, 18, 5, 0x0050, 0x10, 10, 1),
61 PIN_FIELD_BASE(19, 19, 5, 0x0050, 0x10, 3, 1),
62 PIN_FIELD_BASE(20, 20, 5, 0x0050, 0x10, 6, 1),
63 PIN_FIELD_BASE(21, 21, 5, 0x0050, 0x10, 4, 1),
64 PIN_FIELD_BASE(22, 22, 5, 0x0050, 0x10, 7, 1),
65 PIN_FIELD_BASE(23, 23, 5, 0x0050, 0x10, 5, 1),
66 PIN_FIELD_BASE(24, 24, 5, 0x0050, 0x10, 8, 1),
67 PIN_FIELD_BASE(25, 25, 5, 0x0050, 0x10, 18, 1),
68 PIN_FIELD_BASE(26, 26, 5, 0x0050, 0x10, 15, 1),
69 PIN_FIELD_BASE(27, 27, 5, 0x0050, 0x10, 17, 1),
70 PIN_FIELD_BASE(28, 28, 5, 0x0050, 0x10, 16, 1),
71 PIN_FIELD_BASE(29, 29, 6, 0x0030, 0x10, 0, 1),
72 PIN_FIELD_BASE(30, 30, 6, 0x0030, 0x10, 1, 1),
73 PIN_FIELD_BASE(31, 31, 6, 0x0030, 0x10, 2, 1),
74 PIN_FIELD_BASE(32, 32, 2, 0x0040, 0x10, 25, 1),
75 PIN_FIELD_BASE(33, 33, 2, 0x0040, 0x10, 27, 1),
76 PIN_FIELD_BASE(34, 34, 2, 0x0040, 0x10, 26, 1),
77 PIN_FIELD_BASE(35, 35, 2, 0x0040, 0x10, 28, 1),
78 PIN_FIELD_BASE(36, 36, 2, 0x0040, 0x10, 9, 1),
79 PIN_FIELD_BASE(37, 37, 2, 0x0040, 0x10, 10, 1),
80 PIN_FIELD_BASE(38, 38, 2, 0x0040, 0x10, 12, 1),
81 PIN_FIELD_BASE(39, 39, 2, 0x0040, 0x10, 11, 1),
82 PIN_FIELD_BASE(40, 40, 2, 0x0040, 0x10, 13, 1),
83 PIN_FIELD_BASE(41, 41, 2, 0x0040, 0x10, 14, 1),
84 PIN_FIELD_BASE(42, 42, 2, 0x0040, 0x10, 16, 1),
85 PIN_FIELD_BASE(43, 43, 2, 0x0040, 0x10, 15, 1),
86 PIN_FIELD_BASE(44, 44, 5, 0x0060, 0x10, 0, 1),
87 PIN_FIELD_BASE(45, 45, 5, 0x0060, 0x10, 1, 1),
88 PIN_FIELD_BASE(46, 46, 5, 0x0060, 0x10, 3, 1),
89 PIN_FIELD_BASE(47, 47, 5, 0x0060, 0x10, 2, 1),
90 PIN_FIELD_BASE(48, 48, 2, 0x0040, 0x10, 17, 1),
91 PIN_FIELD_BASE(49, 49, 2, 0x0040, 0x10, 18, 1),
92 PIN_FIELD_BASE(50, 50, 2, 0x0040, 0x10, 20, 1),
93 PIN_FIELD_BASE(51, 51, 2, 0x0040, 0x10, 19, 1),
94 PIN_FIELD_BASE(52, 52, 3, 0x0040, 0x10, 18, 1),
95 PIN_FIELD_BASE(53, 53, 3, 0x0040, 0x10, 19, 1),
96 PIN_FIELD_BASE(54, 54, 3, 0x0040, 0x10, 21, 1),
97 PIN_FIELD_BASE(55, 55, 3, 0x0040, 0x10, 20, 1),
98 PIN_FIELD_BASE(56, 56, 5, 0x0050, 0x10, 12, 1),
99 PIN_FIELD_BASE(57, 57, 5, 0x0050, 0x10, 11, 1),
100 PIN_FIELD_BASE(58, 58, 5, 0x0050, 0x10, 13, 1),
101 PIN_FIELD_BASE(59, 59, 5, 0x0050, 0x10, 14, 1),
102 PIN_FIELD_BASE(60, 60, 3, 0x0040, 0x10, 27, 1),
103 PIN_FIELD_BASE(61, 61, 3, 0x0040, 0x10, 22, 1),
104 PIN_FIELD_BASE(62, 62, 3, 0x0040, 0x10, 28, 1),
105 PIN_FIELD_BASE(63, 63, 3, 0x0040, 0x10, 23, 1),
106 PIN_FIELD_BASE(64, 64, 3, 0x0040, 0x10, 24, 1),
107 PIN_FIELD_BASE(65, 65, 3, 0x0040, 0x10, 25, 1),
108 PIN_FIELD_BASE(66, 66, 3, 0x0040, 0x10, 26, 1),
109 PIN_FIELD_BASE(67, 67, 1, 0x0050, 0x10, 18, 1),
110 PIN_FIELD_BASE(68, 68, 1, 0x0050, 0x10, 8, 1),
111 PIN_FIELD_BASE(69, 69, 1, 0x0050, 0x10, 9, 1),
112 PIN_FIELD_BASE(70, 70, 1, 0x0050, 0x10, 19, 1),
113 PIN_FIELD_BASE(71, 71, 1, 0x0050, 0x10, 10, 1),
114 PIN_FIELD_BASE(72, 72, 1, 0x0050, 0x10, 11, 1),
115 PIN_FIELD_BASE(73, 73, 1, 0x0050, 0x10, 12, 1),
116 PIN_FIELD_BASE(74, 74, 1, 0x0050, 0x10, 13, 1),
117 PIN_FIELD_BASE(75, 75, 1, 0x0050, 0x10, 14, 1),
118 PIN_FIELD_BASE(76, 76, 1, 0x0050, 0x10, 15, 1),
119 PIN_FIELD_BASE(77, 77, 1, 0x0050, 0x10, 16, 1),
120 PIN_FIELD_BASE(78, 78, 1, 0x0050, 0x10, 17, 1),
121 PIN_FIELD_BASE(79, 79, 5, 0x0050, 0x10, 24, 1),
122 PIN_FIELD_BASE(80, 80, 5, 0x0050, 0x10, 25, 1),
123 PIN_FIELD_BASE(81, 81, 5, 0x0050, 0x10, 26, 1),
124 PIN_FIELD_BASE(82, 82, 5, 0x0050, 0x10, 27, 1),
125 PIN_FIELD_BASE(83, 83, 6, 0x0030, 0x10, 3, 1),
126 PIN_FIELD_BASE(84, 84, 3, 0x0040, 0x10, 4, 1),
127 PIN_FIELD_BASE(85, 85, 3, 0x0040, 0x10, 5, 1),
128 PIN_FIELD_BASE(86, 86, 3, 0x0040, 0x10, 6, 1),
129 PIN_FIELD_BASE(87, 87, 3, 0x0040, 0x10, 7, 1),
130 PIN_FIELD_BASE(88, 88, 3, 0x0040, 0x10, 8, 1),
131 PIN_FIELD_BASE(89, 89, 3, 0x0040, 0x10, 9, 1),
132 PIN_FIELD_BASE(90, 90, 3, 0x0040, 0x10, 2, 1),
133 PIN_FIELD_BASE(91, 91, 3, 0x0040, 0x10, 29, 1),
134 PIN_FIELD_BASE(92, 92, 3, 0x0040, 0x10, 31, 1),
135 PIN_FIELD_BASE(93, 93, 3, 0x0040, 0x10, 3, 1),
136 PIN_FIELD_BASE(94, 94, 3, 0x0040, 0x10, 30, 1),
137 PIN_FIELD_BASE(95, 95, 3, 0x0050, 0x10, 0, 1),
138 PIN_FIELD_BASE(96, 96, 2, 0x0040, 0x10, 1, 1),
139 PIN_FIELD_BASE(97, 97, 2, 0x0040, 0x10, 0, 1),
140 PIN_FIELD_BASE(98, 98, 2, 0x0040, 0x10, 2, 1),
141 PIN_FIELD_BASE(99, 99, 4, 0x0020, 0x10, 14, 1),
142 PIN_FIELD_BASE(100, 100, 4, 0x0020, 0x10, 15, 1),
143 PIN_FIELD_BASE(101, 101, 4, 0x0020, 0x10, 13, 1),
144 PIN_FIELD_BASE(102, 102, 4, 0x0020, 0x10, 12, 1),
145 PIN_FIELD_BASE(103, 103, 4, 0x0020, 0x10, 0, 1),
146 PIN_FIELD_BASE(104, 104, 4, 0x0020, 0x10, 1, 1),
147 PIN_FIELD_BASE(105, 105, 4, 0x0020, 0x10, 4, 1),
148 PIN_FIELD_BASE(106, 106, 4, 0x0020, 0x10, 5, 1),
149 PIN_FIELD_BASE(107, 107, 4, 0x0020, 0x10, 6, 1),
150 PIN_FIELD_BASE(108, 108, 4, 0x0020, 0x10, 7, 1),
151 PIN_FIELD_BASE(109, 109, 4, 0x0020, 0x10, 8, 1),
152 PIN_FIELD_BASE(110, 110, 4, 0x0020, 0x10, 9, 1),
153 PIN_FIELD_BASE(111, 111, 4, 0x0020, 0x10, 10, 1),
154 PIN_FIELD_BASE(112, 112, 4, 0x0020, 0x10, 11, 1),
155 PIN_FIELD_BASE(113, 113, 4, 0x0020, 0x10, 2, 1),
156 PIN_FIELD_BASE(114, 114, 4, 0x0020, 0x10, 3, 1),
157 PIN_FIELD_BASE(115, 115, 3, 0x0040, 0x10, 10, 1),
158 PIN_FIELD_BASE(116, 116, 3, 0x0040, 0x10, 13, 1),
159 PIN_FIELD_BASE(117, 117, 3, 0x0040, 0x10, 11, 1),
160 PIN_FIELD_BASE(118, 118, 3, 0x0040, 0x10, 12, 1),
161 PIN_FIELD_BASE(119, 119, 5, 0x0050, 0x10, 22, 1),
162 PIN_FIELD_BASE(120, 120, 5, 0x0050, 0x10, 19, 1),
163 PIN_FIELD_BASE(121, 121, 5, 0x0050, 0x10, 20, 1),
164 PIN_FIELD_BASE(122, 122, 5, 0x0050, 0x10, 21, 1),
165 PIN_FIELD_BASE(123, 123, 5, 0x0050, 0x10, 23, 1),
166 PIN_FIELD_BASE(124, 124, 5, 0x0050, 0x10, 0, 1),
167 PIN_FIELD_BASE(125, 125, 5, 0x0050, 0x10, 1, 1),
168 PIN_FIELD_BASE(126, 126, 5, 0x0050, 0x10, 2, 1),
169 PIN_FIELD_BASE(127, 127, 3, 0x0040, 0x10, 14, 1),
170 PIN_FIELD_BASE(128, 128, 3, 0x0040, 0x10, 16, 1),
171 PIN_FIELD_BASE(129, 129, 5, 0x0050, 0x10, 28, 1),
172 PIN_FIELD_BASE(130, 130, 5, 0x0050, 0x10, 30, 1),
173 PIN_FIELD_BASE(131, 131, 5, 0x0050, 0x10, 29, 1),
174 PIN_FIELD_BASE(132, 132, 5, 0x0050, 0x10, 31, 1),
175 PIN_FIELD_BASE(133, 133, 1, 0x0050, 0x10, 21, 1),
176 PIN_FIELD_BASE(134, 134, 1, 0x0050, 0x10, 24, 1),
177 PIN_FIELD_BASE(135, 135, 6, 0x0030, 0x10, 21, 1),
178 PIN_FIELD_BASE(136, 136, 6, 0x0030, 0x10, 24, 1),
179 PIN_FIELD_BASE(137, 137, 1, 0x0050, 0x10, 22, 1),
180 PIN_FIELD_BASE(138, 138, 1, 0x0050, 0x10, 25, 1),
181 PIN_FIELD_BASE(139, 139, 2, 0x0040, 0x10, 7, 1),
182 PIN_FIELD_BASE(140, 140, 2, 0x0040, 0x10, 8, 1),
183 PIN_FIELD_BASE(141, 141, 3, 0x0040, 0x10, 15, 1),
184 PIN_FIELD_BASE(142, 142, 3, 0x0040, 0x10, 17, 1),
185 PIN_FIELD_BASE(143, 143, 6, 0x0030, 0x10, 22, 1),
186 PIN_FIELD_BASE(144, 144, 6, 0x0030, 0x10, 25, 1),
187 PIN_FIELD_BASE(145, 145, 6, 0x0030, 0x10, 23, 1),
188 PIN_FIELD_BASE(146, 146, 6, 0x0030, 0x10, 26, 1),
189 PIN_FIELD_BASE(147, 147, 4, 0x0020, 0x10, 23, 1),
190 PIN_FIELD_BASE(148, 148, 4, 0x0020, 0x10, 24, 1),
191 PIN_FIELD_BASE(149, 149, 4, 0x0020, 0x10, 25, 1),
192 PIN_FIELD_BASE(150, 150, 4, 0x0020, 0x10, 26, 1),
193 PIN_FIELD_BASE(151, 151, 4, 0x0020, 0x10, 27, 1),
194 PIN_FIELD_BASE(152, 152, 4, 0x0020, 0x10, 28, 1),
195 PIN_FIELD_BASE(153, 153, 4, 0x0020, 0x10, 29, 1),
196 PIN_FIELD_BASE(154, 154, 4, 0x0020, 0x10, 30, 1),
197 PIN_FIELD_BASE(155, 155, 4, 0x0020, 0x10, 31, 1),
198 PIN_FIELD_BASE(156, 156, 4, 0x0030, 0x10, 0, 1),
199 PIN_FIELD_BASE(157, 157, 2, 0x0040, 0x10, 4, 1),
200 PIN_FIELD_BASE(158, 158, 2, 0x0040, 0x10, 3, 1),
201 PIN_FIELD_BASE(159, 159, 2, 0x0040, 0x10, 6, 1),
202 PIN_FIELD_BASE(160, 160, 2, 0x0040, 0x10, 5, 1),
203 PIN_FIELD_BASE(161, 161, 2, 0x0040, 0x10, 23, 1),
204 PIN_FIELD_BASE(162, 162, 2, 0x0040, 0x10, 24, 1),
205 PIN_FIELD_BASE(163, 163, 1, 0x0050, 0x10, 23, 1),
206 PIN_FIELD_BASE(164, 164, 1, 0x0050, 0x10, 20, 1),
207 PIN_FIELD_BASE(165, 165, 1, 0x0050, 0x10, 26, 1),
208 PIN_FIELD_BASE(166, 166, 1, 0x0050, 0x10, 1, 1),
209 PIN_FIELD_BASE(167, 167, 1, 0x0050, 0x10, 7, 1),
210 PIN_FIELD_BASE(168, 168, 1, 0x0050, 0x10, 4, 1),
211 PIN_FIELD_BASE(169, 169, 1, 0x0050, 0x10, 5, 1),
212 PIN_FIELD_BASE(170, 170, 1, 0x0050, 0x10, 0, 1),
213 PIN_FIELD_BASE(171, 171, 1, 0x0050, 0x10, 6, 1),
214 PIN_FIELD_BASE(172, 172, 1, 0x0050, 0x10, 2, 1),
215 PIN_FIELD_BASE(173, 173, 1, 0x0050, 0x10, 3, 1),
216 PIN_FIELD_BASE(174, 174, 6, 0x0030, 0x10, 7, 1),
217 PIN_FIELD_BASE(175, 175, 6, 0x0030, 0x10, 8, 1),
218 PIN_FIELD_BASE(176, 176, 6, 0x0030, 0x10, 4, 1),
219 PIN_FIELD_BASE(177, 177, 6, 0x0030, 0x10, 5, 1),
220 PIN_FIELD_BASE(178, 178, 6, 0x0030, 0x10, 6, 1),
221 PIN_FIELD_BASE(179, 179, 6, 0x0030, 0x10, 9, 1),
222 PIN_FIELD_BASE(180, 180, 6, 0x0030, 0x10, 10, 1),
223 PIN_FIELD_BASE(181, 181, 6, 0x0030, 0x10, 11, 1),
224 PIN_FIELD_BASE(182, 182, 6, 0x0030, 0x10, 12, 1),
225 PIN_FIELD_BASE(183, 183, 2, 0x0040, 0x10, 21, 1),
226 PIN_FIELD_BASE(184, 184, 2, 0x0040, 0x10, 22, 1),
227 };
228
229 static const struct mtk_pin_field_calc mt8186_pin_smt_range[] = {
230 PIN_FIELD_BASE(0, 0, 6, 0x0080, 0x10, 0, 1),
231 PIN_FIELD_BASE(1, 1, 6, 0x0080, 0x10, 0, 1),
232 PIN_FIELD_BASE(2, 2, 6, 0x0080, 0x10, 0, 1),
233 PIN_FIELD_BASE(3, 3, 6, 0x0080, 0x10, 0, 1),
234 PIN_FIELD_BASE(4, 4, 6, 0x0080, 0x10, 1, 1),
235 PIN_FIELD_BASE(5, 5, 6, 0x0080, 0x10, 1, 1),
236 PIN_FIELD_BASE(6, 6, 4, 0x0090, 0x10, 0, 1),
237 PIN_FIELD_BASE(7, 7, 4, 0x0090, 0x10, 1, 1),
238 PIN_FIELD_BASE(8, 8, 4, 0x0090, 0x10, 1, 1),
239 PIN_FIELD_BASE(9, 9, 4, 0x0090, 0x10, 1, 1),
240 PIN_FIELD_BASE(10, 10, 4, 0x0090, 0x10, 0, 1),
241 PIN_FIELD_BASE(11, 11, 4, 0x0090, 0x10, 0, 1),
242 PIN_FIELD_BASE(12, 12, 4, 0x0090, 0x10, 0, 1),
243 PIN_FIELD_BASE(13, 13, 3, 0x00e0, 0x10, 11, 1),
244 PIN_FIELD_BASE(14, 14, 3, 0x00e0, 0x10, 11, 1),
245 PIN_FIELD_BASE(15, 15, 6, 0x0080, 0x10, 2, 1),
246 PIN_FIELD_BASE(16, 16, 6, 0x0080, 0x10, 2, 1),
247 PIN_FIELD_BASE(17, 17, 5, 0x00e0, 0x10, 3, 1),
248 PIN_FIELD_BASE(18, 18, 5, 0x00e0, 0x10, 7, 1),
249 PIN_FIELD_BASE(19, 19, 5, 0x00e0, 0x10, 6, 1),
250 PIN_FIELD_BASE(20, 20, 5, 0x00e0, 0x10, 5, 1),
251 PIN_FIELD_BASE(21, 21, 5, 0x00e0, 0x10, 6, 1),
252 PIN_FIELD_BASE(22, 22, 5, 0x00e0, 0x10, 5, 1),
253 PIN_FIELD_BASE(23, 23, 5, 0x00e0, 0x10, 7, 1),
254 PIN_FIELD_BASE(24, 24, 5, 0x00e0, 0x10, 10, 1),
255 PIN_FIELD_BASE(25, 25, 5, 0x00e0, 0x10, 7, 1),
256 PIN_FIELD_BASE(26, 26, 5, 0x00e0, 0x10, 6, 1),
257 PIN_FIELD_BASE(27, 27, 5, 0x00e0, 0x10, 6, 1),
258 PIN_FIELD_BASE(28, 28, 5, 0x00e0, 0x10, 7, 1),
259 PIN_FIELD_BASE(29, 29, 6, 0x0080, 0x10, 1, 1),
260 PIN_FIELD_BASE(30, 30, 6, 0x0080, 0x10, 1, 1),
261 PIN_FIELD_BASE(31, 31, 6, 0x0080, 0x10, 2, 1),
262 PIN_FIELD_BASE(32, 32, 2, 0x0090, 0x10, 2, 1),
263 PIN_FIELD_BASE(33, 33, 2, 0x0090, 0x10, 2, 1),
264 PIN_FIELD_BASE(34, 34, 2, 0x0090, 0x10, 1, 1),
265 PIN_FIELD_BASE(35, 35, 2, 0x0090, 0x10, 1, 1),
266 PIN_FIELD_BASE(36, 36, 2, 0x0090, 0x10, 3, 1),
267 PIN_FIELD_BASE(37, 37, 2, 0x0090, 0x10, 3, 1),
268 PIN_FIELD_BASE(38, 38, 2, 0x0090, 0x10, 4, 1),
269 PIN_FIELD_BASE(39, 39, 2, 0x0090, 0x10, 3, 1),
270 PIN_FIELD_BASE(40, 40, 2, 0x0090, 0x10, 5, 1),
271 PIN_FIELD_BASE(41, 41, 2, 0x0090, 0x10, 4, 1),
272 PIN_FIELD_BASE(42, 42, 2, 0x0090, 0x10, 4, 1),
273 PIN_FIELD_BASE(43, 43, 2, 0x0090, 0x10, 4, 1),
274 PIN_FIELD_BASE(44, 44, 5, 0x00e0, 0x10, 9, 1),
275 PIN_FIELD_BASE(45, 45, 5, 0x00e0, 0x10, 8, 1),
276 PIN_FIELD_BASE(46, 46, 5, 0x00e0, 0x10, 8, 1),
277 PIN_FIELD_BASE(47, 47, 5, 0x00e0, 0x10, 9, 1),
278 PIN_FIELD_BASE(48, 48, 2, 0x0090, 0x10, 5, 1),
279 PIN_FIELD_BASE(49, 49, 2, 0x0090, 0x10, 5, 1),
280 PIN_FIELD_BASE(50, 50, 2, 0x0090, 0x10, 5, 1),
281 PIN_FIELD_BASE(51, 51, 2, 0x0090, 0x10, 6, 1),
282 PIN_FIELD_BASE(52, 52, 3, 0x00e0, 0x10, 9, 1),
283 PIN_FIELD_BASE(53, 53, 3, 0x00e0, 0x10, 10, 1),
284 PIN_FIELD_BASE(54, 54, 3, 0x00e0, 0x10, 9, 1),
285 PIN_FIELD_BASE(55, 55, 3, 0x00e0, 0x10, 9, 1),
286 PIN_FIELD_BASE(56, 56, 5, 0x00e0, 0x10, 8, 1),
287 PIN_FIELD_BASE(57, 57, 5, 0x00e0, 0x10, 9, 1),
288 PIN_FIELD_BASE(58, 58, 5, 0x00e0, 0x10, 9, 1),
289 PIN_FIELD_BASE(59, 59, 5, 0x00e0, 0x10, 8, 1),
290 PIN_FIELD_BASE(60, 60, 3, 0x00e0, 0x10, 6, 1),
291 PIN_FIELD_BASE(61, 61, 3, 0x00e0, 0x10, 6, 1),
292 PIN_FIELD_BASE(62, 62, 3, 0x00e0, 0x10, 6, 1),
293 PIN_FIELD_BASE(63, 63, 3, 0x00e0, 0x10, 6, 1),
294 PIN_FIELD_BASE(64, 64, 3, 0x00e0, 0x10, 7, 1),
295 PIN_FIELD_BASE(65, 65, 3, 0x00e0, 0x10, 7, 1),
296 PIN_FIELD_BASE(66, 66, 3, 0x00e0, 0x10, 7, 1),
297 PIN_FIELD_BASE(67, 67, 1, 0x00f0, 0x10, 10, 1),
298 PIN_FIELD_BASE(68, 68, 1, 0x00f0, 0x10, 0, 1),
299 PIN_FIELD_BASE(69, 69, 1, 0x00f0, 0x10, 1, 1),
300 PIN_FIELD_BASE(70, 70, 1, 0x00f0, 0x10, 11, 1),
301 PIN_FIELD_BASE(71, 71, 1, 0x00f0, 0x10, 2, 1),
302 PIN_FIELD_BASE(72, 72, 1, 0x00f0, 0x10, 3, 1),
303 PIN_FIELD_BASE(73, 73, 1, 0x00f0, 0x10, 4, 1),
304 PIN_FIELD_BASE(74, 74, 1, 0x00f0, 0x10, 5, 1),
305 PIN_FIELD_BASE(75, 75, 1, 0x00f0, 0x10, 6, 1),
306 PIN_FIELD_BASE(76, 76, 1, 0x00f0, 0x10, 7, 1),
307 PIN_FIELD_BASE(77, 77, 1, 0x00f0, 0x10, 8, 1),
308 PIN_FIELD_BASE(78, 78, 1, 0x00f0, 0x10, 9, 1),
309 PIN_FIELD_BASE(79, 79, 5, 0x00e0, 0x10, 5, 1),
310 PIN_FIELD_BASE(80, 80, 5, 0x00e0, 0x10, 5, 1),
311 PIN_FIELD_BASE(81, 81, 5, 0x00e0, 0x10, 4, 1),
312 PIN_FIELD_BASE(82, 82, 5, 0x00e0, 0x10, 4, 1),
313 PIN_FIELD_BASE(83, 83, 6, 0x0080, 0x10, 2, 1),
314 PIN_FIELD_BASE(84, 84, 3, 0x00e0, 0x10, 0, 1),
315 PIN_FIELD_BASE(85, 85, 3, 0x00e0, 0x10, 1, 1),
316 PIN_FIELD_BASE(86, 86, 3, 0x00e0, 0x10, 2, 1),
317 PIN_FIELD_BASE(87, 87, 3, 0x00e0, 0x10, 3, 1),
318 PIN_FIELD_BASE(88, 88, 3, 0x00e0, 0x10, 4, 1),
319 PIN_FIELD_BASE(89, 89, 3, 0x00e0, 0x10, 5, 1),
320 PIN_FIELD_BASE(90, 90, 3, 0x00e0, 0x10, 7, 1),
321 PIN_FIELD_BASE(91, 91, 3, 0x00e0, 0x10, 8, 1),
322 PIN_FIELD_BASE(92, 92, 3, 0x00e0, 0x10, 8, 1),
323 PIN_FIELD_BASE(93, 93, 3, 0x00e0, 0x10, 8, 1),
324 PIN_FIELD_BASE(94, 94, 3, 0x00e0, 0x10, 8, 1),
325 PIN_FIELD_BASE(95, 95, 3, 0x00e0, 0x10, 9, 1),
326 PIN_FIELD_BASE(96, 96, 2, 0x0090, 0x10, 3, 1),
327 PIN_FIELD_BASE(97, 97, 2, 0x0090, 0x10, 2, 1),
328 PIN_FIELD_BASE(98, 98, 2, 0x0090, 0x10, 1, 1),
329 PIN_FIELD_BASE(99, 99, 4, 0x0090, 0x10, 4, 1),
330 PIN_FIELD_BASE(100, 100, 4, 0x0090, 0x10, 4, 1),
331 PIN_FIELD_BASE(101, 101, 4, 0x0090, 0x10, 4, 1),
332 PIN_FIELD_BASE(102, 102, 4, 0x0090, 0x10, 5, 1),
333 PIN_FIELD_BASE(103, 103, 4, 0x0090, 0x10, 5, 1),
334 PIN_FIELD_BASE(104, 104, 4, 0x0090, 0x10, 5, 1),
335 PIN_FIELD_BASE(105, 105, 4, 0x0090, 0x10, 5, 1),
336 PIN_FIELD_BASE(106, 106, 4, 0x0090, 0x10, 6, 1),
337 PIN_FIELD_BASE(107, 107, 4, 0x0090, 0x10, 6, 1),
338 PIN_FIELD_BASE(108, 108, 4, 0x0090, 0x10, 6, 1),
339 PIN_FIELD_BASE(109, 109, 4, 0x0090, 0x10, 6, 1),
340 PIN_FIELD_BASE(110, 110, 4, 0x0090, 0x10, 7, 1),
341 PIN_FIELD_BASE(111, 111, 4, 0x0090, 0x10, 7, 1),
342 PIN_FIELD_BASE(112, 112, 4, 0x0090, 0x10, 7, 1),
343 PIN_FIELD_BASE(113, 113, 4, 0x0090, 0x10, 7, 1),
344 PIN_FIELD_BASE(114, 114, 4, 0x0090, 0x10, 8, 1),
345 PIN_FIELD_BASE(115, 115, 3, 0x00e0, 0x10, 10, 1),
346 PIN_FIELD_BASE(116, 116, 3, 0x00e0, 0x10, 11, 1),
347 PIN_FIELD_BASE(117, 117, 3, 0x00e0, 0x10, 10, 1),
348 PIN_FIELD_BASE(118, 118, 3, 0x00e0, 0x10, 10, 1),
349 PIN_FIELD_BASE(119, 119, 5, 0x00e0, 0x10, 4, 1),
350 PIN_FIELD_BASE(120, 120, 5, 0x00e0, 0x10, 4, 1),
351 PIN_FIELD_BASE(121, 121, 5, 0x00e0, 0x10, 3, 1),
352 PIN_FIELD_BASE(122, 122, 5, 0x00e0, 0x10, 3, 1),
353 PIN_FIELD_BASE(123, 123, 5, 0x00e0, 0x10, 3, 1),
354 PIN_FIELD_BASE(124, 124, 5, 0x00e0, 0x10, 0, 1),
355 PIN_FIELD_BASE(125, 125, 5, 0x00e0, 0x10, 1, 1),
356 PIN_FIELD_BASE(126, 126, 5, 0x00e0, 0x10, 2, 1),
357 PIN_FIELD_BASE(127, 127, 3, 0x00e0, 0x10, 12, 1),
358 PIN_FIELD_BASE(128, 128, 3, 0x00e0, 0x10, 14, 1),
359 PIN_FIELD_BASE(129, 129, 5, 0x00e0, 0x10, 11, 1),
360 PIN_FIELD_BASE(130, 130, 5, 0x00e0, 0x10, 13, 1),
361 PIN_FIELD_BASE(131, 131, 5, 0x00e0, 0x10, 12, 1),
362 PIN_FIELD_BASE(132, 132, 5, 0x00e0, 0x10, 14, 1),
363 PIN_FIELD_BASE(133, 133, 1, 0x00f0, 0x10, 15, 1),
364 PIN_FIELD_BASE(134, 134, 1, 0x00f0, 0x10, 17, 1),
365 PIN_FIELD_BASE(135, 135, 6, 0x0080, 0x10, 6, 1),
366 PIN_FIELD_BASE(136, 136, 6, 0x0080, 0x10, 9, 1),
367 PIN_FIELD_BASE(137, 137, 1, 0x00f0, 0x10, 16, 1),
368 PIN_FIELD_BASE(138, 138, 1, 0x00f0, 0x10, 18, 1),
369 PIN_FIELD_BASE(139, 139, 2, 0x0090, 0x10, 7, 1),
370 PIN_FIELD_BASE(140, 140, 2, 0x0090, 0x10, 8, 1),
371 PIN_FIELD_BASE(141, 141, 3, 0x00e0, 0x10, 13, 1),
372 PIN_FIELD_BASE(142, 142, 3, 0x00e0, 0x10, 15, 1),
373 PIN_FIELD_BASE(143, 143, 6, 0x0080, 0x10, 7, 1),
374 PIN_FIELD_BASE(144, 144, 6, 0x0080, 0x10, 10, 1),
375 PIN_FIELD_BASE(145, 145, 6, 0x0080, 0x10, 8, 1),
376 PIN_FIELD_BASE(146, 146, 6, 0x0080, 0x10, 11, 1),
377 PIN_FIELD_BASE(147, 147, 4, 0x0090, 0x10, 2, 1),
378 PIN_FIELD_BASE(148, 148, 4, 0x0090, 0x10, 2, 1),
379 PIN_FIELD_BASE(149, 149, 4, 0x0090, 0x10, 2, 1),
380 PIN_FIELD_BASE(150, 150, 4, 0x0090, 0x10, 2, 1),
381 PIN_FIELD_BASE(151, 151, 4, 0x0090, 0x10, 3, 1),
382 PIN_FIELD_BASE(152, 152, 4, 0x0090, 0x10, 1, 1),
383 PIN_FIELD_BASE(153, 153, 4, 0x0090, 0x10, 3, 1),
384 PIN_FIELD_BASE(154, 154, 4, 0x0090, 0x10, 3, 1),
385 PIN_FIELD_BASE(155, 155, 4, 0x0090, 0x10, 3, 1),
386 PIN_FIELD_BASE(156, 156, 4, 0x0090, 0x10, 4, 1),
387 PIN_FIELD_BASE(157, 157, 2, 0x0090, 0x10, 0, 1),
388 PIN_FIELD_BASE(158, 158, 2, 0x0090, 0x10, 0, 1),
389 PIN_FIELD_BASE(159, 159, 2, 0x0090, 0x10, 0, 1),
390 PIN_FIELD_BASE(160, 160, 2, 0x0090, 0x10, 0, 1),
391 PIN_FIELD_BASE(161, 161, 2, 0x0090, 0x10, 2, 1),
392 PIN_FIELD_BASE(162, 162, 2, 0x0090, 0x10, 1, 1),
393 PIN_FIELD_BASE(163, 163, 1, 0x00f0, 0x10, 14, 1),
394 PIN_FIELD_BASE(164, 164, 1, 0x00f0, 0x10, 12, 1),
395 PIN_FIELD_BASE(165, 165, 1, 0x00f0, 0x10, 12, 1),
396 PIN_FIELD_BASE(166, 166, 1, 0x00f0, 0x10, 13, 1),
397 PIN_FIELD_BASE(167, 167, 1, 0x00f0, 0x10, 13, 1),
398 PIN_FIELD_BASE(168, 168, 1, 0x00f0, 0x10, 12, 1),
399 PIN_FIELD_BASE(169, 169, 1, 0x00f0, 0x10, 14, 1),
400 PIN_FIELD_BASE(170, 170, 1, 0x00f0, 0x10, 13, 1),
401 PIN_FIELD_BASE(171, 171, 1, 0x00f0, 0x10, 13, 1),
402 PIN_FIELD_BASE(172, 172, 1, 0x00f0, 0x10, 14, 1),
403 PIN_FIELD_BASE(173, 173, 1, 0x00f0, 0x10, 12, 1),
404 PIN_FIELD_BASE(174, 174, 6, 0x0080, 0x10, 3, 1),
405 PIN_FIELD_BASE(175, 175, 6, 0x0080, 0x10, 3, 1),
406 PIN_FIELD_BASE(176, 176, 6, 0x0080, 0x10, 4, 1),
407 PIN_FIELD_BASE(177, 177, 6, 0x0080, 0x10, 4, 1),
408 PIN_FIELD_BASE(178, 178, 6, 0x0080, 0x10, 3, 1),
409 PIN_FIELD_BASE(179, 179, 6, 0x0080, 0x10, 3, 1),
410 PIN_FIELD_BASE(180, 180, 6, 0x0080, 0x10, 4, 1),
411 PIN_FIELD_BASE(181, 181, 6, 0x0080, 0x10, 4, 1),
412 PIN_FIELD_BASE(182, 182, 6, 0x0080, 0x10, 5, 1),
413 PIN_FIELD_BASE(183, 183, 2, 0x0090, 0x10, 9, 1),
414 PIN_FIELD_BASE(184, 184, 2, 0x0090, 0x10, 10, 1),
415 };
416
417 static const struct mtk_pin_field_calc mt8186_pin_pu_range[] = {
418 PIN_FIELD_BASE(0, 0, 6, 0x0050, 0x10, 13, 1),
419 PIN_FIELD_BASE(1, 1, 6, 0x0050, 0x10, 14, 1),
420 PIN_FIELD_BASE(2, 2, 6, 0x0050, 0x10, 17, 1),
421 PIN_FIELD_BASE(3, 3, 6, 0x0050, 0x10, 18, 1),
422 PIN_FIELD_BASE(4, 4, 6, 0x0050, 0x10, 19, 1),
423 PIN_FIELD_BASE(5, 5, 6, 0x0050, 0x10, 20, 1),
424 PIN_FIELD_BASE(6, 6, 4, 0x0060, 0x10, 19, 1),
425 PIN_FIELD_BASE(7, 7, 4, 0x0060, 0x10, 20, 1),
426 PIN_FIELD_BASE(8, 8, 4, 0x0060, 0x10, 21, 1),
427 PIN_FIELD_BASE(9, 9, 4, 0x0060, 0x10, 22, 1),
428 PIN_FIELD_BASE(10, 10, 4, 0x0060, 0x10, 16, 1),
429 PIN_FIELD_BASE(11, 11, 4, 0x0060, 0x10, 17, 1),
430 PIN_FIELD_BASE(12, 12, 4, 0x0060, 0x10, 18, 1),
431 PIN_FIELD_BASE(13, 13, 3, 0x0080, 0x10, 0, 1),
432 PIN_FIELD_BASE(14, 14, 3, 0x0080, 0x10, 1, 1),
433 PIN_FIELD_BASE(15, 15, 6, 0x0050, 0x10, 15, 1),
434 PIN_FIELD_BASE(16, 16, 6, 0x0050, 0x10, 16, 1),
435 PIN_FIELD_BASE(17, 17, 5, 0x0090, 0x10, 9, 1),
436 PIN_FIELD_BASE(18, 18, 5, 0x0090, 0x10, 10, 1),
437 PIN_FIELD_BASE(19, 19, 5, 0x0090, 0x10, 3, 1),
438 PIN_FIELD_BASE(20, 20, 5, 0x0090, 0x10, 6, 1),
439 PIN_FIELD_BASE(21, 21, 5, 0x0090, 0x10, 4, 1),
440 PIN_FIELD_BASE(22, 22, 5, 0x0090, 0x10, 7, 1),
441 PIN_FIELD_BASE(23, 23, 5, 0x0090, 0x10, 5, 1),
442 PIN_FIELD_BASE(24, 24, 5, 0x0090, 0x10, 8, 1),
443 PIN_FIELD_BASE(25, 25, 5, 0x0090, 0x10, 18, 1),
444 PIN_FIELD_BASE(26, 26, 5, 0x0090, 0x10, 15, 1),
445 PIN_FIELD_BASE(27, 27, 5, 0x0090, 0x10, 17, 1),
446 PIN_FIELD_BASE(28, 28, 5, 0x0090, 0x10, 16, 1),
447 PIN_FIELD_BASE(29, 29, 6, 0x0050, 0x10, 0, 1),
448 PIN_FIELD_BASE(30, 30, 6, 0x0050, 0x10, 1, 1),
449 PIN_FIELD_BASE(31, 31, 6, 0x0050, 0x10, 2, 1),
450 PIN_FIELD_BASE(32, 32, 2, 0x0060, 0x10, 25, 1),
451 PIN_FIELD_BASE(33, 33, 2, 0x0060, 0x10, 27, 1),
452 PIN_FIELD_BASE(34, 34, 2, 0x0060, 0x10, 26, 1),
453 PIN_FIELD_BASE(35, 35, 2, 0x0060, 0x10, 28, 1),
454 PIN_FIELD_BASE(36, 36, 2, 0x0060, 0x10, 9, 1),
455 PIN_FIELD_BASE(37, 37, 2, 0x0060, 0x10, 10, 1),
456 PIN_FIELD_BASE(38, 38, 2, 0x0060, 0x10, 12, 1),
457 PIN_FIELD_BASE(39, 39, 2, 0x0060, 0x10, 11, 1),
458 PIN_FIELD_BASE(40, 40, 2, 0x0060, 0x10, 13, 1),
459 PIN_FIELD_BASE(41, 41, 2, 0x0060, 0x10, 14, 1),
460 PIN_FIELD_BASE(42, 42, 2, 0x0060, 0x10, 16, 1),
461 PIN_FIELD_BASE(43, 43, 2, 0x0060, 0x10, 15, 1),
462 PIN_FIELD_BASE(44, 44, 5, 0x0090, 0x10, 28, 1),
463 PIN_FIELD_BASE(45, 45, 5, 0x0090, 0x10, 29, 1),
464 PIN_FIELD_BASE(46, 46, 5, 0x0090, 0x10, 31, 1),
465 PIN_FIELD_BASE(47, 47, 5, 0x0090, 0x10, 30, 1),
466 PIN_FIELD_BASE(48, 48, 2, 0x0060, 0x10, 17, 1),
467 PIN_FIELD_BASE(49, 49, 2, 0x0060, 0x10, 18, 1),
468 PIN_FIELD_BASE(50, 50, 2, 0x0060, 0x10, 20, 1),
469 PIN_FIELD_BASE(51, 51, 2, 0x0060, 0x10, 19, 1),
470 PIN_FIELD_BASE(52, 52, 3, 0x0080, 0x10, 12, 1),
471 PIN_FIELD_BASE(53, 53, 3, 0x0080, 0x10, 13, 1),
472 PIN_FIELD_BASE(54, 54, 3, 0x0080, 0x10, 15, 1),
473 PIN_FIELD_BASE(55, 55, 3, 0x0080, 0x10, 14, 1),
474 PIN_FIELD_BASE(56, 56, 5, 0x0090, 0x10, 12, 1),
475 PIN_FIELD_BASE(57, 57, 5, 0x0090, 0x10, 11, 1),
476 PIN_FIELD_BASE(58, 58, 5, 0x0090, 0x10, 13, 1),
477 PIN_FIELD_BASE(59, 59, 5, 0x0090, 0x10, 14, 1),
478 PIN_FIELD_BASE(60, 60, 3, 0x0080, 0x10, 21, 1),
479 PIN_FIELD_BASE(61, 61, 3, 0x0080, 0x10, 16, 1),
480 PIN_FIELD_BASE(62, 62, 3, 0x0080, 0x10, 22, 1),
481 PIN_FIELD_BASE(63, 63, 3, 0x0080, 0x10, 17, 1),
482 PIN_FIELD_BASE(64, 64, 3, 0x0080, 0x10, 18, 1),
483 PIN_FIELD_BASE(65, 65, 3, 0x0080, 0x10, 19, 1),
484 PIN_FIELD_BASE(66, 66, 3, 0x0080, 0x10, 20, 1),
485 PIN_FIELD_BASE(83, 83, 6, 0x0050, 0x10, 3, 1),
486 PIN_FIELD_BASE(90, 90, 3, 0x0080, 0x10, 2, 1),
487 PIN_FIELD_BASE(91, 91, 3, 0x0080, 0x10, 23, 1),
488 PIN_FIELD_BASE(92, 92, 3, 0x0080, 0x10, 25, 1),
489 PIN_FIELD_BASE(93, 93, 3, 0x0080, 0x10, 3, 1),
490 PIN_FIELD_BASE(94, 94, 3, 0x0080, 0x10, 24, 1),
491 PIN_FIELD_BASE(95, 95, 3, 0x0080, 0x10, 26, 1),
492 PIN_FIELD_BASE(96, 96, 2, 0x0060, 0x10, 1, 1),
493 PIN_FIELD_BASE(97, 97, 2, 0x0060, 0x10, 0, 1),
494 PIN_FIELD_BASE(98, 98, 2, 0x0060, 0x10, 2, 1),
495 PIN_FIELD_BASE(99, 99, 4, 0x0060, 0x10, 14, 1),
496 PIN_FIELD_BASE(100, 100, 4, 0x0060, 0x10, 15, 1),
497 PIN_FIELD_BASE(101, 101, 4, 0x0060, 0x10, 13, 1),
498 PIN_FIELD_BASE(102, 102, 4, 0x0060, 0x10, 12, 1),
499 PIN_FIELD_BASE(103, 103, 4, 0x0060, 0x10, 0, 1),
500 PIN_FIELD_BASE(104, 104, 4, 0x0060, 0x10, 1, 1),
501 PIN_FIELD_BASE(105, 105, 4, 0x0060, 0x10, 4, 1),
502 PIN_FIELD_BASE(106, 106, 4, 0x0060, 0x10, 5, 1),
503 PIN_FIELD_BASE(107, 107, 4, 0x0060, 0x10, 6, 1),
504 PIN_FIELD_BASE(108, 108, 4, 0x0060, 0x10, 7, 1),
505 PIN_FIELD_BASE(109, 109, 4, 0x0060, 0x10, 8, 1),
506 PIN_FIELD_BASE(110, 110, 4, 0x0060, 0x10, 9, 1),
507 PIN_FIELD_BASE(111, 111, 4, 0x0060, 0x10, 10, 1),
508 PIN_FIELD_BASE(112, 112, 4, 0x0060, 0x10, 11, 1),
509 PIN_FIELD_BASE(113, 113, 4, 0x0060, 0x10, 2, 1),
510 PIN_FIELD_BASE(114, 114, 4, 0x0060, 0x10, 3, 1),
511 PIN_FIELD_BASE(115, 115, 3, 0x0080, 0x10, 4, 1),
512 PIN_FIELD_BASE(116, 116, 3, 0x0080, 0x10, 7, 1),
513 PIN_FIELD_BASE(117, 117, 3, 0x0080, 0x10, 5, 1),
514 PIN_FIELD_BASE(118, 118, 3, 0x0080, 0x10, 6, 1),
515 PIN_FIELD_BASE(119, 119, 5, 0x0090, 0x10, 22, 1),
516 PIN_FIELD_BASE(120, 120, 5, 0x0090, 0x10, 19, 1),
517 PIN_FIELD_BASE(121, 121, 5, 0x0090, 0x10, 20, 1),
518 PIN_FIELD_BASE(122, 122, 5, 0x0090, 0x10, 21, 1),
519 PIN_FIELD_BASE(123, 123, 5, 0x0090, 0x10, 23, 1),
520 PIN_FIELD_BASE(124, 124, 5, 0x0090, 0x10, 0, 1),
521 PIN_FIELD_BASE(125, 125, 5, 0x0090, 0x10, 1, 1),
522 PIN_FIELD_BASE(126, 126, 5, 0x0090, 0x10, 2, 1),
523 PIN_FIELD_BASE(127, 127, 3, 0x0080, 0x10, 8, 1),
524 PIN_FIELD_BASE(128, 128, 3, 0x0080, 0x10, 10, 1),
525 PIN_FIELD_BASE(129, 129, 5, 0x0090, 0x10, 24, 1),
526 PIN_FIELD_BASE(130, 130, 5, 0x0090, 0x10, 26, 1),
527 PIN_FIELD_BASE(131, 131, 5, 0x0090, 0x10, 25, 1),
528 PIN_FIELD_BASE(132, 132, 5, 0x0090, 0x10, 27, 1),
529 PIN_FIELD_BASE(133, 133, 1, 0x0080, 0x10, 9, 1),
530 PIN_FIELD_BASE(134, 134, 1, 0x0080, 0x10, 12, 1),
531 PIN_FIELD_BASE(135, 135, 6, 0x0050, 0x10, 21, 1),
532 PIN_FIELD_BASE(136, 136, 6, 0x0050, 0x10, 24, 1),
533 PIN_FIELD_BASE(137, 137, 1, 0x0080, 0x10, 10, 1),
534 PIN_FIELD_BASE(138, 138, 1, 0x0080, 0x10, 13, 1),
535 PIN_FIELD_BASE(139, 139, 2, 0x0060, 0x10, 7, 1),
536 PIN_FIELD_BASE(140, 140, 2, 0x0060, 0x10, 8, 1),
537 PIN_FIELD_BASE(141, 141, 3, 0x0080, 0x10, 9, 1),
538 PIN_FIELD_BASE(142, 142, 3, 0x0080, 0x10, 11, 1),
539 PIN_FIELD_BASE(143, 143, 6, 0x0050, 0x10, 22, 1),
540 PIN_FIELD_BASE(144, 144, 6, 0x0050, 0x10, 25, 1),
541 PIN_FIELD_BASE(145, 145, 6, 0x0050, 0x10, 23, 1),
542 PIN_FIELD_BASE(146, 146, 6, 0x0050, 0x10, 26, 1),
543 PIN_FIELD_BASE(147, 147, 4, 0x0060, 0x10, 23, 1),
544 PIN_FIELD_BASE(148, 148, 4, 0x0060, 0x10, 24, 1),
545 PIN_FIELD_BASE(149, 149, 4, 0x0060, 0x10, 25, 1),
546 PIN_FIELD_BASE(150, 150, 4, 0x0060, 0x10, 26, 1),
547 PIN_FIELD_BASE(151, 151, 4, 0x0060, 0x10, 27, 1),
548 PIN_FIELD_BASE(152, 152, 4, 0x0060, 0x10, 28, 1),
549 PIN_FIELD_BASE(153, 153, 4, 0x0060, 0x10, 29, 1),
550 PIN_FIELD_BASE(154, 154, 4, 0x0060, 0x10, 30, 1),
551 PIN_FIELD_BASE(155, 155, 4, 0x0060, 0x10, 31, 1),
552 PIN_FIELD_BASE(156, 156, 4, 0x0070, 0x10, 0, 1),
553 PIN_FIELD_BASE(157, 157, 2, 0x0060, 0x10, 4, 1),
554 PIN_FIELD_BASE(158, 158, 2, 0x0060, 0x10, 3, 1),
555 PIN_FIELD_BASE(159, 159, 2, 0x0060, 0x10, 6, 1),
556 PIN_FIELD_BASE(160, 160, 2, 0x0060, 0x10, 5, 1),
557 PIN_FIELD_BASE(161, 161, 2, 0x0060, 0x10, 23, 1),
558 PIN_FIELD_BASE(162, 162, 2, 0x0060, 0x10, 24, 1),
559 PIN_FIELD_BASE(163, 163, 1, 0x0080, 0x10, 11, 1),
560 PIN_FIELD_BASE(164, 164, 1, 0x0080, 0x10, 8, 1),
561 PIN_FIELD_BASE(165, 165, 1, 0x0080, 0x10, 16, 1),
562 PIN_FIELD_BASE(166, 166, 1, 0x0080, 0x10, 1, 1),
563 PIN_FIELD_BASE(167, 167, 1, 0x0080, 0x10, 7, 1),
564 PIN_FIELD_BASE(168, 168, 1, 0x0080, 0x10, 4, 1),
565 PIN_FIELD_BASE(169, 169, 1, 0x0080, 0x10, 5, 1),
566 PIN_FIELD_BASE(170, 170, 1, 0x0080, 0x10, 0, 1),
567 PIN_FIELD_BASE(171, 171, 1, 0x0080, 0x10, 6, 1),
568 PIN_FIELD_BASE(172, 172, 1, 0x0080, 0x10, 2, 1),
569 PIN_FIELD_BASE(173, 173, 1, 0x0080, 0x10, 3, 1),
570 PIN_FIELD_BASE(174, 174, 6, 0x0050, 0x10, 7, 1),
571 PIN_FIELD_BASE(175, 175, 6, 0x0050, 0x10, 8, 1),
572 PIN_FIELD_BASE(176, 176, 6, 0x0050, 0x10, 4, 1),
573 PIN_FIELD_BASE(177, 177, 6, 0x0050, 0x10, 5, 1),
574 PIN_FIELD_BASE(178, 178, 6, 0x0050, 0x10, 6, 1),
575 PIN_FIELD_BASE(179, 179, 6, 0x0050, 0x10, 9, 1),
576 PIN_FIELD_BASE(180, 180, 6, 0x0050, 0x10, 10, 1),
577 PIN_FIELD_BASE(181, 181, 6, 0x0050, 0x10, 11, 1),
578 PIN_FIELD_BASE(182, 182, 6, 0x0050, 0x10, 12, 1),
579 PIN_FIELD_BASE(183, 183, 2, 0x0060, 0x10, 21, 1),
580 PIN_FIELD_BASE(184, 184, 2, 0x0060, 0x10, 22, 1),
581 };
582
583 static const struct mtk_pin_field_calc mt8186_pin_pd_range[] = {
584 PIN_FIELD_BASE(0, 0, 6, 0x0040, 0x10, 13, 1),
585 PIN_FIELD_BASE(1, 1, 6, 0x0040, 0x10, 14, 1),
586 PIN_FIELD_BASE(2, 2, 6, 0x0040, 0x10, 17, 1),
587 PIN_FIELD_BASE(3, 3, 6, 0x0040, 0x10, 18, 1),
588 PIN_FIELD_BASE(4, 4, 6, 0x0040, 0x10, 19, 1),
589 PIN_FIELD_BASE(5, 5, 6, 0x0040, 0x10, 20, 1),
590 PIN_FIELD_BASE(6, 6, 4, 0x0040, 0x10, 19, 1),
591 PIN_FIELD_BASE(7, 7, 4, 0x0040, 0x10, 20, 1),
592 PIN_FIELD_BASE(8, 8, 4, 0x0040, 0x10, 21, 1),
593 PIN_FIELD_BASE(9, 9, 4, 0x0040, 0x10, 22, 1),
594 PIN_FIELD_BASE(10, 10, 4, 0x0040, 0x10, 16, 1),
595 PIN_FIELD_BASE(11, 11, 4, 0x0040, 0x10, 17, 1),
596 PIN_FIELD_BASE(12, 12, 4, 0x0040, 0x10, 18, 1),
597 PIN_FIELD_BASE(13, 13, 3, 0x0060, 0x10, 0, 1),
598 PIN_FIELD_BASE(14, 14, 3, 0x0060, 0x10, 1, 1),
599 PIN_FIELD_BASE(15, 15, 6, 0x0040, 0x10, 15, 1),
600 PIN_FIELD_BASE(16, 16, 6, 0x0040, 0x10, 16, 1),
601 PIN_FIELD_BASE(17, 17, 5, 0x0070, 0x10, 9, 1),
602 PIN_FIELD_BASE(18, 18, 5, 0x0070, 0x10, 10, 1),
603 PIN_FIELD_BASE(19, 19, 5, 0x0070, 0x10, 3, 1),
604 PIN_FIELD_BASE(20, 20, 5, 0x0070, 0x10, 6, 1),
605 PIN_FIELD_BASE(21, 21, 5, 0x0070, 0x10, 4, 1),
606 PIN_FIELD_BASE(22, 22, 5, 0x0070, 0x10, 7, 1),
607 PIN_FIELD_BASE(23, 23, 5, 0x0070, 0x10, 5, 1),
608 PIN_FIELD_BASE(24, 24, 5, 0x0070, 0x10, 8, 1),
609 PIN_FIELD_BASE(25, 25, 5, 0x0070, 0x10, 18, 1),
610 PIN_FIELD_BASE(26, 26, 5, 0x0070, 0x10, 15, 1),
611 PIN_FIELD_BASE(27, 27, 5, 0x0070, 0x10, 17, 1),
612 PIN_FIELD_BASE(28, 28, 5, 0x0070, 0x10, 16, 1),
613 PIN_FIELD_BASE(29, 29, 6, 0x0040, 0x10, 0, 1),
614 PIN_FIELD_BASE(30, 30, 6, 0x0040, 0x10, 1, 1),
615 PIN_FIELD_BASE(31, 31, 6, 0x0040, 0x10, 2, 1),
616 PIN_FIELD_BASE(32, 32, 2, 0x0050, 0x10, 25, 1),
617 PIN_FIELD_BASE(33, 33, 2, 0x0050, 0x10, 27, 1),
618 PIN_FIELD_BASE(34, 34, 2, 0x0050, 0x10, 26, 1),
619 PIN_FIELD_BASE(35, 35, 2, 0x0050, 0x10, 28, 1),
620 PIN_FIELD_BASE(36, 36, 2, 0x0050, 0x10, 9, 1),
621 PIN_FIELD_BASE(37, 37, 2, 0x0050, 0x10, 10, 1),
622 PIN_FIELD_BASE(38, 38, 2, 0x0050, 0x10, 12, 1),
623 PIN_FIELD_BASE(39, 39, 2, 0x0050, 0x10, 11, 1),
624 PIN_FIELD_BASE(40, 40, 2, 0x0050, 0x10, 13, 1),
625 PIN_FIELD_BASE(41, 41, 2, 0x0050, 0x10, 14, 1),
626 PIN_FIELD_BASE(42, 42, 2, 0x0050, 0x10, 16, 1),
627 PIN_FIELD_BASE(43, 43, 2, 0x0050, 0x10, 15, 1),
628 PIN_FIELD_BASE(44, 44, 5, 0x0070, 0x10, 28, 1),
629 PIN_FIELD_BASE(45, 45, 5, 0x0070, 0x10, 29, 1),
630 PIN_FIELD_BASE(46, 46, 5, 0x0070, 0x10, 31, 1),
631 PIN_FIELD_BASE(47, 47, 5, 0x0070, 0x10, 30, 1),
632 PIN_FIELD_BASE(48, 48, 2, 0x0050, 0x10, 17, 1),
633 PIN_FIELD_BASE(49, 49, 2, 0x0050, 0x10, 18, 1),
634 PIN_FIELD_BASE(50, 50, 2, 0x0050, 0x10, 20, 1),
635 PIN_FIELD_BASE(51, 51, 2, 0x0050, 0x10, 19, 1),
636 PIN_FIELD_BASE(52, 52, 3, 0x0060, 0x10, 12, 1),
637 PIN_FIELD_BASE(53, 53, 3, 0x0060, 0x10, 13, 1),
638 PIN_FIELD_BASE(54, 54, 3, 0x0060, 0x10, 15, 1),
639 PIN_FIELD_BASE(55, 55, 3, 0x0060, 0x10, 14, 1),
640 PIN_FIELD_BASE(56, 56, 5, 0x0070, 0x10, 12, 1),
641 PIN_FIELD_BASE(57, 57, 5, 0x0070, 0x10, 11, 1),
642 PIN_FIELD_BASE(58, 58, 5, 0x0070, 0x10, 13, 1),
643 PIN_FIELD_BASE(59, 59, 5, 0x0070, 0x10, 14, 1),
644 PIN_FIELD_BASE(60, 60, 3, 0x0060, 0x10, 21, 1),
645 PIN_FIELD_BASE(61, 61, 3, 0x0060, 0x10, 16, 1),
646 PIN_FIELD_BASE(62, 62, 3, 0x0060, 0x10, 22, 1),
647 PIN_FIELD_BASE(63, 63, 3, 0x0060, 0x10, 17, 1),
648 PIN_FIELD_BASE(64, 64, 3, 0x0060, 0x10, 18, 1),
649 PIN_FIELD_BASE(65, 65, 3, 0x0060, 0x10, 19, 1),
650 PIN_FIELD_BASE(66, 66, 3, 0x0060, 0x10, 20, 1),
651 PIN_FIELD_BASE(83, 83, 6, 0x0040, 0x10, 3, 1),
652 PIN_FIELD_BASE(90, 90, 3, 0x0060, 0x10, 2, 1),
653 PIN_FIELD_BASE(91, 91, 3, 0x0060, 0x10, 23, 1),
654 PIN_FIELD_BASE(92, 92, 3, 0x0060, 0x10, 25, 1),
655 PIN_FIELD_BASE(93, 93, 3, 0x0060, 0x10, 3, 1),
656 PIN_FIELD_BASE(94, 94, 3, 0x0060, 0x10, 24, 1),
657 PIN_FIELD_BASE(95, 95, 3, 0x0060, 0x10, 26, 1),
658 PIN_FIELD_BASE(96, 96, 2, 0x0050, 0x10, 1, 1),
659 PIN_FIELD_BASE(97, 97, 2, 0x0050, 0x10, 0, 1),
660 PIN_FIELD_BASE(98, 98, 2, 0x0050, 0x10, 2, 1),
661 PIN_FIELD_BASE(99, 99, 4, 0x0040, 0x10, 14, 1),
662 PIN_FIELD_BASE(100, 100, 4, 0x0040, 0x10, 15, 1),
663 PIN_FIELD_BASE(101, 101, 4, 0x0040, 0x10, 13, 1),
664 PIN_FIELD_BASE(102, 102, 4, 0x0040, 0x10, 12, 1),
665 PIN_FIELD_BASE(103, 103, 4, 0x0040, 0x10, 0, 1),
666 PIN_FIELD_BASE(104, 104, 4, 0x0040, 0x10, 1, 1),
667 PIN_FIELD_BASE(105, 105, 4, 0x0040, 0x10, 4, 1),
668 PIN_FIELD_BASE(106, 106, 4, 0x0040, 0x10, 5, 1),
669 PIN_FIELD_BASE(107, 107, 4, 0x0040, 0x10, 6, 1),
670 PIN_FIELD_BASE(108, 108, 4, 0x0040, 0x10, 7, 1),
671 PIN_FIELD_BASE(109, 109, 4, 0x0040, 0x10, 8, 1),
672 PIN_FIELD_BASE(110, 110, 4, 0x0040, 0x10, 9, 1),
673 PIN_FIELD_BASE(111, 111, 4, 0x0040, 0x10, 10, 1),
674 PIN_FIELD_BASE(112, 112, 4, 0x0040, 0x10, 11, 1),
675 PIN_FIELD_BASE(113, 113, 4, 0x0040, 0x10, 2, 1),
676 PIN_FIELD_BASE(114, 114, 4, 0x0040, 0x10, 3, 1),
677 PIN_FIELD_BASE(115, 115, 3, 0x0060, 0x10, 4, 1),
678 PIN_FIELD_BASE(116, 116, 3, 0x0060, 0x10, 7, 1),
679 PIN_FIELD_BASE(117, 117, 3, 0x0060, 0x10, 5, 1),
680 PIN_FIELD_BASE(118, 118, 3, 0x0060, 0x10, 6, 1),
681 PIN_FIELD_BASE(119, 119, 5, 0x0070, 0x10, 22, 1),
682 PIN_FIELD_BASE(120, 120, 5, 0x0070, 0x10, 19, 1),
683 PIN_FIELD_BASE(121, 121, 5, 0x0070, 0x10, 20, 1),
684 PIN_FIELD_BASE(122, 122, 5, 0x0070, 0x10, 21, 1),
685 PIN_FIELD_BASE(123, 123, 5, 0x0070, 0x10, 23, 1),
686 PIN_FIELD_BASE(124, 124, 5, 0x0070, 0x10, 0, 1),
687 PIN_FIELD_BASE(125, 125, 5, 0x0070, 0x10, 1, 1),
688 PIN_FIELD_BASE(126, 126, 5, 0x0070, 0x10, 2, 1),
689 PIN_FIELD_BASE(127, 127, 3, 0x0060, 0x10, 8, 1),
690 PIN_FIELD_BASE(128, 128, 3, 0x0060, 0x10, 10, 1),
691 PIN_FIELD_BASE(129, 129, 5, 0x0070, 0x10, 24, 1),
692 PIN_FIELD_BASE(130, 130, 5, 0x0070, 0x10, 26, 1),
693 PIN_FIELD_BASE(131, 131, 5, 0x0070, 0x10, 25, 1),
694 PIN_FIELD_BASE(132, 132, 5, 0x0070, 0x10, 27, 1),
695 PIN_FIELD_BASE(133, 133, 1, 0x0060, 0x10, 9, 1),
696 PIN_FIELD_BASE(134, 134, 1, 0x0060, 0x10, 12, 1),
697 PIN_FIELD_BASE(135, 135, 6, 0x0040, 0x10, 21, 1),
698 PIN_FIELD_BASE(136, 136, 6, 0x0040, 0x10, 24, 1),
699 PIN_FIELD_BASE(137, 137, 1, 0x0060, 0x10, 10, 1),
700 PIN_FIELD_BASE(138, 138, 1, 0x0060, 0x10, 13, 1),
701 PIN_FIELD_BASE(139, 139, 2, 0x0050, 0x10, 7, 1),
702 PIN_FIELD_BASE(140, 140, 2, 0x0050, 0x10, 8, 1),
703 PIN_FIELD_BASE(141, 141, 3, 0x0060, 0x10, 9, 1),
704 PIN_FIELD_BASE(142, 142, 3, 0x0060, 0x10, 11, 1),
705 PIN_FIELD_BASE(143, 143, 6, 0x0040, 0x10, 22, 1),
706 PIN_FIELD_BASE(144, 144, 6, 0x0040, 0x10, 25, 1),
707 PIN_FIELD_BASE(145, 145, 6, 0x0040, 0x10, 23, 1),
708 PIN_FIELD_BASE(146, 146, 6, 0x0040, 0x10, 26, 1),
709 PIN_FIELD_BASE(147, 147, 4, 0x0040, 0x10, 23, 1),
710 PIN_FIELD_BASE(148, 148, 4, 0x0040, 0x10, 24, 1),
711 PIN_FIELD_BASE(149, 149, 4, 0x0040, 0x10, 25, 1),
712 PIN_FIELD_BASE(150, 150, 4, 0x0040, 0x10, 26, 1),
713 PIN_FIELD_BASE(151, 151, 4, 0x0040, 0x10, 27, 1),
714 PIN_FIELD_BASE(152, 152, 4, 0x0040, 0x10, 28, 1),
715 PIN_FIELD_BASE(153, 153, 4, 0x0040, 0x10, 29, 1),
716 PIN_FIELD_BASE(154, 154, 4, 0x0040, 0x10, 30, 1),
717 PIN_FIELD_BASE(155, 155, 4, 0x0040, 0x10, 31, 1),
718 PIN_FIELD_BASE(156, 156, 4, 0x0050, 0x10, 0, 1),
719 PIN_FIELD_BASE(157, 157, 2, 0x0050, 0x10, 4, 1),
720 PIN_FIELD_BASE(158, 158, 2, 0x0050, 0x10, 3, 1),
721 PIN_FIELD_BASE(159, 159, 2, 0x0050, 0x10, 6, 1),
722 PIN_FIELD_BASE(160, 160, 2, 0x0050, 0x10, 5, 1),
723 PIN_FIELD_BASE(161, 161, 2, 0x0050, 0x10, 23, 1),
724 PIN_FIELD_BASE(162, 162, 2, 0x0050, 0x10, 24, 1),
725 PIN_FIELD_BASE(163, 163, 1, 0x0060, 0x10, 11, 1),
726 PIN_FIELD_BASE(164, 164, 1, 0x0060, 0x10, 8, 1),
727 PIN_FIELD_BASE(165, 165, 1, 0x0060, 0x10, 16, 1),
728 PIN_FIELD_BASE(166, 166, 1, 0x0060, 0x10, 1, 1),
729 PIN_FIELD_BASE(167, 167, 1, 0x0060, 0x10, 7, 1),
730 PIN_FIELD_BASE(168, 168, 1, 0x0060, 0x10, 4, 1),
731 PIN_FIELD_BASE(169, 169, 1, 0x0060, 0x10, 5, 1),
732 PIN_FIELD_BASE(170, 170, 1, 0x0060, 0x10, 0, 1),
733 PIN_FIELD_BASE(171, 171, 1, 0x0060, 0x10, 6, 1),
734 PIN_FIELD_BASE(172, 172, 1, 0x0060, 0x10, 2, 1),
735 PIN_FIELD_BASE(173, 173, 1, 0x0060, 0x10, 3, 1),
736 PIN_FIELD_BASE(174, 174, 6, 0x0040, 0x10, 7, 1),
737 PIN_FIELD_BASE(175, 175, 6, 0x0040, 0x10, 8, 1),
738 PIN_FIELD_BASE(176, 176, 6, 0x0040, 0x10, 4, 1),
739 PIN_FIELD_BASE(177, 177, 6, 0x0040, 0x10, 5, 1),
740 PIN_FIELD_BASE(178, 178, 6, 0x0040, 0x10, 6, 1),
741 PIN_FIELD_BASE(179, 179, 6, 0x0040, 0x10, 9, 1),
742 PIN_FIELD_BASE(180, 180, 6, 0x0040, 0x10, 10, 1),
743 PIN_FIELD_BASE(181, 181, 6, 0x0040, 0x10, 11, 1),
744 PIN_FIELD_BASE(182, 182, 6, 0x0040, 0x10, 12, 1),
745 PIN_FIELD_BASE(183, 183, 2, 0x0050, 0x10, 21, 1),
746 PIN_FIELD_BASE(184, 184, 2, 0x0050, 0x10, 22, 1),
747 };
748
749 static const struct mtk_pin_field_calc mt8186_pin_pupd_range[] = {
750 PIN_FIELD_BASE(67, 67, 1, 0x0070, 0x10, 10, 1),
751 PIN_FIELD_BASE(68, 68, 1, 0x0070, 0x10, 0, 1),
752 PIN_FIELD_BASE(69, 69, 1, 0x0070, 0x10, 1, 1),
753 PIN_FIELD_BASE(70, 70, 1, 0x0070, 0x10, 11, 1),
754 PIN_FIELD_BASE(71, 71, 1, 0x0070, 0x10, 2, 1),
755 PIN_FIELD_BASE(72, 72, 1, 0x0070, 0x10, 3, 1),
756 PIN_FIELD_BASE(73, 73, 1, 0x0070, 0x10, 4, 1),
757 PIN_FIELD_BASE(74, 74, 1, 0x0070, 0x10, 5, 1),
758 PIN_FIELD_BASE(75, 75, 1, 0x0070, 0x10, 6, 1),
759 PIN_FIELD_BASE(76, 76, 1, 0x0070, 0x10, 7, 1),
760 PIN_FIELD_BASE(77, 77, 1, 0x0070, 0x10, 8, 1),
761 PIN_FIELD_BASE(78, 78, 1, 0x0070, 0x10, 9, 1),
762 PIN_FIELD_BASE(79, 79, 5, 0x0080, 0x10, 0, 1),
763 PIN_FIELD_BASE(80, 80, 5, 0x0080, 0x10, 1, 1),
764 PIN_FIELD_BASE(81, 81, 5, 0x0080, 0x10, 2, 1),
765 PIN_FIELD_BASE(82, 82, 5, 0x0080, 0x10, 3, 1),
766 PIN_FIELD_BASE(84, 84, 3, 0x0070, 0x10, 0, 1),
767 PIN_FIELD_BASE(85, 85, 3, 0x0070, 0x10, 1, 1),
768 PIN_FIELD_BASE(86, 86, 3, 0x0070, 0x10, 2, 1),
769 PIN_FIELD_BASE(87, 87, 3, 0x0070, 0x10, 3, 1),
770 PIN_FIELD_BASE(88, 88, 3, 0x0070, 0x10, 4, 1),
771 PIN_FIELD_BASE(89, 89, 3, 0x0070, 0x10, 5, 1),
772 };
773
774 static const struct mtk_pin_field_calc mt8186_pin_r0_range[] = {
775 PIN_FIELD_BASE(67, 67, 1, 0x0090, 0x10, 10, 1),
776 PIN_FIELD_BASE(68, 68, 1, 0x0090, 0x10, 0, 1),
777 PIN_FIELD_BASE(69, 69, 1, 0x0090, 0x10, 1, 1),
778 PIN_FIELD_BASE(70, 70, 1, 0x0090, 0x10, 11, 1),
779 PIN_FIELD_BASE(71, 71, 1, 0x0090, 0x10, 2, 1),
780 PIN_FIELD_BASE(72, 72, 1, 0x0090, 0x10, 3, 1),
781 PIN_FIELD_BASE(73, 73, 1, 0x0090, 0x10, 4, 1),
782 PIN_FIELD_BASE(74, 74, 1, 0x0090, 0x10, 5, 1),
783 PIN_FIELD_BASE(75, 75, 1, 0x0090, 0x10, 6, 1),
784 PIN_FIELD_BASE(76, 76, 1, 0x0090, 0x10, 7, 1),
785 PIN_FIELD_BASE(77, 77, 1, 0x0090, 0x10, 8, 1),
786 PIN_FIELD_BASE(78, 78, 1, 0x0090, 0x10, 9, 1),
787 PIN_FIELD_BASE(79, 79, 5, 0x00a0, 0x10, 0, 1),
788 PIN_FIELD_BASE(80, 80, 5, 0x00a0, 0x10, 1, 1),
789 PIN_FIELD_BASE(81, 81, 5, 0x00a0, 0x10, 2, 1),
790 PIN_FIELD_BASE(82, 82, 5, 0x00a0, 0x10, 3, 1),
791 PIN_FIELD_BASE(84, 84, 3, 0x0090, 0x10, 0, 1),
792 PIN_FIELD_BASE(85, 85, 3, 0x0090, 0x10, 1, 1),
793 PIN_FIELD_BASE(86, 86, 3, 0x0090, 0x10, 2, 1),
794 PIN_FIELD_BASE(87, 87, 3, 0x0090, 0x10, 3, 1),
795 PIN_FIELD_BASE(88, 88, 3, 0x0090, 0x10, 4, 1),
796 PIN_FIELD_BASE(89, 89, 3, 0x0090, 0x10, 5, 1),
797 };
798
799 static const struct mtk_pin_field_calc mt8186_pin_r1_range[] = {
800 PIN_FIELD_BASE(67, 67, 1, 0x00a0, 0x10, 10, 1),
801 PIN_FIELD_BASE(68, 68, 1, 0x00a0, 0x10, 0, 1),
802 PIN_FIELD_BASE(69, 69, 1, 0x00a0, 0x10, 1, 1),
803 PIN_FIELD_BASE(70, 70, 1, 0x00a0, 0x10, 11, 1),
804 PIN_FIELD_BASE(71, 71, 1, 0x00a0, 0x10, 2, 1),
805 PIN_FIELD_BASE(72, 72, 1, 0x00a0, 0x10, 3, 1),
806 PIN_FIELD_BASE(73, 73, 1, 0x00a0, 0x10, 4, 1),
807 PIN_FIELD_BASE(74, 74, 1, 0x00a0, 0x10, 5, 1),
808 PIN_FIELD_BASE(75, 75, 1, 0x00a0, 0x10, 6, 1),
809 PIN_FIELD_BASE(76, 76, 1, 0x00a0, 0x10, 7, 1),
810 PIN_FIELD_BASE(77, 77, 1, 0x00a0, 0x10, 8, 1),
811 PIN_FIELD_BASE(78, 78, 1, 0x00a0, 0x10, 9, 1),
812 PIN_FIELD_BASE(79, 79, 5, 0x00b0, 0x10, 0, 1),
813 PIN_FIELD_BASE(80, 80, 5, 0x00b0, 0x10, 1, 1),
814 PIN_FIELD_BASE(81, 81, 5, 0x00b0, 0x10, 2, 1),
815 PIN_FIELD_BASE(82, 82, 5, 0x00b0, 0x10, 3, 1),
816 PIN_FIELD_BASE(84, 84, 3, 0x00a0, 0x10, 0, 1),
817 PIN_FIELD_BASE(85, 85, 3, 0x00a0, 0x10, 1, 1),
818 PIN_FIELD_BASE(86, 86, 3, 0x00a0, 0x10, 2, 1),
819 PIN_FIELD_BASE(87, 87, 3, 0x00a0, 0x10, 3, 1),
820 PIN_FIELD_BASE(88, 88, 3, 0x00a0, 0x10, 4, 1),
821 PIN_FIELD_BASE(89, 89, 3, 0x00a0, 0x10, 5, 1),
822 };
823
824 static const struct mtk_pin_field_calc mt8186_pin_drv_range[] = {
825 PIN_FIELD_BASE(0, 0, 6, 0x0000, 0x10, 27, 3),
826 PIN_FIELD_BASE(1, 1, 6, 0x0000, 0x10, 27, 3),
827 PIN_FIELD_BASE(2, 2, 6, 0x0000, 0x10, 27, 3),
828 PIN_FIELD_BASE(3, 3, 6, 0x0000, 0x10, 27, 3),
829 PIN_FIELD_BASE(4, 4, 6, 0x0010, 0x10, 0, 3),
830 PIN_FIELD_BASE(5, 5, 6, 0x0010, 0x10, 0, 3),
831 PIN_FIELD_BASE(6, 6, 4, 0x0000, 0x10, 9, 3),
832 PIN_FIELD_BASE(7, 7, 4, 0x0000, 0x10, 9, 3),
833 PIN_FIELD_BASE(8, 8, 4, 0x0000, 0x10, 9, 3),
834 PIN_FIELD_BASE(9, 9, 4, 0x0000, 0x10, 12, 3),
835 PIN_FIELD_BASE(10, 10, 4, 0x0000, 0x10, 0, 3),
836 PIN_FIELD_BASE(11, 11, 4, 0x0000, 0x10, 3, 3),
837 PIN_FIELD_BASE(12, 12, 4, 0x0000, 0x10, 6, 3),
838 PIN_FIELD_BASE(13, 13, 3, 0x0000, 0x10, 0, 3),
839 PIN_FIELD_BASE(14, 14, 3, 0x0000, 0x10, 3, 3),
840 PIN_FIELD_BASE(15, 15, 6, 0x0010, 0x10, 3, 3),
841 PIN_FIELD_BASE(16, 16, 6, 0x0010, 0x10, 3, 3),
842 PIN_FIELD_BASE(17, 17, 5, 0x0000, 0x10, 21, 3),
843 PIN_FIELD_BASE(18, 18, 5, 0x0010, 0x10, 0, 3),
844 PIN_FIELD_BASE(19, 19, 5, 0x0000, 0x10, 27, 3),
845 PIN_FIELD_BASE(20, 20, 5, 0x0000, 0x10, 24, 3),
846 PIN_FIELD_BASE(21, 21, 5, 0x0000, 0x10, 27, 3),
847 PIN_FIELD_BASE(22, 22, 5, 0x0000, 0x10, 24, 3),
848 PIN_FIELD_BASE(23, 23, 5, 0x0010, 0x10, 0, 3),
849 PIN_FIELD_BASE(24, 24, 5, 0x0010, 0x10, 9, 3),
850 PIN_FIELD_BASE(25, 25, 5, 0x0010, 0x10, 0, 3),
851 PIN_FIELD_BASE(26, 26, 5, 0x0000, 0x10, 27, 3),
852 PIN_FIELD_BASE(27, 27, 5, 0x0000, 0x10, 27, 3),
853 PIN_FIELD_BASE(28, 28, 5, 0x0010, 0x10, 0, 3),
854 PIN_FIELD_BASE(29, 29, 6, 0x0010, 0x10, 0, 3),
855 PIN_FIELD_BASE(30, 30, 6, 0x0010, 0x10, 0, 3),
856 PIN_FIELD_BASE(31, 31, 6, 0x0010, 0x10, 3, 3),
857 PIN_FIELD_BASE(32, 32, 2, 0x0000, 0x10, 6, 3),
858 PIN_FIELD_BASE(33, 33, 2, 0x0000, 0x10, 6, 3),
859 PIN_FIELD_BASE(34, 34, 2, 0x0000, 0x10, 3, 3),
860 PIN_FIELD_BASE(35, 35, 2, 0x0000, 0x10, 3, 3),
861 PIN_FIELD_BASE(36, 36, 2, 0x0000, 0x10, 9, 3),
862 PIN_FIELD_BASE(37, 37, 2, 0x0000, 0x10, 9, 3),
863 PIN_FIELD_BASE(38, 38, 2, 0x0000, 0x10, 12, 3),
864 PIN_FIELD_BASE(39, 39, 2, 0x0000, 0x10, 9, 3),
865 PIN_FIELD_BASE(40, 40, 2, 0x0000, 0x10, 15, 3),
866 PIN_FIELD_BASE(41, 41, 2, 0x0000, 0x10, 12, 3),
867 PIN_FIELD_BASE(42, 42, 2, 0x0000, 0x10, 12, 3),
868 PIN_FIELD_BASE(43, 43, 2, 0x0000, 0x10, 12, 3),
869 PIN_FIELD_BASE(44, 44, 5, 0x0010, 0x10, 6, 3),
870 PIN_FIELD_BASE(45, 45, 5, 0x0010, 0x10, 3, 3),
871 PIN_FIELD_BASE(46, 46, 5, 0x0010, 0x10, 3, 3),
872 PIN_FIELD_BASE(47, 47, 5, 0x0010, 0x10, 6, 3),
873 PIN_FIELD_BASE(48, 48, 2, 0x0000, 0x10, 15, 3),
874 PIN_FIELD_BASE(49, 49, 2, 0x0000, 0x10, 15, 3),
875 PIN_FIELD_BASE(50, 50, 2, 0x0000, 0x10, 15, 3),
876 PIN_FIELD_BASE(51, 51, 2, 0x0000, 0x10, 18, 3),
877 PIN_FIELD_BASE(52, 52, 3, 0x0010, 0x10, 3, 3),
878 PIN_FIELD_BASE(53, 53, 3, 0x0010, 0x10, 6, 3),
879 PIN_FIELD_BASE(54, 54, 3, 0x0010, 0x10, 3, 3),
880 PIN_FIELD_BASE(55, 55, 3, 0x0010, 0x10, 3, 3),
881 PIN_FIELD_BASE(56, 56, 5, 0x0010, 0x10, 3, 3),
882 PIN_FIELD_BASE(57, 57, 5, 0x0010, 0x10, 6, 3),
883 PIN_FIELD_BASE(58, 58, 5, 0x0010, 0x10, 6, 3),
884 PIN_FIELD_BASE(59, 59, 5, 0x0010, 0x10, 3, 3),
885 PIN_FIELD_BASE(60, 60, 3, 0x0000, 0x10, 24, 3),
886 PIN_FIELD_BASE(61, 61, 3, 0x0000, 0x10, 24, 3),
887 PIN_FIELD_BASE(62, 62, 3, 0x0000, 0x10, 24, 3),
888 PIN_FIELD_BASE(63, 63, 3, 0x0000, 0x10, 24, 3),
889 PIN_FIELD_BASE(64, 64, 3, 0x0000, 0x10, 27, 3),
890 PIN_FIELD_BASE(65, 65, 3, 0x0000, 0x10, 27, 3),
891 PIN_FIELD_BASE(66, 66, 3, 0x0000, 0x10, 27, 3),
892 PIN_FIELD_BASE(67, 67, 1, 0x0010, 0x10, 0, 3),
893 PIN_FIELD_BASE(68, 68, 1, 0x0000, 0x10, 0, 3),
894 PIN_FIELD_BASE(69, 69, 1, 0x0000, 0x10, 3, 3),
895 PIN_FIELD_BASE(70, 70, 1, 0x0010, 0x10, 3, 3),
896 PIN_FIELD_BASE(71, 71, 1, 0x0000, 0x10, 6, 3),
897 PIN_FIELD_BASE(72, 72, 1, 0x0000, 0x10, 9, 3),
898 PIN_FIELD_BASE(73, 73, 1, 0x0000, 0x10, 12, 3),
899 PIN_FIELD_BASE(74, 74, 1, 0x0000, 0x10, 15, 3),
900 PIN_FIELD_BASE(75, 75, 1, 0x0000, 0x10, 18, 3),
901 PIN_FIELD_BASE(76, 76, 1, 0x0000, 0x10, 21, 3),
902 PIN_FIELD_BASE(77, 77, 1, 0x0000, 0x10, 24, 3),
903 PIN_FIELD_BASE(78, 78, 1, 0x0000, 0x10, 27, 3),
904 PIN_FIELD_BASE(79, 79, 5, 0x0000, 0x10, 24, 3),
905 PIN_FIELD_BASE(80, 80, 5, 0x0000, 0x10, 24, 3),
906 PIN_FIELD_BASE(81, 81, 5, 0x0000, 0x10, 21, 3),
907 PIN_FIELD_BASE(82, 82, 5, 0x0000, 0x10, 21, 3),
908 PIN_FIELD_BASE(83, 83, 6, 0x0010, 0x10, 3, 3),
909 PIN_FIELD_BASE(84, 84, 3, 0x0000, 0x10, 6, 3),
910 PIN_FIELD_BASE(85, 85, 3, 0x0000, 0x10, 9, 3),
911 PIN_FIELD_BASE(86, 86, 3, 0x0000, 0x10, 12, 3),
912 PIN_FIELD_BASE(87, 87, 3, 0x0000, 0x10, 15, 3),
913 PIN_FIELD_BASE(88, 88, 3, 0x0000, 0x10, 18, 3),
914 PIN_FIELD_BASE(89, 89, 3, 0x0000, 0x10, 21, 3),
915 PIN_FIELD_BASE(90, 90, 3, 0x0000, 0x10, 27, 3),
916 PIN_FIELD_BASE(91, 91, 3, 0x0010, 0x10, 0, 3),
917 PIN_FIELD_BASE(92, 92, 3, 0x0010, 0x10, 0, 3),
918 PIN_FIELD_BASE(93, 93, 3, 0x0010, 0x10, 0, 3),
919 PIN_FIELD_BASE(94, 94, 3, 0x0010, 0x10, 0, 3),
920 PIN_FIELD_BASE(95, 95, 3, 0x0010, 0x10, 3, 3),
921 PIN_FIELD_BASE(96, 96, 2, 0x0000, 0x10, 9, 3),
922 PIN_FIELD_BASE(97, 97, 2, 0x0000, 0x10, 6, 3),
923 PIN_FIELD_BASE(98, 98, 2, 0x0000, 0x10, 3, 3),
924 PIN_FIELD_BASE(99, 99, 4, 0x0000, 0x10, 18, 3),
925 PIN_FIELD_BASE(100, 100, 4, 0x0000, 0x10, 18, 3),
926 PIN_FIELD_BASE(101, 101, 4, 0x0000, 0x10, 21, 3),
927 PIN_FIELD_BASE(102, 102, 4, 0x0000, 0x10, 21, 3),
928 PIN_FIELD_BASE(103, 103, 4, 0x0000, 0x10, 21, 3),
929 PIN_FIELD_BASE(104, 104, 4, 0x0000, 0x10, 21, 3),
930 PIN_FIELD_BASE(105, 105, 4, 0x0000, 0x10, 24, 3),
931 PIN_FIELD_BASE(106, 106, 4, 0x0000, 0x10, 24, 3),
932 PIN_FIELD_BASE(107, 107, 4, 0x0000, 0x10, 24, 3),
933 PIN_FIELD_BASE(108, 108, 4, 0x0000, 0x10, 24, 3),
934 PIN_FIELD_BASE(109, 109, 4, 0x0000, 0x10, 27, 3),
935 PIN_FIELD_BASE(110, 110, 4, 0x0000, 0x10, 27, 3),
936 PIN_FIELD_BASE(111, 111, 4, 0x0000, 0x10, 27, 3),
937 PIN_FIELD_BASE(112, 112, 4, 0x0000, 0x10, 27, 3),
938 PIN_FIELD_BASE(113, 113, 4, 0x0010, 0x10, 0, 3),
939 PIN_FIELD_BASE(114, 114, 4, 0x0010, 0x10, 0, 3),
940 PIN_FIELD_BASE(115, 115, 3, 0x0010, 0x10, 6, 3),
941 PIN_FIELD_BASE(116, 116, 3, 0x0010, 0x10, 9, 3),
942 PIN_FIELD_BASE(117, 117, 3, 0x0010, 0x10, 6, 3),
943 PIN_FIELD_BASE(118, 118, 3, 0x0010, 0x10, 6, 3),
944 PIN_FIELD_BASE(119, 119, 5, 0x0000, 0x10, 18, 3),
945 PIN_FIELD_BASE(120, 120, 5, 0x0000, 0x10, 9, 3),
946 PIN_FIELD_BASE(121, 121, 5, 0x0000, 0x10, 12, 3),
947 PIN_FIELD_BASE(122, 122, 5, 0x0000, 0x10, 15, 3),
948 PIN_FIELD_BASE(123, 123, 5, 0x0000, 0x10, 21, 3),
949 PIN_FIELD_BASE(124, 124, 5, 0x0000, 0x10, 0, 3),
950 PIN_FIELD_BASE(125, 125, 5, 0x0000, 0x10, 3, 3),
951 PIN_FIELD_BASE(126, 126, 5, 0x0000, 0x10, 6, 3),
952 PIN_FIELD_BASE(127, 127, 3, 0x0010, 0x10, 12, 3),
953 PIN_FIELD_BASE(128, 128, 3, 0x0010, 0x10, 18, 3),
954 PIN_FIELD_BASE(129, 129, 5, 0x0010, 0x10, 12, 3),
955 PIN_FIELD_BASE(130, 130, 5, 0x0010, 0x10, 18, 3),
956 PIN_FIELD_BASE(131, 131, 5, 0x0010, 0x10, 15, 3),
957 PIN_FIELD_BASE(132, 132, 5, 0x0010, 0x10, 21, 3),
958 PIN_FIELD_BASE(133, 133, 1, 0x0010, 0x10, 15, 3),
959 PIN_FIELD_BASE(134, 134, 1, 0x0010, 0x10, 21, 3),
960 PIN_FIELD_BASE(135, 135, 6, 0x0010, 0x10, 6, 3),
961 PIN_FIELD_BASE(136, 136, 6, 0x0010, 0x10, 15, 3),
962 PIN_FIELD_BASE(137, 137, 1, 0x0010, 0x10, 18, 3),
963 PIN_FIELD_BASE(138, 138, 1, 0x0010, 0x10, 24, 3),
964 PIN_FIELD_BASE(139, 139, 2, 0x0000, 0x10, 21, 3),
965 PIN_FIELD_BASE(140, 140, 2, 0x0000, 0x10, 24, 3),
966 PIN_FIELD_BASE(141, 141, 3, 0x0010, 0x10, 15, 3),
967 PIN_FIELD_BASE(142, 142, 3, 0x0010, 0x10, 21, 3),
968 PIN_FIELD_BASE(143, 143, 6, 0x0010, 0x10, 9, 3),
969 PIN_FIELD_BASE(144, 144, 6, 0x0010, 0x10, 18, 3),
970 PIN_FIELD_BASE(145, 145, 6, 0x0010, 0x10, 12, 3),
971 PIN_FIELD_BASE(146, 146, 6, 0x0010, 0x10, 21, 3),
972 PIN_FIELD_BASE(147, 147, 4, 0x0000, 0x10, 12, 3),
973 PIN_FIELD_BASE(148, 148, 4, 0x0000, 0x10, 12, 3),
974 PIN_FIELD_BASE(149, 149, 4, 0x0000, 0x10, 12, 3),
975 PIN_FIELD_BASE(150, 150, 4, 0x0000, 0x10, 15, 3),
976 PIN_FIELD_BASE(151, 151, 4, 0x0000, 0x10, 15, 3),
977 PIN_FIELD_BASE(152, 152, 4, 0x0000, 0x10, 9, 3),
978 PIN_FIELD_BASE(153, 153, 4, 0x0000, 0x10, 15, 3),
979 PIN_FIELD_BASE(154, 154, 4, 0x0000, 0x10, 15, 3),
980 PIN_FIELD_BASE(155, 155, 4, 0x0000, 0x10, 18, 3),
981 PIN_FIELD_BASE(156, 156, 4, 0x0000, 0x10, 18, 3),
982 PIN_FIELD_BASE(157, 157, 2, 0x0000, 0x10, 0, 3),
983 PIN_FIELD_BASE(158, 158, 2, 0x0000, 0x10, 0, 3),
984 PIN_FIELD_BASE(159, 159, 2, 0x0000, 0x10, 0, 3),
985 PIN_FIELD_BASE(160, 160, 2, 0x0000, 0x10, 0, 3),
986 PIN_FIELD_BASE(161, 161, 2, 0x0000, 0x10, 6, 3),
987 PIN_FIELD_BASE(162, 162, 2, 0x0000, 0x10, 3, 3),
988 PIN_FIELD_BASE(163, 163, 1, 0x0010, 0x10, 12, 3),
989 PIN_FIELD_BASE(165, 165, 1, 0x0010, 0x10, 6, 3),
990 PIN_FIELD_BASE(166, 166, 1, 0x0010, 0x10, 6, 3),
991 PIN_FIELD_BASE(167, 167, 1, 0x0010, 0x10, 9, 3),
992 PIN_FIELD_BASE(168, 168, 1, 0x0010, 0x10, 6, 3),
993 PIN_FIELD_BASE(169, 169, 1, 0x0010, 0x10, 12, 3),
994 PIN_FIELD_BASE(170, 170, 1, 0x0010, 0x10, 9, 3),
995 PIN_FIELD_BASE(171, 171, 1, 0x0010, 0x10, 9, 3),
996 PIN_FIELD_BASE(172, 172, 1, 0x0010, 0x10, 9, 3),
997 PIN_FIELD_BASE(173, 173, 1, 0x0010, 0x10, 6, 3),
998 PIN_FIELD_BASE(174, 174, 6, 0x0000, 0x10, 9, 3),
999 PIN_FIELD_BASE(175, 175, 6, 0x0000, 0x10, 12, 3),
1000 PIN_FIELD_BASE(176, 176, 6, 0x0000, 0x10, 0, 3),
1001 PIN_FIELD_BASE(177, 177, 6, 0x0000, 0x10, 3, 3),
1002 PIN_FIELD_BASE(178, 178, 6, 0x0000, 0x10, 6, 3),
1003 PIN_FIELD_BASE(179, 179, 6, 0x0000, 0x10, 15, 3),
1004 PIN_FIELD_BASE(180, 180, 6, 0x0000, 0x10, 18, 3),
1005 PIN_FIELD_BASE(181, 181, 6, 0x0000, 0x10, 21, 3),
1006 PIN_FIELD_BASE(182, 182, 6, 0x0000, 0x10, 24, 3),
1007 PIN_FIELD_BASE(183, 183, 2, 0x0000, 0x10, 27, 3),
1008 PIN_FIELD_BASE(184, 184, 2, 0x0010, 0x10, 0, 3),
1009 };
1010
1011 static const struct mtk_pin_field_calc mt8186_pin_drv_adv_range[] = {
1012 PIN_FIELD_BASE(127, 127, 3, 0x0030, 0x10, 0, 3),
1013 PIN_FIELD_BASE(128, 128, 3, 0x0030, 0x10, 6, 3),
1014 PIN_FIELD_BASE(129, 129, 5, 0x0030, 0x10, 0, 3),
1015 PIN_FIELD_BASE(130, 130, 5, 0x0030, 0x10, 6, 3),
1016 PIN_FIELD_BASE(131, 131, 5, 0x0030, 0x10, 3, 3),
1017 PIN_FIELD_BASE(132, 132, 5, 0x0030, 0x10, 9, 3),
1018 PIN_FIELD_BASE(133, 133, 1, 0x0030, 0x10, 0, 3),
1019 PIN_FIELD_BASE(134, 134, 1, 0x0030, 0x10, 6, 3),
1020 PIN_FIELD_BASE(135, 135, 6, 0x0020, 0x10, 0, 3),
1021 PIN_FIELD_BASE(136, 136, 6, 0x0020, 0x10, 9, 3),
1022 PIN_FIELD_BASE(137, 137, 1, 0x0030, 0x10, 3, 3),
1023 PIN_FIELD_BASE(138, 138, 1, 0x0030, 0x10, 9, 3),
1024 PIN_FIELD_BASE(139, 139, 2, 0x0020, 0x10, 0, 3),
1025 PIN_FIELD_BASE(140, 140, 2, 0x0020, 0x10, 3, 3),
1026 PIN_FIELD_BASE(141, 141, 3, 0x0030, 0x10, 3, 3),
1027 PIN_FIELD_BASE(142, 142, 3, 0x0030, 0x10, 9, 3),
1028 PIN_FIELD_BASE(143, 143, 6, 0x0020, 0x10, 3, 3),
1029 PIN_FIELD_BASE(144, 144, 6, 0x0020, 0x10, 12, 3),
1030 PIN_FIELD_BASE(145, 145, 6, 0x0020, 0x10, 6, 3),
1031 PIN_FIELD_BASE(146, 146, 6, 0x0020, 0x10, 15, 3),
1032 };
1033
1034 static const struct mtk_pin_field_calc mt8186_pin_rsel_range[] = {
1035 PIN_FIELD_BASE(127, 127, 3, 0x00d0, 0x10, 0, 2),
1036 PIN_FIELD_BASE(128, 128, 3, 0x00d0, 0x10, 4, 2),
1037 PIN_FIELD_BASE(129, 129, 5, 0x00d0, 0x10, 0, 2),
1038 PIN_FIELD_BASE(130, 130, 5, 0x00d0, 0x10, 4, 2),
1039 PIN_FIELD_BASE(131, 131, 5, 0x00d0, 0x10, 2, 2),
1040 PIN_FIELD_BASE(132, 132, 5, 0x00d0, 0x10, 6, 2),
1041 PIN_FIELD_BASE(133, 133, 1, 0x00e0, 0x10, 0, 2),
1042 PIN_FIELD_BASE(134, 134, 1, 0x00e0, 0x10, 4, 2),
1043 PIN_FIELD_BASE(135, 135, 6, 0x0070, 0x10, 0, 2),
1044 PIN_FIELD_BASE(136, 136, 6, 0x0070, 0x10, 6, 2),
1045 PIN_FIELD_BASE(137, 137, 1, 0x00e0, 0x10, 2, 2),
1046 PIN_FIELD_BASE(138, 138, 1, 0x00e0, 0x10, 6, 2),
1047 PIN_FIELD_BASE(139, 139, 2, 0x0080, 0x10, 0, 2),
1048 PIN_FIELD_BASE(140, 140, 2, 0x0080, 0x10, 2, 2),
1049 PIN_FIELD_BASE(141, 141, 3, 0x00d0, 0x10, 2, 2),
1050 PIN_FIELD_BASE(142, 142, 3, 0x00d0, 0x10, 6, 2),
1051 PIN_FIELD_BASE(143, 143, 6, 0x0070, 0x10, 2, 2),
1052 PIN_FIELD_BASE(144, 144, 6, 0x0070, 0x10, 8, 2),
1053 PIN_FIELD_BASE(145, 145, 6, 0x0070, 0x10, 4, 2),
1054 PIN_FIELD_BASE(146, 146, 6, 0x0070, 0x10, 10, 2),
1055 };
1056
1057 static const struct mtk_pin_rsel mt8186_pin_rsel_val_range[] = {
1058 PIN_RSEL(127, 128, 0x0, 75000, 75000),
1059 PIN_RSEL(127, 128, 0x1, 10000, 75000),
1060 PIN_RSEL(127, 128, 0x2, 5000, 5000),
1061 PIN_RSEL(127, 128, 0x3, 1000, 5000),
1062 PIN_RSEL(129, 130, 0x0, 75000, 75000),
1063 PIN_RSEL(129, 130, 0x1, 10000, 75000),
1064 PIN_RSEL(129, 130, 0x2, 5000, 5000),
1065 PIN_RSEL(129, 130, 0x3, 1000, 5000),
1066 PIN_RSEL(131, 132, 0x0, 75000, 75000),
1067 PIN_RSEL(131, 132, 0x1, 10000, 75000),
1068 PIN_RSEL(131, 132, 0x2, 5000, 5000),
1069 PIN_RSEL(131, 132, 0x3, 1000, 5000),
1070 PIN_RSEL(133, 134, 0x0, 75000, 75000),
1071 PIN_RSEL(133, 134, 0x1, 10000, 75000),
1072 PIN_RSEL(133, 134, 0x2, 5000, 5000),
1073 PIN_RSEL(133, 134, 0x3, 1000, 5000),
1074 PIN_RSEL(135, 136, 0x0, 75000, 75000),
1075 PIN_RSEL(135, 136, 0x1, 10000, 75000),
1076 PIN_RSEL(135, 136, 0x2, 5000, 5000),
1077 PIN_RSEL(135, 136, 0x3, 1000, 5000),
1078 PIN_RSEL(137, 138, 0x0, 75000, 75000),
1079 PIN_RSEL(137, 138, 0x1, 10000, 75000),
1080 PIN_RSEL(137, 138, 0x2, 5000, 5000),
1081 PIN_RSEL(137, 138, 0x3, 1000, 5000),
1082 PIN_RSEL(139, 140, 0x0, 75000, 75000),
1083 PIN_RSEL(139, 140, 0x1, 10000, 75000),
1084 PIN_RSEL(139, 140, 0x2, 5000, 5000),
1085 PIN_RSEL(139, 140, 0x3, 1000, 5000),
1086 PIN_RSEL(141, 142, 0x0, 75000, 75000),
1087 PIN_RSEL(141, 142, 0x1, 10000, 75000),
1088 PIN_RSEL(141, 142, 0x2, 5000, 5000),
1089 PIN_RSEL(141, 142, 0x3, 1000, 5000),
1090 PIN_RSEL(143, 144, 0x0, 75000, 75000),
1091 PIN_RSEL(143, 144, 0x1, 10000, 75000),
1092 PIN_RSEL(143, 144, 0x2, 5000, 5000),
1093 PIN_RSEL(143, 144, 0x3, 1000, 5000),
1094 PIN_RSEL(145, 146, 0x0, 75000, 75000),
1095 PIN_RSEL(145, 146, 0x1, 10000, 75000),
1096 PIN_RSEL(145, 146, 0x2, 5000, 5000),
1097 PIN_RSEL(145, 146, 0x3, 1000, 5000),
1098 };
1099
1100 static const unsigned int mt8186_pull_type[] = {
1101 MTK_PULL_PU_PD_TYPE,/*0*/ MTK_PULL_PU_PD_TYPE,/*1*/
1102 MTK_PULL_PU_PD_TYPE,/*2*/ MTK_PULL_PU_PD_TYPE,/*3*/
1103 MTK_PULL_PU_PD_TYPE,/*4*/ MTK_PULL_PU_PD_TYPE,/*5*/
1104 MTK_PULL_PU_PD_TYPE,/*6*/ MTK_PULL_PU_PD_TYPE,/*7*/
1105 MTK_PULL_PU_PD_TYPE,/*8*/ MTK_PULL_PU_PD_TYPE,/*9*/
1106 MTK_PULL_PU_PD_TYPE,/*10*/ MTK_PULL_PU_PD_TYPE,/*11*/
1107 MTK_PULL_PU_PD_TYPE,/*12*/ MTK_PULL_PU_PD_TYPE,/*13*/
1108 MTK_PULL_PU_PD_TYPE,/*14*/ MTK_PULL_PU_PD_TYPE,/*15*/
1109 MTK_PULL_PU_PD_TYPE,/*16*/ MTK_PULL_PU_PD_TYPE,/*17*/
1110 MTK_PULL_PU_PD_TYPE,/*18*/ MTK_PULL_PU_PD_TYPE,/*19*/
1111 MTK_PULL_PU_PD_TYPE,/*20*/ MTK_PULL_PU_PD_TYPE,/*21*/
1112 MTK_PULL_PU_PD_TYPE,/*22*/ MTK_PULL_PU_PD_TYPE,/*23*/
1113 MTK_PULL_PU_PD_TYPE,/*24*/ MTK_PULL_PU_PD_TYPE,/*25*/
1114 MTK_PULL_PU_PD_TYPE,/*26*/ MTK_PULL_PU_PD_TYPE,/*27*/
1115 MTK_PULL_PU_PD_TYPE,/*28*/ MTK_PULL_PU_PD_TYPE,/*29*/
1116 MTK_PULL_PU_PD_TYPE,/*30*/ MTK_PULL_PU_PD_TYPE,/*31*/
1117 MTK_PULL_PU_PD_TYPE,/*32*/ MTK_PULL_PU_PD_TYPE,/*33*/
1118 MTK_PULL_PU_PD_TYPE,/*34*/ MTK_PULL_PU_PD_TYPE,/*35*/
1119 MTK_PULL_PU_PD_TYPE,/*36*/ MTK_PULL_PU_PD_TYPE,/*37*/
1120 MTK_PULL_PU_PD_TYPE,/*38*/ MTK_PULL_PU_PD_TYPE,/*39*/
1121 MTK_PULL_PU_PD_TYPE,/*40*/ MTK_PULL_PU_PD_TYPE,/*41*/
1122 MTK_PULL_PU_PD_TYPE,/*42*/ MTK_PULL_PU_PD_TYPE,/*43*/
1123 MTK_PULL_PU_PD_TYPE,/*44*/ MTK_PULL_PU_PD_TYPE,/*45*/
1124 MTK_PULL_PU_PD_TYPE,/*46*/ MTK_PULL_PU_PD_TYPE,/*47*/
1125 MTK_PULL_PU_PD_TYPE,/*48*/ MTK_PULL_PU_PD_TYPE,/*49*/
1126 MTK_PULL_PU_PD_TYPE,/*50*/ MTK_PULL_PU_PD_TYPE,/*51*/
1127 MTK_PULL_PU_PD_TYPE,/*52*/ MTK_PULL_PU_PD_TYPE,/*53*/
1128 MTK_PULL_PU_PD_TYPE,/*54*/ MTK_PULL_PU_PD_TYPE,/*55*/
1129 MTK_PULL_PU_PD_TYPE,/*56*/ MTK_PULL_PU_PD_TYPE,/*57*/
1130 MTK_PULL_PU_PD_TYPE,/*58*/ MTK_PULL_PU_PD_TYPE,/*59*/
1131 MTK_PULL_PU_PD_TYPE,/*60*/ MTK_PULL_PU_PD_TYPE,/*61*/
1132 MTK_PULL_PU_PD_TYPE,/*62*/ MTK_PULL_PU_PD_TYPE,/*63*/
1133 MTK_PULL_PU_PD_TYPE,/*64*/ MTK_PULL_PU_PD_TYPE,/*65*/
1134 MTK_PULL_PU_PD_TYPE,/*66*/ MTK_PULL_PUPD_R1R0_TYPE,/*67*/
1135 MTK_PULL_PUPD_R1R0_TYPE,/*68*/ MTK_PULL_PUPD_R1R0_TYPE,/*69*/
1136 MTK_PULL_PUPD_R1R0_TYPE,/*70*/ MTK_PULL_PUPD_R1R0_TYPE,/*71*/
1137 MTK_PULL_PUPD_R1R0_TYPE,/*72*/ MTK_PULL_PUPD_R1R0_TYPE,/*73*/
1138 MTK_PULL_PUPD_R1R0_TYPE,/*74*/ MTK_PULL_PUPD_R1R0_TYPE,/*75*/
1139 MTK_PULL_PUPD_R1R0_TYPE,/*76*/ MTK_PULL_PUPD_R1R0_TYPE,/*77*/
1140 MTK_PULL_PUPD_R1R0_TYPE,/*78*/ MTK_PULL_PUPD_R1R0_TYPE,/*79*/
1141 MTK_PULL_PUPD_R1R0_TYPE,/*80*/ MTK_PULL_PUPD_R1R0_TYPE,/*81*/
1142 MTK_PULL_PUPD_R1R0_TYPE,/*82*/ MTK_PULL_PU_PD_TYPE,/*83*/
1143 MTK_PULL_PUPD_R1R0_TYPE,/*84*/ MTK_PULL_PUPD_R1R0_TYPE,/*85*/
1144 MTK_PULL_PUPD_R1R0_TYPE,/*86*/ MTK_PULL_PUPD_R1R0_TYPE,/*87*/
1145 MTK_PULL_PUPD_R1R0_TYPE,/*88*/ MTK_PULL_PUPD_R1R0_TYPE,/*89*/
1146 MTK_PULL_PU_PD_TYPE,/*90*/ MTK_PULL_PU_PD_TYPE,/*91*/
1147 MTK_PULL_PU_PD_TYPE,/*92*/ MTK_PULL_PU_PD_TYPE,/*93*/
1148 MTK_PULL_PU_PD_TYPE,/*94*/ MTK_PULL_PU_PD_TYPE,/*95*/
1149 MTK_PULL_PU_PD_TYPE,/*96*/ MTK_PULL_PU_PD_TYPE,/*97*/
1150 MTK_PULL_PU_PD_TYPE,/*98*/ MTK_PULL_PU_PD_TYPE,/*99*/
1151 MTK_PULL_PU_PD_TYPE,/*100*/ MTK_PULL_PU_PD_TYPE,/*101*/
1152 MTK_PULL_PU_PD_TYPE,/*102*/ MTK_PULL_PU_PD_TYPE,/*103*/
1153 MTK_PULL_PU_PD_TYPE,/*104*/ MTK_PULL_PU_PD_TYPE,/*105*/
1154 MTK_PULL_PU_PD_TYPE,/*106*/ MTK_PULL_PU_PD_TYPE,/*107*/
1155 MTK_PULL_PU_PD_TYPE,/*108*/ MTK_PULL_PU_PD_TYPE,/*109*/
1156 MTK_PULL_PU_PD_TYPE,/*110*/ MTK_PULL_PU_PD_TYPE,/*111*/
1157 MTK_PULL_PU_PD_TYPE,/*112*/ MTK_PULL_PU_PD_TYPE,/*113*/
1158 MTK_PULL_PU_PD_TYPE,/*114*/ MTK_PULL_PU_PD_TYPE,/*115*/
1159 MTK_PULL_PU_PD_TYPE,/*116*/ MTK_PULL_PU_PD_TYPE,/*117*/
1160 MTK_PULL_PU_PD_TYPE,/*118*/ MTK_PULL_PU_PD_TYPE,/*119*/
1161 MTK_PULL_PU_PD_TYPE,/*120*/ MTK_PULL_PU_PD_TYPE,/*121*/
1162 MTK_PULL_PU_PD_TYPE,/*122*/ MTK_PULL_PU_PD_TYPE,/*123*/
1163 MTK_PULL_PU_PD_TYPE,/*124*/ MTK_PULL_PU_PD_TYPE,/*125*/
1164 MTK_PULL_PU_PD_TYPE,/*126*/ MTK_PULL_PU_PD_RSEL_TYPE,/*127*/
1165 MTK_PULL_PU_PD_RSEL_TYPE,/*128*/ MTK_PULL_PU_PD_RSEL_TYPE,/*129*/
1166 MTK_PULL_PU_PD_RSEL_TYPE,/*130*/ MTK_PULL_PU_PD_RSEL_TYPE,/*131*/
1167 MTK_PULL_PU_PD_RSEL_TYPE,/*132*/ MTK_PULL_PU_PD_RSEL_TYPE,/*133*/
1168 MTK_PULL_PU_PD_RSEL_TYPE,/*134*/ MTK_PULL_PU_PD_RSEL_TYPE,/*135*/
1169 MTK_PULL_PU_PD_RSEL_TYPE,/*136*/ MTK_PULL_PU_PD_RSEL_TYPE,/*137*/
1170 MTK_PULL_PU_PD_RSEL_TYPE,/*138*/ MTK_PULL_PU_PD_RSEL_TYPE,/*139*/
1171 MTK_PULL_PU_PD_RSEL_TYPE,/*140*/ MTK_PULL_PU_PD_RSEL_TYPE,/*141*/
1172 MTK_PULL_PU_PD_RSEL_TYPE,/*142*/ MTK_PULL_PU_PD_RSEL_TYPE,/*143*/
1173 MTK_PULL_PU_PD_RSEL_TYPE,/*144*/ MTK_PULL_PU_PD_RSEL_TYPE,/*145*/
1174 MTK_PULL_PU_PD_RSEL_TYPE,/*146*/ MTK_PULL_PU_PD_TYPE,/*147*/
1175 MTK_PULL_PU_PD_TYPE,/*148*/ MTK_PULL_PU_PD_TYPE,/*149*/
1176 MTK_PULL_PU_PD_TYPE,/*150*/ MTK_PULL_PU_PD_TYPE,/*151*/
1177 MTK_PULL_PU_PD_TYPE,/*152*/ MTK_PULL_PU_PD_TYPE,/*153*/
1178 MTK_PULL_PU_PD_TYPE,/*154*/ MTK_PULL_PU_PD_TYPE,/*155*/
1179 MTK_PULL_PU_PD_TYPE,/*156*/ MTK_PULL_PU_PD_TYPE,/*157*/
1180 MTK_PULL_PU_PD_TYPE,/*158*/ MTK_PULL_PU_PD_TYPE,/*159*/
1181 MTK_PULL_PU_PD_TYPE,/*160*/ MTK_PULL_PU_PD_TYPE,/*161*/
1182 MTK_PULL_PU_PD_TYPE,/*162*/ MTK_PULL_PU_PD_TYPE,/*163*/
1183 MTK_PULL_PU_PD_TYPE,/*164*/ MTK_PULL_PU_PD_TYPE,/*165*/
1184 MTK_PULL_PU_PD_TYPE,/*166*/ MTK_PULL_PU_PD_TYPE,/*167*/
1185 MTK_PULL_PU_PD_TYPE,/*168*/ MTK_PULL_PU_PD_TYPE,/*169*/
1186 MTK_PULL_PU_PD_TYPE,/*170*/ MTK_PULL_PU_PD_TYPE,/*171*/
1187 MTK_PULL_PU_PD_TYPE,/*172*/ MTK_PULL_PU_PD_TYPE,/*173*/
1188 MTK_PULL_PU_PD_TYPE,/*174*/ MTK_PULL_PU_PD_TYPE,/*175*/
1189 MTK_PULL_PU_PD_TYPE,/*176*/ MTK_PULL_PU_PD_TYPE,/*177*/
1190 MTK_PULL_PU_PD_TYPE,/*178*/ MTK_PULL_PU_PD_TYPE,/*179*/
1191 MTK_PULL_PU_PD_TYPE,/*180*/ MTK_PULL_PU_PD_TYPE,/*181*/
1192 MTK_PULL_PU_PD_TYPE,/*182*/ MTK_PULL_PU_PD_TYPE,/*183*/
1193 MTK_PULL_PU_PD_TYPE,/*184*/
1194 };
1195
1196 static const struct mtk_pin_reg_calc mt8186_reg_cals[PINCTRL_PIN_REG_MAX] = {
1197 [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt8186_pin_mode_range),
1198 [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8186_pin_dir_range),
1199 [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8186_pin_di_range),
1200 [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8186_pin_do_range),
1201 [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8186_pin_smt_range),
1202 [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8186_pin_ies_range),
1203 [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt8186_pin_pu_range),
1204 [PINCTRL_PIN_REG_PD] = MTK_RANGE(mt8186_pin_pd_range),
1205 [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt8186_pin_drv_range),
1206 [PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt8186_pin_pupd_range),
1207 [PINCTRL_PIN_REG_R0] = MTK_RANGE(mt8186_pin_r0_range),
1208 [PINCTRL_PIN_REG_R1] = MTK_RANGE(mt8186_pin_r1_range),
1209 [PINCTRL_PIN_REG_DRV_ADV] = MTK_RANGE(mt8186_pin_drv_adv_range),
1210 [PINCTRL_PIN_REG_RSEL] = MTK_RANGE(mt8186_pin_rsel_range),
1211
1212 };
1213
1214 static const char * const mt8186_pinctrl_register_base_names[] = {
1215 "iocfg0", "iocfg_lt", "iocfg_lm", "iocfg_lb", "iocfg_bl",
1216 "iocfg_rb", "iocfg_rt",
1217 };
1218
1219 static const struct mtk_eint_hw mt8186_eint_hw = {
1220 .port_mask = 0xf,
1221 .ports = 7,
1222 .ap_num = 217,
1223 .db_cnt = 32,
1224 .db_time = debounce_time_mt6765,
1225 };
1226
1227 static const struct mtk_pin_soc mt8186_data = {
1228 .reg_cal = mt8186_reg_cals,
1229 .pins = mtk_pins_mt8186,
1230 .npins = ARRAY_SIZE(mtk_pins_mt8186),
1231 .ngrps = ARRAY_SIZE(mtk_pins_mt8186),
1232 .nfuncs = 8,
1233 .gpio_m = 0,
1234 .eint_hw = &mt8186_eint_hw,
1235 .base_names = mt8186_pinctrl_register_base_names,
1236 .nbase_names = ARRAY_SIZE(mt8186_pinctrl_register_base_names),
1237 .pull_type = mt8186_pull_type,
1238 .pin_rsel = mt8186_pin_rsel_val_range,
1239 .npin_rsel = ARRAY_SIZE(mt8186_pin_rsel_val_range),
1240 .bias_set_combo = mtk_pinconf_bias_set_combo,
1241 .bias_get_combo = mtk_pinconf_bias_get_combo,
1242 .drive_set = mtk_pinconf_drive_set_rev1,
1243 .drive_get = mtk_pinconf_drive_get_rev1,
1244 .adv_drive_get = mtk_pinconf_adv_drive_get_raw,
1245 .adv_drive_set = mtk_pinconf_adv_drive_set_raw,
1246 };
1247
1248 static const struct of_device_id mt8186_pinctrl_of_match[] = {
1249 { .compatible = "mediatek,mt8186-pinctrl", .data = &mt8186_data },
1250 { }
1251 };
1252
1253 static struct platform_driver mt8186_pinctrl_driver = {
1254 .driver = {
1255 .name = "mt8186-pinctrl",
1256 .of_match_table = mt8186_pinctrl_of_match,
1257 .pm = &mtk_paris_pinctrl_pm_ops,
1258 },
1259 .probe = mtk_paris_pinctrl_probe,
1260 };
1261
mt8186_pinctrl_init(void)1262 static int __init mt8186_pinctrl_init(void)
1263 {
1264 return platform_driver_register(&mt8186_pinctrl_driver);
1265 }
1266
1267 arch_initcall(mt8186_pinctrl_init);
1268