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