1 /*
2  * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14 
15 #include <linux/kernel.h>
16 #include <linux/module.h>
17 #include <linux/pinctrl/pinctrl.h>
18 #include <linux/platform_device.h>
19 
20 #include "pinctrl-uniphier.h"
21 
22 static const struct pinctrl_pin_desc uniphier_ld4_pins[] = {
23 	UNIPHIER_PINCTRL_PIN(0, "EA1", UNIPHIER_PIN_IECTRL_NONE,
24 			     8, UNIPHIER_PIN_DRV_1BIT,
25 			     8, UNIPHIER_PIN_PULL_DOWN),
26 	UNIPHIER_PINCTRL_PIN(1, "EA2", UNIPHIER_PIN_IECTRL_NONE,
27 			     9, UNIPHIER_PIN_DRV_1BIT,
28 			     9, UNIPHIER_PIN_PULL_DOWN),
29 	UNIPHIER_PINCTRL_PIN(2, "EA3", UNIPHIER_PIN_IECTRL_NONE,
30 			     10, UNIPHIER_PIN_DRV_1BIT,
31 			     10, UNIPHIER_PIN_PULL_DOWN),
32 	UNIPHIER_PINCTRL_PIN(3, "EA4", UNIPHIER_PIN_IECTRL_NONE,
33 			     11, UNIPHIER_PIN_DRV_1BIT,
34 			     11, UNIPHIER_PIN_PULL_DOWN),
35 	UNIPHIER_PINCTRL_PIN(4, "EA5", UNIPHIER_PIN_IECTRL_NONE,
36 			     12, UNIPHIER_PIN_DRV_1BIT,
37 			     12, UNIPHIER_PIN_PULL_DOWN),
38 	UNIPHIER_PINCTRL_PIN(5, "EA6", UNIPHIER_PIN_IECTRL_NONE,
39 			     13, UNIPHIER_PIN_DRV_1BIT,
40 			     13, UNIPHIER_PIN_PULL_DOWN),
41 	UNIPHIER_PINCTRL_PIN(6, "EA7", UNIPHIER_PIN_IECTRL_NONE,
42 			     14, UNIPHIER_PIN_DRV_1BIT,
43 			     14, UNIPHIER_PIN_PULL_DOWN),
44 	UNIPHIER_PINCTRL_PIN(7, "EA8", 0,
45 			     15, UNIPHIER_PIN_DRV_1BIT,
46 			     15, UNIPHIER_PIN_PULL_DOWN),
47 	UNIPHIER_PINCTRL_PIN(8, "EA9", 0,
48 			     16, UNIPHIER_PIN_DRV_1BIT,
49 			     16, UNIPHIER_PIN_PULL_DOWN),
50 	UNIPHIER_PINCTRL_PIN(9, "EA10", 0,
51 			     17, UNIPHIER_PIN_DRV_1BIT,
52 			     17, UNIPHIER_PIN_PULL_DOWN),
53 	UNIPHIER_PINCTRL_PIN(10, "EA11", 0,
54 			     18, UNIPHIER_PIN_DRV_1BIT,
55 			     18, UNIPHIER_PIN_PULL_DOWN),
56 	UNIPHIER_PINCTRL_PIN(11, "EA12", 0,
57 			     19, UNIPHIER_PIN_DRV_1BIT,
58 			     19, UNIPHIER_PIN_PULL_DOWN),
59 	UNIPHIER_PINCTRL_PIN(12, "EA13", 0,
60 			     20, UNIPHIER_PIN_DRV_1BIT,
61 			     20, UNIPHIER_PIN_PULL_DOWN),
62 	UNIPHIER_PINCTRL_PIN(13, "EA14", 0,
63 			     21, UNIPHIER_PIN_DRV_1BIT,
64 			     21, UNIPHIER_PIN_PULL_DOWN),
65 	UNIPHIER_PINCTRL_PIN(14, "EA15", 0,
66 			     22, UNIPHIER_PIN_DRV_1BIT,
67 			     22, UNIPHIER_PIN_PULL_DOWN),
68 	UNIPHIER_PINCTRL_PIN(15, "ECLK", UNIPHIER_PIN_IECTRL_NONE,
69 			     23, UNIPHIER_PIN_DRV_1BIT,
70 			     23, UNIPHIER_PIN_PULL_DOWN),
71 	UNIPHIER_PINCTRL_PIN(16, "XERWE0", UNIPHIER_PIN_IECTRL_NONE,
72 			     24, UNIPHIER_PIN_DRV_1BIT,
73 			     24, UNIPHIER_PIN_PULL_UP),
74 	UNIPHIER_PINCTRL_PIN(17, "XERWE1", UNIPHIER_PIN_IECTRL_NONE,
75 			     25, UNIPHIER_PIN_DRV_1BIT,
76 			     25, UNIPHIER_PIN_PULL_UP),
77 	UNIPHIER_PINCTRL_PIN(18, "ES0", UNIPHIER_PIN_IECTRL_NONE,
78 			     27, UNIPHIER_PIN_DRV_1BIT,
79 			     27, UNIPHIER_PIN_PULL_UP),
80 	UNIPHIER_PINCTRL_PIN(19, "ES1", UNIPHIER_PIN_IECTRL_NONE,
81 			     28, UNIPHIER_PIN_DRV_1BIT,
82 			     28, UNIPHIER_PIN_PULL_UP),
83 	UNIPHIER_PINCTRL_PIN(20, "ES2", UNIPHIER_PIN_IECTRL_NONE,
84 			     29, UNIPHIER_PIN_DRV_1BIT,
85 			     29, UNIPHIER_PIN_PULL_UP),
86 	UNIPHIER_PINCTRL_PIN(21, "XERST", UNIPHIER_PIN_IECTRL_NONE,
87 			     38, UNIPHIER_PIN_DRV_1BIT,
88 			     38, UNIPHIER_PIN_PULL_UP),
89 	UNIPHIER_PINCTRL_PIN(22, "MMCCLK", UNIPHIER_PIN_IECTRL_NONE,
90 			     0, UNIPHIER_PIN_DRV_2BIT,
91 			     146, UNIPHIER_PIN_PULL_UP),
92 	UNIPHIER_PINCTRL_PIN(23, "MMCCMD", UNIPHIER_PIN_IECTRL_NONE,
93 			     1, UNIPHIER_PIN_DRV_2BIT,
94 			     147, UNIPHIER_PIN_PULL_UP),
95 	UNIPHIER_PINCTRL_PIN(24, "MMCDAT0", UNIPHIER_PIN_IECTRL_NONE,
96 			     2, UNIPHIER_PIN_DRV_2BIT,
97 			     148, UNIPHIER_PIN_PULL_UP),
98 	UNIPHIER_PINCTRL_PIN(25, "MMCDAT1", UNIPHIER_PIN_IECTRL_NONE,
99 			     3, UNIPHIER_PIN_DRV_2BIT,
100 			     149, UNIPHIER_PIN_PULL_UP),
101 	UNIPHIER_PINCTRL_PIN(26, "MMCDAT2", UNIPHIER_PIN_IECTRL_NONE,
102 			     4, UNIPHIER_PIN_DRV_2BIT,
103 			     150, UNIPHIER_PIN_PULL_UP),
104 	UNIPHIER_PINCTRL_PIN(27, "MMCDAT3", UNIPHIER_PIN_IECTRL_NONE,
105 			     5, UNIPHIER_PIN_DRV_2BIT,
106 			     151, UNIPHIER_PIN_PULL_UP),
107 	UNIPHIER_PINCTRL_PIN(28, "MMCDAT4", UNIPHIER_PIN_IECTRL_NONE,
108 			     6, UNIPHIER_PIN_DRV_2BIT,
109 			     152, UNIPHIER_PIN_PULL_UP),
110 	UNIPHIER_PINCTRL_PIN(29, "MMCDAT5", UNIPHIER_PIN_IECTRL_NONE,
111 			     7, UNIPHIER_PIN_DRV_2BIT,
112 			     153, UNIPHIER_PIN_PULL_UP),
113 	UNIPHIER_PINCTRL_PIN(30, "MMCDAT6", UNIPHIER_PIN_IECTRL_NONE,
114 			     8, UNIPHIER_PIN_DRV_2BIT,
115 			     154, UNIPHIER_PIN_PULL_UP),
116 	UNIPHIER_PINCTRL_PIN(31, "MMCDAT7", UNIPHIER_PIN_IECTRL_NONE,
117 			     9, UNIPHIER_PIN_DRV_2BIT,
118 			     155, UNIPHIER_PIN_PULL_UP),
119 	UNIPHIER_PINCTRL_PIN(32, "RMII_RXD0", 6,
120 			     39, UNIPHIER_PIN_DRV_1BIT,
121 			     39, UNIPHIER_PIN_PULL_DOWN),
122 	UNIPHIER_PINCTRL_PIN(33, "RMII_RXD1", 6,
123 			     40, UNIPHIER_PIN_DRV_1BIT,
124 			     40, UNIPHIER_PIN_PULL_DOWN),
125 	UNIPHIER_PINCTRL_PIN(34, "RMII_CRS_DV", 6,
126 			     41, UNIPHIER_PIN_DRV_1BIT,
127 			     41, UNIPHIER_PIN_PULL_DOWN),
128 	UNIPHIER_PINCTRL_PIN(35, "RMII_RXER", 6,
129 			     42, UNIPHIER_PIN_DRV_1BIT,
130 			     42, UNIPHIER_PIN_PULL_DOWN),
131 	UNIPHIER_PINCTRL_PIN(36, "RMII_REFCLK", 6,
132 			     43, UNIPHIER_PIN_DRV_1BIT,
133 			     43, UNIPHIER_PIN_PULL_DOWN),
134 	UNIPHIER_PINCTRL_PIN(37, "RMII_TXD0", 6,
135 			     44, UNIPHIER_PIN_DRV_1BIT,
136 			     44, UNIPHIER_PIN_PULL_DOWN),
137 	UNIPHIER_PINCTRL_PIN(38, "RMII_TXD1", 6,
138 			     45, UNIPHIER_PIN_DRV_1BIT,
139 			     45, UNIPHIER_PIN_PULL_DOWN),
140 	UNIPHIER_PINCTRL_PIN(39, "RMII_TXEN", 6,
141 			     46, UNIPHIER_PIN_DRV_1BIT,
142 			     46, UNIPHIER_PIN_PULL_DOWN),
143 	UNIPHIER_PINCTRL_PIN(40, "MDC", 6,
144 			     47, UNIPHIER_PIN_DRV_1BIT,
145 			     47, UNIPHIER_PIN_PULL_DOWN),
146 	UNIPHIER_PINCTRL_PIN(41, "MDIO", 6,
147 			     48, UNIPHIER_PIN_DRV_1BIT,
148 			     48, UNIPHIER_PIN_PULL_DOWN),
149 	UNIPHIER_PINCTRL_PIN(42, "MDIO_INTL", 6,
150 			     49, UNIPHIER_PIN_DRV_1BIT,
151 			     49, UNIPHIER_PIN_PULL_DOWN),
152 	UNIPHIER_PINCTRL_PIN(43, "PHYRSTL", 6,
153 			     50, UNIPHIER_PIN_DRV_1BIT,
154 			     50, UNIPHIER_PIN_PULL_DOWN),
155 	UNIPHIER_PINCTRL_PIN(44, "SDCLK", UNIPHIER_PIN_IECTRL_NONE,
156 			     10, UNIPHIER_PIN_DRV_2BIT,
157 			     156, UNIPHIER_PIN_PULL_UP),
158 	UNIPHIER_PINCTRL_PIN(45, "SDCMD", UNIPHIER_PIN_IECTRL_NONE,
159 			     11, UNIPHIER_PIN_DRV_2BIT,
160 			     157, UNIPHIER_PIN_PULL_UP),
161 	UNIPHIER_PINCTRL_PIN(46, "SDDAT0", UNIPHIER_PIN_IECTRL_NONE,
162 			     12, UNIPHIER_PIN_DRV_2BIT,
163 			     158, UNIPHIER_PIN_PULL_UP),
164 	UNIPHIER_PINCTRL_PIN(47, "SDDAT1", UNIPHIER_PIN_IECTRL_NONE,
165 			     13, UNIPHIER_PIN_DRV_2BIT,
166 			     159, UNIPHIER_PIN_PULL_UP),
167 	UNIPHIER_PINCTRL_PIN(48, "SDDAT2", UNIPHIER_PIN_IECTRL_NONE,
168 			     14, UNIPHIER_PIN_DRV_2BIT,
169 			     160, UNIPHIER_PIN_PULL_UP),
170 	UNIPHIER_PINCTRL_PIN(49, "SDDAT3", UNIPHIER_PIN_IECTRL_NONE,
171 			     15, UNIPHIER_PIN_DRV_2BIT,
172 			     161, UNIPHIER_PIN_PULL_UP),
173 	UNIPHIER_PINCTRL_PIN(50, "SDCD", UNIPHIER_PIN_IECTRL_NONE,
174 			     51, UNIPHIER_PIN_DRV_1BIT,
175 			     51, UNIPHIER_PIN_PULL_UP),
176 	UNIPHIER_PINCTRL_PIN(51, "SDWP", UNIPHIER_PIN_IECTRL_NONE,
177 			     52, UNIPHIER_PIN_DRV_1BIT,
178 			     52, UNIPHIER_PIN_PULL_UP),
179 	UNIPHIER_PINCTRL_PIN(52, "SDVOLC", UNIPHIER_PIN_IECTRL_NONE,
180 			     53, UNIPHIER_PIN_DRV_1BIT,
181 			     53, UNIPHIER_PIN_PULL_UP),
182 	UNIPHIER_PINCTRL_PIN(53, "USB0VBUS", 0,
183 			     54, UNIPHIER_PIN_DRV_1BIT,
184 			     54, UNIPHIER_PIN_PULL_DOWN),
185 	UNIPHIER_PINCTRL_PIN(54, "USB0OD", 0,
186 			     55, UNIPHIER_PIN_DRV_1BIT,
187 			     55, UNIPHIER_PIN_PULL_DOWN),
188 	UNIPHIER_PINCTRL_PIN(55, "USB1VBUS", 0,
189 			     56, UNIPHIER_PIN_DRV_1BIT,
190 			     56, UNIPHIER_PIN_PULL_DOWN),
191 	UNIPHIER_PINCTRL_PIN(56, "USB1OD", 0,
192 			     57, UNIPHIER_PIN_DRV_1BIT,
193 			     57, UNIPHIER_PIN_PULL_DOWN),
194 	UNIPHIER_PINCTRL_PIN(57, "PCRESET", 0,
195 			     58, UNIPHIER_PIN_DRV_1BIT,
196 			     58, UNIPHIER_PIN_PULL_DOWN),
197 	UNIPHIER_PINCTRL_PIN(58, "PCREG", 0,
198 			     59, UNIPHIER_PIN_DRV_1BIT,
199 			     59, UNIPHIER_PIN_PULL_DOWN),
200 	UNIPHIER_PINCTRL_PIN(59, "PCCE2", 0,
201 			     60, UNIPHIER_PIN_DRV_1BIT,
202 			     60, UNIPHIER_PIN_PULL_DOWN),
203 	UNIPHIER_PINCTRL_PIN(60, "PCVS1", 0,
204 			     61, UNIPHIER_PIN_DRV_1BIT,
205 			     61, UNIPHIER_PIN_PULL_DOWN),
206 	UNIPHIER_PINCTRL_PIN(61, "PCCD2", 0,
207 			     62, UNIPHIER_PIN_DRV_1BIT,
208 			     62, UNIPHIER_PIN_PULL_DOWN),
209 	UNIPHIER_PINCTRL_PIN(62, "PCCD1", 0,
210 			     63, UNIPHIER_PIN_DRV_1BIT,
211 			     63, UNIPHIER_PIN_PULL_DOWN),
212 	UNIPHIER_PINCTRL_PIN(63, "PCREADY", 0,
213 			     64, UNIPHIER_PIN_DRV_1BIT,
214 			     64, UNIPHIER_PIN_PULL_DOWN),
215 	UNIPHIER_PINCTRL_PIN(64, "PCDOE", 0,
216 			     65, UNIPHIER_PIN_DRV_1BIT,
217 			     65, UNIPHIER_PIN_PULL_DOWN),
218 	UNIPHIER_PINCTRL_PIN(65, "PCCE1", 0,
219 			     66, UNIPHIER_PIN_DRV_1BIT,
220 			     66, UNIPHIER_PIN_PULL_DOWN),
221 	UNIPHIER_PINCTRL_PIN(66, "PCWE", 0,
222 			     67, UNIPHIER_PIN_DRV_1BIT,
223 			     67, UNIPHIER_PIN_PULL_DOWN),
224 	UNIPHIER_PINCTRL_PIN(67, "PCOE", 0,
225 			     68, UNIPHIER_PIN_DRV_1BIT,
226 			     68, UNIPHIER_PIN_PULL_DOWN),
227 	UNIPHIER_PINCTRL_PIN(68, "PCWAIT", 0,
228 			     69, UNIPHIER_PIN_DRV_1BIT,
229 			     69, UNIPHIER_PIN_PULL_DOWN),
230 	UNIPHIER_PINCTRL_PIN(69, "PCIOWR", 0,
231 			     70, UNIPHIER_PIN_DRV_1BIT,
232 			     70, UNIPHIER_PIN_PULL_DOWN),
233 	UNIPHIER_PINCTRL_PIN(70, "PCIORD", 0,
234 			     71, UNIPHIER_PIN_DRV_1BIT,
235 			     71, UNIPHIER_PIN_PULL_DOWN),
236 	UNIPHIER_PINCTRL_PIN(71, "HS0DIN0", 0,
237 			     72, UNIPHIER_PIN_DRV_1BIT,
238 			     72, UNIPHIER_PIN_PULL_DOWN),
239 	UNIPHIER_PINCTRL_PIN(72, "HS0DIN1", 0,
240 			     73, UNIPHIER_PIN_DRV_1BIT,
241 			     73, UNIPHIER_PIN_PULL_DOWN),
242 	UNIPHIER_PINCTRL_PIN(73, "HS0DIN2", 0,
243 			     74, UNIPHIER_PIN_DRV_1BIT,
244 			     74, UNIPHIER_PIN_PULL_DOWN),
245 	UNIPHIER_PINCTRL_PIN(74, "HS0DIN3", 0,
246 			     75, UNIPHIER_PIN_DRV_1BIT,
247 			     75, UNIPHIER_PIN_PULL_DOWN),
248 	UNIPHIER_PINCTRL_PIN(75, "HS0DIN4", 0,
249 			     76, UNIPHIER_PIN_DRV_1BIT,
250 			     76, UNIPHIER_PIN_PULL_DOWN),
251 	UNIPHIER_PINCTRL_PIN(76, "HS0DIN5", 0,
252 			     77, UNIPHIER_PIN_DRV_1BIT,
253 			     77, UNIPHIER_PIN_PULL_DOWN),
254 	UNIPHIER_PINCTRL_PIN(77, "HS0DIN6", 0,
255 			     78, UNIPHIER_PIN_DRV_1BIT,
256 			     78, UNIPHIER_PIN_PULL_DOWN),
257 	UNIPHIER_PINCTRL_PIN(78, "HS0DIN7", 0,
258 			     79, UNIPHIER_PIN_DRV_1BIT,
259 			     79, UNIPHIER_PIN_PULL_DOWN),
260 	UNIPHIER_PINCTRL_PIN(79, "HS0BCLKIN", 0,
261 			     80, UNIPHIER_PIN_DRV_1BIT,
262 			     80, UNIPHIER_PIN_PULL_DOWN),
263 	UNIPHIER_PINCTRL_PIN(80, "HS0VALIN", 0,
264 			     81, UNIPHIER_PIN_DRV_1BIT,
265 			     81, UNIPHIER_PIN_PULL_DOWN),
266 	UNIPHIER_PINCTRL_PIN(81, "HS0SYNCIN", 0,
267 			     82, UNIPHIER_PIN_DRV_1BIT,
268 			     82, UNIPHIER_PIN_PULL_DOWN),
269 	UNIPHIER_PINCTRL_PIN(82, "HSDOUT0", 0,
270 			     83, UNIPHIER_PIN_DRV_1BIT,
271 			     83, UNIPHIER_PIN_PULL_DOWN),
272 	UNIPHIER_PINCTRL_PIN(83, "HSDOUT1", 0,
273 			     84, UNIPHIER_PIN_DRV_1BIT,
274 			     84, UNIPHIER_PIN_PULL_DOWN),
275 	UNIPHIER_PINCTRL_PIN(84, "HSDOUT2", 0,
276 			     85, UNIPHIER_PIN_DRV_1BIT,
277 			     85, UNIPHIER_PIN_PULL_DOWN),
278 	UNIPHIER_PINCTRL_PIN(85, "HSDOUT3", 0,
279 			     86, UNIPHIER_PIN_DRV_1BIT,
280 			     86, UNIPHIER_PIN_PULL_DOWN),
281 	UNIPHIER_PINCTRL_PIN(86, "HSDOUT4", 0,
282 			     87, UNIPHIER_PIN_DRV_1BIT,
283 			     87, UNIPHIER_PIN_PULL_DOWN),
284 	UNIPHIER_PINCTRL_PIN(87, "HSDOUT5", 0,
285 			     88, UNIPHIER_PIN_DRV_1BIT,
286 			     88, UNIPHIER_PIN_PULL_DOWN),
287 	UNIPHIER_PINCTRL_PIN(88, "HSDOUT6", 0,
288 			     89, UNIPHIER_PIN_DRV_1BIT,
289 			     89, UNIPHIER_PIN_PULL_DOWN),
290 	UNIPHIER_PINCTRL_PIN(89, "HSDOUT7", 0,
291 			     90, UNIPHIER_PIN_DRV_1BIT,
292 			     90, UNIPHIER_PIN_PULL_DOWN),
293 	UNIPHIER_PINCTRL_PIN(90, "HSBCLKOUT", 0,
294 			     91, UNIPHIER_PIN_DRV_1BIT,
295 			     91, UNIPHIER_PIN_PULL_DOWN),
296 	UNIPHIER_PINCTRL_PIN(91, "HSVALOUT", 0,
297 			     92, UNIPHIER_PIN_DRV_1BIT,
298 			     92, UNIPHIER_PIN_PULL_DOWN),
299 	UNIPHIER_PINCTRL_PIN(92, "HSSYNCOUT", 0,
300 			     93, UNIPHIER_PIN_DRV_1BIT,
301 			     93, UNIPHIER_PIN_PULL_DOWN),
302 	UNIPHIER_PINCTRL_PIN(93, "AGCI", 3,
303 			     -1, UNIPHIER_PIN_DRV_FIXED4,
304 			     162, UNIPHIER_PIN_PULL_DOWN),
305 	UNIPHIER_PINCTRL_PIN(94, "AGCR", 4,
306 			     -1, UNIPHIER_PIN_DRV_FIXED4,
307 			     163, UNIPHIER_PIN_PULL_DOWN),
308 	UNIPHIER_PINCTRL_PIN(95, "AGCBS", 5,
309 			     -1, UNIPHIER_PIN_DRV_FIXED4,
310 			     164, UNIPHIER_PIN_PULL_DOWN),
311 	UNIPHIER_PINCTRL_PIN(96, "IECOUT", 0,
312 			     94, UNIPHIER_PIN_DRV_1BIT,
313 			     94, UNIPHIER_PIN_PULL_DOWN),
314 	UNIPHIER_PINCTRL_PIN(97, "ASMCK", 0,
315 			     95, UNIPHIER_PIN_DRV_1BIT,
316 			     95, UNIPHIER_PIN_PULL_DOWN),
317 	UNIPHIER_PINCTRL_PIN(98, "ABCKO", UNIPHIER_PIN_IECTRL_NONE,
318 			     96, UNIPHIER_PIN_DRV_1BIT,
319 			     96, UNIPHIER_PIN_PULL_DOWN),
320 	UNIPHIER_PINCTRL_PIN(99, "ALRCKO", UNIPHIER_PIN_IECTRL_NONE,
321 			     97, UNIPHIER_PIN_DRV_1BIT,
322 			     97, UNIPHIER_PIN_PULL_DOWN),
323 	UNIPHIER_PINCTRL_PIN(100, "ASDOUT0", UNIPHIER_PIN_IECTRL_NONE,
324 			     98, UNIPHIER_PIN_DRV_1BIT,
325 			     98, UNIPHIER_PIN_PULL_DOWN),
326 	UNIPHIER_PINCTRL_PIN(101, "ARCOUT", 0,
327 			     99, UNIPHIER_PIN_DRV_1BIT,
328 			     99, UNIPHIER_PIN_PULL_DOWN),
329 	UNIPHIER_PINCTRL_PIN(102, "SDA0", UNIPHIER_PIN_IECTRL_NONE,
330 			     -1, UNIPHIER_PIN_DRV_FIXED4,
331 			     -1, UNIPHIER_PIN_PULL_NONE),
332 	UNIPHIER_PINCTRL_PIN(103, "SCL0", UNIPHIER_PIN_IECTRL_NONE,
333 			     -1, UNIPHIER_PIN_DRV_FIXED4,
334 			     -1, UNIPHIER_PIN_PULL_NONE),
335 	UNIPHIER_PINCTRL_PIN(104, "SDA1", UNIPHIER_PIN_IECTRL_NONE,
336 			     -1, UNIPHIER_PIN_DRV_FIXED4,
337 			     -1, UNIPHIER_PIN_PULL_NONE),
338 	UNIPHIER_PINCTRL_PIN(105, "SCL1", UNIPHIER_PIN_IECTRL_NONE,
339 			     -1, UNIPHIER_PIN_DRV_FIXED4,
340 			     -1, UNIPHIER_PIN_PULL_NONE),
341 	UNIPHIER_PINCTRL_PIN(106, "DMDSDA0", UNIPHIER_PIN_IECTRL_NONE,
342 			     -1, UNIPHIER_PIN_DRV_FIXED4,
343 			     -1, UNIPHIER_PIN_PULL_NONE),
344 	UNIPHIER_PINCTRL_PIN(107, "DMDSCL0", UNIPHIER_PIN_IECTRL_NONE,
345 			     -1, UNIPHIER_PIN_DRV_FIXED4,
346 			     -1, UNIPHIER_PIN_PULL_NONE),
347 	UNIPHIER_PINCTRL_PIN(108, "DMDSDA1", UNIPHIER_PIN_IECTRL_NONE,
348 			     -1, UNIPHIER_PIN_DRV_FIXED4,
349 			     -1, UNIPHIER_PIN_PULL_NONE),
350 	UNIPHIER_PINCTRL_PIN(109, "DMDSCL1", UNIPHIER_PIN_IECTRL_NONE,
351 			     -1, UNIPHIER_PIN_DRV_FIXED4,
352 			     -1, UNIPHIER_PIN_PULL_NONE),
353 	UNIPHIER_PINCTRL_PIN(110, "SBO0", UNIPHIER_PIN_IECTRL_NONE,
354 			     100, UNIPHIER_PIN_DRV_1BIT,
355 			     100, UNIPHIER_PIN_PULL_UP),
356 	UNIPHIER_PINCTRL_PIN(111, "SBI0", UNIPHIER_PIN_IECTRL_NONE,
357 			     101, UNIPHIER_PIN_DRV_1BIT,
358 			     101, UNIPHIER_PIN_PULL_UP),
359 	UNIPHIER_PINCTRL_PIN(112, "HIN", 1,
360 			     -1, UNIPHIER_PIN_DRV_FIXED5,
361 			     -1, UNIPHIER_PIN_PULL_NONE),
362 	UNIPHIER_PINCTRL_PIN(113, "VIN", 2,
363 			     -1, UNIPHIER_PIN_DRV_FIXED5,
364 			     -1, UNIPHIER_PIN_PULL_NONE),
365 	UNIPHIER_PINCTRL_PIN(114, "TCON0", UNIPHIER_PIN_IECTRL_NONE,
366 			     102, UNIPHIER_PIN_DRV_1BIT,
367 			     102, UNIPHIER_PIN_PULL_DOWN),
368 	UNIPHIER_PINCTRL_PIN(115, "TCON1", UNIPHIER_PIN_IECTRL_NONE,
369 			     103, UNIPHIER_PIN_DRV_1BIT,
370 			     103, UNIPHIER_PIN_PULL_DOWN),
371 	UNIPHIER_PINCTRL_PIN(116, "TCON2", UNIPHIER_PIN_IECTRL_NONE,
372 			     104, UNIPHIER_PIN_DRV_1BIT,
373 			     104, UNIPHIER_PIN_PULL_DOWN),
374 	UNIPHIER_PINCTRL_PIN(117, "TCON3", UNIPHIER_PIN_IECTRL_NONE,
375 			     105, UNIPHIER_PIN_DRV_1BIT,
376 			     105, UNIPHIER_PIN_PULL_DOWN),
377 	UNIPHIER_PINCTRL_PIN(118, "TCON4", UNIPHIER_PIN_IECTRL_NONE,
378 			     106, UNIPHIER_PIN_DRV_1BIT,
379 			     106, UNIPHIER_PIN_PULL_DOWN),
380 	UNIPHIER_PINCTRL_PIN(119, "TCON5", UNIPHIER_PIN_IECTRL_NONE,
381 			     107, UNIPHIER_PIN_DRV_1BIT,
382 			     107, UNIPHIER_PIN_PULL_DOWN),
383 	UNIPHIER_PINCTRL_PIN(120, "TCON6", 0,
384 			     108, UNIPHIER_PIN_DRV_1BIT,
385 			     108, UNIPHIER_PIN_PULL_DOWN),
386 	UNIPHIER_PINCTRL_PIN(121, "TCON7", 0,
387 			     109, UNIPHIER_PIN_DRV_1BIT,
388 			     109, UNIPHIER_PIN_PULL_DOWN),
389 	UNIPHIER_PINCTRL_PIN(122, "PWMA", 0,
390 			     110, UNIPHIER_PIN_DRV_1BIT,
391 			     110, UNIPHIER_PIN_PULL_DOWN),
392 	UNIPHIER_PINCTRL_PIN(123, "XIRQ1", 0,
393 			     111, UNIPHIER_PIN_DRV_1BIT,
394 			     111, UNIPHIER_PIN_PULL_DOWN),
395 	UNIPHIER_PINCTRL_PIN(124, "XIRQ2", 0,
396 			     112, UNIPHIER_PIN_DRV_1BIT,
397 			     112, UNIPHIER_PIN_PULL_DOWN),
398 	UNIPHIER_PINCTRL_PIN(125, "XIRQ3", 0,
399 			     113, UNIPHIER_PIN_DRV_1BIT,
400 			     113, UNIPHIER_PIN_PULL_DOWN),
401 	UNIPHIER_PINCTRL_PIN(126, "XIRQ4", 0,
402 			     114, UNIPHIER_PIN_DRV_1BIT,
403 			     114, UNIPHIER_PIN_PULL_DOWN),
404 	UNIPHIER_PINCTRL_PIN(127, "XIRQ5", 0,
405 			     115, UNIPHIER_PIN_DRV_1BIT,
406 			     115, UNIPHIER_PIN_PULL_DOWN),
407 	UNIPHIER_PINCTRL_PIN(128, "XIRQ6", 0,
408 			     116, UNIPHIER_PIN_DRV_1BIT,
409 			     116, UNIPHIER_PIN_PULL_DOWN),
410 	UNIPHIER_PINCTRL_PIN(129, "XIRQ7", 0,
411 			     117, UNIPHIER_PIN_DRV_1BIT,
412 			     117, UNIPHIER_PIN_PULL_DOWN),
413 	UNIPHIER_PINCTRL_PIN(130, "XIRQ8", 0,
414 			     118, UNIPHIER_PIN_DRV_1BIT,
415 			     118, UNIPHIER_PIN_PULL_DOWN),
416 	UNIPHIER_PINCTRL_PIN(131, "XIRQ9", 0,
417 			     119, UNIPHIER_PIN_DRV_1BIT,
418 			     119, UNIPHIER_PIN_PULL_DOWN),
419 	UNIPHIER_PINCTRL_PIN(132, "XIRQ10", 0,
420 			     120, UNIPHIER_PIN_DRV_1BIT,
421 			     120, UNIPHIER_PIN_PULL_DOWN),
422 	UNIPHIER_PINCTRL_PIN(133, "XIRQ11", 0,
423 			     121, UNIPHIER_PIN_DRV_1BIT,
424 			     121, UNIPHIER_PIN_PULL_DOWN),
425 	UNIPHIER_PINCTRL_PIN(134, "XIRQ14", 0,
426 			     122, UNIPHIER_PIN_DRV_1BIT,
427 			     122, UNIPHIER_PIN_PULL_DOWN),
428 	UNIPHIER_PINCTRL_PIN(135, "PORT00", 0,
429 			     123, UNIPHIER_PIN_DRV_1BIT,
430 			     123, UNIPHIER_PIN_PULL_DOWN),
431 	UNIPHIER_PINCTRL_PIN(136, "PORT01", 0,
432 			     124, UNIPHIER_PIN_DRV_1BIT,
433 			     124, UNIPHIER_PIN_PULL_DOWN),
434 	UNIPHIER_PINCTRL_PIN(137, "PORT02", 0,
435 			     125, UNIPHIER_PIN_DRV_1BIT,
436 			     125, UNIPHIER_PIN_PULL_DOWN),
437 	UNIPHIER_PINCTRL_PIN(138, "PORT03", 0,
438 			     126, UNIPHIER_PIN_DRV_1BIT,
439 			     126, UNIPHIER_PIN_PULL_DOWN),
440 	UNIPHIER_PINCTRL_PIN(139, "PORT04", 0,
441 			     127, UNIPHIER_PIN_DRV_1BIT,
442 			     127, UNIPHIER_PIN_PULL_DOWN),
443 	UNIPHIER_PINCTRL_PIN(140, "PORT05", 0,
444 			     128, UNIPHIER_PIN_DRV_1BIT,
445 			     128, UNIPHIER_PIN_PULL_DOWN),
446 	UNIPHIER_PINCTRL_PIN(141, "PORT06", 0,
447 			     129, UNIPHIER_PIN_DRV_1BIT,
448 			     129, UNIPHIER_PIN_PULL_DOWN),
449 	UNIPHIER_PINCTRL_PIN(142, "PORT07", 0,
450 			     130, UNIPHIER_PIN_DRV_1BIT,
451 			     130, UNIPHIER_PIN_PULL_DOWN),
452 	UNIPHIER_PINCTRL_PIN(143, "PORT10", 0,
453 			     131, UNIPHIER_PIN_DRV_1BIT,
454 			     131, UNIPHIER_PIN_PULL_DOWN),
455 	UNIPHIER_PINCTRL_PIN(144, "PORT11", 0,
456 			     132, UNIPHIER_PIN_DRV_1BIT,
457 			     132, UNIPHIER_PIN_PULL_DOWN),
458 	UNIPHIER_PINCTRL_PIN(145, "PORT12", 0,
459 			     133, UNIPHIER_PIN_DRV_1BIT,
460 			     133, UNIPHIER_PIN_PULL_DOWN),
461 	UNIPHIER_PINCTRL_PIN(146, "PORT13", 0,
462 			     134, UNIPHIER_PIN_DRV_1BIT,
463 			     134, UNIPHIER_PIN_PULL_DOWN),
464 	UNIPHIER_PINCTRL_PIN(147, "PORT14", 0,
465 			     135, UNIPHIER_PIN_DRV_1BIT,
466 			     135, UNIPHIER_PIN_PULL_DOWN),
467 	UNIPHIER_PINCTRL_PIN(148, "PORT15", 0,
468 			     136, UNIPHIER_PIN_DRV_1BIT,
469 			     136, UNIPHIER_PIN_PULL_DOWN),
470 	UNIPHIER_PINCTRL_PIN(149, "PORT16", 0,
471 			     137, UNIPHIER_PIN_DRV_1BIT,
472 			     137, UNIPHIER_PIN_PULL_DOWN),
473 	UNIPHIER_PINCTRL_PIN(150, "PORT17", UNIPHIER_PIN_IECTRL_NONE,
474 			     138, UNIPHIER_PIN_DRV_1BIT,
475 			     138, UNIPHIER_PIN_PULL_DOWN),
476 	UNIPHIER_PINCTRL_PIN(151, "PORT20", 0,
477 			     139, UNIPHIER_PIN_DRV_1BIT,
478 			     139, UNIPHIER_PIN_PULL_DOWN),
479 	UNIPHIER_PINCTRL_PIN(152, "PORT21", 0,
480 			     140, UNIPHIER_PIN_DRV_1BIT,
481 			     140, UNIPHIER_PIN_PULL_DOWN),
482 	UNIPHIER_PINCTRL_PIN(153, "PORT22", 0,
483 			     141, UNIPHIER_PIN_DRV_1BIT,
484 			     141, UNIPHIER_PIN_PULL_DOWN),
485 	UNIPHIER_PINCTRL_PIN(154, "PORT23", 0,
486 			     142, UNIPHIER_PIN_DRV_1BIT,
487 			     142, UNIPHIER_PIN_PULL_DOWN),
488 	UNIPHIER_PINCTRL_PIN(155, "PORT24", UNIPHIER_PIN_IECTRL_NONE,
489 			     143, UNIPHIER_PIN_DRV_1BIT,
490 			     143, UNIPHIER_PIN_PULL_DOWN),
491 	UNIPHIER_PINCTRL_PIN(156, "PORT25", 0,
492 			     144, UNIPHIER_PIN_DRV_1BIT,
493 			     144, UNIPHIER_PIN_PULL_DOWN),
494 	UNIPHIER_PINCTRL_PIN(157, "PORT26", 0,
495 			     145, UNIPHIER_PIN_DRV_1BIT,
496 			     145, UNIPHIER_PIN_PULL_DOWN),
497 	UNIPHIER_PINCTRL_PIN(158, "XNFRE", UNIPHIER_PIN_IECTRL_NONE,
498 			     31, UNIPHIER_PIN_DRV_1BIT,
499 			     31, UNIPHIER_PIN_PULL_UP),
500 	UNIPHIER_PINCTRL_PIN(159, "XNFWE", UNIPHIER_PIN_IECTRL_NONE,
501 			     32, UNIPHIER_PIN_DRV_1BIT,
502 			     32, UNIPHIER_PIN_PULL_UP),
503 	UNIPHIER_PINCTRL_PIN(160, "NFALE", UNIPHIER_PIN_IECTRL_NONE,
504 			     33, UNIPHIER_PIN_DRV_1BIT,
505 			     33, UNIPHIER_PIN_PULL_DOWN),
506 	UNIPHIER_PINCTRL_PIN(161, "NFCLE", UNIPHIER_PIN_IECTRL_NONE,
507 			     34, UNIPHIER_PIN_DRV_1BIT,
508 			     34, UNIPHIER_PIN_PULL_DOWN),
509 	UNIPHIER_PINCTRL_PIN(162, "XNFWP", UNIPHIER_PIN_IECTRL_NONE,
510 			     35, UNIPHIER_PIN_DRV_1BIT,
511 			     35, UNIPHIER_PIN_PULL_DOWN),
512 	UNIPHIER_PINCTRL_PIN(163, "XNFCE0", UNIPHIER_PIN_IECTRL_NONE,
513 			     36, UNIPHIER_PIN_DRV_1BIT,
514 			     36, UNIPHIER_PIN_PULL_UP),
515 	UNIPHIER_PINCTRL_PIN(164, "NANDRYBY0", UNIPHIER_PIN_IECTRL_NONE,
516 			     37, UNIPHIER_PIN_DRV_1BIT,
517 			     37, UNIPHIER_PIN_PULL_UP),
518 	/* dedicated pins */
519 	UNIPHIER_PINCTRL_PIN(165, "ED0", -1,
520 			     0, UNIPHIER_PIN_DRV_1BIT,
521 			     0, UNIPHIER_PIN_PULL_DOWN),
522 	UNIPHIER_PINCTRL_PIN(166, "ED1", -1,
523 			     1, UNIPHIER_PIN_DRV_1BIT,
524 			     1, UNIPHIER_PIN_PULL_DOWN),
525 	UNIPHIER_PINCTRL_PIN(167, "ED2", -1,
526 			     2, UNIPHIER_PIN_DRV_1BIT,
527 			     2, UNIPHIER_PIN_PULL_DOWN),
528 	UNIPHIER_PINCTRL_PIN(168, "ED3", -1,
529 			     3, UNIPHIER_PIN_DRV_1BIT,
530 			     3, UNIPHIER_PIN_PULL_DOWN),
531 	UNIPHIER_PINCTRL_PIN(169, "ED4", -1,
532 			     4, UNIPHIER_PIN_DRV_1BIT,
533 			     4, UNIPHIER_PIN_PULL_DOWN),
534 	UNIPHIER_PINCTRL_PIN(170, "ED5", -1,
535 			     5, UNIPHIER_PIN_DRV_1BIT,
536 			     5, UNIPHIER_PIN_PULL_DOWN),
537 	UNIPHIER_PINCTRL_PIN(171, "ED6", -1,
538 			     6, UNIPHIER_PIN_DRV_1BIT,
539 			     6, UNIPHIER_PIN_PULL_DOWN),
540 	UNIPHIER_PINCTRL_PIN(172, "ED7", -1,
541 			     7, UNIPHIER_PIN_DRV_1BIT,
542 			     7, UNIPHIER_PIN_PULL_DOWN),
543 	UNIPHIER_PINCTRL_PIN(173, "ERXW", -1,
544 			     26, UNIPHIER_PIN_DRV_1BIT,
545 			     26, UNIPHIER_PIN_PULL_UP),
546 	UNIPHIER_PINCTRL_PIN(174, "XECS1", -1,
547 			     30, UNIPHIER_PIN_DRV_1BIT,
548 			     30, UNIPHIER_PIN_PULL_UP),
549 };
550 
551 static const unsigned emmc_pins[] = {21, 22, 23, 24, 25, 26, 27};
552 static const int emmc_muxvals[] = {0, 1, 1, 1, 1, 1, 1};
553 static const unsigned emmc_dat8_pins[] = {28, 29, 30, 31};
554 static const int emmc_dat8_muxvals[] = {1, 1, 1, 1};
555 static const unsigned ether_mii_pins[] = {32, 33, 34, 35, 36, 37, 38, 39, 40,
556 					  41, 42, 43, 136, 137, 138, 139, 140,
557 					  141, 142};
558 static const int ether_mii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
559 					4, 4, 4, 4, 4, 4, 4};
560 static const unsigned ether_rmii_pins[] = {32, 33, 34, 35, 36, 37, 38, 39, 40,
561 					   41, 42, 43};
562 static const int ether_rmii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
563 static const unsigned i2c0_pins[] = {102, 103};
564 static const int i2c0_muxvals[] = {0, 0};
565 static const unsigned i2c1_pins[] = {104, 105};
566 static const int i2c1_muxvals[] = {0, 0};
567 static const unsigned i2c2_pins[] = {108, 109};
568 static const int i2c2_muxvals[] = {2, 2};
569 static const unsigned i2c3_pins[] = {108, 109};
570 static const int i2c3_muxvals[] = {3, 3};
571 static const unsigned nand_pins[] = {24, 25, 26, 27, 28, 29, 30, 31, 158, 159,
572 				     160, 161, 162, 163, 164};
573 static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
574 static const unsigned nand_cs1_pins[] = {22, 23};
575 static const int nand_cs1_muxvals[] = {0, 0};
576 static const unsigned sd_pins[] = {44, 45, 46, 47, 48, 49, 50, 51, 52};
577 static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
578 static const unsigned system_bus_pins[] = {16, 17, 18, 19, 20, 165, 166, 167,
579 					   168, 169, 170, 171, 172, 173};
580 static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1,
581 					 -1, -1, -1};
582 static const unsigned system_bus_cs0_pins[] = {155};
583 static const int system_bus_cs0_muxvals[] = {1};
584 static const unsigned system_bus_cs1_pins[] = {174};
585 static const int system_bus_cs1_muxvals[] = {-1};
586 static const unsigned system_bus_cs2_pins[] = {64};
587 static const int system_bus_cs2_muxvals[] = {1};
588 static const unsigned system_bus_cs3_pins[] = {156};
589 static const int system_bus_cs3_muxvals[] = {1};
590 static const unsigned uart0_pins[] = {85, 88};
591 static const int uart0_muxvals[] = {1, 1};
592 static const unsigned uart1_pins[] = {155, 156};
593 static const int uart1_muxvals[] = {13, 13};
594 static const unsigned uart1b_pins[] = {69, 70};
595 static const int uart1b_muxvals[] = {23, 23};
596 static const unsigned uart2_pins[] = {128, 129};
597 static const int uart2_muxvals[] = {13, 13};
598 static const unsigned uart3_pins[] = {110, 111};
599 static const int uart3_muxvals[] = {1, 1};
600 static const unsigned usb0_pins[] = {53, 54};
601 static const int usb0_muxvals[] = {0, 0};
602 static const unsigned usb1_pins[] = {55, 56};
603 static const int usb1_muxvals[] = {0, 0};
604 static const unsigned usb2_pins[] = {155, 156};
605 static const int usb2_muxvals[] = {4, 4};
606 static const unsigned usb2b_pins[] = {67, 68};
607 static const int usb2b_muxvals[] = {23, 23};
608 static const unsigned port_range0_pins[] = {
609 	135, 136, 137, 138, 139, 140, 141, 142,		/* PORT0x */
610 	143, 144, 145, 146, 147, 148, 149, 150,		/* PORT1x */
611 	151, 152, 153, 154, 155, 156, 157, 0,		/* PORT2x */
612 	1, 2, 3, 4, 5, 120, 121, 122,			/* PORT3x */
613 	24, 25, 26, 27, 28, 29, 30, 31,			/* PORT4x */
614 	40, 41, 42, 43, 44, 45, 46, 47,			/* PORT5x */
615 	48, 49, 50, 51, 52, 53, 54, 55,			/* PORT6x */
616 	56, 85, 84, 59, 82, 61, 64, 65,			/* PORT7x */
617 	8, 9, 10, 11, 12, 13, 14, 15,			/* PORT8x */
618 	66, 67, 68, 69, 70, 71, 72, 73,			/* PORT9x */
619 	74, 75, 89, 86, 78, 79, 80, 81,			/* PORT10x */
620 	60, 83, 58, 57, 88, 87, 77, 76,			/* PORT11x */
621 	90, 91, 92, 93, 94, 95, 96, 97,			/* PORT12x */
622 	98, 99, 100, 6, 101, 114, 115, 116,		/* PORT13x */
623 	103, 108, 21, 22, 23, 117, 118, 119,		/* PORT14x */
624 };
625 static const int port_range0_muxvals[] = {
626 	0, 0, 0, 0, 0, 0, 0, 0,				/* PORT0x */
627 	0, 0, 0, 0, 0, 0, 0, 0,				/* PORT1x */
628 	0, 0, 0, 0, 0, 0, 0, 15,			/* PORT2x */
629 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT3x */
630 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT4x */
631 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT5x */
632 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT6x */
633 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT7x */
634 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT8x */
635 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT9x */
636 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT10x */
637 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT11x */
638 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT12x */
639 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT13x */
640 	15, 15, 15, 15, 15, 15, 15, 15,			/* PORT14x */
641 };
642 static const unsigned port_range1_pins[] = {
643 	7,						/* PORT166 */
644 };
645 static const int port_range1_muxvals[] = {
646 	15,						/* PORT166 */
647 };
648 static const unsigned xirq_range0_pins[] = {
649 	151, 123, 124, 125, 126, 127, 128, 129,		/* XIRQ0-7 */
650 	130, 131, 132, 133, 62,				/* XIRQ8-12 */
651 };
652 static const int xirq_range0_muxvals[] = {
653 	14, 0, 0, 0, 0, 0, 0, 0,			/* XIRQ0-7 */
654 	0, 0, 0, 0, 14,					/* XIRQ8-12 */
655 };
656 static const unsigned xirq_range1_pins[] = {
657 	134, 63,					/* XIRQ14-15 */
658 };
659 static const int xirq_range1_muxvals[] = {
660 	0, 14,						/* XIRQ14-15 */
661 };
662 
663 static const struct uniphier_pinctrl_group uniphier_ld4_groups[] = {
664 	UNIPHIER_PINCTRL_GROUP(emmc),
665 	UNIPHIER_PINCTRL_GROUP(emmc_dat8),
666 	UNIPHIER_PINCTRL_GROUP(ether_mii),
667 	UNIPHIER_PINCTRL_GROUP(ether_rmii),
668 	UNIPHIER_PINCTRL_GROUP(i2c0),
669 	UNIPHIER_PINCTRL_GROUP(i2c1),
670 	UNIPHIER_PINCTRL_GROUP(i2c2),
671 	UNIPHIER_PINCTRL_GROUP(i2c3),
672 	UNIPHIER_PINCTRL_GROUP(nand),
673 	UNIPHIER_PINCTRL_GROUP(nand_cs1),
674 	UNIPHIER_PINCTRL_GROUP(sd),
675 	UNIPHIER_PINCTRL_GROUP(system_bus),
676 	UNIPHIER_PINCTRL_GROUP(system_bus_cs0),
677 	UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
678 	UNIPHIER_PINCTRL_GROUP(system_bus_cs2),
679 	UNIPHIER_PINCTRL_GROUP(system_bus_cs3),
680 	UNIPHIER_PINCTRL_GROUP(uart0),
681 	UNIPHIER_PINCTRL_GROUP(uart1),
682 	UNIPHIER_PINCTRL_GROUP(uart1b),
683 	UNIPHIER_PINCTRL_GROUP(uart2),
684 	UNIPHIER_PINCTRL_GROUP(uart3),
685 	UNIPHIER_PINCTRL_GROUP(usb0),
686 	UNIPHIER_PINCTRL_GROUP(usb1),
687 	UNIPHIER_PINCTRL_GROUP(usb2),
688 	UNIPHIER_PINCTRL_GROUP(usb2b),
689 	UNIPHIER_PINCTRL_GROUP_GPIO_RANGE_PORT(port_range0),
690 	UNIPHIER_PINCTRL_GROUP_GPIO_RANGE_PORT(port_range1),
691 	UNIPHIER_PINCTRL_GROUP_GPIO_RANGE_IRQ(xirq_range0),
692 	UNIPHIER_PINCTRL_GROUP_GPIO_RANGE_IRQ(xirq_range1),
693 	UNIPHIER_PINCTRL_GROUP_SINGLE(port00, port_range0, 0),
694 	UNIPHIER_PINCTRL_GROUP_SINGLE(port01, port_range0, 1),
695 	UNIPHIER_PINCTRL_GROUP_SINGLE(port02, port_range0, 2),
696 	UNIPHIER_PINCTRL_GROUP_SINGLE(port03, port_range0, 3),
697 	UNIPHIER_PINCTRL_GROUP_SINGLE(port04, port_range0, 4),
698 	UNIPHIER_PINCTRL_GROUP_SINGLE(port05, port_range0, 5),
699 	UNIPHIER_PINCTRL_GROUP_SINGLE(port06, port_range0, 6),
700 	UNIPHIER_PINCTRL_GROUP_SINGLE(port07, port_range0, 7),
701 	UNIPHIER_PINCTRL_GROUP_SINGLE(port10, port_range0, 8),
702 	UNIPHIER_PINCTRL_GROUP_SINGLE(port11, port_range0, 9),
703 	UNIPHIER_PINCTRL_GROUP_SINGLE(port12, port_range0, 10),
704 	UNIPHIER_PINCTRL_GROUP_SINGLE(port13, port_range0, 11),
705 	UNIPHIER_PINCTRL_GROUP_SINGLE(port14, port_range0, 12),
706 	UNIPHIER_PINCTRL_GROUP_SINGLE(port15, port_range0, 13),
707 	UNIPHIER_PINCTRL_GROUP_SINGLE(port16, port_range0, 14),
708 	UNIPHIER_PINCTRL_GROUP_SINGLE(port17, port_range0, 15),
709 	UNIPHIER_PINCTRL_GROUP_SINGLE(port20, port_range0, 16),
710 	UNIPHIER_PINCTRL_GROUP_SINGLE(port21, port_range0, 17),
711 	UNIPHIER_PINCTRL_GROUP_SINGLE(port22, port_range0, 18),
712 	UNIPHIER_PINCTRL_GROUP_SINGLE(port23, port_range0, 19),
713 	UNIPHIER_PINCTRL_GROUP_SINGLE(port24, port_range0, 20),
714 	UNIPHIER_PINCTRL_GROUP_SINGLE(port25, port_range0, 21),
715 	UNIPHIER_PINCTRL_GROUP_SINGLE(port26, port_range0, 22),
716 	UNIPHIER_PINCTRL_GROUP_SINGLE(port27, port_range0, 23),
717 	UNIPHIER_PINCTRL_GROUP_SINGLE(port30, port_range0, 24),
718 	UNIPHIER_PINCTRL_GROUP_SINGLE(port31, port_range0, 25),
719 	UNIPHIER_PINCTRL_GROUP_SINGLE(port32, port_range0, 26),
720 	UNIPHIER_PINCTRL_GROUP_SINGLE(port33, port_range0, 27),
721 	UNIPHIER_PINCTRL_GROUP_SINGLE(port34, port_range0, 28),
722 	UNIPHIER_PINCTRL_GROUP_SINGLE(port35, port_range0, 29),
723 	UNIPHIER_PINCTRL_GROUP_SINGLE(port36, port_range0, 30),
724 	UNIPHIER_PINCTRL_GROUP_SINGLE(port37, port_range0, 31),
725 	UNIPHIER_PINCTRL_GROUP_SINGLE(port40, port_range0, 32),
726 	UNIPHIER_PINCTRL_GROUP_SINGLE(port41, port_range0, 33),
727 	UNIPHIER_PINCTRL_GROUP_SINGLE(port42, port_range0, 34),
728 	UNIPHIER_PINCTRL_GROUP_SINGLE(port43, port_range0, 35),
729 	UNIPHIER_PINCTRL_GROUP_SINGLE(port44, port_range0, 36),
730 	UNIPHIER_PINCTRL_GROUP_SINGLE(port45, port_range0, 37),
731 	UNIPHIER_PINCTRL_GROUP_SINGLE(port46, port_range0, 38),
732 	UNIPHIER_PINCTRL_GROUP_SINGLE(port47, port_range0, 39),
733 	UNIPHIER_PINCTRL_GROUP_SINGLE(port50, port_range0, 40),
734 	UNIPHIER_PINCTRL_GROUP_SINGLE(port51, port_range0, 41),
735 	UNIPHIER_PINCTRL_GROUP_SINGLE(port52, port_range0, 42),
736 	UNIPHIER_PINCTRL_GROUP_SINGLE(port53, port_range0, 43),
737 	UNIPHIER_PINCTRL_GROUP_SINGLE(port54, port_range0, 44),
738 	UNIPHIER_PINCTRL_GROUP_SINGLE(port55, port_range0, 45),
739 	UNIPHIER_PINCTRL_GROUP_SINGLE(port56, port_range0, 46),
740 	UNIPHIER_PINCTRL_GROUP_SINGLE(port57, port_range0, 47),
741 	UNIPHIER_PINCTRL_GROUP_SINGLE(port60, port_range0, 48),
742 	UNIPHIER_PINCTRL_GROUP_SINGLE(port61, port_range0, 49),
743 	UNIPHIER_PINCTRL_GROUP_SINGLE(port62, port_range0, 50),
744 	UNIPHIER_PINCTRL_GROUP_SINGLE(port63, port_range0, 51),
745 	UNIPHIER_PINCTRL_GROUP_SINGLE(port64, port_range0, 52),
746 	UNIPHIER_PINCTRL_GROUP_SINGLE(port65, port_range0, 53),
747 	UNIPHIER_PINCTRL_GROUP_SINGLE(port66, port_range0, 54),
748 	UNIPHIER_PINCTRL_GROUP_SINGLE(port67, port_range0, 55),
749 	UNIPHIER_PINCTRL_GROUP_SINGLE(port70, port_range0, 56),
750 	UNIPHIER_PINCTRL_GROUP_SINGLE(port71, port_range0, 57),
751 	UNIPHIER_PINCTRL_GROUP_SINGLE(port72, port_range0, 58),
752 	UNIPHIER_PINCTRL_GROUP_SINGLE(port73, port_range0, 59),
753 	UNIPHIER_PINCTRL_GROUP_SINGLE(port74, port_range0, 60),
754 	UNIPHIER_PINCTRL_GROUP_SINGLE(port75, port_range0, 61),
755 	UNIPHIER_PINCTRL_GROUP_SINGLE(port76, port_range0, 62),
756 	UNIPHIER_PINCTRL_GROUP_SINGLE(port77, port_range0, 63),
757 	UNIPHIER_PINCTRL_GROUP_SINGLE(port80, port_range0, 64),
758 	UNIPHIER_PINCTRL_GROUP_SINGLE(port81, port_range0, 65),
759 	UNIPHIER_PINCTRL_GROUP_SINGLE(port82, port_range0, 66),
760 	UNIPHIER_PINCTRL_GROUP_SINGLE(port83, port_range0, 67),
761 	UNIPHIER_PINCTRL_GROUP_SINGLE(port84, port_range0, 68),
762 	UNIPHIER_PINCTRL_GROUP_SINGLE(port85, port_range0, 69),
763 	UNIPHIER_PINCTRL_GROUP_SINGLE(port86, port_range0, 70),
764 	UNIPHIER_PINCTRL_GROUP_SINGLE(port87, port_range0, 71),
765 	UNIPHIER_PINCTRL_GROUP_SINGLE(port90, port_range0, 72),
766 	UNIPHIER_PINCTRL_GROUP_SINGLE(port91, port_range0, 73),
767 	UNIPHIER_PINCTRL_GROUP_SINGLE(port92, port_range0, 74),
768 	UNIPHIER_PINCTRL_GROUP_SINGLE(port93, port_range0, 75),
769 	UNIPHIER_PINCTRL_GROUP_SINGLE(port94, port_range0, 76),
770 	UNIPHIER_PINCTRL_GROUP_SINGLE(port95, port_range0, 77),
771 	UNIPHIER_PINCTRL_GROUP_SINGLE(port96, port_range0, 78),
772 	UNIPHIER_PINCTRL_GROUP_SINGLE(port97, port_range0, 79),
773 	UNIPHIER_PINCTRL_GROUP_SINGLE(port100, port_range0, 80),
774 	UNIPHIER_PINCTRL_GROUP_SINGLE(port101, port_range0, 81),
775 	UNIPHIER_PINCTRL_GROUP_SINGLE(port102, port_range0, 82),
776 	UNIPHIER_PINCTRL_GROUP_SINGLE(port103, port_range0, 83),
777 	UNIPHIER_PINCTRL_GROUP_SINGLE(port104, port_range0, 84),
778 	UNIPHIER_PINCTRL_GROUP_SINGLE(port105, port_range0, 85),
779 	UNIPHIER_PINCTRL_GROUP_SINGLE(port106, port_range0, 86),
780 	UNIPHIER_PINCTRL_GROUP_SINGLE(port107, port_range0, 87),
781 	UNIPHIER_PINCTRL_GROUP_SINGLE(port110, port_range0, 88),
782 	UNIPHIER_PINCTRL_GROUP_SINGLE(port111, port_range0, 89),
783 	UNIPHIER_PINCTRL_GROUP_SINGLE(port112, port_range0, 90),
784 	UNIPHIER_PINCTRL_GROUP_SINGLE(port113, port_range0, 91),
785 	UNIPHIER_PINCTRL_GROUP_SINGLE(port114, port_range0, 92),
786 	UNIPHIER_PINCTRL_GROUP_SINGLE(port115, port_range0, 93),
787 	UNIPHIER_PINCTRL_GROUP_SINGLE(port116, port_range0, 94),
788 	UNIPHIER_PINCTRL_GROUP_SINGLE(port117, port_range0, 95),
789 	UNIPHIER_PINCTRL_GROUP_SINGLE(port120, port_range0, 96),
790 	UNIPHIER_PINCTRL_GROUP_SINGLE(port121, port_range0, 97),
791 	UNIPHIER_PINCTRL_GROUP_SINGLE(port122, port_range0, 98),
792 	UNIPHIER_PINCTRL_GROUP_SINGLE(port123, port_range0, 99),
793 	UNIPHIER_PINCTRL_GROUP_SINGLE(port124, port_range0, 100),
794 	UNIPHIER_PINCTRL_GROUP_SINGLE(port125, port_range0, 101),
795 	UNIPHIER_PINCTRL_GROUP_SINGLE(port126, port_range0, 102),
796 	UNIPHIER_PINCTRL_GROUP_SINGLE(port127, port_range0, 103),
797 	UNIPHIER_PINCTRL_GROUP_SINGLE(port130, port_range0, 104),
798 	UNIPHIER_PINCTRL_GROUP_SINGLE(port131, port_range0, 105),
799 	UNIPHIER_PINCTRL_GROUP_SINGLE(port132, port_range0, 106),
800 	UNIPHIER_PINCTRL_GROUP_SINGLE(port133, port_range0, 107),
801 	UNIPHIER_PINCTRL_GROUP_SINGLE(port134, port_range0, 108),
802 	UNIPHIER_PINCTRL_GROUP_SINGLE(port135, port_range0, 109),
803 	UNIPHIER_PINCTRL_GROUP_SINGLE(port136, port_range0, 110),
804 	UNIPHIER_PINCTRL_GROUP_SINGLE(port137, port_range0, 111),
805 	UNIPHIER_PINCTRL_GROUP_SINGLE(port140, port_range0, 112),
806 	UNIPHIER_PINCTRL_GROUP_SINGLE(port141, port_range0, 113),
807 	UNIPHIER_PINCTRL_GROUP_SINGLE(port142, port_range0, 114),
808 	UNIPHIER_PINCTRL_GROUP_SINGLE(port143, port_range0, 115),
809 	UNIPHIER_PINCTRL_GROUP_SINGLE(port144, port_range0, 116),
810 	UNIPHIER_PINCTRL_GROUP_SINGLE(port145, port_range0, 117),
811 	UNIPHIER_PINCTRL_GROUP_SINGLE(port146, port_range0, 118),
812 	UNIPHIER_PINCTRL_GROUP_SINGLE(port147, port_range0, 119),
813 	UNIPHIER_PINCTRL_GROUP_SINGLE(port165, port_range1, 0),
814 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq0, xirq_range0, 0),
815 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq1, xirq_range0, 1),
816 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq2, xirq_range0, 2),
817 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq3, xirq_range0, 3),
818 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq4, xirq_range0, 4),
819 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq5, xirq_range0, 5),
820 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq6, xirq_range0, 6),
821 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq7, xirq_range0, 7),
822 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq8, xirq_range0, 8),
823 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq9, xirq_range0, 9),
824 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq10, xirq_range0, 10),
825 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq11, xirq_range0, 11),
826 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq12, xirq_range0, 12),
827 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq14, xirq_range1, 0),
828 	UNIPHIER_PINCTRL_GROUP_SINGLE(xirq15, xirq_range1, 1),
829 };
830 
831 static const char * const emmc_groups[] = {"emmc", "emmc_dat8"};
832 static const char * const ether_mii_groups[] = {"ether_mii"};
833 static const char * const ether_rmii_groups[] = {"ether_rmii"};
834 static const char * const i2c0_groups[] = {"i2c0"};
835 static const char * const i2c1_groups[] = {"i2c1"};
836 static const char * const i2c2_groups[] = {"i2c2"};
837 static const char * const i2c3_groups[] = {"i2c3"};
838 static const char * const nand_groups[] = {"nand", "nand_cs1"};
839 static const char * const sd_groups[] = {"sd"};
840 static const char * const system_bus_groups[] = {"system_bus",
841 						 "system_bus_cs0",
842 						 "system_bus_cs1",
843 						 "system_bus_cs2",
844 						 "system_bus_cs3"};
845 static const char * const uart0_groups[] = {"uart0"};
846 static const char * const uart1_groups[] = {"uart1", "uart1b"};
847 static const char * const uart2_groups[] = {"uart2"};
848 static const char * const uart3_groups[] = {"uart3"};
849 static const char * const usb0_groups[] = {"usb0"};
850 static const char * const usb1_groups[] = {"usb1"};
851 static const char * const usb2_groups[] = {"usb2", "usb2b"};
852 static const char * const port_groups[] = {
853 	"port00",  "port01",  "port02",  "port03",
854 	"port04",  "port05",  "port06",  "port07",
855 	"port10",  "port11",  "port12",  "port13",
856 	"port14",  "port15",  "port16",  "port17",
857 	"port20",  "port21",  "port22",  "port23",
858 	"port24",  "port25",  "port26",  "port27",
859 	"port30",  "port31",  "port32",  "port33",
860 	"port34",  "port35",  "port36",  "port37",
861 	"port40",  "port41",  "port42",  "port43",
862 	"port44",  "port45",  "port46",  "port47",
863 	"port50",  "port51",  "port52",  "port53",
864 	"port54",  "port55",  "port56",  "port57",
865 	"port60",  "port61",  "port62",  "port63",
866 	"port64",  "port65",  "port66",  "port67",
867 	"port70",  "port71",  "port72",  "port73",
868 	"port74",  "port75",  "port76",  "port77",
869 	"port80",  "port81",  "port82",  "port83",
870 	"port84",  "port85",  "port86",  "port87",
871 	"port90",  "port91",  "port92",  "port93",
872 	"port94",  "port95",  "port96",  "port97",
873 	"port100", "port101", "port102", "port103",
874 	"port104", "port105", "port106", "port107",
875 	"port110", "port111", "port112", "port113",
876 	"port114", "port115", "port116", "port117",
877 	"port120", "port121", "port122", "port123",
878 	"port124", "port125", "port126", "port127",
879 	"port130", "port131", "port132", "port133",
880 	"port134", "port135", "port136", "port137",
881 	"port140", "port141", "port142", "port143",
882 	"port144", "port145", "port146", "port147",
883 	/* port150-164 missing */
884 	/* none */ "port165",
885 };
886 static const char * const xirq_groups[] = {
887 	"xirq0",  "xirq1",  "xirq2",  "xirq3",
888 	"xirq4",  "xirq5",  "xirq6",  "xirq7",
889 	"xirq8",  "xirq9",  "xirq10", "xirq11",
890 	"xirq12", /* none*/ "xirq14", "xirq15",
891 };
892 
893 static const struct uniphier_pinmux_function uniphier_ld4_functions[] = {
894 	UNIPHIER_PINMUX_FUNCTION(emmc),
895 	UNIPHIER_PINMUX_FUNCTION(ether_mii),
896 	UNIPHIER_PINMUX_FUNCTION(ether_rmii),
897 	UNIPHIER_PINMUX_FUNCTION(i2c0),
898 	UNIPHIER_PINMUX_FUNCTION(i2c1),
899 	UNIPHIER_PINMUX_FUNCTION(i2c2),
900 	UNIPHIER_PINMUX_FUNCTION(i2c3),
901 	UNIPHIER_PINMUX_FUNCTION(nand),
902 	UNIPHIER_PINMUX_FUNCTION(sd),
903 	UNIPHIER_PINMUX_FUNCTION(system_bus),
904 	UNIPHIER_PINMUX_FUNCTION(uart0),
905 	UNIPHIER_PINMUX_FUNCTION(uart1),
906 	UNIPHIER_PINMUX_FUNCTION(uart2),
907 	UNIPHIER_PINMUX_FUNCTION(uart3),
908 	UNIPHIER_PINMUX_FUNCTION(usb0),
909 	UNIPHIER_PINMUX_FUNCTION(usb1),
910 	UNIPHIER_PINMUX_FUNCTION(usb2),
911 	UNIPHIER_PINMUX_FUNCTION(port),
912 	UNIPHIER_PINMUX_FUNCTION(xirq),
913 };
914 
915 static struct uniphier_pinctrl_socdata uniphier_ld4_pindata = {
916 	.pins = uniphier_ld4_pins,
917 	.npins = ARRAY_SIZE(uniphier_ld4_pins),
918 	.groups = uniphier_ld4_groups,
919 	.groups_count = ARRAY_SIZE(uniphier_ld4_groups),
920 	.functions = uniphier_ld4_functions,
921 	.functions_count = ARRAY_SIZE(uniphier_ld4_functions),
922 	.caps = 0,
923 };
924 
925 static int uniphier_ld4_pinctrl_probe(struct platform_device *pdev)
926 {
927 	return uniphier_pinctrl_probe(pdev, &uniphier_ld4_pindata);
928 }
929 
930 static const struct of_device_id uniphier_ld4_pinctrl_match[] = {
931 	{ .compatible = "socionext,uniphier-ld4-pinctrl" },
932 	{ .compatible = "socionext,ph1-ld4-pinctrl" },
933 	{ /* sentinel */ }
934 };
935 MODULE_DEVICE_TABLE(of, uniphier_ld4_pinctrl_match);
936 
937 static struct platform_driver uniphier_ld4_pinctrl_driver = {
938 	.probe = uniphier_ld4_pinctrl_probe,
939 	.driver = {
940 		.name = "uniphier-ld4-pinctrl",
941 		.of_match_table = uniphier_ld4_pinctrl_match,
942 	},
943 };
944 module_platform_driver(uniphier_ld4_pinctrl_driver);
945 
946 MODULE_AUTHOR("Masahiro Yamada <yamada.masahiro@socionext.com>");
947 MODULE_DESCRIPTION("UniPhier PH1-LD4 pinctrl driver");
948 MODULE_LICENSE("GPL");
949