1 /*
2  * Copyright (C) 2015-2017 Socionext Inc.
3  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
15 
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/mod_devicetable.h>
19 #include <linux/pinctrl/pinctrl.h>
20 #include <linux/platform_device.h>
21 
22 #include "pinctrl-uniphier.h"
23 
24 static const struct pinctrl_pin_desc uniphier_ld4_pins[] = {
25 	UNIPHIER_PINCTRL_PIN(0, "EA1", UNIPHIER_PIN_IECTRL_NONE,
26 			     8, UNIPHIER_PIN_DRV_1BIT,
27 			     8, UNIPHIER_PIN_PULL_DOWN),
28 	UNIPHIER_PINCTRL_PIN(1, "EA2", UNIPHIER_PIN_IECTRL_NONE,
29 			     9, UNIPHIER_PIN_DRV_1BIT,
30 			     9, UNIPHIER_PIN_PULL_DOWN),
31 	UNIPHIER_PINCTRL_PIN(2, "EA3", UNIPHIER_PIN_IECTRL_NONE,
32 			     10, UNIPHIER_PIN_DRV_1BIT,
33 			     10, UNIPHIER_PIN_PULL_DOWN),
34 	UNIPHIER_PINCTRL_PIN(3, "EA4", UNIPHIER_PIN_IECTRL_NONE,
35 			     11, UNIPHIER_PIN_DRV_1BIT,
36 			     11, UNIPHIER_PIN_PULL_DOWN),
37 	UNIPHIER_PINCTRL_PIN(4, "EA5", UNIPHIER_PIN_IECTRL_NONE,
38 			     12, UNIPHIER_PIN_DRV_1BIT,
39 			     12, UNIPHIER_PIN_PULL_DOWN),
40 	UNIPHIER_PINCTRL_PIN(5, "EA6", UNIPHIER_PIN_IECTRL_NONE,
41 			     13, UNIPHIER_PIN_DRV_1BIT,
42 			     13, UNIPHIER_PIN_PULL_DOWN),
43 	UNIPHIER_PINCTRL_PIN(6, "EA7", UNIPHIER_PIN_IECTRL_NONE,
44 			     14, UNIPHIER_PIN_DRV_1BIT,
45 			     14, UNIPHIER_PIN_PULL_DOWN),
46 	UNIPHIER_PINCTRL_PIN(7, "EA8", 0,
47 			     15, UNIPHIER_PIN_DRV_1BIT,
48 			     15, UNIPHIER_PIN_PULL_DOWN),
49 	UNIPHIER_PINCTRL_PIN(8, "EA9", 0,
50 			     16, UNIPHIER_PIN_DRV_1BIT,
51 			     16, UNIPHIER_PIN_PULL_DOWN),
52 	UNIPHIER_PINCTRL_PIN(9, "EA10", 0,
53 			     17, UNIPHIER_PIN_DRV_1BIT,
54 			     17, UNIPHIER_PIN_PULL_DOWN),
55 	UNIPHIER_PINCTRL_PIN(10, "EA11", 0,
56 			     18, UNIPHIER_PIN_DRV_1BIT,
57 			     18, UNIPHIER_PIN_PULL_DOWN),
58 	UNIPHIER_PINCTRL_PIN(11, "EA12", 0,
59 			     19, UNIPHIER_PIN_DRV_1BIT,
60 			     19, UNIPHIER_PIN_PULL_DOWN),
61 	UNIPHIER_PINCTRL_PIN(12, "EA13", 0,
62 			     20, UNIPHIER_PIN_DRV_1BIT,
63 			     20, UNIPHIER_PIN_PULL_DOWN),
64 	UNIPHIER_PINCTRL_PIN(13, "EA14", 0,
65 			     21, UNIPHIER_PIN_DRV_1BIT,
66 			     21, UNIPHIER_PIN_PULL_DOWN),
67 	UNIPHIER_PINCTRL_PIN(14, "EA15", 0,
68 			     22, UNIPHIER_PIN_DRV_1BIT,
69 			     22, UNIPHIER_PIN_PULL_DOWN),
70 	UNIPHIER_PINCTRL_PIN(15, "ECLK", UNIPHIER_PIN_IECTRL_NONE,
71 			     23, UNIPHIER_PIN_DRV_1BIT,
72 			     23, UNIPHIER_PIN_PULL_DOWN),
73 	UNIPHIER_PINCTRL_PIN(16, "XERWE0", UNIPHIER_PIN_IECTRL_NONE,
74 			     24, UNIPHIER_PIN_DRV_1BIT,
75 			     24, UNIPHIER_PIN_PULL_UP),
76 	UNIPHIER_PINCTRL_PIN(17, "XERWE1", UNIPHIER_PIN_IECTRL_NONE,
77 			     25, UNIPHIER_PIN_DRV_1BIT,
78 			     25, UNIPHIER_PIN_PULL_UP),
79 	UNIPHIER_PINCTRL_PIN(18, "ES0", UNIPHIER_PIN_IECTRL_NONE,
80 			     27, UNIPHIER_PIN_DRV_1BIT,
81 			     27, UNIPHIER_PIN_PULL_UP),
82 	UNIPHIER_PINCTRL_PIN(19, "ES1", UNIPHIER_PIN_IECTRL_NONE,
83 			     28, UNIPHIER_PIN_DRV_1BIT,
84 			     28, UNIPHIER_PIN_PULL_UP),
85 	UNIPHIER_PINCTRL_PIN(20, "ES2", UNIPHIER_PIN_IECTRL_NONE,
86 			     29, UNIPHIER_PIN_DRV_1BIT,
87 			     29, UNIPHIER_PIN_PULL_UP),
88 	UNIPHIER_PINCTRL_PIN(21, "XERST", UNIPHIER_PIN_IECTRL_NONE,
89 			     38, UNIPHIER_PIN_DRV_1BIT,
90 			     38, UNIPHIER_PIN_PULL_UP),
91 	UNIPHIER_PINCTRL_PIN(22, "MMCCLK", UNIPHIER_PIN_IECTRL_NONE,
92 			     0, UNIPHIER_PIN_DRV_2BIT,
93 			     146, UNIPHIER_PIN_PULL_UP),
94 	UNIPHIER_PINCTRL_PIN(23, "MMCCMD", UNIPHIER_PIN_IECTRL_NONE,
95 			     1, UNIPHIER_PIN_DRV_2BIT,
96 			     147, UNIPHIER_PIN_PULL_UP),
97 	UNIPHIER_PINCTRL_PIN(24, "MMCDAT0", UNIPHIER_PIN_IECTRL_NONE,
98 			     2, UNIPHIER_PIN_DRV_2BIT,
99 			     148, UNIPHIER_PIN_PULL_UP),
100 	UNIPHIER_PINCTRL_PIN(25, "MMCDAT1", UNIPHIER_PIN_IECTRL_NONE,
101 			     3, UNIPHIER_PIN_DRV_2BIT,
102 			     149, UNIPHIER_PIN_PULL_UP),
103 	UNIPHIER_PINCTRL_PIN(26, "MMCDAT2", UNIPHIER_PIN_IECTRL_NONE,
104 			     4, UNIPHIER_PIN_DRV_2BIT,
105 			     150, UNIPHIER_PIN_PULL_UP),
106 	UNIPHIER_PINCTRL_PIN(27, "MMCDAT3", UNIPHIER_PIN_IECTRL_NONE,
107 			     5, UNIPHIER_PIN_DRV_2BIT,
108 			     151, UNIPHIER_PIN_PULL_UP),
109 	UNIPHIER_PINCTRL_PIN(28, "MMCDAT4", UNIPHIER_PIN_IECTRL_NONE,
110 			     6, UNIPHIER_PIN_DRV_2BIT,
111 			     152, UNIPHIER_PIN_PULL_UP),
112 	UNIPHIER_PINCTRL_PIN(29, "MMCDAT5", UNIPHIER_PIN_IECTRL_NONE,
113 			     7, UNIPHIER_PIN_DRV_2BIT,
114 			     153, UNIPHIER_PIN_PULL_UP),
115 	UNIPHIER_PINCTRL_PIN(30, "MMCDAT6", UNIPHIER_PIN_IECTRL_NONE,
116 			     8, UNIPHIER_PIN_DRV_2BIT,
117 			     154, UNIPHIER_PIN_PULL_UP),
118 	UNIPHIER_PINCTRL_PIN(31, "MMCDAT7", UNIPHIER_PIN_IECTRL_NONE,
119 			     9, UNIPHIER_PIN_DRV_2BIT,
120 			     155, UNIPHIER_PIN_PULL_UP),
121 	UNIPHIER_PINCTRL_PIN(32, "RMII_RXD0", 6,
122 			     39, UNIPHIER_PIN_DRV_1BIT,
123 			     39, UNIPHIER_PIN_PULL_DOWN),
124 	UNIPHIER_PINCTRL_PIN(33, "RMII_RXD1", 6,
125 			     40, UNIPHIER_PIN_DRV_1BIT,
126 			     40, UNIPHIER_PIN_PULL_DOWN),
127 	UNIPHIER_PINCTRL_PIN(34, "RMII_CRS_DV", 6,
128 			     41, UNIPHIER_PIN_DRV_1BIT,
129 			     41, UNIPHIER_PIN_PULL_DOWN),
130 	UNIPHIER_PINCTRL_PIN(35, "RMII_RXER", 6,
131 			     42, UNIPHIER_PIN_DRV_1BIT,
132 			     42, UNIPHIER_PIN_PULL_DOWN),
133 	UNIPHIER_PINCTRL_PIN(36, "RMII_REFCLK", 6,
134 			     43, UNIPHIER_PIN_DRV_1BIT,
135 			     43, UNIPHIER_PIN_PULL_DOWN),
136 	UNIPHIER_PINCTRL_PIN(37, "RMII_TXD0", 6,
137 			     44, UNIPHIER_PIN_DRV_1BIT,
138 			     44, UNIPHIER_PIN_PULL_DOWN),
139 	UNIPHIER_PINCTRL_PIN(38, "RMII_TXD1", 6,
140 			     45, UNIPHIER_PIN_DRV_1BIT,
141 			     45, UNIPHIER_PIN_PULL_DOWN),
142 	UNIPHIER_PINCTRL_PIN(39, "RMII_TXEN", 6,
143 			     46, UNIPHIER_PIN_DRV_1BIT,
144 			     46, UNIPHIER_PIN_PULL_DOWN),
145 	UNIPHIER_PINCTRL_PIN(40, "MDC", 6,
146 			     47, UNIPHIER_PIN_DRV_1BIT,
147 			     47, UNIPHIER_PIN_PULL_DOWN),
148 	UNIPHIER_PINCTRL_PIN(41, "MDIO", 6,
149 			     48, UNIPHIER_PIN_DRV_1BIT,
150 			     48, UNIPHIER_PIN_PULL_DOWN),
151 	UNIPHIER_PINCTRL_PIN(42, "MDIO_INTL", 6,
152 			     49, UNIPHIER_PIN_DRV_1BIT,
153 			     49, UNIPHIER_PIN_PULL_DOWN),
154 	UNIPHIER_PINCTRL_PIN(43, "PHYRSTL", 6,
155 			     50, UNIPHIER_PIN_DRV_1BIT,
156 			     50, UNIPHIER_PIN_PULL_DOWN),
157 	UNIPHIER_PINCTRL_PIN(44, "SDCLK", UNIPHIER_PIN_IECTRL_NONE,
158 			     10, UNIPHIER_PIN_DRV_2BIT,
159 			     156, UNIPHIER_PIN_PULL_UP),
160 	UNIPHIER_PINCTRL_PIN(45, "SDCMD", UNIPHIER_PIN_IECTRL_NONE,
161 			     11, UNIPHIER_PIN_DRV_2BIT,
162 			     157, UNIPHIER_PIN_PULL_UP),
163 	UNIPHIER_PINCTRL_PIN(46, "SDDAT0", UNIPHIER_PIN_IECTRL_NONE,
164 			     12, UNIPHIER_PIN_DRV_2BIT,
165 			     158, UNIPHIER_PIN_PULL_UP),
166 	UNIPHIER_PINCTRL_PIN(47, "SDDAT1", UNIPHIER_PIN_IECTRL_NONE,
167 			     13, UNIPHIER_PIN_DRV_2BIT,
168 			     159, UNIPHIER_PIN_PULL_UP),
169 	UNIPHIER_PINCTRL_PIN(48, "SDDAT2", UNIPHIER_PIN_IECTRL_NONE,
170 			     14, UNIPHIER_PIN_DRV_2BIT,
171 			     160, UNIPHIER_PIN_PULL_UP),
172 	UNIPHIER_PINCTRL_PIN(49, "SDDAT3", UNIPHIER_PIN_IECTRL_NONE,
173 			     15, UNIPHIER_PIN_DRV_2BIT,
174 			     161, UNIPHIER_PIN_PULL_UP),
175 	UNIPHIER_PINCTRL_PIN(50, "SDCD", UNIPHIER_PIN_IECTRL_NONE,
176 			     51, UNIPHIER_PIN_DRV_1BIT,
177 			     51, UNIPHIER_PIN_PULL_UP),
178 	UNIPHIER_PINCTRL_PIN(51, "SDWP", UNIPHIER_PIN_IECTRL_NONE,
179 			     52, UNIPHIER_PIN_DRV_1BIT,
180 			     52, UNIPHIER_PIN_PULL_UP),
181 	UNIPHIER_PINCTRL_PIN(52, "SDVOLC", UNIPHIER_PIN_IECTRL_NONE,
182 			     53, UNIPHIER_PIN_DRV_1BIT,
183 			     53, UNIPHIER_PIN_PULL_UP),
184 	UNIPHIER_PINCTRL_PIN(53, "USB0VBUS", 0,
185 			     54, UNIPHIER_PIN_DRV_1BIT,
186 			     54, UNIPHIER_PIN_PULL_DOWN),
187 	UNIPHIER_PINCTRL_PIN(54, "USB0OD", 0,
188 			     55, UNIPHIER_PIN_DRV_1BIT,
189 			     55, UNIPHIER_PIN_PULL_DOWN),
190 	UNIPHIER_PINCTRL_PIN(55, "USB1VBUS", 0,
191 			     56, UNIPHIER_PIN_DRV_1BIT,
192 			     56, UNIPHIER_PIN_PULL_DOWN),
193 	UNIPHIER_PINCTRL_PIN(56, "USB1OD", 0,
194 			     57, UNIPHIER_PIN_DRV_1BIT,
195 			     57, UNIPHIER_PIN_PULL_DOWN),
196 	UNIPHIER_PINCTRL_PIN(57, "PCRESET", 0,
197 			     58, UNIPHIER_PIN_DRV_1BIT,
198 			     58, UNIPHIER_PIN_PULL_DOWN),
199 	UNIPHIER_PINCTRL_PIN(58, "PCREG", 0,
200 			     59, UNIPHIER_PIN_DRV_1BIT,
201 			     59, UNIPHIER_PIN_PULL_DOWN),
202 	UNIPHIER_PINCTRL_PIN(59, "PCCE2", 0,
203 			     60, UNIPHIER_PIN_DRV_1BIT,
204 			     60, UNIPHIER_PIN_PULL_DOWN),
205 	UNIPHIER_PINCTRL_PIN(60, "PCVS1", 0,
206 			     61, UNIPHIER_PIN_DRV_1BIT,
207 			     61, UNIPHIER_PIN_PULL_DOWN),
208 	UNIPHIER_PINCTRL_PIN(61, "PCCD2", 0,
209 			     62, UNIPHIER_PIN_DRV_1BIT,
210 			     62, UNIPHIER_PIN_PULL_DOWN),
211 	UNIPHIER_PINCTRL_PIN(62, "PCCD1", 0,
212 			     63, UNIPHIER_PIN_DRV_1BIT,
213 			     63, UNIPHIER_PIN_PULL_DOWN),
214 	UNIPHIER_PINCTRL_PIN(63, "PCREADY", 0,
215 			     64, UNIPHIER_PIN_DRV_1BIT,
216 			     64, UNIPHIER_PIN_PULL_DOWN),
217 	UNIPHIER_PINCTRL_PIN(64, "PCDOE", 0,
218 			     65, UNIPHIER_PIN_DRV_1BIT,
219 			     65, UNIPHIER_PIN_PULL_DOWN),
220 	UNIPHIER_PINCTRL_PIN(65, "PCCE1", 0,
221 			     66, UNIPHIER_PIN_DRV_1BIT,
222 			     66, UNIPHIER_PIN_PULL_DOWN),
223 	UNIPHIER_PINCTRL_PIN(66, "PCWE", 0,
224 			     67, UNIPHIER_PIN_DRV_1BIT,
225 			     67, UNIPHIER_PIN_PULL_DOWN),
226 	UNIPHIER_PINCTRL_PIN(67, "PCOE", 0,
227 			     68, UNIPHIER_PIN_DRV_1BIT,
228 			     68, UNIPHIER_PIN_PULL_DOWN),
229 	UNIPHIER_PINCTRL_PIN(68, "PCWAIT", 0,
230 			     69, UNIPHIER_PIN_DRV_1BIT,
231 			     69, UNIPHIER_PIN_PULL_DOWN),
232 	UNIPHIER_PINCTRL_PIN(69, "PCIOWR", 0,
233 			     70, UNIPHIER_PIN_DRV_1BIT,
234 			     70, UNIPHIER_PIN_PULL_DOWN),
235 	UNIPHIER_PINCTRL_PIN(70, "PCIORD", 0,
236 			     71, UNIPHIER_PIN_DRV_1BIT,
237 			     71, UNIPHIER_PIN_PULL_DOWN),
238 	UNIPHIER_PINCTRL_PIN(71, "HS0DIN0", 0,
239 			     72, UNIPHIER_PIN_DRV_1BIT,
240 			     72, UNIPHIER_PIN_PULL_DOWN),
241 	UNIPHIER_PINCTRL_PIN(72, "HS0DIN1", 0,
242 			     73, UNIPHIER_PIN_DRV_1BIT,
243 			     73, UNIPHIER_PIN_PULL_DOWN),
244 	UNIPHIER_PINCTRL_PIN(73, "HS0DIN2", 0,
245 			     74, UNIPHIER_PIN_DRV_1BIT,
246 			     74, UNIPHIER_PIN_PULL_DOWN),
247 	UNIPHIER_PINCTRL_PIN(74, "HS0DIN3", 0,
248 			     75, UNIPHIER_PIN_DRV_1BIT,
249 			     75, UNIPHIER_PIN_PULL_DOWN),
250 	UNIPHIER_PINCTRL_PIN(75, "HS0DIN4", 0,
251 			     76, UNIPHIER_PIN_DRV_1BIT,
252 			     76, UNIPHIER_PIN_PULL_DOWN),
253 	UNIPHIER_PINCTRL_PIN(76, "HS0DIN5", 0,
254 			     77, UNIPHIER_PIN_DRV_1BIT,
255 			     77, UNIPHIER_PIN_PULL_DOWN),
256 	UNIPHIER_PINCTRL_PIN(77, "HS0DIN6", 0,
257 			     78, UNIPHIER_PIN_DRV_1BIT,
258 			     78, UNIPHIER_PIN_PULL_DOWN),
259 	UNIPHIER_PINCTRL_PIN(78, "HS0DIN7", 0,
260 			     79, UNIPHIER_PIN_DRV_1BIT,
261 			     79, UNIPHIER_PIN_PULL_DOWN),
262 	UNIPHIER_PINCTRL_PIN(79, "HS0BCLKIN", 0,
263 			     80, UNIPHIER_PIN_DRV_1BIT,
264 			     80, UNIPHIER_PIN_PULL_DOWN),
265 	UNIPHIER_PINCTRL_PIN(80, "HS0VALIN", 0,
266 			     81, UNIPHIER_PIN_DRV_1BIT,
267 			     81, UNIPHIER_PIN_PULL_DOWN),
268 	UNIPHIER_PINCTRL_PIN(81, "HS0SYNCIN", 0,
269 			     82, UNIPHIER_PIN_DRV_1BIT,
270 			     82, UNIPHIER_PIN_PULL_DOWN),
271 	UNIPHIER_PINCTRL_PIN(82, "HSDOUT0", 0,
272 			     83, UNIPHIER_PIN_DRV_1BIT,
273 			     83, UNIPHIER_PIN_PULL_DOWN),
274 	UNIPHIER_PINCTRL_PIN(83, "HSDOUT1", 0,
275 			     84, UNIPHIER_PIN_DRV_1BIT,
276 			     84, UNIPHIER_PIN_PULL_DOWN),
277 	UNIPHIER_PINCTRL_PIN(84, "HSDOUT2", 0,
278 			     85, UNIPHIER_PIN_DRV_1BIT,
279 			     85, UNIPHIER_PIN_PULL_DOWN),
280 	UNIPHIER_PINCTRL_PIN(85, "HSDOUT3", 0,
281 			     86, UNIPHIER_PIN_DRV_1BIT,
282 			     86, UNIPHIER_PIN_PULL_DOWN),
283 	UNIPHIER_PINCTRL_PIN(86, "HSDOUT4", 0,
284 			     87, UNIPHIER_PIN_DRV_1BIT,
285 			     87, UNIPHIER_PIN_PULL_DOWN),
286 	UNIPHIER_PINCTRL_PIN(87, "HSDOUT5", 0,
287 			     88, UNIPHIER_PIN_DRV_1BIT,
288 			     88, UNIPHIER_PIN_PULL_DOWN),
289 	UNIPHIER_PINCTRL_PIN(88, "HSDOUT6", 0,
290 			     89, UNIPHIER_PIN_DRV_1BIT,
291 			     89, UNIPHIER_PIN_PULL_DOWN),
292 	UNIPHIER_PINCTRL_PIN(89, "HSDOUT7", 0,
293 			     90, UNIPHIER_PIN_DRV_1BIT,
294 			     90, UNIPHIER_PIN_PULL_DOWN),
295 	UNIPHIER_PINCTRL_PIN(90, "HSBCLKOUT", 0,
296 			     91, UNIPHIER_PIN_DRV_1BIT,
297 			     91, UNIPHIER_PIN_PULL_DOWN),
298 	UNIPHIER_PINCTRL_PIN(91, "HSVALOUT", 0,
299 			     92, UNIPHIER_PIN_DRV_1BIT,
300 			     92, UNIPHIER_PIN_PULL_DOWN),
301 	UNIPHIER_PINCTRL_PIN(92, "HSSYNCOUT", 0,
302 			     93, UNIPHIER_PIN_DRV_1BIT,
303 			     93, UNIPHIER_PIN_PULL_DOWN),
304 	UNIPHIER_PINCTRL_PIN(93, "AGCI", 3,
305 			     -1, UNIPHIER_PIN_DRV_FIXED4,
306 			     162, UNIPHIER_PIN_PULL_DOWN),
307 	UNIPHIER_PINCTRL_PIN(94, "AGCR", 4,
308 			     -1, UNIPHIER_PIN_DRV_FIXED4,
309 			     163, UNIPHIER_PIN_PULL_DOWN),
310 	UNIPHIER_PINCTRL_PIN(95, "AGCBS", 5,
311 			     -1, UNIPHIER_PIN_DRV_FIXED4,
312 			     164, UNIPHIER_PIN_PULL_DOWN),
313 	UNIPHIER_PINCTRL_PIN(96, "IECOUT", 0,
314 			     94, UNIPHIER_PIN_DRV_1BIT,
315 			     94, UNIPHIER_PIN_PULL_DOWN),
316 	UNIPHIER_PINCTRL_PIN(97, "ASMCK", 0,
317 			     95, UNIPHIER_PIN_DRV_1BIT,
318 			     95, UNIPHIER_PIN_PULL_DOWN),
319 	UNIPHIER_PINCTRL_PIN(98, "ABCKO", UNIPHIER_PIN_IECTRL_NONE,
320 			     96, UNIPHIER_PIN_DRV_1BIT,
321 			     96, UNIPHIER_PIN_PULL_DOWN),
322 	UNIPHIER_PINCTRL_PIN(99, "ALRCKO", UNIPHIER_PIN_IECTRL_NONE,
323 			     97, UNIPHIER_PIN_DRV_1BIT,
324 			     97, UNIPHIER_PIN_PULL_DOWN),
325 	UNIPHIER_PINCTRL_PIN(100, "ASDOUT0", UNIPHIER_PIN_IECTRL_NONE,
326 			     98, UNIPHIER_PIN_DRV_1BIT,
327 			     98, UNIPHIER_PIN_PULL_DOWN),
328 	UNIPHIER_PINCTRL_PIN(101, "ARCOUT", 0,
329 			     99, UNIPHIER_PIN_DRV_1BIT,
330 			     99, UNIPHIER_PIN_PULL_DOWN),
331 	UNIPHIER_PINCTRL_PIN(102, "SDA0", UNIPHIER_PIN_IECTRL_NONE,
332 			     -1, UNIPHIER_PIN_DRV_FIXED4,
333 			     -1, UNIPHIER_PIN_PULL_NONE),
334 	UNIPHIER_PINCTRL_PIN(103, "SCL0", UNIPHIER_PIN_IECTRL_NONE,
335 			     -1, UNIPHIER_PIN_DRV_FIXED4,
336 			     -1, UNIPHIER_PIN_PULL_NONE),
337 	UNIPHIER_PINCTRL_PIN(104, "SDA1", UNIPHIER_PIN_IECTRL_NONE,
338 			     -1, UNIPHIER_PIN_DRV_FIXED4,
339 			     -1, UNIPHIER_PIN_PULL_NONE),
340 	UNIPHIER_PINCTRL_PIN(105, "SCL1", UNIPHIER_PIN_IECTRL_NONE,
341 			     -1, UNIPHIER_PIN_DRV_FIXED4,
342 			     -1, UNIPHIER_PIN_PULL_NONE),
343 	UNIPHIER_PINCTRL_PIN(106, "DMDSDA0", UNIPHIER_PIN_IECTRL_NONE,
344 			     -1, UNIPHIER_PIN_DRV_FIXED4,
345 			     -1, UNIPHIER_PIN_PULL_NONE),
346 	UNIPHIER_PINCTRL_PIN(107, "DMDSCL0", UNIPHIER_PIN_IECTRL_NONE,
347 			     -1, UNIPHIER_PIN_DRV_FIXED4,
348 			     -1, UNIPHIER_PIN_PULL_NONE),
349 	UNIPHIER_PINCTRL_PIN(108, "DMDSDA1", UNIPHIER_PIN_IECTRL_NONE,
350 			     -1, UNIPHIER_PIN_DRV_FIXED4,
351 			     -1, UNIPHIER_PIN_PULL_NONE),
352 	UNIPHIER_PINCTRL_PIN(109, "DMDSCL1", UNIPHIER_PIN_IECTRL_NONE,
353 			     -1, UNIPHIER_PIN_DRV_FIXED4,
354 			     -1, UNIPHIER_PIN_PULL_NONE),
355 	UNIPHIER_PINCTRL_PIN(110, "SBO0", UNIPHIER_PIN_IECTRL_NONE,
356 			     100, UNIPHIER_PIN_DRV_1BIT,
357 			     100, UNIPHIER_PIN_PULL_UP),
358 	UNIPHIER_PINCTRL_PIN(111, "SBI0", UNIPHIER_PIN_IECTRL_NONE,
359 			     101, UNIPHIER_PIN_DRV_1BIT,
360 			     101, UNIPHIER_PIN_PULL_UP),
361 	UNIPHIER_PINCTRL_PIN(112, "HIN", 1,
362 			     -1, UNIPHIER_PIN_DRV_FIXED5,
363 			     -1, UNIPHIER_PIN_PULL_NONE),
364 	UNIPHIER_PINCTRL_PIN(113, "VIN", 2,
365 			     -1, UNIPHIER_PIN_DRV_FIXED5,
366 			     -1, UNIPHIER_PIN_PULL_NONE),
367 	UNIPHIER_PINCTRL_PIN(114, "TCON0", UNIPHIER_PIN_IECTRL_NONE,
368 			     102, UNIPHIER_PIN_DRV_1BIT,
369 			     102, UNIPHIER_PIN_PULL_DOWN),
370 	UNIPHIER_PINCTRL_PIN(115, "TCON1", UNIPHIER_PIN_IECTRL_NONE,
371 			     103, UNIPHIER_PIN_DRV_1BIT,
372 			     103, UNIPHIER_PIN_PULL_DOWN),
373 	UNIPHIER_PINCTRL_PIN(116, "TCON2", UNIPHIER_PIN_IECTRL_NONE,
374 			     104, UNIPHIER_PIN_DRV_1BIT,
375 			     104, UNIPHIER_PIN_PULL_DOWN),
376 	UNIPHIER_PINCTRL_PIN(117, "TCON3", UNIPHIER_PIN_IECTRL_NONE,
377 			     105, UNIPHIER_PIN_DRV_1BIT,
378 			     105, UNIPHIER_PIN_PULL_DOWN),
379 	UNIPHIER_PINCTRL_PIN(118, "TCON4", UNIPHIER_PIN_IECTRL_NONE,
380 			     106, UNIPHIER_PIN_DRV_1BIT,
381 			     106, UNIPHIER_PIN_PULL_DOWN),
382 	UNIPHIER_PINCTRL_PIN(119, "TCON5", UNIPHIER_PIN_IECTRL_NONE,
383 			     107, UNIPHIER_PIN_DRV_1BIT,
384 			     107, UNIPHIER_PIN_PULL_DOWN),
385 	UNIPHIER_PINCTRL_PIN(120, "TCON6", 0,
386 			     108, UNIPHIER_PIN_DRV_1BIT,
387 			     108, UNIPHIER_PIN_PULL_DOWN),
388 	UNIPHIER_PINCTRL_PIN(121, "TCON7", 0,
389 			     109, UNIPHIER_PIN_DRV_1BIT,
390 			     109, UNIPHIER_PIN_PULL_DOWN),
391 	UNIPHIER_PINCTRL_PIN(122, "PWMA", 0,
392 			     110, UNIPHIER_PIN_DRV_1BIT,
393 			     110, UNIPHIER_PIN_PULL_DOWN),
394 	UNIPHIER_PINCTRL_PIN(123, "XIRQ1", 0,
395 			     111, UNIPHIER_PIN_DRV_1BIT,
396 			     111, UNIPHIER_PIN_PULL_DOWN),
397 	UNIPHIER_PINCTRL_PIN(124, "XIRQ2", 0,
398 			     112, UNIPHIER_PIN_DRV_1BIT,
399 			     112, UNIPHIER_PIN_PULL_DOWN),
400 	UNIPHIER_PINCTRL_PIN(125, "XIRQ3", 0,
401 			     113, UNIPHIER_PIN_DRV_1BIT,
402 			     113, UNIPHIER_PIN_PULL_DOWN),
403 	UNIPHIER_PINCTRL_PIN(126, "XIRQ4", 0,
404 			     114, UNIPHIER_PIN_DRV_1BIT,
405 			     114, UNIPHIER_PIN_PULL_DOWN),
406 	UNIPHIER_PINCTRL_PIN(127, "XIRQ5", 0,
407 			     115, UNIPHIER_PIN_DRV_1BIT,
408 			     115, UNIPHIER_PIN_PULL_DOWN),
409 	UNIPHIER_PINCTRL_PIN(128, "XIRQ6", 0,
410 			     116, UNIPHIER_PIN_DRV_1BIT,
411 			     116, UNIPHIER_PIN_PULL_DOWN),
412 	UNIPHIER_PINCTRL_PIN(129, "XIRQ7", 0,
413 			     117, UNIPHIER_PIN_DRV_1BIT,
414 			     117, UNIPHIER_PIN_PULL_DOWN),
415 	UNIPHIER_PINCTRL_PIN(130, "XIRQ8", 0,
416 			     118, UNIPHIER_PIN_DRV_1BIT,
417 			     118, UNIPHIER_PIN_PULL_DOWN),
418 	UNIPHIER_PINCTRL_PIN(131, "XIRQ9", 0,
419 			     119, UNIPHIER_PIN_DRV_1BIT,
420 			     119, UNIPHIER_PIN_PULL_DOWN),
421 	UNIPHIER_PINCTRL_PIN(132, "XIRQ10", 0,
422 			     120, UNIPHIER_PIN_DRV_1BIT,
423 			     120, UNIPHIER_PIN_PULL_DOWN),
424 	UNIPHIER_PINCTRL_PIN(133, "XIRQ11", 0,
425 			     121, UNIPHIER_PIN_DRV_1BIT,
426 			     121, UNIPHIER_PIN_PULL_DOWN),
427 	UNIPHIER_PINCTRL_PIN(134, "XIRQ14", 0,
428 			     122, UNIPHIER_PIN_DRV_1BIT,
429 			     122, UNIPHIER_PIN_PULL_DOWN),
430 	UNIPHIER_PINCTRL_PIN(135, "PORT00", 0,
431 			     123, UNIPHIER_PIN_DRV_1BIT,
432 			     123, UNIPHIER_PIN_PULL_DOWN),
433 	UNIPHIER_PINCTRL_PIN(136, "PORT01", 0,
434 			     124, UNIPHIER_PIN_DRV_1BIT,
435 			     124, UNIPHIER_PIN_PULL_DOWN),
436 	UNIPHIER_PINCTRL_PIN(137, "PORT02", 0,
437 			     125, UNIPHIER_PIN_DRV_1BIT,
438 			     125, UNIPHIER_PIN_PULL_DOWN),
439 	UNIPHIER_PINCTRL_PIN(138, "PORT03", 0,
440 			     126, UNIPHIER_PIN_DRV_1BIT,
441 			     126, UNIPHIER_PIN_PULL_DOWN),
442 	UNIPHIER_PINCTRL_PIN(139, "PORT04", 0,
443 			     127, UNIPHIER_PIN_DRV_1BIT,
444 			     127, UNIPHIER_PIN_PULL_DOWN),
445 	UNIPHIER_PINCTRL_PIN(140, "PORT05", 0,
446 			     128, UNIPHIER_PIN_DRV_1BIT,
447 			     128, UNIPHIER_PIN_PULL_DOWN),
448 	UNIPHIER_PINCTRL_PIN(141, "PORT06", 0,
449 			     129, UNIPHIER_PIN_DRV_1BIT,
450 			     129, UNIPHIER_PIN_PULL_DOWN),
451 	UNIPHIER_PINCTRL_PIN(142, "PORT07", 0,
452 			     130, UNIPHIER_PIN_DRV_1BIT,
453 			     130, UNIPHIER_PIN_PULL_DOWN),
454 	UNIPHIER_PINCTRL_PIN(143, "PORT10", 0,
455 			     131, UNIPHIER_PIN_DRV_1BIT,
456 			     131, UNIPHIER_PIN_PULL_DOWN),
457 	UNIPHIER_PINCTRL_PIN(144, "PORT11", 0,
458 			     132, UNIPHIER_PIN_DRV_1BIT,
459 			     132, UNIPHIER_PIN_PULL_DOWN),
460 	UNIPHIER_PINCTRL_PIN(145, "PORT12", 0,
461 			     133, UNIPHIER_PIN_DRV_1BIT,
462 			     133, UNIPHIER_PIN_PULL_DOWN),
463 	UNIPHIER_PINCTRL_PIN(146, "PORT13", 0,
464 			     134, UNIPHIER_PIN_DRV_1BIT,
465 			     134, UNIPHIER_PIN_PULL_DOWN),
466 	UNIPHIER_PINCTRL_PIN(147, "PORT14", 0,
467 			     135, UNIPHIER_PIN_DRV_1BIT,
468 			     135, UNIPHIER_PIN_PULL_DOWN),
469 	UNIPHIER_PINCTRL_PIN(148, "PORT15", 0,
470 			     136, UNIPHIER_PIN_DRV_1BIT,
471 			     136, UNIPHIER_PIN_PULL_DOWN),
472 	UNIPHIER_PINCTRL_PIN(149, "PORT16", 0,
473 			     137, UNIPHIER_PIN_DRV_1BIT,
474 			     137, UNIPHIER_PIN_PULL_DOWN),
475 	UNIPHIER_PINCTRL_PIN(150, "PORT17", UNIPHIER_PIN_IECTRL_NONE,
476 			     138, UNIPHIER_PIN_DRV_1BIT,
477 			     138, UNIPHIER_PIN_PULL_DOWN),
478 	UNIPHIER_PINCTRL_PIN(151, "PORT20", 0,
479 			     139, UNIPHIER_PIN_DRV_1BIT,
480 			     139, UNIPHIER_PIN_PULL_DOWN),
481 	UNIPHIER_PINCTRL_PIN(152, "PORT21", 0,
482 			     140, UNIPHIER_PIN_DRV_1BIT,
483 			     140, UNIPHIER_PIN_PULL_DOWN),
484 	UNIPHIER_PINCTRL_PIN(153, "PORT22", 0,
485 			     141, UNIPHIER_PIN_DRV_1BIT,
486 			     141, UNIPHIER_PIN_PULL_DOWN),
487 	UNIPHIER_PINCTRL_PIN(154, "PORT23", 0,
488 			     142, UNIPHIER_PIN_DRV_1BIT,
489 			     142, UNIPHIER_PIN_PULL_DOWN),
490 	UNIPHIER_PINCTRL_PIN(155, "PORT24", UNIPHIER_PIN_IECTRL_NONE,
491 			     143, UNIPHIER_PIN_DRV_1BIT,
492 			     143, UNIPHIER_PIN_PULL_DOWN),
493 	UNIPHIER_PINCTRL_PIN(156, "PORT25", 0,
494 			     144, UNIPHIER_PIN_DRV_1BIT,
495 			     144, UNIPHIER_PIN_PULL_DOWN),
496 	UNIPHIER_PINCTRL_PIN(157, "PORT26", 0,
497 			     145, UNIPHIER_PIN_DRV_1BIT,
498 			     145, UNIPHIER_PIN_PULL_DOWN),
499 	UNIPHIER_PINCTRL_PIN(158, "XNFRE", UNIPHIER_PIN_IECTRL_NONE,
500 			     31, UNIPHIER_PIN_DRV_1BIT,
501 			     31, UNIPHIER_PIN_PULL_UP),
502 	UNIPHIER_PINCTRL_PIN(159, "XNFWE", UNIPHIER_PIN_IECTRL_NONE,
503 			     32, UNIPHIER_PIN_DRV_1BIT,
504 			     32, UNIPHIER_PIN_PULL_UP),
505 	UNIPHIER_PINCTRL_PIN(160, "NFALE", UNIPHIER_PIN_IECTRL_NONE,
506 			     33, UNIPHIER_PIN_DRV_1BIT,
507 			     33, UNIPHIER_PIN_PULL_DOWN),
508 	UNIPHIER_PINCTRL_PIN(161, "NFCLE", UNIPHIER_PIN_IECTRL_NONE,
509 			     34, UNIPHIER_PIN_DRV_1BIT,
510 			     34, UNIPHIER_PIN_PULL_DOWN),
511 	UNIPHIER_PINCTRL_PIN(162, "XNFWP", UNIPHIER_PIN_IECTRL_NONE,
512 			     35, UNIPHIER_PIN_DRV_1BIT,
513 			     35, UNIPHIER_PIN_PULL_DOWN),
514 	UNIPHIER_PINCTRL_PIN(163, "XNFCE0", UNIPHIER_PIN_IECTRL_NONE,
515 			     36, UNIPHIER_PIN_DRV_1BIT,
516 			     36, UNIPHIER_PIN_PULL_UP),
517 	UNIPHIER_PINCTRL_PIN(164, "NANDRYBY0", UNIPHIER_PIN_IECTRL_NONE,
518 			     37, UNIPHIER_PIN_DRV_1BIT,
519 			     37, UNIPHIER_PIN_PULL_UP),
520 	/* dedicated pins */
521 	UNIPHIER_PINCTRL_PIN(165, "ED0", -1,
522 			     0, UNIPHIER_PIN_DRV_1BIT,
523 			     0, UNIPHIER_PIN_PULL_DOWN),
524 	UNIPHIER_PINCTRL_PIN(166, "ED1", -1,
525 			     1, UNIPHIER_PIN_DRV_1BIT,
526 			     1, UNIPHIER_PIN_PULL_DOWN),
527 	UNIPHIER_PINCTRL_PIN(167, "ED2", -1,
528 			     2, UNIPHIER_PIN_DRV_1BIT,
529 			     2, UNIPHIER_PIN_PULL_DOWN),
530 	UNIPHIER_PINCTRL_PIN(168, "ED3", -1,
531 			     3, UNIPHIER_PIN_DRV_1BIT,
532 			     3, UNIPHIER_PIN_PULL_DOWN),
533 	UNIPHIER_PINCTRL_PIN(169, "ED4", -1,
534 			     4, UNIPHIER_PIN_DRV_1BIT,
535 			     4, UNIPHIER_PIN_PULL_DOWN),
536 	UNIPHIER_PINCTRL_PIN(170, "ED5", -1,
537 			     5, UNIPHIER_PIN_DRV_1BIT,
538 			     5, UNIPHIER_PIN_PULL_DOWN),
539 	UNIPHIER_PINCTRL_PIN(171, "ED6", -1,
540 			     6, UNIPHIER_PIN_DRV_1BIT,
541 			     6, UNIPHIER_PIN_PULL_DOWN),
542 	UNIPHIER_PINCTRL_PIN(172, "ED7", -1,
543 			     7, UNIPHIER_PIN_DRV_1BIT,
544 			     7, UNIPHIER_PIN_PULL_DOWN),
545 	UNIPHIER_PINCTRL_PIN(173, "ERXW", -1,
546 			     26, UNIPHIER_PIN_DRV_1BIT,
547 			     26, UNIPHIER_PIN_PULL_UP),
548 	UNIPHIER_PINCTRL_PIN(174, "XECS1", -1,
549 			     30, UNIPHIER_PIN_DRV_1BIT,
550 			     30, UNIPHIER_PIN_PULL_UP),
551 };
552 
553 static const unsigned emmc_pins[] = {21, 22, 23, 24, 25, 26, 27};
554 static const int emmc_muxvals[] = {0, 1, 1, 1, 1, 1, 1};
555 static const unsigned emmc_dat8_pins[] = {28, 29, 30, 31};
556 static const int emmc_dat8_muxvals[] = {1, 1, 1, 1};
557 static const unsigned ether_mii_pins[] = {32, 33, 34, 35, 36, 37, 38, 39, 40,
558 					  41, 42, 43, 136, 137, 138, 139, 140,
559 					  141, 142};
560 static const int ether_mii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
561 					4, 4, 4, 4, 4, 4, 4};
562 static const unsigned ether_rmii_pins[] = {32, 33, 34, 35, 36, 37, 38, 39, 40,
563 					   41, 42, 43};
564 static const int ether_rmii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
565 static const unsigned i2c0_pins[] = {102, 103};
566 static const int i2c0_muxvals[] = {0, 0};
567 static const unsigned i2c1_pins[] = {104, 105};
568 static const int i2c1_muxvals[] = {0, 0};
569 static const unsigned i2c2_pins[] = {108, 109};
570 static const int i2c2_muxvals[] = {2, 2};
571 static const unsigned i2c3_pins[] = {108, 109};
572 static const int i2c3_muxvals[] = {3, 3};
573 static const unsigned nand_pins[] = {24, 25, 26, 27, 28, 29, 30, 31, 158, 159,
574 				     160, 161, 162, 163, 164};
575 static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
576 static const unsigned nand_cs1_pins[] = {22, 23};
577 static const int nand_cs1_muxvals[] = {0, 0};
578 static const unsigned sd_pins[] = {44, 45, 46, 47, 48, 49, 50, 51, 52};
579 static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
580 static const unsigned spi0_pins[] = {135, 136, 137, 138};
581 static const int spi0_muxvals[] = {12, 12, 12, 12};
582 static const unsigned system_bus_pins[] = {16, 17, 18, 19, 20, 165, 166, 167,
583 					   168, 169, 170, 171, 172, 173};
584 static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1,
585 					 -1, -1, -1};
586 static const unsigned system_bus_cs0_pins[] = {155};
587 static const int system_bus_cs0_muxvals[] = {1};
588 static const unsigned system_bus_cs1_pins[] = {174};
589 static const int system_bus_cs1_muxvals[] = {-1};
590 static const unsigned system_bus_cs2_pins[] = {64};
591 static const int system_bus_cs2_muxvals[] = {1};
592 static const unsigned system_bus_cs3_pins[] = {156};
593 static const int system_bus_cs3_muxvals[] = {1};
594 static const unsigned uart0_pins[] = {85, 88};
595 static const int uart0_muxvals[] = {1, 1};
596 static const unsigned uart0_ctsrts_pins[] = {86, 87, 89};
597 static const int uart0_ctsrts_muxvals[] = {1, 1, 1};
598 static const unsigned uart1_pins[] = {155, 156};
599 static const int uart1_muxvals[] = {13, 13};
600 static const unsigned uart1b_pins[] = {69, 70};
601 static const int uart1b_muxvals[] = {23, 23};
602 static const unsigned uart2_pins[] = {128, 129};
603 static const int uart2_muxvals[] = {13, 13};
604 static const unsigned uart3_pins[] = {110, 111};
605 static const int uart3_muxvals[] = {1, 1};
606 static const unsigned usb0_pins[] = {53, 54};
607 static const int usb0_muxvals[] = {0, 0};
608 static const unsigned usb1_pins[] = {55, 56};
609 static const int usb1_muxvals[] = {0, 0};
610 static const unsigned usb2_pins[] = {155, 156};
611 static const int usb2_muxvals[] = {4, 4};
612 static const unsigned usb2b_pins[] = {67, 68};
613 static const int usb2b_muxvals[] = {23, 23};
614 static const unsigned int gpio_range_pins[] = {
615 	135, 136, 137, 138, 139, 140, 141, 142,	/* PORT0x */
616 	143, 144, 145, 146, 147, 148, 149, 150,	/* PORT1x */
617 	151, 152, 153, 154, 155, 156, 157, 0,	/* PORT2x */
618 	1, 2, 3, 4, 5, 120, 121, 122,		/* PORT3x */
619 	24, 25, 26, 27, 28, 29, 30, 31,		/* PORT4x */
620 	40, 41, 42, 43, 44, 45, 46, 47,		/* PORT5x */
621 	48, 49, 50, 51, 52, 53, 54, 55,		/* PORT6x */
622 	56, 85, 84, 59, 82, 61, 64, 65,		/* PORT7x */
623 	8, 9, 10, 11, 12, 13, 14, 15,		/* PORT8x */
624 	66, 67, 68, 69, 70, 71, 72, 73,		/* PORT9x */
625 	74, 75, 89, 86, 78, 79, 80, 81,		/* PORT10x */
626 	60, 83, 58, 57, 88, 87, 77, 76,		/* PORT11x */
627 	90, 91, 92, 93, 94, 95, 96, 97,		/* PORT12x */
628 	98, 99, 100, 6, 101, 114, 115, 116,	/* PORT13x */
629 	103, 108, 21, 22, 23, 117, 118, 119,	/* PORT14x */
630 	151, 123, 124, 125, 126, 127, 128, 129,	/* XIRQ0-7 */
631 	130, 131, 132, 133, 62, 7, 134, 63,   /* XIRQ8-12, PORT165, XIRQ14-15 */
632 };
633 
634 static const struct uniphier_pinctrl_group uniphier_ld4_groups[] = {
635 	UNIPHIER_PINCTRL_GROUP(emmc),
636 	UNIPHIER_PINCTRL_GROUP(emmc_dat8),
637 	UNIPHIER_PINCTRL_GROUP(ether_mii),
638 	UNIPHIER_PINCTRL_GROUP(ether_rmii),
639 	UNIPHIER_PINCTRL_GROUP(i2c0),
640 	UNIPHIER_PINCTRL_GROUP(i2c1),
641 	UNIPHIER_PINCTRL_GROUP(i2c2),
642 	UNIPHIER_PINCTRL_GROUP(i2c3),
643 	UNIPHIER_PINCTRL_GROUP(nand),
644 	UNIPHIER_PINCTRL_GROUP(nand_cs1),
645 	UNIPHIER_PINCTRL_GROUP(sd),
646 	UNIPHIER_PINCTRL_GROUP(spi0),
647 	UNIPHIER_PINCTRL_GROUP(system_bus),
648 	UNIPHIER_PINCTRL_GROUP(system_bus_cs0),
649 	UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
650 	UNIPHIER_PINCTRL_GROUP(system_bus_cs2),
651 	UNIPHIER_PINCTRL_GROUP(system_bus_cs3),
652 	UNIPHIER_PINCTRL_GROUP(uart0),
653 	UNIPHIER_PINCTRL_GROUP(uart0_ctsrts),
654 	UNIPHIER_PINCTRL_GROUP(uart1),
655 	UNIPHIER_PINCTRL_GROUP(uart1b),
656 	UNIPHIER_PINCTRL_GROUP(uart2),
657 	UNIPHIER_PINCTRL_GROUP(uart3),
658 	UNIPHIER_PINCTRL_GROUP(usb0),
659 	UNIPHIER_PINCTRL_GROUP(usb1),
660 	UNIPHIER_PINCTRL_GROUP(usb2),
661 	UNIPHIER_PINCTRL_GROUP(usb2b),
662 	UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range),
663 };
664 
665 static const char * const emmc_groups[] = {"emmc", "emmc_dat8"};
666 static const char * const ether_mii_groups[] = {"ether_mii"};
667 static const char * const ether_rmii_groups[] = {"ether_rmii"};
668 static const char * const i2c0_groups[] = {"i2c0"};
669 static const char * const i2c1_groups[] = {"i2c1"};
670 static const char * const i2c2_groups[] = {"i2c2"};
671 static const char * const i2c3_groups[] = {"i2c3"};
672 static const char * const nand_groups[] = {"nand", "nand_cs1"};
673 static const char * const sd_groups[] = {"sd"};
674 static const char * const spi0_groups[] = {"spi0"};
675 static const char * const system_bus_groups[] = {"system_bus",
676 						 "system_bus_cs0",
677 						 "system_bus_cs1",
678 						 "system_bus_cs2",
679 						 "system_bus_cs3"};
680 static const char * const uart0_groups[] = {"uart0", "uart0_ctsrts"};
681 static const char * const uart1_groups[] = {"uart1", "uart1b"};
682 static const char * const uart2_groups[] = {"uart2"};
683 static const char * const uart3_groups[] = {"uart3"};
684 static const char * const usb0_groups[] = {"usb0"};
685 static const char * const usb1_groups[] = {"usb1"};
686 static const char * const usb2_groups[] = {"usb2", "usb2b"};
687 
688 static const struct uniphier_pinmux_function uniphier_ld4_functions[] = {
689 	UNIPHIER_PINMUX_FUNCTION(emmc),
690 	UNIPHIER_PINMUX_FUNCTION(ether_mii),
691 	UNIPHIER_PINMUX_FUNCTION(ether_rmii),
692 	UNIPHIER_PINMUX_FUNCTION(i2c0),
693 	UNIPHIER_PINMUX_FUNCTION(i2c1),
694 	UNIPHIER_PINMUX_FUNCTION(i2c2),
695 	UNIPHIER_PINMUX_FUNCTION(i2c3),
696 	UNIPHIER_PINMUX_FUNCTION(nand),
697 	UNIPHIER_PINMUX_FUNCTION(sd),
698 	UNIPHIER_PINMUX_FUNCTION(spi0),
699 	UNIPHIER_PINMUX_FUNCTION(system_bus),
700 	UNIPHIER_PINMUX_FUNCTION(uart0),
701 	UNIPHIER_PINMUX_FUNCTION(uart1),
702 	UNIPHIER_PINMUX_FUNCTION(uart2),
703 	UNIPHIER_PINMUX_FUNCTION(uart3),
704 	UNIPHIER_PINMUX_FUNCTION(usb0),
705 	UNIPHIER_PINMUX_FUNCTION(usb1),
706 	UNIPHIER_PINMUX_FUNCTION(usb2),
707 };
708 
709 static int uniphier_ld4_get_gpio_muxval(unsigned int pin,
710 					unsigned int gpio_offset)
711 {
712 	switch (gpio_offset) {
713 	case 0 ... 22:		/* PORT00-PORT26 */
714 	case 121 ... 131:	/* XIRQ1-XIRQ11 */
715 	case 134:		/* XIRQ14 */
716 		return 0;
717 	case 120:		/* XIRQ0 */
718 	case 132:		/* XIRQ12 */
719 	case 135:		/* XIRQ15 */
720 		return 14;
721 	default:
722 		return 15;
723 	}
724 }
725 
726 static struct uniphier_pinctrl_socdata uniphier_ld4_pindata = {
727 	.pins = uniphier_ld4_pins,
728 	.npins = ARRAY_SIZE(uniphier_ld4_pins),
729 	.groups = uniphier_ld4_groups,
730 	.groups_count = ARRAY_SIZE(uniphier_ld4_groups),
731 	.functions = uniphier_ld4_functions,
732 	.functions_count = ARRAY_SIZE(uniphier_ld4_functions),
733 	.get_gpio_muxval = uniphier_ld4_get_gpio_muxval,
734 	.caps = 0,
735 };
736 
737 static int uniphier_ld4_pinctrl_probe(struct platform_device *pdev)
738 {
739 	return uniphier_pinctrl_probe(pdev, &uniphier_ld4_pindata);
740 }
741 
742 static const struct of_device_id uniphier_ld4_pinctrl_match[] = {
743 	{ .compatible = "socionext,uniphier-ld4-pinctrl" },
744 	{ /* sentinel */ }
745 };
746 
747 static struct platform_driver uniphier_ld4_pinctrl_driver = {
748 	.probe = uniphier_ld4_pinctrl_probe,
749 	.driver = {
750 		.name = "uniphier-ld4-pinctrl",
751 		.of_match_table = uniphier_ld4_pinctrl_match,
752 		.pm = &uniphier_pinctrl_pm_ops,
753 	},
754 };
755 builtin_platform_driver(uniphier_ld4_pinctrl_driver);
756