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