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