1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (c) 2015, Sony Mobile Communications AB.
4  */
5 
6 #include <linux/module.h>
7 #include <linux/of.h>
8 #include <linux/platform_device.h>
9 #include <linux/pinctrl/pinctrl.h>
10 
11 #include "pinctrl-msm.h"
12 
13 static const struct pinctrl_pin_desc msm8660_pins[] = {
14 	PINCTRL_PIN(0, "GPIO_0"),
15 	PINCTRL_PIN(1, "GPIO_1"),
16 	PINCTRL_PIN(2, "GPIO_2"),
17 	PINCTRL_PIN(3, "GPIO_3"),
18 	PINCTRL_PIN(4, "GPIO_4"),
19 	PINCTRL_PIN(5, "GPIO_5"),
20 	PINCTRL_PIN(6, "GPIO_6"),
21 	PINCTRL_PIN(7, "GPIO_7"),
22 	PINCTRL_PIN(8, "GPIO_8"),
23 	PINCTRL_PIN(9, "GPIO_9"),
24 	PINCTRL_PIN(10, "GPIO_10"),
25 	PINCTRL_PIN(11, "GPIO_11"),
26 	PINCTRL_PIN(12, "GPIO_12"),
27 	PINCTRL_PIN(13, "GPIO_13"),
28 	PINCTRL_PIN(14, "GPIO_14"),
29 	PINCTRL_PIN(15, "GPIO_15"),
30 	PINCTRL_PIN(16, "GPIO_16"),
31 	PINCTRL_PIN(17, "GPIO_17"),
32 	PINCTRL_PIN(18, "GPIO_18"),
33 	PINCTRL_PIN(19, "GPIO_19"),
34 	PINCTRL_PIN(20, "GPIO_20"),
35 	PINCTRL_PIN(21, "GPIO_21"),
36 	PINCTRL_PIN(22, "GPIO_22"),
37 	PINCTRL_PIN(23, "GPIO_23"),
38 	PINCTRL_PIN(24, "GPIO_24"),
39 	PINCTRL_PIN(25, "GPIO_25"),
40 	PINCTRL_PIN(26, "GPIO_26"),
41 	PINCTRL_PIN(27, "GPIO_27"),
42 	PINCTRL_PIN(28, "GPIO_28"),
43 	PINCTRL_PIN(29, "GPIO_29"),
44 	PINCTRL_PIN(30, "GPIO_30"),
45 	PINCTRL_PIN(31, "GPIO_31"),
46 	PINCTRL_PIN(32, "GPIO_32"),
47 	PINCTRL_PIN(33, "GPIO_33"),
48 	PINCTRL_PIN(34, "GPIO_34"),
49 	PINCTRL_PIN(35, "GPIO_35"),
50 	PINCTRL_PIN(36, "GPIO_36"),
51 	PINCTRL_PIN(37, "GPIO_37"),
52 	PINCTRL_PIN(38, "GPIO_38"),
53 	PINCTRL_PIN(39, "GPIO_39"),
54 	PINCTRL_PIN(40, "GPIO_40"),
55 	PINCTRL_PIN(41, "GPIO_41"),
56 	PINCTRL_PIN(42, "GPIO_42"),
57 	PINCTRL_PIN(43, "GPIO_43"),
58 	PINCTRL_PIN(44, "GPIO_44"),
59 	PINCTRL_PIN(45, "GPIO_45"),
60 	PINCTRL_PIN(46, "GPIO_46"),
61 	PINCTRL_PIN(47, "GPIO_47"),
62 	PINCTRL_PIN(48, "GPIO_48"),
63 	PINCTRL_PIN(49, "GPIO_49"),
64 	PINCTRL_PIN(50, "GPIO_50"),
65 	PINCTRL_PIN(51, "GPIO_51"),
66 	PINCTRL_PIN(52, "GPIO_52"),
67 	PINCTRL_PIN(53, "GPIO_53"),
68 	PINCTRL_PIN(54, "GPIO_54"),
69 	PINCTRL_PIN(55, "GPIO_55"),
70 	PINCTRL_PIN(56, "GPIO_56"),
71 	PINCTRL_PIN(57, "GPIO_57"),
72 	PINCTRL_PIN(58, "GPIO_58"),
73 	PINCTRL_PIN(59, "GPIO_59"),
74 	PINCTRL_PIN(60, "GPIO_60"),
75 	PINCTRL_PIN(61, "GPIO_61"),
76 	PINCTRL_PIN(62, "GPIO_62"),
77 	PINCTRL_PIN(63, "GPIO_63"),
78 	PINCTRL_PIN(64, "GPIO_64"),
79 	PINCTRL_PIN(65, "GPIO_65"),
80 	PINCTRL_PIN(66, "GPIO_66"),
81 	PINCTRL_PIN(67, "GPIO_67"),
82 	PINCTRL_PIN(68, "GPIO_68"),
83 	PINCTRL_PIN(69, "GPIO_69"),
84 	PINCTRL_PIN(70, "GPIO_70"),
85 	PINCTRL_PIN(71, "GPIO_71"),
86 	PINCTRL_PIN(72, "GPIO_72"),
87 	PINCTRL_PIN(73, "GPIO_73"),
88 	PINCTRL_PIN(74, "GPIO_74"),
89 	PINCTRL_PIN(75, "GPIO_75"),
90 	PINCTRL_PIN(76, "GPIO_76"),
91 	PINCTRL_PIN(77, "GPIO_77"),
92 	PINCTRL_PIN(78, "GPIO_78"),
93 	PINCTRL_PIN(79, "GPIO_79"),
94 	PINCTRL_PIN(80, "GPIO_80"),
95 	PINCTRL_PIN(81, "GPIO_81"),
96 	PINCTRL_PIN(82, "GPIO_82"),
97 	PINCTRL_PIN(83, "GPIO_83"),
98 	PINCTRL_PIN(84, "GPIO_84"),
99 	PINCTRL_PIN(85, "GPIO_85"),
100 	PINCTRL_PIN(86, "GPIO_86"),
101 	PINCTRL_PIN(87, "GPIO_87"),
102 	PINCTRL_PIN(88, "GPIO_88"),
103 	PINCTRL_PIN(89, "GPIO_89"),
104 	PINCTRL_PIN(90, "GPIO_90"),
105 	PINCTRL_PIN(91, "GPIO_91"),
106 	PINCTRL_PIN(92, "GPIO_92"),
107 	PINCTRL_PIN(93, "GPIO_93"),
108 	PINCTRL_PIN(94, "GPIO_94"),
109 	PINCTRL_PIN(95, "GPIO_95"),
110 	PINCTRL_PIN(96, "GPIO_96"),
111 	PINCTRL_PIN(97, "GPIO_97"),
112 	PINCTRL_PIN(98, "GPIO_98"),
113 	PINCTRL_PIN(99, "GPIO_99"),
114 	PINCTRL_PIN(100, "GPIO_100"),
115 	PINCTRL_PIN(101, "GPIO_101"),
116 	PINCTRL_PIN(102, "GPIO_102"),
117 	PINCTRL_PIN(103, "GPIO_103"),
118 	PINCTRL_PIN(104, "GPIO_104"),
119 	PINCTRL_PIN(105, "GPIO_105"),
120 	PINCTRL_PIN(106, "GPIO_106"),
121 	PINCTRL_PIN(107, "GPIO_107"),
122 	PINCTRL_PIN(108, "GPIO_108"),
123 	PINCTRL_PIN(109, "GPIO_109"),
124 	PINCTRL_PIN(110, "GPIO_110"),
125 	PINCTRL_PIN(111, "GPIO_111"),
126 	PINCTRL_PIN(112, "GPIO_112"),
127 	PINCTRL_PIN(113, "GPIO_113"),
128 	PINCTRL_PIN(114, "GPIO_114"),
129 	PINCTRL_PIN(115, "GPIO_115"),
130 	PINCTRL_PIN(116, "GPIO_116"),
131 	PINCTRL_PIN(117, "GPIO_117"),
132 	PINCTRL_PIN(118, "GPIO_118"),
133 	PINCTRL_PIN(119, "GPIO_119"),
134 	PINCTRL_PIN(120, "GPIO_120"),
135 	PINCTRL_PIN(121, "GPIO_121"),
136 	PINCTRL_PIN(122, "GPIO_122"),
137 	PINCTRL_PIN(123, "GPIO_123"),
138 	PINCTRL_PIN(124, "GPIO_124"),
139 	PINCTRL_PIN(125, "GPIO_125"),
140 	PINCTRL_PIN(126, "GPIO_126"),
141 	PINCTRL_PIN(127, "GPIO_127"),
142 	PINCTRL_PIN(128, "GPIO_128"),
143 	PINCTRL_PIN(129, "GPIO_129"),
144 	PINCTRL_PIN(130, "GPIO_130"),
145 	PINCTRL_PIN(131, "GPIO_131"),
146 	PINCTRL_PIN(132, "GPIO_132"),
147 	PINCTRL_PIN(133, "GPIO_133"),
148 	PINCTRL_PIN(134, "GPIO_134"),
149 	PINCTRL_PIN(135, "GPIO_135"),
150 	PINCTRL_PIN(136, "GPIO_136"),
151 	PINCTRL_PIN(137, "GPIO_137"),
152 	PINCTRL_PIN(138, "GPIO_138"),
153 	PINCTRL_PIN(139, "GPIO_139"),
154 	PINCTRL_PIN(140, "GPIO_140"),
155 	PINCTRL_PIN(141, "GPIO_141"),
156 	PINCTRL_PIN(142, "GPIO_142"),
157 	PINCTRL_PIN(143, "GPIO_143"),
158 	PINCTRL_PIN(144, "GPIO_144"),
159 	PINCTRL_PIN(145, "GPIO_145"),
160 	PINCTRL_PIN(146, "GPIO_146"),
161 	PINCTRL_PIN(147, "GPIO_147"),
162 	PINCTRL_PIN(148, "GPIO_148"),
163 	PINCTRL_PIN(149, "GPIO_149"),
164 	PINCTRL_PIN(150, "GPIO_150"),
165 	PINCTRL_PIN(151, "GPIO_151"),
166 	PINCTRL_PIN(152, "GPIO_152"),
167 	PINCTRL_PIN(153, "GPIO_153"),
168 	PINCTRL_PIN(154, "GPIO_154"),
169 	PINCTRL_PIN(155, "GPIO_155"),
170 	PINCTRL_PIN(156, "GPIO_156"),
171 	PINCTRL_PIN(157, "GPIO_157"),
172 	PINCTRL_PIN(158, "GPIO_158"),
173 	PINCTRL_PIN(159, "GPIO_159"),
174 	PINCTRL_PIN(160, "GPIO_160"),
175 	PINCTRL_PIN(161, "GPIO_161"),
176 	PINCTRL_PIN(162, "GPIO_162"),
177 	PINCTRL_PIN(163, "GPIO_163"),
178 	PINCTRL_PIN(164, "GPIO_164"),
179 	PINCTRL_PIN(165, "GPIO_165"),
180 	PINCTRL_PIN(166, "GPIO_166"),
181 	PINCTRL_PIN(167, "GPIO_167"),
182 	PINCTRL_PIN(168, "GPIO_168"),
183 	PINCTRL_PIN(169, "GPIO_169"),
184 	PINCTRL_PIN(170, "GPIO_170"),
185 	PINCTRL_PIN(171, "GPIO_171"),
186 	PINCTRL_PIN(172, "GPIO_172"),
187 
188 	PINCTRL_PIN(173, "SDC4_CLK"),
189 	PINCTRL_PIN(174, "SDC4_CMD"),
190 	PINCTRL_PIN(175, "SDC4_DATA"),
191 	PINCTRL_PIN(176, "SDC3_CLK"),
192 	PINCTRL_PIN(177, "SDC3_CMD"),
193 	PINCTRL_PIN(178, "SDC3_DATA"),
194 };
195 
196 #define DECLARE_MSM_GPIO_PIN(pin) static const unsigned int gpio##pin##_pins[] = { pin }
197 DECLARE_MSM_GPIO_PIN(0);
198 DECLARE_MSM_GPIO_PIN(1);
199 DECLARE_MSM_GPIO_PIN(2);
200 DECLARE_MSM_GPIO_PIN(3);
201 DECLARE_MSM_GPIO_PIN(4);
202 DECLARE_MSM_GPIO_PIN(5);
203 DECLARE_MSM_GPIO_PIN(6);
204 DECLARE_MSM_GPIO_PIN(7);
205 DECLARE_MSM_GPIO_PIN(8);
206 DECLARE_MSM_GPIO_PIN(9);
207 DECLARE_MSM_GPIO_PIN(10);
208 DECLARE_MSM_GPIO_PIN(11);
209 DECLARE_MSM_GPIO_PIN(12);
210 DECLARE_MSM_GPIO_PIN(13);
211 DECLARE_MSM_GPIO_PIN(14);
212 DECLARE_MSM_GPIO_PIN(15);
213 DECLARE_MSM_GPIO_PIN(16);
214 DECLARE_MSM_GPIO_PIN(17);
215 DECLARE_MSM_GPIO_PIN(18);
216 DECLARE_MSM_GPIO_PIN(19);
217 DECLARE_MSM_GPIO_PIN(20);
218 DECLARE_MSM_GPIO_PIN(21);
219 DECLARE_MSM_GPIO_PIN(22);
220 DECLARE_MSM_GPIO_PIN(23);
221 DECLARE_MSM_GPIO_PIN(24);
222 DECLARE_MSM_GPIO_PIN(25);
223 DECLARE_MSM_GPIO_PIN(26);
224 DECLARE_MSM_GPIO_PIN(27);
225 DECLARE_MSM_GPIO_PIN(28);
226 DECLARE_MSM_GPIO_PIN(29);
227 DECLARE_MSM_GPIO_PIN(30);
228 DECLARE_MSM_GPIO_PIN(31);
229 DECLARE_MSM_GPIO_PIN(32);
230 DECLARE_MSM_GPIO_PIN(33);
231 DECLARE_MSM_GPIO_PIN(34);
232 DECLARE_MSM_GPIO_PIN(35);
233 DECLARE_MSM_GPIO_PIN(36);
234 DECLARE_MSM_GPIO_PIN(37);
235 DECLARE_MSM_GPIO_PIN(38);
236 DECLARE_MSM_GPIO_PIN(39);
237 DECLARE_MSM_GPIO_PIN(40);
238 DECLARE_MSM_GPIO_PIN(41);
239 DECLARE_MSM_GPIO_PIN(42);
240 DECLARE_MSM_GPIO_PIN(43);
241 DECLARE_MSM_GPIO_PIN(44);
242 DECLARE_MSM_GPIO_PIN(45);
243 DECLARE_MSM_GPIO_PIN(46);
244 DECLARE_MSM_GPIO_PIN(47);
245 DECLARE_MSM_GPIO_PIN(48);
246 DECLARE_MSM_GPIO_PIN(49);
247 DECLARE_MSM_GPIO_PIN(50);
248 DECLARE_MSM_GPIO_PIN(51);
249 DECLARE_MSM_GPIO_PIN(52);
250 DECLARE_MSM_GPIO_PIN(53);
251 DECLARE_MSM_GPIO_PIN(54);
252 DECLARE_MSM_GPIO_PIN(55);
253 DECLARE_MSM_GPIO_PIN(56);
254 DECLARE_MSM_GPIO_PIN(57);
255 DECLARE_MSM_GPIO_PIN(58);
256 DECLARE_MSM_GPIO_PIN(59);
257 DECLARE_MSM_GPIO_PIN(60);
258 DECLARE_MSM_GPIO_PIN(61);
259 DECLARE_MSM_GPIO_PIN(62);
260 DECLARE_MSM_GPIO_PIN(63);
261 DECLARE_MSM_GPIO_PIN(64);
262 DECLARE_MSM_GPIO_PIN(65);
263 DECLARE_MSM_GPIO_PIN(66);
264 DECLARE_MSM_GPIO_PIN(67);
265 DECLARE_MSM_GPIO_PIN(68);
266 DECLARE_MSM_GPIO_PIN(69);
267 DECLARE_MSM_GPIO_PIN(70);
268 DECLARE_MSM_GPIO_PIN(71);
269 DECLARE_MSM_GPIO_PIN(72);
270 DECLARE_MSM_GPIO_PIN(73);
271 DECLARE_MSM_GPIO_PIN(74);
272 DECLARE_MSM_GPIO_PIN(75);
273 DECLARE_MSM_GPIO_PIN(76);
274 DECLARE_MSM_GPIO_PIN(77);
275 DECLARE_MSM_GPIO_PIN(78);
276 DECLARE_MSM_GPIO_PIN(79);
277 DECLARE_MSM_GPIO_PIN(80);
278 DECLARE_MSM_GPIO_PIN(81);
279 DECLARE_MSM_GPIO_PIN(82);
280 DECLARE_MSM_GPIO_PIN(83);
281 DECLARE_MSM_GPIO_PIN(84);
282 DECLARE_MSM_GPIO_PIN(85);
283 DECLARE_MSM_GPIO_PIN(86);
284 DECLARE_MSM_GPIO_PIN(87);
285 DECLARE_MSM_GPIO_PIN(88);
286 DECLARE_MSM_GPIO_PIN(89);
287 DECLARE_MSM_GPIO_PIN(90);
288 DECLARE_MSM_GPIO_PIN(91);
289 DECLARE_MSM_GPIO_PIN(92);
290 DECLARE_MSM_GPIO_PIN(93);
291 DECLARE_MSM_GPIO_PIN(94);
292 DECLARE_MSM_GPIO_PIN(95);
293 DECLARE_MSM_GPIO_PIN(96);
294 DECLARE_MSM_GPIO_PIN(97);
295 DECLARE_MSM_GPIO_PIN(98);
296 DECLARE_MSM_GPIO_PIN(99);
297 DECLARE_MSM_GPIO_PIN(100);
298 DECLARE_MSM_GPIO_PIN(101);
299 DECLARE_MSM_GPIO_PIN(102);
300 DECLARE_MSM_GPIO_PIN(103);
301 DECLARE_MSM_GPIO_PIN(104);
302 DECLARE_MSM_GPIO_PIN(105);
303 DECLARE_MSM_GPIO_PIN(106);
304 DECLARE_MSM_GPIO_PIN(107);
305 DECLARE_MSM_GPIO_PIN(108);
306 DECLARE_MSM_GPIO_PIN(109);
307 DECLARE_MSM_GPIO_PIN(110);
308 DECLARE_MSM_GPIO_PIN(111);
309 DECLARE_MSM_GPIO_PIN(112);
310 DECLARE_MSM_GPIO_PIN(113);
311 DECLARE_MSM_GPIO_PIN(114);
312 DECLARE_MSM_GPIO_PIN(115);
313 DECLARE_MSM_GPIO_PIN(116);
314 DECLARE_MSM_GPIO_PIN(117);
315 DECLARE_MSM_GPIO_PIN(118);
316 DECLARE_MSM_GPIO_PIN(119);
317 DECLARE_MSM_GPIO_PIN(120);
318 DECLARE_MSM_GPIO_PIN(121);
319 DECLARE_MSM_GPIO_PIN(122);
320 DECLARE_MSM_GPIO_PIN(123);
321 DECLARE_MSM_GPIO_PIN(124);
322 DECLARE_MSM_GPIO_PIN(125);
323 DECLARE_MSM_GPIO_PIN(126);
324 DECLARE_MSM_GPIO_PIN(127);
325 DECLARE_MSM_GPIO_PIN(128);
326 DECLARE_MSM_GPIO_PIN(129);
327 DECLARE_MSM_GPIO_PIN(130);
328 DECLARE_MSM_GPIO_PIN(131);
329 DECLARE_MSM_GPIO_PIN(132);
330 DECLARE_MSM_GPIO_PIN(133);
331 DECLARE_MSM_GPIO_PIN(134);
332 DECLARE_MSM_GPIO_PIN(135);
333 DECLARE_MSM_GPIO_PIN(136);
334 DECLARE_MSM_GPIO_PIN(137);
335 DECLARE_MSM_GPIO_PIN(138);
336 DECLARE_MSM_GPIO_PIN(139);
337 DECLARE_MSM_GPIO_PIN(140);
338 DECLARE_MSM_GPIO_PIN(141);
339 DECLARE_MSM_GPIO_PIN(142);
340 DECLARE_MSM_GPIO_PIN(143);
341 DECLARE_MSM_GPIO_PIN(144);
342 DECLARE_MSM_GPIO_PIN(145);
343 DECLARE_MSM_GPIO_PIN(146);
344 DECLARE_MSM_GPIO_PIN(147);
345 DECLARE_MSM_GPIO_PIN(148);
346 DECLARE_MSM_GPIO_PIN(149);
347 DECLARE_MSM_GPIO_PIN(150);
348 DECLARE_MSM_GPIO_PIN(151);
349 DECLARE_MSM_GPIO_PIN(152);
350 DECLARE_MSM_GPIO_PIN(153);
351 DECLARE_MSM_GPIO_PIN(154);
352 DECLARE_MSM_GPIO_PIN(155);
353 DECLARE_MSM_GPIO_PIN(156);
354 DECLARE_MSM_GPIO_PIN(157);
355 DECLARE_MSM_GPIO_PIN(158);
356 DECLARE_MSM_GPIO_PIN(159);
357 DECLARE_MSM_GPIO_PIN(160);
358 DECLARE_MSM_GPIO_PIN(161);
359 DECLARE_MSM_GPIO_PIN(162);
360 DECLARE_MSM_GPIO_PIN(163);
361 DECLARE_MSM_GPIO_PIN(164);
362 DECLARE_MSM_GPIO_PIN(165);
363 DECLARE_MSM_GPIO_PIN(166);
364 DECLARE_MSM_GPIO_PIN(167);
365 DECLARE_MSM_GPIO_PIN(168);
366 DECLARE_MSM_GPIO_PIN(169);
367 DECLARE_MSM_GPIO_PIN(170);
368 DECLARE_MSM_GPIO_PIN(171);
369 DECLARE_MSM_GPIO_PIN(172);
370 
371 static const unsigned int sdc4_clk_pins[] = { 173 };
372 static const unsigned int sdc4_cmd_pins[] = { 174 };
373 static const unsigned int sdc4_data_pins[] = { 175 };
374 static const unsigned int sdc3_clk_pins[] = { 176 };
375 static const unsigned int sdc3_cmd_pins[] = { 177 };
376 static const unsigned int sdc3_data_pins[] = { 178 };
377 
378 #define FUNCTION(fname)					\
379 	[MSM_MUX_##fname] = {				\
380 		.name = #fname,				\
381 		.groups = fname##_groups,		\
382 		.ngroups = ARRAY_SIZE(fname##_groups),	\
383 	}
384 
385 #define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7) \
386 	{						\
387 		.name = "gpio" #id,			\
388 		.pins = gpio##id##_pins,		\
389 		.npins = ARRAY_SIZE(gpio##id##_pins),	\
390 		.funcs = (int[]){			\
391 			MSM_MUX_gpio,			\
392 			MSM_MUX_##f1,			\
393 			MSM_MUX_##f2,			\
394 			MSM_MUX_##f3,			\
395 			MSM_MUX_##f4,			\
396 			MSM_MUX_##f5,			\
397 			MSM_MUX_##f6,			\
398 			MSM_MUX_##f7,			\
399 		},					\
400 		.nfuncs = 8,				\
401 		.ctl_reg = 0x1000 + 0x10 * id,		\
402 		.io_reg = 0x1004 + 0x10 * id,		\
403 		.intr_cfg_reg = 0x1008 + 0x10 * id,	\
404 		.intr_status_reg = 0x100c + 0x10 * id,	\
405 		.intr_target_reg = 0x400 + 0x4 * id,	\
406 		.mux_bit = 2,				\
407 		.pull_bit = 0,				\
408 		.drv_bit = 6,				\
409 		.oe_bit = 9,				\
410 		.in_bit = 0,				\
411 		.out_bit = 1,				\
412 		.intr_enable_bit = 0,			\
413 		.intr_status_bit = 0,			\
414 		.intr_ack_high = 1,			\
415 		.intr_target_bit = 0,			\
416 		.intr_target_kpss_val = 4,		\
417 		.intr_raw_status_bit = 3,		\
418 		.intr_polarity_bit = 1,			\
419 		.intr_detection_bit = 2,		\
420 		.intr_detection_width = 1,		\
421 	}
422 
423 #define SDC_PINGROUP(pg_name, ctl, pull, drv)		\
424 	{						\
425 		.name = #pg_name,			\
426 		.pins = pg_name##_pins,			\
427 		.npins = ARRAY_SIZE(pg_name##_pins),	\
428 		.ctl_reg = ctl,				\
429 		.io_reg = 0,				\
430 		.intr_cfg_reg = 0,			\
431 		.intr_status_reg = 0,			\
432 		.intr_target_reg = 0,			\
433 		.mux_bit = -1,				\
434 		.pull_bit = pull,			\
435 		.drv_bit = drv,				\
436 		.oe_bit = -1,				\
437 		.in_bit = -1,				\
438 		.out_bit = -1,				\
439 		.intr_enable_bit = -1,			\
440 		.intr_status_bit = -1,			\
441 		.intr_target_bit = -1,			\
442 		.intr_target_kpss_val = -1,		\
443 		.intr_raw_status_bit = -1,		\
444 		.intr_polarity_bit = -1,		\
445 		.intr_detection_bit = -1,		\
446 		.intr_detection_width = -1,		\
447 	}
448 
449 enum msm8660_functions {
450 	MSM_MUX_gpio,
451 	MSM_MUX_cam_mclk,
452 	MSM_MUX_dsub,
453 	MSM_MUX_ext_gps,
454 	MSM_MUX_gp_clk_0a,
455 	MSM_MUX_gp_clk_0b,
456 	MSM_MUX_gp_clk_1a,
457 	MSM_MUX_gp_clk_1b,
458 	MSM_MUX_gp_clk_2a,
459 	MSM_MUX_gp_clk_2b,
460 	MSM_MUX_gp_mn,
461 	MSM_MUX_gsbi1,
462 	MSM_MUX_gsbi1_spi_cs1_n,
463 	MSM_MUX_gsbi1_spi_cs2a_n,
464 	MSM_MUX_gsbi1_spi_cs2b_n,
465 	MSM_MUX_gsbi1_spi_cs3_n,
466 	MSM_MUX_gsbi2,
467 	MSM_MUX_gsbi2_spi_cs1_n,
468 	MSM_MUX_gsbi2_spi_cs2_n,
469 	MSM_MUX_gsbi2_spi_cs3_n,
470 	MSM_MUX_gsbi3,
471 	MSM_MUX_gsbi3_spi_cs1_n,
472 	MSM_MUX_gsbi3_spi_cs2_n,
473 	MSM_MUX_gsbi3_spi_cs3_n,
474 	MSM_MUX_gsbi4,
475 	MSM_MUX_gsbi5,
476 	MSM_MUX_gsbi6,
477 	MSM_MUX_gsbi7,
478 	MSM_MUX_gsbi8,
479 	MSM_MUX_gsbi9,
480 	MSM_MUX_gsbi10,
481 	MSM_MUX_gsbi11,
482 	MSM_MUX_gsbi12,
483 	MSM_MUX_hdmi,
484 	MSM_MUX_i2s,
485 	MSM_MUX_lcdc,
486 	MSM_MUX_mdp_vsync,
487 	MSM_MUX_mi2s,
488 	MSM_MUX_pcm,
489 	MSM_MUX_ps_hold,
490 	MSM_MUX_sdc1,
491 	MSM_MUX_sdc2,
492 	MSM_MUX_sdc5,
493 	MSM_MUX_tsif1,
494 	MSM_MUX_tsif2,
495 	MSM_MUX_usb_fs1,
496 	MSM_MUX_usb_fs1_oe_n,
497 	MSM_MUX_usb_fs2,
498 	MSM_MUX_usb_fs2_oe_n,
499 	MSM_MUX_vfe,
500 	MSM_MUX_vsens_alarm,
501 	MSM_MUX_ebi2cs,
502 	MSM_MUX_ebi2,
503 	MSM_MUX__,
504 };
505 
506 static const char * const gpio_groups[] = {
507 	"gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
508 	"gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
509 	"gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
510 	"gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
511 	"gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
512 	"gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
513 	"gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
514 	"gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
515 	"gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
516 	"gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
517 	"gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
518 	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
519 	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89", "gpio90", "gpio91",
520 	"gpio92", "gpio93", "gpio94", "gpio95", "gpio96", "gpio97", "gpio98",
521 	"gpio99", "gpio100", "gpio101", "gpio102", "gpio103", "gpio104",
522 	"gpio105", "gpio106", "gpio107", "gpio108", "gpio109", "gpio110",
523 	"gpio111", "gpio112", "gpio113", "gpio114", "gpio115", "gpio116",
524 	"gpio117", "gpio118", "gpio119", "gpio120", "gpio121", "gpio122",
525 	"gpio123", "gpio124", "gpio125", "gpio126", "gpio127", "gpio128",
526 	"gpio129", "gpio130", "gpio131", "gpio132", "gpio133", "gpio134",
527 	"gpio135", "gpio136", "gpio137", "gpio138", "gpio139", "gpio140",
528 	"gpio141", "gpio142", "gpio143", "gpio144", "gpio145", "gpio146",
529 	"gpio147", "gpio148", "gpio149", "gpio150", "gpio151", "gpio152",
530 	"gpio153", "gpio154", "gpio155", "gpio156", "gpio157", "gpio158",
531 	"gpio159", "gpio160", "gpio161", "gpio162", "gpio163", "gpio164",
532 	"gpio165", "gpio166", "gpio167", "gpio168", "gpio169", "gpio170",
533 	"gpio171", "gpio172"
534 };
535 
536 static const char * const cam_mclk_groups[] = {
537 	"gpio32"
538 };
539 static const char * const dsub_groups[] = {
540 	"gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
541 	"gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
542 	"gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
543 	"gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27"
544 };
545 static const char * const ext_gps_groups[] = {
546 	"gpio66", "gpio67", "gpio68", "gpio69"
547 };
548 static const char * const gp_clk_0a_groups[] = {
549 	"gpio30"
550 };
551 static const char * const gp_clk_0b_groups[] = {
552 	"gpio115"
553 };
554 static const char * const gp_clk_1a_groups[] = {
555 	"gpio31"
556 };
557 static const char * const gp_clk_1b_groups[] = {
558 	"gpio122"
559 };
560 static const char * const gp_clk_2a_groups[] = {
561 	"gpio103"
562 };
563 static const char * const gp_clk_2b_groups[] = {
564 	"gpio70"
565 };
566 static const char * const gp_mn_groups[] = {
567 	"gpio29"
568 };
569 static const char * const gsbi1_groups[] = {
570 	"gpio33", "gpio34", "gpio35", "gpio36"
571 };
572 static const char * const gsbi1_spi_cs1_n_groups[] = {
573 };
574 static const char * const gsbi1_spi_cs2a_n_groups[] = {
575 };
576 static const char * const gsbi1_spi_cs2b_n_groups[] = {
577 };
578 static const char * const gsbi1_spi_cs3_n_groups[] = {
579 };
580 static const char * const gsbi2_groups[] = {
581 	"gpio37", "gpio38", "gpio39", "gpio40"
582 };
583 static const char * const gsbi2_spi_cs1_n_groups[] = {
584 	"gpio123"
585 };
586 static const char * const gsbi2_spi_cs2_n_groups[] = {
587 	"gpio124"
588 };
589 static const char * const gsbi2_spi_cs3_n_groups[] = {
590 	"gpio125"
591 };
592 static const char * const gsbi3_groups[] = {
593 	"gpio41", "gpio42", "gpio43", "gpio44"
594 };
595 static const char * const gsbi3_spi_cs1_n_groups[] = {
596 	"gpio62"
597 };
598 static const char * const gsbi3_spi_cs2_n_groups[] = {
599 	"gpio45"
600 };
601 static const char * const gsbi3_spi_cs3_n_groups[] = {
602 	"gpio46"
603 };
604 static const char * const gsbi4_groups[] = {
605 	"gpio45", "gpio56", "gpio47", "gpio48"
606 };
607 static const char * const gsbi5_groups[] = {
608 	"gpio49", "gpio50", "gpio51", "gpio52"
609 };
610 static const char * const gsbi6_groups[] = {
611 	"gpio53", "gpio54", "gpio55", "gpio56"
612 };
613 static const char * const gsbi7_groups[] = {
614 	"gpio57", "gpio58", "gpio59", "gpio60"
615 };
616 static const char * const gsbi8_groups[] = {
617 	"gpio62", "gpio63", "gpio64", "gpio65"
618 };
619 static const char * const gsbi9_groups[] = {
620 	"gpio66", "gpio67", "gpio68", "gpio69"
621 };
622 static const char * const gsbi10_groups[] = {
623 	"gpio70", "gpio71", "gpio72", "gpio73"
624 };
625 static const char * const gsbi11_groups[] = {
626 	"gpio103", "gpio104", "gpio105", "gpio106"
627 };
628 static const char * const gsbi12_groups[] = {
629 	"gpio115", "gpio116", "gpio117", "gpio118"
630 };
631 static const char * const hdmi_groups[] = {
632 	"gpio169", "gpio170", "gpio171", "gpio172"
633 };
634 static const char * const i2s_groups[] = {
635 	"gpio108", "gpio109", "gpio110", "gpio115", "gpio116", "gpio117",
636 	"gpio118", "gpio119", "gpio120", "gpio121", "gpio122"
637 };
638 static const char * const lcdc_groups[] = {
639 	"gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
640 	"gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
641 	"gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
642 	"gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27"
643 };
644 static const char * const mdp_vsync_groups[] = {
645 	"gpio28", "gpio39", "gpio41"
646 };
647 static const char * const mi2s_groups[] = {
648 	"gpio101", "gpio102", "gpio103", "gpio104", "gpio105", "gpio106",
649 	"gpio107"
650 };
651 static const char * const pcm_groups[] = {
652 	"gpio111", "gpio112", "gpio113", "gpio114"
653 };
654 static const char * const ps_hold_groups[] = {
655 	"gpio92"
656 };
657 static const char * const sdc1_groups[] = {
658 	"gpio159", "gpio160", "gpio161", "gpio162", "gpio163", "gpio164",
659 	"gpio165", "gpio166", "gpio167", "gpio168"
660 };
661 static const char * const sdc2_groups[] = {
662 	"gpio143", "gpio144", "gpio145", "gpio146", "gpio147", "gpio148",
663 	"gpio149", "gpio150", "gpio151", "gpio152"
664 };
665 static const char * const sdc5_groups[] = {
666 	"gpio95", "gpio96", "gpio97", "gpio98", "gpio99", "gpio100"
667 };
668 static const char * const tsif1_groups[] = {
669 	"gpio93", "gpio94", "gpio95", "gpio96"
670 };
671 static const char * const tsif2_groups[] = {
672 	"gpio97", "gpio98", "gpio99", "gpio100"
673 };
674 static const char * const usb_fs1_groups[] = {
675 	"gpio49", "gpio50", "gpio51"
676 };
677 static const char * const usb_fs1_oe_n_groups[] = {
678 	"gpio51"
679 };
680 static const char * const usb_fs2_groups[] = {
681 	"gpio71", "gpio72", "gpio73"
682 };
683 static const char * const usb_fs2_oe_n_groups[] = {
684 	"gpio73"
685 };
686 static const char * const vfe_groups[] = {
687 	"gpio29", "gpio30", "gpio31", "gpio42", "gpio46", "gpio105", "gpio106",
688 	"gpio117"
689 };
690 static const char * const vsens_alarm_groups[] = {
691 	"gpio127"
692 };
693 static const char * const ebi2cs_groups[] = {
694 	"gpio39", /* CS1A */
695 	"gpio40", /* CS2A */
696 	"gpio123", /* CS1B */
697 	"gpio124", /* CS2B */
698 	"gpio131", /* CS5 */
699 	"gpio132", /* CS4 */
700 	"gpio133", /* CS3 */
701 	"gpio134", /* CS0 */
702 };
703 static const char * const ebi2_groups[] = {
704 	/* ADDR9 & ADDR8 */
705 	"gpio37", "gpio38",
706 	/* ADDR7 - ADDR 0 */
707 	"gpio123", "gpio124", "gpio125", "gpio126",
708 	"gpio127", "gpio128", "gpio129", "gpio130",
709 	/* (muxed address+data) AD15 - AD0 */
710 	"gpio135", "gpio136", "gpio137", "gpio138", "gpio139",
711 	"gpio140", "gpio141", "gpio142", "gpio143", "gpio144",
712 	"gpio145", "gpio146", "gpio147", "gpio148", "gpio149",
713 	"gpio150",
714 	"gpio151", /* OE output enable */
715 	"gpio152", /* clock */
716 	"gpio153", /* ADV */
717 	"gpio154", /* WAIT (input) */
718 	"gpio155", /* UB Upper Byte Enable */
719 	"gpio156", /* LB Lower Byte Enable */
720 	"gpio157", /* WE Write Enable */
721 	"gpio158", /* busy */
722 };
723 
724 static const struct msm_function msm8660_functions[] = {
725 	FUNCTION(gpio),
726 	FUNCTION(cam_mclk),
727 	FUNCTION(dsub),
728 	FUNCTION(ext_gps),
729 	FUNCTION(gp_clk_0a),
730 	FUNCTION(gp_clk_0b),
731 	FUNCTION(gp_clk_1a),
732 	FUNCTION(gp_clk_1b),
733 	FUNCTION(gp_clk_2a),
734 	FUNCTION(gp_clk_2b),
735 	FUNCTION(gp_mn),
736 	FUNCTION(gsbi1),
737 	FUNCTION(gsbi1_spi_cs1_n),
738 	FUNCTION(gsbi1_spi_cs2a_n),
739 	FUNCTION(gsbi1_spi_cs2b_n),
740 	FUNCTION(gsbi1_spi_cs3_n),
741 	FUNCTION(gsbi2),
742 	FUNCTION(gsbi2_spi_cs1_n),
743 	FUNCTION(gsbi2_spi_cs2_n),
744 	FUNCTION(gsbi2_spi_cs3_n),
745 	FUNCTION(gsbi3),
746 	FUNCTION(gsbi3_spi_cs1_n),
747 	FUNCTION(gsbi3_spi_cs2_n),
748 	FUNCTION(gsbi3_spi_cs3_n),
749 	FUNCTION(gsbi4),
750 	FUNCTION(gsbi5),
751 	FUNCTION(gsbi6),
752 	FUNCTION(gsbi7),
753 	FUNCTION(gsbi8),
754 	FUNCTION(gsbi9),
755 	FUNCTION(gsbi10),
756 	FUNCTION(gsbi11),
757 	FUNCTION(gsbi12),
758 	FUNCTION(hdmi),
759 	FUNCTION(i2s),
760 	FUNCTION(lcdc),
761 	FUNCTION(mdp_vsync),
762 	FUNCTION(mi2s),
763 	FUNCTION(pcm),
764 	FUNCTION(ps_hold),
765 	FUNCTION(sdc1),
766 	FUNCTION(sdc2),
767 	FUNCTION(sdc5),
768 	FUNCTION(tsif1),
769 	FUNCTION(tsif2),
770 	FUNCTION(usb_fs1),
771 	FUNCTION(usb_fs1_oe_n),
772 	FUNCTION(usb_fs2),
773 	FUNCTION(usb_fs2_oe_n),
774 	FUNCTION(vfe),
775 	FUNCTION(vsens_alarm),
776 	FUNCTION(ebi2cs), /* for EBI2 chip selects */
777 	FUNCTION(ebi2), /* for general EBI2 pins */
778 };
779 
780 static const struct msm_pingroup msm8660_groups[] = {
781 	PINGROUP(0, lcdc, dsub, _, _, _, _, _),
782 	PINGROUP(1, lcdc, dsub, _, _, _, _, _),
783 	PINGROUP(2, lcdc, dsub, _, _, _, _, _),
784 	PINGROUP(3, lcdc, dsub, _, _, _, _, _),
785 	PINGROUP(4, lcdc, dsub, _, _, _, _, _),
786 	PINGROUP(5, lcdc, dsub, _, _, _, _, _),
787 	PINGROUP(6, lcdc, dsub, _, _, _, _, _),
788 	PINGROUP(7, lcdc, dsub, _, _, _, _, _),
789 	PINGROUP(8, lcdc, dsub, _, _, _, _, _),
790 	PINGROUP(9, lcdc, dsub, _, _, _, _, _),
791 	PINGROUP(10, lcdc, dsub, _, _, _, _, _),
792 	PINGROUP(11, lcdc, dsub, _, _, _, _, _),
793 	PINGROUP(12, lcdc, dsub, _, _, _, _, _),
794 	PINGROUP(13, lcdc, dsub, _, _, _, _, _),
795 	PINGROUP(14, lcdc, dsub, _, _, _, _, _),
796 	PINGROUP(15, lcdc, dsub, _, _, _, _, _),
797 	PINGROUP(16, lcdc, dsub, _, _, _, _, _),
798 	PINGROUP(17, lcdc, dsub, _, _, _, _, _),
799 	PINGROUP(18, lcdc, dsub, _, _, _, _, _),
800 	PINGROUP(19, lcdc, dsub, _, _, _, _, _),
801 	PINGROUP(20, lcdc, dsub, _, _, _, _, _),
802 	PINGROUP(21, lcdc, dsub, _, _, _, _, _),
803 	PINGROUP(22, lcdc, dsub, _, _, _, _, _),
804 	PINGROUP(23, lcdc, dsub, _, _, _, _, _),
805 	PINGROUP(24, lcdc, dsub, _, _, _, _, _),
806 	PINGROUP(25, lcdc, dsub, _, _, _, _, _),
807 	PINGROUP(26, lcdc, dsub, _, _, _, _, _),
808 	PINGROUP(27, lcdc, dsub, _, _, _, _, _),
809 	PINGROUP(28, mdp_vsync, _, _, _, _, _, _),
810 	PINGROUP(29, vfe, gp_mn, _, _, _, _, _),
811 	PINGROUP(30, vfe, gp_clk_0a, _, _, _, _, _),
812 	PINGROUP(31, vfe, gp_clk_1a, _, _, _, _, _),
813 	PINGROUP(32, cam_mclk, _, _, _, _, _, _),
814 	PINGROUP(33, gsbi1, _, _, _, _, _, _),
815 	PINGROUP(34, gsbi1, _, _, _, _, _, _),
816 	PINGROUP(35, gsbi1, _, _, _, _, _, _),
817 	PINGROUP(36, gsbi1, _, _, _, _, _, _),
818 	PINGROUP(37, gsbi2, ebi2, _, _, _, _, _),
819 	PINGROUP(38, gsbi2, ebi2, _, _, _, _, _),
820 	PINGROUP(39, gsbi2, ebi2cs, mdp_vsync, _, _, _, _),
821 	PINGROUP(40, gsbi2, ebi2cs, _, _, _, _, _),
822 	PINGROUP(41, gsbi3, mdp_vsync, _, _, _, _, _),
823 	PINGROUP(42, gsbi3, vfe, _, _, _, _, _),
824 	PINGROUP(43, gsbi3, _, _, _, _, _, _),
825 	PINGROUP(44, gsbi3, _, _, _, _, _, _),
826 	PINGROUP(45, gsbi4, gsbi3_spi_cs2_n, _, _, _, _, _),
827 	PINGROUP(46, gsbi4, gsbi3_spi_cs3_n, vfe, _, _, _, _),
828 	PINGROUP(47, gsbi4, _, _, _, _, _, _),
829 	PINGROUP(48, gsbi4, _, _, _, _, _, _),
830 	PINGROUP(49, gsbi5, usb_fs1, _, _, _, _, _),
831 	PINGROUP(50, gsbi5, usb_fs1, _, _, _, _, _),
832 	PINGROUP(51, gsbi5, usb_fs1, usb_fs1_oe_n, _, _, _, _),
833 	PINGROUP(52, gsbi5, _, _, _, _, _, _),
834 	PINGROUP(53, gsbi6, _, _, _, _, _, _),
835 	PINGROUP(54, gsbi6, _, _, _, _, _, _),
836 	PINGROUP(55, gsbi6, _, _, _, _, _, _),
837 	PINGROUP(56, gsbi6, _, _, _, _, _, _),
838 	PINGROUP(57, gsbi7, _, _, _, _, _, _),
839 	PINGROUP(58, gsbi7, _, _, _, _, _, _),
840 	PINGROUP(59, gsbi7, _, _, _, _, _, _),
841 	PINGROUP(60, gsbi7, _, _, _, _, _, _),
842 	PINGROUP(61, _, _, _, _, _, _, _),
843 	PINGROUP(62, gsbi8, gsbi3_spi_cs1_n, gsbi1_spi_cs2a_n, _, _, _, _),
844 	PINGROUP(63, gsbi8, gsbi1_spi_cs1_n, _, _, _, _, _),
845 	PINGROUP(64, gsbi8, gsbi1_spi_cs2b_n, _, _, _, _, _),
846 	PINGROUP(65, gsbi8, gsbi1_spi_cs3_n, _, _, _, _, _),
847 	PINGROUP(66, gsbi9, ext_gps, _, _, _, _, _),
848 	PINGROUP(67, gsbi9, ext_gps, _, _, _, _, _),
849 	PINGROUP(68, gsbi9, ext_gps, _, _, _, _, _),
850 	PINGROUP(69, gsbi9, ext_gps, _, _, _, _, _),
851 	PINGROUP(70, gsbi10, gp_clk_2b, _, _, _, _, _),
852 	PINGROUP(71, gsbi10, usb_fs2, _, _, _, _, _),
853 	PINGROUP(72, gsbi10, usb_fs2, _, _, _, _, _),
854 	PINGROUP(73, gsbi10, usb_fs2, usb_fs2_oe_n, _, _, _, _),
855 	PINGROUP(74, _, _, _, _, _, _, _),
856 	PINGROUP(75, _, _, _, _, _, _, _),
857 	PINGROUP(76, _, _, _, _, _, _, _),
858 	PINGROUP(77, _, _, _, _, _, _, _),
859 	PINGROUP(78, _, _, _, _, _, _, _),
860 	PINGROUP(79, _, _, _, _, _, _, _),
861 	PINGROUP(80, _, _, _, _, _, _, _),
862 	PINGROUP(81, _, _, _, _, _, _, _),
863 	PINGROUP(82, _, _, _, _, _, _, _),
864 	PINGROUP(83, _, _, _, _, _, _, _),
865 	PINGROUP(84, _, _, _, _, _, _, _),
866 	PINGROUP(85, _, _, _, _, _, _, _),
867 	PINGROUP(86, _, _, _, _, _, _, _),
868 	PINGROUP(87, _, _, _, _, _, _, _),
869 	PINGROUP(88, _, _, _, _, _, _, _),
870 	PINGROUP(89, _, _, _, _, _, _, _),
871 	PINGROUP(90, _, _, _, _, _, _, _),
872 	PINGROUP(91, _, _, _, _, _, _, _),
873 	PINGROUP(92, ps_hold, _, _, _, _, _, _),
874 	PINGROUP(93, tsif1, _, _, _, _, _, _),
875 	PINGROUP(94, tsif1, _, _, _, _, _, _),
876 	PINGROUP(95, tsif1, sdc5, _, _, _, _, _),
877 	PINGROUP(96, tsif1, sdc5, _, _, _, _, _),
878 	PINGROUP(97, tsif2, sdc5, _, _, _, _, _),
879 	PINGROUP(98, tsif2, sdc5, _, _, _, _, _),
880 	PINGROUP(99, tsif2, sdc5, _, _, _, _, _),
881 	PINGROUP(100, tsif2, sdc5, _, _, _, _, _),
882 	PINGROUP(101, mi2s, _, _, _, _, _, _),
883 	PINGROUP(102, mi2s, _, _, _, _, _, _),
884 	PINGROUP(103, mi2s, gsbi11, gp_clk_2a, _, _, _, _),
885 	PINGROUP(104, mi2s, gsbi11, _, _, _, _, _),
886 	PINGROUP(105, mi2s, gsbi11, vfe, _, _, _, _),
887 	PINGROUP(106, mi2s, gsbi11, vfe, _, _, _, _),
888 	PINGROUP(107, mi2s, _, _, _, _, _, _),
889 	PINGROUP(108, i2s, _, _, _, _, _, _),
890 	PINGROUP(109, i2s, _, _, _, _, _, _),
891 	PINGROUP(110, i2s, _, _, _, _, _, _),
892 	PINGROUP(111, pcm, _, _, _, _, _, _),
893 	PINGROUP(112, pcm, _, _, _, _, _, _),
894 	PINGROUP(113, pcm, _, _, _, _, _, _),
895 	PINGROUP(114, pcm, _, _, _, _, _, _),
896 	PINGROUP(115, i2s, gsbi12, gp_clk_0b, _, _, _, _),
897 	PINGROUP(116, i2s, gsbi12, _, _, _, _, _),
898 	PINGROUP(117, i2s, gsbi12, vfe, _, _, _, _),
899 	PINGROUP(118, i2s, gsbi12, _, _, _, _, _),
900 	PINGROUP(119, i2s, _, _, _, _, _, _),
901 	PINGROUP(120, i2s, _, _, _, _, _, _),
902 	PINGROUP(121, i2s, _, _, _, _, _, _),
903 	PINGROUP(122, i2s, gp_clk_1b, _, _, _, _, _),
904 	PINGROUP(123, ebi2, gsbi2_spi_cs1_n, ebi2cs, _, _, _, _),
905 	PINGROUP(124, ebi2, gsbi2_spi_cs2_n, ebi2cs, _, _, _, _),
906 	PINGROUP(125, ebi2, gsbi2_spi_cs3_n, _, _, _, _, _),
907 	PINGROUP(126, ebi2, _, _, _, _, _, _),
908 	PINGROUP(127, ebi2, vsens_alarm, _, _, _, _, _),
909 	PINGROUP(128, ebi2, _, _, _, _, _, _),
910 	PINGROUP(129, ebi2, _, _, _, _, _, _),
911 	PINGROUP(130, ebi2, _, _, _, _, _, _),
912 	PINGROUP(131, ebi2cs, _, _, _, _, _, _),
913 	PINGROUP(132, ebi2cs, _, _, _, _, _, _),
914 	PINGROUP(133, ebi2cs, _, _, _, _, _, _),
915 	PINGROUP(134, ebi2cs, _, _, _, _, _, _),
916 	PINGROUP(135, ebi2, _, _, _, _, _, _),
917 	PINGROUP(136, ebi2, _, _, _, _, _, _),
918 	PINGROUP(137, ebi2, _, _, _, _, _, _),
919 	PINGROUP(138, ebi2, _, _, _, _, _, _),
920 	PINGROUP(139, ebi2, _, _, _, _, _, _),
921 	PINGROUP(140, ebi2, _, _, _, _, _, _),
922 	PINGROUP(141, ebi2, _, _, _, _, _, _),
923 	PINGROUP(142, ebi2, _, _, _, _, _, _),
924 	PINGROUP(143, ebi2, sdc2, _, _, _, _, _),
925 	PINGROUP(144, ebi2, sdc2, _, _, _, _, _),
926 	PINGROUP(145, ebi2, sdc2, _, _, _, _, _),
927 	PINGROUP(146, ebi2, sdc2, _, _, _, _, _),
928 	PINGROUP(147, ebi2, sdc2, _, _, _, _, _),
929 	PINGROUP(148, ebi2, sdc2, _, _, _, _, _),
930 	PINGROUP(149, ebi2, sdc2, _, _, _, _, _),
931 	PINGROUP(150, ebi2, sdc2, _, _, _, _, _),
932 	PINGROUP(151, ebi2, sdc2, _, _, _, _, _),
933 	PINGROUP(152, ebi2, sdc2, _, _, _, _, _),
934 	PINGROUP(153, ebi2, _, _, _, _, _, _),
935 	PINGROUP(154, ebi2, _, _, _, _, _, _),
936 	PINGROUP(155, ebi2, _, _, _, _, _, _),
937 	PINGROUP(156, ebi2, _, _, _, _, _, _),
938 	PINGROUP(157, ebi2, _, _, _, _, _, _),
939 	PINGROUP(158, ebi2, _, _, _, _, _, _),
940 	PINGROUP(159, sdc1, _, _, _, _, _, _),
941 	PINGROUP(160, sdc1, _, _, _, _, _, _),
942 	PINGROUP(161, sdc1, _, _, _, _, _, _),
943 	PINGROUP(162, sdc1, _, _, _, _, _, _),
944 	PINGROUP(163, sdc1, _, _, _, _, _, _),
945 	PINGROUP(164, sdc1, _, _, _, _, _, _),
946 	PINGROUP(165, sdc1, _, _, _, _, _, _),
947 	PINGROUP(166, sdc1, _, _, _, _, _, _),
948 	PINGROUP(167, sdc1, _, _, _, _, _, _),
949 	PINGROUP(168, sdc1, _, _, _, _, _, _),
950 	PINGROUP(169, hdmi, _, _, _, _, _, _),
951 	PINGROUP(170, hdmi, _, _, _, _, _, _),
952 	PINGROUP(171, hdmi, _, _, _, _, _, _),
953 	PINGROUP(172, hdmi, _, _, _, _, _, _),
954 
955 	SDC_PINGROUP(sdc4_clk, 0x20a0, -1, 6),
956 	SDC_PINGROUP(sdc4_cmd, 0x20a0, 11, 3),
957 	SDC_PINGROUP(sdc4_data, 0x20a0, 9, 0),
958 
959 	SDC_PINGROUP(sdc3_clk, 0x20a4, -1, 6),
960 	SDC_PINGROUP(sdc3_cmd, 0x20a4, 11, 3),
961 	SDC_PINGROUP(sdc3_data, 0x20a4, 9, 0),
962 };
963 
964 #define NUM_GPIO_PINGROUPS 173
965 
966 static const struct msm_pinctrl_soc_data msm8660_pinctrl = {
967 	.pins = msm8660_pins,
968 	.npins = ARRAY_SIZE(msm8660_pins),
969 	.functions = msm8660_functions,
970 	.nfunctions = ARRAY_SIZE(msm8660_functions),
971 	.groups = msm8660_groups,
972 	.ngroups = ARRAY_SIZE(msm8660_groups),
973 	.ngpios = NUM_GPIO_PINGROUPS,
974 };
975 
msm8660_pinctrl_probe(struct platform_device * pdev)976 static int msm8660_pinctrl_probe(struct platform_device *pdev)
977 {
978 	return msm_pinctrl_probe(pdev, &msm8660_pinctrl);
979 }
980 
981 static const struct of_device_id msm8660_pinctrl_of_match[] = {
982 	{ .compatible = "qcom,msm8660-pinctrl", },
983 	{ },
984 };
985 
986 static struct platform_driver msm8660_pinctrl_driver = {
987 	.driver = {
988 		.name = "msm8660-pinctrl",
989 		.of_match_table = msm8660_pinctrl_of_match,
990 	},
991 	.probe = msm8660_pinctrl_probe,
992 	.remove = msm_pinctrl_remove,
993 };
994 
msm8660_pinctrl_init(void)995 static int __init msm8660_pinctrl_init(void)
996 {
997 	return platform_driver_register(&msm8660_pinctrl_driver);
998 }
999 arch_initcall(msm8660_pinctrl_init);
1000 
msm8660_pinctrl_exit(void)1001 static void __exit msm8660_pinctrl_exit(void)
1002 {
1003 	platform_driver_unregister(&msm8660_pinctrl_driver);
1004 }
1005 module_exit(msm8660_pinctrl_exit);
1006 
1007 MODULE_AUTHOR("Bjorn Andersson <bjorn.andersson@sonymobile.com>");
1008 MODULE_DESCRIPTION("Qualcomm MSM8660 pinctrl driver");
1009 MODULE_LICENSE("GPL v2");
1010 MODULE_DEVICE_TABLE(of, msm8660_pinctrl_of_match);
1011