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