1 /*
2  * Copyright (C) 2016-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_ld11_pins[] = {
25 	UNIPHIER_PINCTRL_PIN(0, "XECS1", UNIPHIER_PIN_IECTRL_EXIST,
26 			     0, UNIPHIER_PIN_DRV_1BIT,
27 			     0, UNIPHIER_PIN_PULL_UP),
28 	UNIPHIER_PINCTRL_PIN(1, "ERXW", UNIPHIER_PIN_IECTRL_NONE,
29 			     1, UNIPHIER_PIN_DRV_1BIT,
30 			     1, UNIPHIER_PIN_PULL_UP),
31 	UNIPHIER_PINCTRL_PIN(2, "XERWE1", UNIPHIER_PIN_IECTRL_NONE,
32 			     2, UNIPHIER_PIN_DRV_1BIT,
33 			     2, UNIPHIER_PIN_PULL_UP),
34 	UNIPHIER_PINCTRL_PIN(3, "XNFWP", UNIPHIER_PIN_IECTRL_EXIST,
35 			     3, UNIPHIER_PIN_DRV_1BIT,
36 			     3, UNIPHIER_PIN_PULL_DOWN),
37 	UNIPHIER_PINCTRL_PIN(4, "XNFCE0", UNIPHIER_PIN_IECTRL_EXIST,
38 			     4, UNIPHIER_PIN_DRV_1BIT,
39 			     4, UNIPHIER_PIN_PULL_UP),
40 	UNIPHIER_PINCTRL_PIN(5, "NFRYBY0", UNIPHIER_PIN_IECTRL_EXIST,
41 			     5, UNIPHIER_PIN_DRV_1BIT,
42 			     5, UNIPHIER_PIN_PULL_UP),
43 	UNIPHIER_PINCTRL_PIN(6, "XNFRE", UNIPHIER_PIN_IECTRL_NONE,
44 			     6, UNIPHIER_PIN_DRV_1BIT,
45 			     6, UNIPHIER_PIN_PULL_UP),
46 	UNIPHIER_PINCTRL_PIN(7, "XNFWE", UNIPHIER_PIN_IECTRL_NONE,
47 			     7, UNIPHIER_PIN_DRV_1BIT,
48 			     7, UNIPHIER_PIN_PULL_UP),
49 	UNIPHIER_PINCTRL_PIN(8, "NFALE", UNIPHIER_PIN_IECTRL_NONE,
50 			     8, UNIPHIER_PIN_DRV_1BIT,
51 			     8, UNIPHIER_PIN_PULL_UP),
52 	UNIPHIER_PINCTRL_PIN(9, "NFCLE", UNIPHIER_PIN_IECTRL_NONE,
53 			     9, UNIPHIER_PIN_DRV_1BIT,
54 			     9, UNIPHIER_PIN_PULL_UP),
55 	UNIPHIER_PINCTRL_PIN(10, "NFD0", UNIPHIER_PIN_IECTRL_EXIST,
56 			     10, UNIPHIER_PIN_DRV_1BIT,
57 			     10, UNIPHIER_PIN_PULL_UP),
58 	UNIPHIER_PINCTRL_PIN(11, "NFD1", UNIPHIER_PIN_IECTRL_EXIST,
59 			     11, UNIPHIER_PIN_DRV_1BIT,
60 			     11, UNIPHIER_PIN_PULL_UP),
61 	UNIPHIER_PINCTRL_PIN(12, "NFD2", UNIPHIER_PIN_IECTRL_EXIST,
62 			     12, UNIPHIER_PIN_DRV_1BIT,
63 			     12, UNIPHIER_PIN_PULL_UP),
64 	UNIPHIER_PINCTRL_PIN(13, "NFD3", UNIPHIER_PIN_IECTRL_EXIST,
65 			     13, UNIPHIER_PIN_DRV_1BIT,
66 			     13, UNIPHIER_PIN_PULL_UP),
67 	UNIPHIER_PINCTRL_PIN(14, "NFD4", UNIPHIER_PIN_IECTRL_EXIST,
68 			     14, UNIPHIER_PIN_DRV_1BIT,
69 			     14, UNIPHIER_PIN_PULL_UP),
70 	UNIPHIER_PINCTRL_PIN(15, "NFD5", UNIPHIER_PIN_IECTRL_EXIST,
71 			     15, UNIPHIER_PIN_DRV_1BIT,
72 			     15, UNIPHIER_PIN_PULL_UP),
73 	UNIPHIER_PINCTRL_PIN(16, "NFD6", UNIPHIER_PIN_IECTRL_EXIST,
74 			     16, UNIPHIER_PIN_DRV_1BIT,
75 			     16, UNIPHIER_PIN_PULL_UP),
76 	UNIPHIER_PINCTRL_PIN(17, "NFD7", UNIPHIER_PIN_IECTRL_EXIST,
77 			     17, UNIPHIER_PIN_DRV_1BIT,
78 			     17, UNIPHIER_PIN_PULL_UP),
79 	UNIPHIER_PINCTRL_PIN(18, "XERST", UNIPHIER_PIN_IECTRL_EXIST,
80 			     0, UNIPHIER_PIN_DRV_2BIT,
81 			     18, UNIPHIER_PIN_PULL_UP),
82 	UNIPHIER_PINCTRL_PIN(19, "MMCCLK", UNIPHIER_PIN_IECTRL_EXIST,
83 			     1, UNIPHIER_PIN_DRV_2BIT,
84 			     19, UNIPHIER_PIN_PULL_UP),
85 	UNIPHIER_PINCTRL_PIN(20, "MMCCMD", UNIPHIER_PIN_IECTRL_EXIST,
86 			     2, UNIPHIER_PIN_DRV_2BIT,
87 			     20, UNIPHIER_PIN_PULL_UP),
88 	UNIPHIER_PINCTRL_PIN(21, "MMCDS", UNIPHIER_PIN_IECTRL_EXIST,
89 			     3, UNIPHIER_PIN_DRV_2BIT,
90 			     21, UNIPHIER_PIN_PULL_UP),
91 	UNIPHIER_PINCTRL_PIN(22, "MMCDAT0", UNIPHIER_PIN_IECTRL_EXIST,
92 			     4, UNIPHIER_PIN_DRV_2BIT,
93 			     22, UNIPHIER_PIN_PULL_UP),
94 	UNIPHIER_PINCTRL_PIN(23, "MMCDAT1", UNIPHIER_PIN_IECTRL_EXIST,
95 			     5, UNIPHIER_PIN_DRV_2BIT,
96 			     23, UNIPHIER_PIN_PULL_UP),
97 	UNIPHIER_PINCTRL_PIN(24, "MMCDAT2", UNIPHIER_PIN_IECTRL_EXIST,
98 			     6, UNIPHIER_PIN_DRV_2BIT,
99 			     24, UNIPHIER_PIN_PULL_UP),
100 	UNIPHIER_PINCTRL_PIN(25, "MMCDAT3", UNIPHIER_PIN_IECTRL_EXIST,
101 			     7, UNIPHIER_PIN_DRV_2BIT,
102 			     25, UNIPHIER_PIN_PULL_UP),
103 	UNIPHIER_PINCTRL_PIN(26, "MMCDAT4", UNIPHIER_PIN_IECTRL_EXIST,
104 			     8, UNIPHIER_PIN_DRV_2BIT,
105 			     26, UNIPHIER_PIN_PULL_UP),
106 	UNIPHIER_PINCTRL_PIN(27, "MMCDAT5", UNIPHIER_PIN_IECTRL_EXIST,
107 			     9, UNIPHIER_PIN_DRV_2BIT,
108 			     27, UNIPHIER_PIN_PULL_UP),
109 	UNIPHIER_PINCTRL_PIN(28, "MMCDAT6", UNIPHIER_PIN_IECTRL_EXIST,
110 			     10, UNIPHIER_PIN_DRV_2BIT,
111 			     28, UNIPHIER_PIN_PULL_UP),
112 	UNIPHIER_PINCTRL_PIN(29, "MMCDAT7", UNIPHIER_PIN_IECTRL_EXIST,
113 			     11, UNIPHIER_PIN_DRV_2BIT,
114 			     29, UNIPHIER_PIN_PULL_UP),
115 	UNIPHIER_PINCTRL_PIN(46, "USB0VBUS", UNIPHIER_PIN_IECTRL_EXIST,
116 			     46, UNIPHIER_PIN_DRV_1BIT,
117 			     46, UNIPHIER_PIN_PULL_DOWN),
118 	UNIPHIER_PINCTRL_PIN(47, "USB0OD", UNIPHIER_PIN_IECTRL_NONE,
119 			     47, UNIPHIER_PIN_DRV_1BIT,
120 			     47, UNIPHIER_PIN_PULL_UP),
121 	UNIPHIER_PINCTRL_PIN(48, "USB1VBUS", UNIPHIER_PIN_IECTRL_EXIST,
122 			     48, UNIPHIER_PIN_DRV_1BIT,
123 			     48, UNIPHIER_PIN_PULL_DOWN),
124 	UNIPHIER_PINCTRL_PIN(49, "USB1OD", UNIPHIER_PIN_IECTRL_EXIST,
125 			     49, UNIPHIER_PIN_DRV_1BIT,
126 			     49, UNIPHIER_PIN_PULL_UP),
127 	UNIPHIER_PINCTRL_PIN(50, "USB2VBUS", UNIPHIER_PIN_IECTRL_EXIST,
128 			     50, UNIPHIER_PIN_DRV_1BIT,
129 			     50, UNIPHIER_PIN_PULL_DOWN),
130 	UNIPHIER_PINCTRL_PIN(51, "USB2OD", UNIPHIER_PIN_IECTRL_EXIST,
131 			     51, UNIPHIER_PIN_DRV_1BIT,
132 			     51, UNIPHIER_PIN_PULL_UP),
133 	UNIPHIER_PINCTRL_PIN(54, "TXD0", UNIPHIER_PIN_IECTRL_EXIST,
134 			     54, UNIPHIER_PIN_DRV_1BIT,
135 			     54, UNIPHIER_PIN_PULL_UP),
136 	UNIPHIER_PINCTRL_PIN(55, "RXD0", UNIPHIER_PIN_IECTRL_EXIST,
137 			     55, UNIPHIER_PIN_DRV_1BIT,
138 			     55, UNIPHIER_PIN_PULL_UP),
139 	UNIPHIER_PINCTRL_PIN(56, "SPISYNC0", UNIPHIER_PIN_IECTRL_EXIST,
140 			     56, UNIPHIER_PIN_DRV_1BIT,
141 			     56, UNIPHIER_PIN_PULL_DOWN),
142 	UNIPHIER_PINCTRL_PIN(57, "SPISCLK0", UNIPHIER_PIN_IECTRL_EXIST,
143 			     57, UNIPHIER_PIN_DRV_1BIT,
144 			     57, UNIPHIER_PIN_PULL_DOWN),
145 	UNIPHIER_PINCTRL_PIN(58, "SPITXD0", UNIPHIER_PIN_IECTRL_EXIST,
146 			     58, UNIPHIER_PIN_DRV_1BIT,
147 			     58, UNIPHIER_PIN_PULL_DOWN),
148 	UNIPHIER_PINCTRL_PIN(59, "SPIRXD0", UNIPHIER_PIN_IECTRL_EXIST,
149 			     59, UNIPHIER_PIN_DRV_1BIT,
150 			     59, UNIPHIER_PIN_PULL_DOWN),
151 	UNIPHIER_PINCTRL_PIN(60, "AGCI", UNIPHIER_PIN_IECTRL_EXIST,
152 			     60, UNIPHIER_PIN_DRV_1BIT,
153 			     60, UNIPHIER_PIN_PULL_DOWN),
154 	UNIPHIER_PINCTRL_PIN(61, "DMDSDA0", UNIPHIER_PIN_IECTRL_EXIST,
155 			     -1, UNIPHIER_PIN_DRV_FIXED4,
156 			     -1, UNIPHIER_PIN_PULL_NONE),
157 	UNIPHIER_PINCTRL_PIN(62, "DMDSCL0", UNIPHIER_PIN_IECTRL_EXIST,
158 			     -1, UNIPHIER_PIN_DRV_FIXED4,
159 			     -1, UNIPHIER_PIN_PULL_NONE),
160 	UNIPHIER_PINCTRL_PIN(63, "SDA0", UNIPHIER_PIN_IECTRL_EXIST,
161 			     -1, UNIPHIER_PIN_DRV_FIXED4,
162 			     -1, UNIPHIER_PIN_PULL_NONE),
163 	UNIPHIER_PINCTRL_PIN(64, "SCL0", UNIPHIER_PIN_IECTRL_EXIST,
164 			     -1, UNIPHIER_PIN_DRV_FIXED4,
165 			     -1, UNIPHIER_PIN_PULL_NONE),
166 	UNIPHIER_PINCTRL_PIN(65, "SDA1", UNIPHIER_PIN_IECTRL_EXIST,
167 			     -1, UNIPHIER_PIN_DRV_FIXED4,
168 			     -1, UNIPHIER_PIN_PULL_NONE),
169 	UNIPHIER_PINCTRL_PIN(66, "SCL1", UNIPHIER_PIN_IECTRL_EXIST,
170 			     -1, UNIPHIER_PIN_DRV_FIXED4,
171 			     -1, UNIPHIER_PIN_PULL_NONE),
172 	UNIPHIER_PINCTRL_PIN(67, "HIN", UNIPHIER_PIN_IECTRL_EXIST,
173 			     -1, UNIPHIER_PIN_DRV_FIXED5,
174 			     -1, UNIPHIER_PIN_PULL_NONE),
175 	UNIPHIER_PINCTRL_PIN(68, "VIN", UNIPHIER_PIN_IECTRL_EXIST,
176 			     -1, UNIPHIER_PIN_DRV_FIXED5,
177 			     -1, UNIPHIER_PIN_PULL_NONE),
178 	UNIPHIER_PINCTRL_PIN(69, "PCA00", UNIPHIER_PIN_IECTRL_EXIST,
179 			     69, UNIPHIER_PIN_DRV_1BIT,
180 			     69, UNIPHIER_PIN_PULL_DOWN),
181 	UNIPHIER_PINCTRL_PIN(70, "PCA01", UNIPHIER_PIN_IECTRL_EXIST,
182 			     70, UNIPHIER_PIN_DRV_1BIT,
183 			     70, UNIPHIER_PIN_PULL_DOWN),
184 	UNIPHIER_PINCTRL_PIN(71, "PCA02", UNIPHIER_PIN_IECTRL_EXIST,
185 			     71, UNIPHIER_PIN_DRV_1BIT,
186 			     71, UNIPHIER_PIN_PULL_DOWN),
187 	UNIPHIER_PINCTRL_PIN(72, "PCA03", UNIPHIER_PIN_IECTRL_EXIST,
188 			     72, UNIPHIER_PIN_DRV_1BIT,
189 			     72, UNIPHIER_PIN_PULL_DOWN),
190 	UNIPHIER_PINCTRL_PIN(73, "PCA04", UNIPHIER_PIN_IECTRL_EXIST,
191 			     73, UNIPHIER_PIN_DRV_1BIT,
192 			     73, UNIPHIER_PIN_PULL_DOWN),
193 	UNIPHIER_PINCTRL_PIN(74, "PCA05", UNIPHIER_PIN_IECTRL_EXIST,
194 			     74, UNIPHIER_PIN_DRV_1BIT,
195 			     74, UNIPHIER_PIN_PULL_DOWN),
196 	UNIPHIER_PINCTRL_PIN(75, "PCA06", UNIPHIER_PIN_IECTRL_EXIST,
197 			     75, UNIPHIER_PIN_DRV_1BIT,
198 			     75, UNIPHIER_PIN_PULL_DOWN),
199 	UNIPHIER_PINCTRL_PIN(76, "PCA07", UNIPHIER_PIN_IECTRL_EXIST,
200 			     76, UNIPHIER_PIN_DRV_1BIT,
201 			     76, UNIPHIER_PIN_PULL_DOWN),
202 	UNIPHIER_PINCTRL_PIN(77, "PCA08", UNIPHIER_PIN_IECTRL_EXIST,
203 			     77, UNIPHIER_PIN_DRV_1BIT,
204 			     77, UNIPHIER_PIN_PULL_DOWN),
205 	UNIPHIER_PINCTRL_PIN(78, "PCA09", UNIPHIER_PIN_IECTRL_EXIST,
206 			     78, UNIPHIER_PIN_DRV_1BIT,
207 			     78, UNIPHIER_PIN_PULL_DOWN),
208 	UNIPHIER_PINCTRL_PIN(79, "PCA10", UNIPHIER_PIN_IECTRL_EXIST,
209 			     79, UNIPHIER_PIN_DRV_1BIT,
210 			     79, UNIPHIER_PIN_PULL_DOWN),
211 	UNIPHIER_PINCTRL_PIN(80, "PCA11", UNIPHIER_PIN_IECTRL_EXIST,
212 			     80, UNIPHIER_PIN_DRV_1BIT,
213 			     80, UNIPHIER_PIN_PULL_DOWN),
214 	UNIPHIER_PINCTRL_PIN(81, "PCA12", UNIPHIER_PIN_IECTRL_EXIST,
215 			     81, UNIPHIER_PIN_DRV_1BIT,
216 			     81, UNIPHIER_PIN_PULL_DOWN),
217 	UNIPHIER_PINCTRL_PIN(82, "PCA13", UNIPHIER_PIN_IECTRL_EXIST,
218 			     82, UNIPHIER_PIN_DRV_1BIT,
219 			     82, UNIPHIER_PIN_PULL_DOWN),
220 	UNIPHIER_PINCTRL_PIN(83, "PCA14", UNIPHIER_PIN_IECTRL_EXIST,
221 			     83, UNIPHIER_PIN_DRV_1BIT,
222 			     83, UNIPHIER_PIN_PULL_DOWN),
223 	UNIPHIER_PINCTRL_PIN(84, "PC0READY", UNIPHIER_PIN_IECTRL_EXIST,
224 			     84, UNIPHIER_PIN_DRV_1BIT,
225 			     84, UNIPHIER_PIN_PULL_DOWN),
226 	UNIPHIER_PINCTRL_PIN(85, "PC0CD1", UNIPHIER_PIN_IECTRL_EXIST,
227 			     85, UNIPHIER_PIN_DRV_1BIT,
228 			     85, UNIPHIER_PIN_PULL_DOWN),
229 	UNIPHIER_PINCTRL_PIN(86, "PC0CD2", UNIPHIER_PIN_IECTRL_EXIST,
230 			     86, UNIPHIER_PIN_DRV_1BIT,
231 			     86, UNIPHIER_PIN_PULL_DOWN),
232 	UNIPHIER_PINCTRL_PIN(87, "PC0WAIT", UNIPHIER_PIN_IECTRL_EXIST,
233 			     87, UNIPHIER_PIN_DRV_1BIT,
234 			     87, UNIPHIER_PIN_PULL_DOWN),
235 	UNIPHIER_PINCTRL_PIN(88, "PC0RESET", UNIPHIER_PIN_IECTRL_EXIST,
236 			     88, UNIPHIER_PIN_DRV_1BIT,
237 			     88, UNIPHIER_PIN_PULL_DOWN),
238 	UNIPHIER_PINCTRL_PIN(89, "PC0CE1", UNIPHIER_PIN_IECTRL_EXIST,
239 			     89, UNIPHIER_PIN_DRV_1BIT,
240 			     89, UNIPHIER_PIN_PULL_DOWN),
241 	UNIPHIER_PINCTRL_PIN(90, "PC0WE", UNIPHIER_PIN_IECTRL_EXIST,
242 			     90, UNIPHIER_PIN_DRV_1BIT,
243 			     90, UNIPHIER_PIN_PULL_DOWN),
244 	UNIPHIER_PINCTRL_PIN(91, "PC0OE", UNIPHIER_PIN_IECTRL_EXIST,
245 			     91, UNIPHIER_PIN_DRV_1BIT,
246 			     91, UNIPHIER_PIN_PULL_DOWN),
247 	UNIPHIER_PINCTRL_PIN(92, "PC0IOWR", UNIPHIER_PIN_IECTRL_EXIST,
248 			     92, UNIPHIER_PIN_DRV_1BIT,
249 			     92, UNIPHIER_PIN_PULL_DOWN),
250 	UNIPHIER_PINCTRL_PIN(93, "PC0IORD", UNIPHIER_PIN_IECTRL_EXIST,
251 			     93, UNIPHIER_PIN_DRV_1BIT,
252 			     93, UNIPHIER_PIN_PULL_DOWN),
253 	UNIPHIER_PINCTRL_PIN(94, "PCD00", UNIPHIER_PIN_IECTRL_EXIST,
254 			     94, UNIPHIER_PIN_DRV_1BIT,
255 			     94, UNIPHIER_PIN_PULL_DOWN),
256 	UNIPHIER_PINCTRL_PIN(95, "PCD01", UNIPHIER_PIN_IECTRL_EXIST,
257 			     95, UNIPHIER_PIN_DRV_1BIT,
258 			     95, UNIPHIER_PIN_PULL_DOWN),
259 	UNIPHIER_PINCTRL_PIN(96, "PCD02", UNIPHIER_PIN_IECTRL_EXIST,
260 			     96, UNIPHIER_PIN_DRV_1BIT,
261 			     96, UNIPHIER_PIN_PULL_DOWN),
262 	UNIPHIER_PINCTRL_PIN(97, "PCD03", UNIPHIER_PIN_IECTRL_EXIST,
263 			     97, UNIPHIER_PIN_DRV_1BIT,
264 			     97, UNIPHIER_PIN_PULL_DOWN),
265 	UNIPHIER_PINCTRL_PIN(98, "PCD04", UNIPHIER_PIN_IECTRL_EXIST,
266 			     98, UNIPHIER_PIN_DRV_1BIT,
267 			     98, UNIPHIER_PIN_PULL_DOWN),
268 	UNIPHIER_PINCTRL_PIN(99, "PCD05", UNIPHIER_PIN_IECTRL_EXIST,
269 			     99, UNIPHIER_PIN_DRV_1BIT,
270 			     99, UNIPHIER_PIN_PULL_DOWN),
271 	UNIPHIER_PINCTRL_PIN(100, "PCD06", UNIPHIER_PIN_IECTRL_EXIST,
272 			     100, UNIPHIER_PIN_DRV_1BIT,
273 			     100, UNIPHIER_PIN_PULL_DOWN),
274 	UNIPHIER_PINCTRL_PIN(101, "PCD07", UNIPHIER_PIN_IECTRL_EXIST,
275 			     101, UNIPHIER_PIN_DRV_1BIT,
276 			     101, UNIPHIER_PIN_PULL_DOWN),
277 	UNIPHIER_PINCTRL_PIN(102, "HS0BCLKIN", UNIPHIER_PIN_IECTRL_EXIST,
278 			     102, UNIPHIER_PIN_DRV_1BIT,
279 			     102, UNIPHIER_PIN_PULL_DOWN),
280 	UNIPHIER_PINCTRL_PIN(103, "HS0SYNCIN", UNIPHIER_PIN_IECTRL_EXIST,
281 			     103, UNIPHIER_PIN_DRV_1BIT,
282 			     103, UNIPHIER_PIN_PULL_DOWN),
283 	UNIPHIER_PINCTRL_PIN(104, "HS0VALIN", UNIPHIER_PIN_IECTRL_EXIST,
284 			     104, UNIPHIER_PIN_DRV_1BIT,
285 			     104, UNIPHIER_PIN_PULL_DOWN),
286 	UNIPHIER_PINCTRL_PIN(105, "HS0DIN0", UNIPHIER_PIN_IECTRL_EXIST,
287 			     105, UNIPHIER_PIN_DRV_1BIT,
288 			     105, UNIPHIER_PIN_PULL_DOWN),
289 	UNIPHIER_PINCTRL_PIN(106, "HS0DIN1", UNIPHIER_PIN_IECTRL_EXIST,
290 			     106, UNIPHIER_PIN_DRV_1BIT,
291 			     106, UNIPHIER_PIN_PULL_DOWN),
292 	UNIPHIER_PINCTRL_PIN(107, "HS0DIN2", UNIPHIER_PIN_IECTRL_EXIST,
293 			     107, UNIPHIER_PIN_DRV_1BIT,
294 			     107, UNIPHIER_PIN_PULL_DOWN),
295 	UNIPHIER_PINCTRL_PIN(108, "HS0DIN3", UNIPHIER_PIN_IECTRL_EXIST,
296 			     108, UNIPHIER_PIN_DRV_1BIT,
297 			     108, UNIPHIER_PIN_PULL_DOWN),
298 	UNIPHIER_PINCTRL_PIN(109, "HS0DIN4", UNIPHIER_PIN_IECTRL_EXIST,
299 			     109, UNIPHIER_PIN_DRV_1BIT,
300 			     109, UNIPHIER_PIN_PULL_DOWN),
301 	UNIPHIER_PINCTRL_PIN(110, "HS0DIN5", UNIPHIER_PIN_IECTRL_EXIST,
302 			     110, UNIPHIER_PIN_DRV_1BIT,
303 			     110, UNIPHIER_PIN_PULL_DOWN),
304 	UNIPHIER_PINCTRL_PIN(111, "HS0DIN6", UNIPHIER_PIN_IECTRL_EXIST,
305 			     111, UNIPHIER_PIN_DRV_1BIT,
306 			     111, UNIPHIER_PIN_PULL_DOWN),
307 	UNIPHIER_PINCTRL_PIN(112, "HS0DIN7", UNIPHIER_PIN_IECTRL_EXIST,
308 			     112, UNIPHIER_PIN_DRV_1BIT,
309 			     112, UNIPHIER_PIN_PULL_DOWN),
310 	UNIPHIER_PINCTRL_PIN(113, "HS0BCLKOUT", UNIPHIER_PIN_IECTRL_EXIST,
311 			     113, UNIPHIER_PIN_DRV_1BIT,
312 			     113, UNIPHIER_PIN_PULL_DOWN),
313 	UNIPHIER_PINCTRL_PIN(114, "HS0SYNCOUT", UNIPHIER_PIN_IECTRL_EXIST,
314 			     114, UNIPHIER_PIN_DRV_1BIT,
315 			     114, UNIPHIER_PIN_PULL_DOWN),
316 	UNIPHIER_PINCTRL_PIN(115, "HS0VALOUT", UNIPHIER_PIN_IECTRL_EXIST,
317 			     115, UNIPHIER_PIN_DRV_1BIT,
318 			     115, UNIPHIER_PIN_PULL_DOWN),
319 	UNIPHIER_PINCTRL_PIN(116, "HS0DOUT0", UNIPHIER_PIN_IECTRL_EXIST,
320 			     116, UNIPHIER_PIN_DRV_1BIT,
321 			     116, UNIPHIER_PIN_PULL_DOWN),
322 	UNIPHIER_PINCTRL_PIN(117, "HS0DOUT1", UNIPHIER_PIN_IECTRL_EXIST,
323 			     117, UNIPHIER_PIN_DRV_1BIT,
324 			     117, UNIPHIER_PIN_PULL_DOWN),
325 	UNIPHIER_PINCTRL_PIN(118, "HS0DOUT2", UNIPHIER_PIN_IECTRL_EXIST,
326 			     118, UNIPHIER_PIN_DRV_1BIT,
327 			     118, UNIPHIER_PIN_PULL_DOWN),
328 	UNIPHIER_PINCTRL_PIN(119, "HS0DOUT3", UNIPHIER_PIN_IECTRL_EXIST,
329 			     119, UNIPHIER_PIN_DRV_1BIT,
330 			     119, UNIPHIER_PIN_PULL_DOWN),
331 	UNIPHIER_PINCTRL_PIN(120, "HS0DOUT4", UNIPHIER_PIN_IECTRL_EXIST,
332 			     120, UNIPHIER_PIN_DRV_1BIT,
333 			     120, UNIPHIER_PIN_PULL_DOWN),
334 	UNIPHIER_PINCTRL_PIN(121, "HS0DOUT5", UNIPHIER_PIN_IECTRL_EXIST,
335 			     121, UNIPHIER_PIN_DRV_1BIT,
336 			     121, UNIPHIER_PIN_PULL_DOWN),
337 	UNIPHIER_PINCTRL_PIN(122, "HS0DOUT6", UNIPHIER_PIN_IECTRL_EXIST,
338 			     122, UNIPHIER_PIN_DRV_1BIT,
339 			     122, UNIPHIER_PIN_PULL_DOWN),
340 	UNIPHIER_PINCTRL_PIN(123, "HS0DOUT7", UNIPHIER_PIN_IECTRL_EXIST,
341 			     123, UNIPHIER_PIN_DRV_1BIT,
342 			     123, UNIPHIER_PIN_PULL_DOWN),
343 	UNIPHIER_PINCTRL_PIN(124, "HS1BCLKIN", UNIPHIER_PIN_IECTRL_EXIST,
344 			     124, UNIPHIER_PIN_DRV_1BIT,
345 			     124, UNIPHIER_PIN_PULL_DOWN),
346 	UNIPHIER_PINCTRL_PIN(125, "HS1SYNCIN", UNIPHIER_PIN_IECTRL_EXIST,
347 			     125, UNIPHIER_PIN_DRV_1BIT,
348 			     125, UNIPHIER_PIN_PULL_DOWN),
349 	UNIPHIER_PINCTRL_PIN(126, "HS1VALIN", UNIPHIER_PIN_IECTRL_EXIST,
350 			     126, UNIPHIER_PIN_DRV_1BIT,
351 			     126, UNIPHIER_PIN_PULL_DOWN),
352 	UNIPHIER_PINCTRL_PIN(127, "HS1DIN0", UNIPHIER_PIN_IECTRL_EXIST,
353 			     127, UNIPHIER_PIN_DRV_1BIT,
354 			     127, UNIPHIER_PIN_PULL_DOWN),
355 	UNIPHIER_PINCTRL_PIN(128, "HS1DIN1", UNIPHIER_PIN_IECTRL_EXIST,
356 			     128, UNIPHIER_PIN_DRV_1BIT,
357 			     128, UNIPHIER_PIN_PULL_DOWN),
358 	UNIPHIER_PINCTRL_PIN(129, "HS1DIN2", UNIPHIER_PIN_IECTRL_EXIST,
359 			     129, UNIPHIER_PIN_DRV_1BIT,
360 			     129, UNIPHIER_PIN_PULL_DOWN),
361 	UNIPHIER_PINCTRL_PIN(130, "HS1DIN3", UNIPHIER_PIN_IECTRL_EXIST,
362 			     130, UNIPHIER_PIN_DRV_1BIT,
363 			     130, UNIPHIER_PIN_PULL_DOWN),
364 	UNIPHIER_PINCTRL_PIN(131, "HS1DIN4", UNIPHIER_PIN_IECTRL_EXIST,
365 			     131, UNIPHIER_PIN_DRV_1BIT,
366 			     131, UNIPHIER_PIN_PULL_DOWN),
367 	UNIPHIER_PINCTRL_PIN(132, "HS1DIN5", UNIPHIER_PIN_IECTRL_EXIST,
368 			     132, UNIPHIER_PIN_DRV_1BIT,
369 			     132, UNIPHIER_PIN_PULL_DOWN),
370 	UNIPHIER_PINCTRL_PIN(133, "HS1DIN6", UNIPHIER_PIN_IECTRL_EXIST,
371 			     133, UNIPHIER_PIN_DRV_1BIT,
372 			     133, UNIPHIER_PIN_PULL_DOWN),
373 	UNIPHIER_PINCTRL_PIN(134, "HS1DIN7", UNIPHIER_PIN_IECTRL_EXIST,
374 			     134, UNIPHIER_PIN_DRV_1BIT,
375 			     134, UNIPHIER_PIN_PULL_DOWN),
376 	UNIPHIER_PINCTRL_PIN(135, "AO1IEC", UNIPHIER_PIN_IECTRL_EXIST,
377 			     135, UNIPHIER_PIN_DRV_1BIT,
378 			     135, UNIPHIER_PIN_PULL_DOWN),
379 	UNIPHIER_PINCTRL_PIN(136, "AO1ARC", UNIPHIER_PIN_IECTRL_EXIST,
380 			     136, UNIPHIER_PIN_DRV_1BIT,
381 			     136, UNIPHIER_PIN_PULL_DOWN),
382 	UNIPHIER_PINCTRL_PIN(137, "AO1DACCK", UNIPHIER_PIN_IECTRL_EXIST,
383 			     137, UNIPHIER_PIN_DRV_1BIT,
384 			     137, UNIPHIER_PIN_PULL_DOWN),
385 	UNIPHIER_PINCTRL_PIN(138, "AO1BCK", UNIPHIER_PIN_IECTRL_EXIST,
386 			     138, UNIPHIER_PIN_DRV_1BIT,
387 			     138, UNIPHIER_PIN_PULL_DOWN),
388 	UNIPHIER_PINCTRL_PIN(139, "AO1LRCK", UNIPHIER_PIN_IECTRL_EXIST,
389 			     139, UNIPHIER_PIN_DRV_1BIT,
390 			     139, UNIPHIER_PIN_PULL_DOWN),
391 	UNIPHIER_PINCTRL_PIN(140, "AO1D0", UNIPHIER_PIN_IECTRL_EXIST,
392 			     140, UNIPHIER_PIN_DRV_1BIT,
393 			     140, UNIPHIER_PIN_PULL_DOWN),
394 	UNIPHIER_PINCTRL_PIN(141, "AO1D1", UNIPHIER_PIN_IECTRL_EXIST,
395 			     141, UNIPHIER_PIN_DRV_1BIT,
396 			     141, UNIPHIER_PIN_PULL_DOWN),
397 	UNIPHIER_PINCTRL_PIN(142, "AO1D2", UNIPHIER_PIN_IECTRL_EXIST,
398 			     142, UNIPHIER_PIN_DRV_1BIT,
399 			     142, UNIPHIER_PIN_PULL_DOWN),
400 	UNIPHIER_PINCTRL_PIN(143, "XIRQ9", UNIPHIER_PIN_IECTRL_EXIST,
401 			     143, UNIPHIER_PIN_DRV_1BIT,
402 			     143, UNIPHIER_PIN_PULL_DOWN),
403 	UNIPHIER_PINCTRL_PIN(144, "XIRQ10", UNIPHIER_PIN_IECTRL_EXIST,
404 			     144, UNIPHIER_PIN_DRV_1BIT,
405 			     144, UNIPHIER_PIN_PULL_DOWN),
406 	UNIPHIER_PINCTRL_PIN(145, "XIRQ11", UNIPHIER_PIN_IECTRL_EXIST,
407 			     145, UNIPHIER_PIN_DRV_1BIT,
408 			     145, UNIPHIER_PIN_PULL_DOWN),
409 	UNIPHIER_PINCTRL_PIN(146, "XIRQ13", UNIPHIER_PIN_IECTRL_EXIST,
410 			     146, UNIPHIER_PIN_DRV_1BIT,
411 			     146, UNIPHIER_PIN_PULL_DOWN),
412 	UNIPHIER_PINCTRL_PIN(147, "PWMA", UNIPHIER_PIN_IECTRL_EXIST,
413 			     147, UNIPHIER_PIN_DRV_1BIT,
414 			     147, UNIPHIER_PIN_PULL_DOWN),
415 	UNIPHIER_PINCTRL_PIN(148, "LR_GOUT", UNIPHIER_PIN_IECTRL_EXIST,
416 			     148, UNIPHIER_PIN_DRV_1BIT,
417 			     148, UNIPHIER_PIN_PULL_DOWN),
418 	UNIPHIER_PINCTRL_PIN(149, "XIRQ0", UNIPHIER_PIN_IECTRL_EXIST,
419 			     149, UNIPHIER_PIN_DRV_1BIT,
420 			     149, UNIPHIER_PIN_PULL_DOWN),
421 	UNIPHIER_PINCTRL_PIN(150, "XIRQ1", UNIPHIER_PIN_IECTRL_EXIST,
422 			     150, UNIPHIER_PIN_DRV_1BIT,
423 			     150, UNIPHIER_PIN_PULL_DOWN),
424 	UNIPHIER_PINCTRL_PIN(151, "XIRQ2", UNIPHIER_PIN_IECTRL_EXIST,
425 			     151, UNIPHIER_PIN_DRV_1BIT,
426 			     151, UNIPHIER_PIN_PULL_DOWN),
427 	UNIPHIER_PINCTRL_PIN(152, "XIRQ3", UNIPHIER_PIN_IECTRL_EXIST,
428 			     152, UNIPHIER_PIN_DRV_1BIT,
429 			     152, UNIPHIER_PIN_PULL_DOWN),
430 	UNIPHIER_PINCTRL_PIN(153, "XIRQ4", UNIPHIER_PIN_IECTRL_EXIST,
431 			     153, UNIPHIER_PIN_DRV_1BIT,
432 			     153, UNIPHIER_PIN_PULL_DOWN),
433 	UNIPHIER_PINCTRL_PIN(154, "XIRQ5", UNIPHIER_PIN_IECTRL_EXIST,
434 			     154, UNIPHIER_PIN_DRV_1BIT,
435 			     154, UNIPHIER_PIN_PULL_DOWN),
436 	UNIPHIER_PINCTRL_PIN(155, "XIRQ6", UNIPHIER_PIN_IECTRL_EXIST,
437 			     155, UNIPHIER_PIN_DRV_1BIT,
438 			     155, UNIPHIER_PIN_PULL_DOWN),
439 	UNIPHIER_PINCTRL_PIN(156, "XIRQ7", UNIPHIER_PIN_IECTRL_EXIST,
440 			     156, UNIPHIER_PIN_DRV_1BIT,
441 			     156, UNIPHIER_PIN_PULL_DOWN),
442 	UNIPHIER_PINCTRL_PIN(157, "XIRQ8", UNIPHIER_PIN_IECTRL_EXIST,
443 			     157, UNIPHIER_PIN_DRV_1BIT,
444 			     157, UNIPHIER_PIN_PULL_DOWN),
445 	UNIPHIER_PINCTRL_PIN(158, "AGCBS", UNIPHIER_PIN_IECTRL_EXIST,
446 			     158, UNIPHIER_PIN_DRV_1BIT,
447 			     158, UNIPHIER_PIN_PULL_DOWN),
448 	UNIPHIER_PINCTRL_PIN(159, "XIRQ21", UNIPHIER_PIN_IECTRL_EXIST,
449 			     159, UNIPHIER_PIN_DRV_1BIT,
450 			     159, UNIPHIER_PIN_PULL_DOWN),
451 	UNIPHIER_PINCTRL_PIN(160, "XIRQ22", UNIPHIER_PIN_IECTRL_EXIST,
452 			     160, UNIPHIER_PIN_DRV_1BIT,
453 			     160, UNIPHIER_PIN_PULL_DOWN),
454 	UNIPHIER_PINCTRL_PIN(161, "XIRQ23", UNIPHIER_PIN_IECTRL_EXIST,
455 			     161, UNIPHIER_PIN_DRV_1BIT,
456 			     161, UNIPHIER_PIN_PULL_DOWN),
457 	UNIPHIER_PINCTRL_PIN(162, "CH2CLK", UNIPHIER_PIN_IECTRL_EXIST,
458 			     162, UNIPHIER_PIN_DRV_1BIT,
459 			     162, UNIPHIER_PIN_PULL_DOWN),
460 	UNIPHIER_PINCTRL_PIN(163, "CH2PSYNC", UNIPHIER_PIN_IECTRL_EXIST,
461 			     163, UNIPHIER_PIN_DRV_1BIT,
462 			     163, UNIPHIER_PIN_PULL_DOWN),
463 	UNIPHIER_PINCTRL_PIN(164, "CH2VAL", UNIPHIER_PIN_IECTRL_EXIST,
464 			     164, UNIPHIER_PIN_DRV_1BIT,
465 			     164, UNIPHIER_PIN_PULL_DOWN),
466 	UNIPHIER_PINCTRL_PIN(165, "CH2DATA", UNIPHIER_PIN_IECTRL_EXIST,
467 			     165, UNIPHIER_PIN_DRV_1BIT,
468 			     165, UNIPHIER_PIN_PULL_DOWN),
469 	UNIPHIER_PINCTRL_PIN(166, "CK25O", UNIPHIER_PIN_IECTRL_EXIST,
470 			     166, UNIPHIER_PIN_DRV_1BIT,
471 			     166, UNIPHIER_PIN_PULL_DOWN),
472 };
473 
474 static const unsigned aout1_pins[] = {137, 138, 139, 140, 141, 142};
475 static const int aout1_muxvals[] = {0, 0, 0, 0, 0, 0};
476 static const unsigned aoutiec1_pins[] = {135, 136};
477 static const int aoutiec1_muxvals[] = {0, 0};
478 static const unsigned int emmc_pins[] = {19, 20, 21, 22, 23, 24, 25};
479 static const int emmc_muxvals[] = {0, 0, 0, 0, 0, 0, 0};
480 static const unsigned emmc_dat8_pins[] = {26, 27, 28, 29};
481 static const int emmc_dat8_muxvals[] = {0, 0, 0, 0};
482 static const unsigned ether_rmii_pins[] = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
483 					   16, 17};
484 static const int ether_rmii_muxvals[] = {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4};
485 static const unsigned hscin0_ci_pins[] = {102, 103, 104, 105, 106, 107, 108,
486 					  109, 110, 111, 112};
487 static const int hscin0_ci_muxvals[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
488 static const unsigned hscin0_p_pins[] = {102, 103, 104, 105, 106, 107, 108, 109,
489 					 110, 111, 112};
490 static const int hscin0_p_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
491 static const unsigned hscin0_s_pins[] = {116, 117, 118, 119};
492 static const int hscin0_s_muxvals[] = {3, 3, 3, 3};
493 static const unsigned hscin1_p_pins[] = {124, 125, 126, 127, 128, 129, 130, 131,
494 					 132, 133, 134};
495 static const int hscin1_p_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
496 static const unsigned hscin1_s_pins[] = {120, 121, 122, 123};
497 static const int hscin1_s_muxvals[] = {3, 3, 3, 3};
498 static const unsigned hscin2_s_pins[] = {124, 125, 126, 127};
499 static const int hscin2_s_muxvals[] = {3, 3, 3, 3};
500 static const unsigned hscout0_ci_pins[] = {113, 114, 115, 116, 117, 118, 119,
501 					   120, 121, 122, 123};
502 static const int hscout0_ci_muxvals[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
503 static const unsigned hscout0_p_pins[] = {113, 114, 115, 116, 117, 118, 119,
504 					  120, 121, 122, 123};
505 static const int hscout0_p_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
506 static const unsigned hscout0_s_pins[] = {116, 117, 118, 119};
507 static const int hscout0_s_muxvals[] = {4, 4, 4, 4};
508 static const unsigned hscout1_s_pins[] = {120, 121, 122, 123};
509 static const int hscout1_s_muxvals[] = {4, 4, 4, 4};
510 static const unsigned i2c0_pins[] = {63, 64};
511 static const int i2c0_muxvals[] = {0, 0};
512 static const unsigned i2c1_pins[] = {65, 66};
513 static const int i2c1_muxvals[] = {0, 0};
514 static const unsigned i2c3_pins[] = {67, 68};
515 static const int i2c3_muxvals[] = {1, 1};
516 static const unsigned i2c4_pins[] = {61, 62};
517 static const int i2c4_muxvals[] = {1, 1};
518 static const unsigned nand_pins[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
519 				     15, 16, 17};
520 static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
521 static const unsigned spi0_pins[] = {56, 57, 58, 59};
522 static const int spi0_muxvals[] = {0, 0, 0, 0};
523 static const unsigned spi1_pins[] = {169, 170, 171, 172};
524 static const int spi1_muxvals[] = {1, 1, 1, 1};
525 static const unsigned system_bus_pins[] = {1, 2, 6, 7, 8, 9, 10, 11, 12, 13,
526 					   14, 15, 16, 17};
527 static const int system_bus_muxvals[] = {0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 					 2};
529 static const unsigned system_bus_cs1_pins[] = {0};
530 static const int system_bus_cs1_muxvals[] = {0};
531 static const unsigned uart0_pins[] = {54, 55};
532 static const int uart0_muxvals[] = {0, 0};
533 static const unsigned uart1_pins[] = {58, 59};
534 static const int uart1_muxvals[] = {1, 1};
535 static const unsigned uart2_pins[] = {90, 91};
536 static const int uart2_muxvals[] = {1, 1};
537 static const unsigned uart3_pins[] = {94, 95};
538 static const int uart3_muxvals[] = {1, 1};
539 static const unsigned uart3_ctsrts_pins[] = {96, 97, 98, 99, 100, 101};
540 static const int uart3_ctsrts_muxvals[] = {1, 1, 1, 1, 1, 1};
541 static const unsigned usb0_pins[] = {46, 47};
542 static const int usb0_muxvals[] = {0, 0};
543 static const unsigned usb1_pins[] = {48, 49};
544 static const int usb1_muxvals[] = {0, 0};
545 static const unsigned usb2_pins[] = {50, 51};
546 static const int usb2_muxvals[] = {0, 0};
547 static const unsigned int gpio_range0_pins[] = {
548 	159, 160, 161, 162, 163, 164, 165, 166,		/* PORT0x */
549 	0, 1, 2, 3, 4, 5, 6, 7,				/* PORT1x */
550 	8, 9, 10, 11, 12, 13, 14, 15,			/* PORT2x */
551 	16, 17, 18,					/* PORT30-32 */
552 };
553 static const unsigned int gpio_range1_pins[] = {
554 	46, 47, 48, 49, 50,				/* PORT53-57 */
555 	51,						/* PORT60 */
556 };
557 static const unsigned int gpio_range2_pins[] = {
558 	54, 55, 56, 57, 58,				/* PORT63-67 */
559 	59, 60, 69, 70, 71, 72, 73, 74,			/* PORT7x */
560 	75, 76, 77, 78, 79, 80, 81, 82,			/* PORT8x */
561 	83, 84, 85, 86, 87, 88, 89, 90,			/* PORT9x */
562 	91, 92, 93, 94, 95, 96, 97, 98,			/* PORT10x */
563 };
564 static const unsigned int gpio_range3_pins[] = {
565 	99, 100, 101, 102, 103, 104, 105, 106,		/* PORT12x */
566 	107, 108, 109, 110, 111, 112, 113, 114,		/* PORT13x */
567 	115, 116, 117, 118, 119, 120, 121, 122,		/* PORT14x */
568 	149, 150, 151, 152, 153, 154, 155, 156,		/* XIRQ0-7 */
569 	157, 143, 144, 145, 85, 146, 158, 84,		/* XIRQ8-15 */
570 	141, 142, 148, 50, 51, 159, 160, 161,		/* XIRQ16-23 */
571 	61, 62, 63, 64, 65, 66, 67, 68,			/* PORT18x */
572 };
573 static const unsigned int gpio_range4_pins[] = {
574 	123, 124, 125, 126, 127, 128, 129, 130,		/* PORT20x */
575 	131, 132, 133, 134, 135, 136, 137, 138,		/* PORT21x */
576 	139, 140, 141, 142,				/* PORT220-223 */
577 };
578 static const unsigned int gpio_range5_pins[] = {
579 	147, 148, 149, 150, 151, 152, 153, 154,		/* PORT23x */
580 	155, 156, 157, 143, 144, 145, 146, 158,		/* PORT24x */
581 };
582 
583 static const struct uniphier_pinctrl_group uniphier_ld11_groups[] = {
584 	UNIPHIER_PINCTRL_GROUP(aout1),
585 	UNIPHIER_PINCTRL_GROUP(aoutiec1),
586 	UNIPHIER_PINCTRL_GROUP(emmc),
587 	UNIPHIER_PINCTRL_GROUP(emmc_dat8),
588 	UNIPHIER_PINCTRL_GROUP(ether_rmii),
589 	UNIPHIER_PINCTRL_GROUP(hscin0_ci),
590 	UNIPHIER_PINCTRL_GROUP(hscin0_p),
591 	UNIPHIER_PINCTRL_GROUP(hscin0_s),
592 	UNIPHIER_PINCTRL_GROUP(hscin1_p),
593 	UNIPHIER_PINCTRL_GROUP(hscin1_s),
594 	UNIPHIER_PINCTRL_GROUP(hscin2_s),
595 	UNIPHIER_PINCTRL_GROUP(hscout0_ci),
596 	UNIPHIER_PINCTRL_GROUP(hscout0_p),
597 	UNIPHIER_PINCTRL_GROUP(hscout0_s),
598 	UNIPHIER_PINCTRL_GROUP(hscout1_s),
599 	UNIPHIER_PINCTRL_GROUP(i2c0),
600 	UNIPHIER_PINCTRL_GROUP(i2c1),
601 	UNIPHIER_PINCTRL_GROUP(i2c3),
602 	UNIPHIER_PINCTRL_GROUP(i2c4),
603 	UNIPHIER_PINCTRL_GROUP(nand),
604 	UNIPHIER_PINCTRL_GROUP(spi0),
605 	UNIPHIER_PINCTRL_GROUP(spi1),
606 	UNIPHIER_PINCTRL_GROUP(system_bus),
607 	UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
608 	UNIPHIER_PINCTRL_GROUP(uart0),
609 	UNIPHIER_PINCTRL_GROUP(uart1),
610 	UNIPHIER_PINCTRL_GROUP(uart2),
611 	UNIPHIER_PINCTRL_GROUP(uart3),
612 	UNIPHIER_PINCTRL_GROUP(uart3_ctsrts),
613 	UNIPHIER_PINCTRL_GROUP(usb0),
614 	UNIPHIER_PINCTRL_GROUP(usb1),
615 	UNIPHIER_PINCTRL_GROUP(usb2),
616 	UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range0),
617 	UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range1),
618 	UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range2),
619 	UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range3),
620 	UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range4),
621 	UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range5),
622 };
623 
624 static const char * const aout1_groups[] = {"aout1"};
625 static const char * const aoutiec1_groups[] = {"aoutiec1"};
626 static const char * const emmc_groups[] = {"emmc", "emmc_dat8"};
627 static const char * const ether_rmii_groups[] = {"ether_rmii"};
628 static const char * const hscin0_groups[] = {"hscin0_ci",
629 					     "hscin0_p",
630 					     "hscin0_s"};
631 static const char * const hscin1_groups[] = {"hscin1_p", "hscin1_s"};
632 static const char * const hscin2_groups[] = {"hscin2_s"};
633 static const char * const hscout0_groups[] = {"hscout0_ci",
634 					      "hscout0_p",
635 					      "hscout0_s"};
636 static const char * const hscout1_groups[] = {"hscout1_s"};
637 static const char * const i2c0_groups[] = {"i2c0"};
638 static const char * const i2c1_groups[] = {"i2c1"};
639 static const char * const i2c3_groups[] = {"i2c3"};
640 static const char * const i2c4_groups[] = {"i2c4"};
641 static const char * const nand_groups[] = {"nand"};
642 static const char * const spi0_groups[] = {"spi0"};
643 static const char * const spi1_groups[] = {"spi1"};
644 static const char * const system_bus_groups[] = {"system_bus",
645 						 "system_bus_cs1"};
646 static const char * const uart0_groups[] = {"uart0"};
647 static const char * const uart1_groups[] = {"uart1"};
648 static const char * const uart2_groups[] = {"uart2"};
649 static const char * const uart3_groups[] = {"uart3", "uart3_ctsrts"};
650 static const char * const usb0_groups[] = {"usb0"};
651 static const char * const usb1_groups[] = {"usb1"};
652 static const char * const usb2_groups[] = {"usb2"};
653 
654 static const struct uniphier_pinmux_function uniphier_ld11_functions[] = {
655 	UNIPHIER_PINMUX_FUNCTION(aout1),
656 	UNIPHIER_PINMUX_FUNCTION(aoutiec1),
657 	UNIPHIER_PINMUX_FUNCTION(emmc),
658 	UNIPHIER_PINMUX_FUNCTION(ether_rmii),
659 	UNIPHIER_PINMUX_FUNCTION(hscin0),
660 	UNIPHIER_PINMUX_FUNCTION(hscin1),
661 	UNIPHIER_PINMUX_FUNCTION(hscin2),
662 	UNIPHIER_PINMUX_FUNCTION(hscout0),
663 	UNIPHIER_PINMUX_FUNCTION(hscout1),
664 	UNIPHIER_PINMUX_FUNCTION(i2c0),
665 	UNIPHIER_PINMUX_FUNCTION(i2c1),
666 	UNIPHIER_PINMUX_FUNCTION(i2c3),
667 	UNIPHIER_PINMUX_FUNCTION(i2c4),
668 	UNIPHIER_PINMUX_FUNCTION(nand),
669 	UNIPHIER_PINMUX_FUNCTION(spi0),
670 	UNIPHIER_PINMUX_FUNCTION(spi1),
671 	UNIPHIER_PINMUX_FUNCTION(system_bus),
672 	UNIPHIER_PINMUX_FUNCTION(uart0),
673 	UNIPHIER_PINMUX_FUNCTION(uart1),
674 	UNIPHIER_PINMUX_FUNCTION(uart2),
675 	UNIPHIER_PINMUX_FUNCTION(uart3),
676 	UNIPHIER_PINMUX_FUNCTION(usb0),
677 	UNIPHIER_PINMUX_FUNCTION(usb1),
678 	UNIPHIER_PINMUX_FUNCTION(usb2),
679 };
680 
uniphier_ld11_get_gpio_muxval(unsigned int pin,unsigned int gpio_offset)681 static int uniphier_ld11_get_gpio_muxval(unsigned int pin,
682 					 unsigned int gpio_offset)
683 {
684 	if (gpio_offset == 132 || gpio_offset == 135)	/* XIRQ12, 15 */
685 		return 13;
686 
687 	if (gpio_offset >= 120 && gpio_offset <= 143)	/* XIRQx */
688 		return 14;
689 
690 	return 15;
691 }
692 
693 static struct uniphier_pinctrl_socdata uniphier_ld11_pindata = {
694 	.pins = uniphier_ld11_pins,
695 	.npins = ARRAY_SIZE(uniphier_ld11_pins),
696 	.groups = uniphier_ld11_groups,
697 	.groups_count = ARRAY_SIZE(uniphier_ld11_groups),
698 	.functions = uniphier_ld11_functions,
699 	.functions_count = ARRAY_SIZE(uniphier_ld11_functions),
700 	.get_gpio_muxval = uniphier_ld11_get_gpio_muxval,
701 	.caps = UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL,
702 };
703 
uniphier_ld11_pinctrl_probe(struct platform_device * pdev)704 static int uniphier_ld11_pinctrl_probe(struct platform_device *pdev)
705 {
706 	return uniphier_pinctrl_probe(pdev, &uniphier_ld11_pindata);
707 }
708 
709 static const struct of_device_id uniphier_ld11_pinctrl_match[] = {
710 	{ .compatible = "socionext,uniphier-ld11-pinctrl" },
711 	{ /* sentinel */ }
712 };
713 
714 static struct platform_driver uniphier_ld11_pinctrl_driver = {
715 	.probe = uniphier_ld11_pinctrl_probe,
716 	.driver = {
717 		.name = "uniphier-ld11-pinctrl",
718 		.of_match_table = uniphier_ld11_pinctrl_match,
719 		.pm = &uniphier_pinctrl_pm_ops,
720 	},
721 };
722 builtin_platform_driver(uniphier_ld11_pinctrl_driver);
723