2 * Copyright (c) 2015, Sony Mobile Communications AB.
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.
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.
14 #include <linux/module.h>
16 #include <linux/platform_device.h>
17 #include <linux/pinctrl/pinctrl.h>
19 #include "pinctrl-msm.h"
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"),
196 PINCTRL_PIN(173, "SDC1_CLK"),
197 PINCTRL_PIN(174, "SDC1_CMD"),
198 PINCTRL_PIN(175, "SDC1_DATA"),
199 PINCTRL_PIN(176, "SDC3_CLK"),
200 PINCTRL_PIN(177, "SDC3_CMD"),
201 PINCTRL_PIN(178, "SDC3_DATA"),
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);
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 };
386 #define FUNCTION(fname) \
387 [MSM_MUX_##fname] = { \
389 .groups = fname##_groups, \
390 .ngroups = ARRAY_SIZE(fname##_groups), \
393 #define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7) \
395 .name = "gpio" #id, \
396 .pins = gpio##id##_pins, \
397 .npins = ARRAY_SIZE(gpio##id##_pins), \
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, \
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, \
431 #define SDC_PINGROUP(pg_name, ctl, pull, drv) \
434 .pins = pg_name##_pins, \
435 .npins = ARRAY_SIZE(pg_name##_pins), \
439 .intr_status_reg = 0, \
440 .intr_target_reg = 0, \
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, \
457 enum msm8660_functions {
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,
475 MSM_MUX_gsbi2_spi_cs1_n,
476 MSM_MUX_gsbi2_spi_cs2_n,
477 MSM_MUX_gsbi2_spi_cs3_n,
479 MSM_MUX_gsbi3_spi_cs1_n,
480 MSM_MUX_gsbi3_spi_cs2_n,
481 MSM_MUX_gsbi3_spi_cs3_n,
504 MSM_MUX_usb_fs1_oe_n,
506 MSM_MUX_usb_fs2_oe_n,
512 static const char * const gpio_groups[] = {
513 "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
514 "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
515 "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
516 "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
517 "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
518 "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
519 "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
520 "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
521 "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
522 "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
523 "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
524 "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
525 "gpio85", "gpio86", "gpio87", "gpio88", "gpio89", "gpio90", "gpio91",
526 "gpio92", "gpio93", "gpio94", "gpio95", "gpio96", "gpio97", "gpio98",
527 "gpio99", "gpio100", "gpio101", "gpio102", "gpio103", "gpio104",
528 "gpio105", "gpio106", "gpio107", "gpio108", "gpio109", "gpio110",
529 "gpio111", "gpio112", "gpio113", "gpio114", "gpio115", "gpio116",
530 "gpio117", "gpio118", "gpio119", "gpio120", "gpio121", "gpio122",
531 "gpio123", "gpio124", "gpio125", "gpio126", "gpio127", "gpio128",
532 "gpio129", "gpio130", "gpio131", "gpio132", "gpio133", "gpio134",
533 "gpio135", "gpio136", "gpio137", "gpio138", "gpio139", "gpio140",
534 "gpio141", "gpio142", "gpio143", "gpio144", "gpio145", "gpio146",
535 "gpio147", "gpio148", "gpio149", "gpio150", "gpio151", "gpio152",
536 "gpio153", "gpio154", "gpio155", "gpio156", "gpio157", "gpio158",
537 "gpio159", "gpio160", "gpio161", "gpio162", "gpio163", "gpio164",
538 "gpio165", "gpio166", "gpio167", "gpio168", "gpio169", "gpio170",
542 static const char * const cam_mclk_groups[] = {
545 static const char * const dsub_groups[] = {
546 "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
547 "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
548 "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
549 "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27"
551 static const char * const ext_gps_groups[] = {
552 "gpio66", "gpio67", "gpio68", "gpio69"
554 static const char * const gp_clk_0a_groups[] = {
557 static const char * const gp_clk_0b_groups[] = {
560 static const char * const gp_clk_1a_groups[] = {
563 static const char * const gp_clk_1b_groups[] = {
566 static const char * const gp_clk_2a_groups[] = {
569 static const char * const gp_clk_2b_groups[] = {
572 static const char * const gp_mn_groups[] = {
575 static const char * const gsbi1_groups[] = {
576 "gpio33", "gpio34", "gpio35", "gpio36"
578 static const char * const gsbi1_spi_cs1_n_groups[] = {
580 static const char * const gsbi1_spi_cs2a_n_groups[] = {
582 static const char * const gsbi1_spi_cs2b_n_groups[] = {
584 static const char * const gsbi1_spi_cs3_n_groups[] = {
586 static const char * const gsbi2_groups[] = {
587 "gpio37", "gpio38", "gpio39", "gpio40"
589 static const char * const gsbi2_spi_cs1_n_groups[] = {
592 static const char * const gsbi2_spi_cs2_n_groups[] = {
595 static const char * const gsbi2_spi_cs3_n_groups[] = {
598 static const char * const gsbi3_groups[] = {
599 "gpio41", "gpio42", "gpio43", "gpio44"
601 static const char * const gsbi3_spi_cs1_n_groups[] = {
604 static const char * const gsbi3_spi_cs2_n_groups[] = {
607 static const char * const gsbi3_spi_cs3_n_groups[] = {
610 static const char * const gsbi4_groups[] = {
611 "gpio45", "gpio56", "gpio47", "gpio48"
613 static const char * const gsbi5_groups[] = {
614 "gpio49", "gpio50", "gpio51", "gpio52"
616 static const char * const gsbi6_groups[] = {
617 "gpio53", "gpio54", "gpio55", "gpio56"
619 static const char * const gsbi7_groups[] = {
620 "gpio57", "gpio58", "gpio59", "gpio60"
622 static const char * const gsbi8_groups[] = {
623 "gpio62", "gpio63", "gpio64", "gpio65"
625 static const char * const gsbi9_groups[] = {
626 "gpio66", "gpio67", "gpio68", "gpio69"
628 static const char * const gsbi10_groups[] = {
629 "gpio70", "gpio71", "gpio72", "gpio73"
631 static const char * const gsbi11_groups[] = {
632 "gpio103", "gpio104", "gpio105", "gpio106"
634 static const char * const gsbi12_groups[] = {
635 "gpio115", "gpio116", "gpio117", "gpio118"
637 static const char * const hdmi_groups[] = {
638 "gpio169", "gpio170", "gpio171", "gpio172"
640 static const char * const i2s_groups[] = {
641 "gpio108", "gpio109", "gpio110", "gpio115", "gpio116", "gpio117",
642 "gpio118", "gpio119", "gpio120", "gpio121", "gpio122"
644 static const char * const lcdc_groups[] = {
645 "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
646 "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
647 "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
648 "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27"
650 static const char * const mdp_vsync_groups[] = {
651 "gpio28", "gpio39", "gpio41"
653 static const char * const mi2s_groups[] = {
654 "gpio101", "gpio102", "gpio103", "gpio104", "gpio105", "gpio106",
657 static const char * const pcm_groups[] = {
658 "gpio111", "gpio112", "gpio113", "gpio114"
660 static const char * const ps_hold_groups[] = {
663 static const char * const sdc1_groups[] = {
664 "gpio159", "gpio160", "gpio161", "gpio162", "gpio163", "gpio164",
665 "gpio165", "gpio166", "gpio167", "gpio168"
667 static const char * const sdc2_groups[] = {
668 "gpio143", "gpio144", "gpio145", "gpio146", "gpio147", "gpio148",
669 "gpio149", "gpio150", "gpio151", "gpio152"
671 static const char * const sdc5_groups[] = {
672 "gpio95", "gpio96", "gpio97", "gpio98", "gpio99", "gpio100"
674 static const char * const tsif1_groups[] = {
675 "gpio93", "gpio94", "gpio95", "gpio96"
677 static const char * const tsif2_groups[] = {
678 "gpio97", "gpio98", "gpio99", "gpio100"
680 static const char * const usb_fs1_groups[] = {
681 "gpio49", "gpio50", "gpio51"
683 static const char * const usb_fs1_oe_n_groups[] = {
686 static const char * const usb_fs2_groups[] = {
687 "gpio71", "gpio72", "gpio73"
689 static const char * const usb_fs2_oe_n_groups[] = {
692 static const char * const vfe_groups[] = {
693 "gpio29", "gpio30", "gpio31", "gpio42", "gpio46", "gpio105", "gpio106",
696 static const char * const vsens_alarm_groups[] = {
700 static const struct msm_function msm8660_functions[] = {
713 FUNCTION(gsbi1_spi_cs1_n),
714 FUNCTION(gsbi1_spi_cs2a_n),
715 FUNCTION(gsbi1_spi_cs2b_n),
716 FUNCTION(gsbi1_spi_cs3_n),
718 FUNCTION(gsbi2_spi_cs1_n),
719 FUNCTION(gsbi2_spi_cs2_n),
720 FUNCTION(gsbi2_spi_cs3_n),
722 FUNCTION(gsbi3_spi_cs1_n),
723 FUNCTION(gsbi3_spi_cs2_n),
724 FUNCTION(gsbi3_spi_cs3_n),
747 FUNCTION(usb_fs1_oe_n),
749 FUNCTION(usb_fs2_oe_n),
751 FUNCTION(vsens_alarm),
754 static const struct msm_pingroup msm8660_groups[] = {
755 PINGROUP(0, lcdc, dsub, _, _, _, _, _),
756 PINGROUP(1, lcdc, dsub, _, _, _, _, _),
757 PINGROUP(2, lcdc, dsub, _, _, _, _, _),
758 PINGROUP(3, lcdc, dsub, _, _, _, _, _),
759 PINGROUP(4, lcdc, dsub, _, _, _, _, _),
760 PINGROUP(5, lcdc, dsub, _, _, _, _, _),
761 PINGROUP(6, lcdc, dsub, _, _, _, _, _),
762 PINGROUP(7, lcdc, dsub, _, _, _, _, _),
763 PINGROUP(8, lcdc, dsub, _, _, _, _, _),
764 PINGROUP(9, lcdc, dsub, _, _, _, _, _),
765 PINGROUP(10, lcdc, dsub, _, _, _, _, _),
766 PINGROUP(11, lcdc, dsub, _, _, _, _, _),
767 PINGROUP(12, lcdc, dsub, _, _, _, _, _),
768 PINGROUP(13, lcdc, dsub, _, _, _, _, _),
769 PINGROUP(14, lcdc, dsub, _, _, _, _, _),
770 PINGROUP(15, lcdc, dsub, _, _, _, _, _),
771 PINGROUP(16, lcdc, dsub, _, _, _, _, _),
772 PINGROUP(17, lcdc, dsub, _, _, _, _, _),
773 PINGROUP(18, lcdc, dsub, _, _, _, _, _),
774 PINGROUP(19, lcdc, dsub, _, _, _, _, _),
775 PINGROUP(20, lcdc, dsub, _, _, _, _, _),
776 PINGROUP(21, lcdc, dsub, _, _, _, _, _),
777 PINGROUP(22, lcdc, dsub, _, _, _, _, _),
778 PINGROUP(23, lcdc, dsub, _, _, _, _, _),
779 PINGROUP(24, lcdc, dsub, _, _, _, _, _),
780 PINGROUP(25, lcdc, dsub, _, _, _, _, _),
781 PINGROUP(26, lcdc, dsub, _, _, _, _, _),
782 PINGROUP(27, lcdc, dsub, _, _, _, _, _),
783 PINGROUP(28, mdp_vsync, _, _, _, _, _, _),
784 PINGROUP(29, vfe, gp_mn, _, _, _, _, _),
785 PINGROUP(30, vfe, gp_clk_0a, _, _, _, _, _),
786 PINGROUP(31, vfe, gp_clk_1a, _, _, _, _, _),
787 PINGROUP(32, cam_mclk, _, _, _, _, _, _),
788 PINGROUP(33, gsbi1, _, _, _, _, _, _),
789 PINGROUP(34, gsbi1, _, _, _, _, _, _),
790 PINGROUP(35, gsbi1, _, _, _, _, _, _),
791 PINGROUP(36, gsbi1, _, _, _, _, _, _),
792 PINGROUP(37, gsbi2, _, _, _, _, _, _),
793 PINGROUP(38, gsbi2, _, _, _, _, _, _),
794 PINGROUP(39, gsbi2, _, mdp_vsync, _, _, _, _),
795 PINGROUP(40, gsbi2, _, _, _, _, _, _),
796 PINGROUP(41, gsbi3, mdp_vsync, _, _, _, _, _),
797 PINGROUP(42, gsbi3, vfe, _, _, _, _, _),
798 PINGROUP(43, gsbi3, _, _, _, _, _, _),
799 PINGROUP(44, gsbi3, _, _, _, _, _, _),
800 PINGROUP(45, gsbi4, gsbi3_spi_cs2_n, _, _, _, _, _),
801 PINGROUP(46, gsbi4, gsbi3_spi_cs3_n, vfe, _, _, _, _),
802 PINGROUP(47, gsbi4, _, _, _, _, _, _),
803 PINGROUP(48, gsbi4, _, _, _, _, _, _),
804 PINGROUP(49, gsbi5, usb_fs1, _, _, _, _, _),
805 PINGROUP(50, gsbi5, usb_fs1, _, _, _, _, _),
806 PINGROUP(51, gsbi5, usb_fs1, usb_fs1_oe_n, _, _, _, _),
807 PINGROUP(52, gsbi5, _, _, _, _, _, _),
808 PINGROUP(53, gsbi6, _, _, _, _, _, _),
809 PINGROUP(54, gsbi6, _, _, _, _, _, _),
810 PINGROUP(55, gsbi6, _, _, _, _, _, _),
811 PINGROUP(56, gsbi6, _, _, _, _, _, _),
812 PINGROUP(57, gsbi7, _, _, _, _, _, _),
813 PINGROUP(58, gsbi7, _, _, _, _, _, _),
814 PINGROUP(59, gsbi7, _, _, _, _, _, _),
815 PINGROUP(60, gsbi7, _, _, _, _, _, _),
816 PINGROUP(61, _, _, _, _, _, _, _),
817 PINGROUP(62, gsbi8, gsbi3_spi_cs1_n, gsbi1_spi_cs2a_n, _, _, _, _),
818 PINGROUP(63, gsbi8, gsbi1_spi_cs1_n, _, _, _, _, _),
819 PINGROUP(64, gsbi8, gsbi1_spi_cs2b_n, _, _, _, _, _),
820 PINGROUP(65, gsbi8, gsbi1_spi_cs3_n, _, _, _, _, _),
821 PINGROUP(66, gsbi9, ext_gps, _, _, _, _, _),
822 PINGROUP(67, gsbi9, ext_gps, _, _, _, _, _),
823 PINGROUP(68, gsbi9, ext_gps, _, _, _, _, _),
824 PINGROUP(69, gsbi9, ext_gps, _, _, _, _, _),
825 PINGROUP(70, gsbi10, gp_clk_2b, _, _, _, _, _),
826 PINGROUP(71, gsbi10, usb_fs2, _, _, _, _, _),
827 PINGROUP(72, gsbi10, usb_fs2, _, _, _, _, _),
828 PINGROUP(73, gsbi10, usb_fs2, usb_fs2_oe_n, _, _, _, _),
829 PINGROUP(74, _, _, _, _, _, _, _),
830 PINGROUP(75, _, _, _, _, _, _, _),
831 PINGROUP(76, _, _, _, _, _, _, _),
832 PINGROUP(77, _, _, _, _, _, _, _),
833 PINGROUP(78, _, _, _, _, _, _, _),
834 PINGROUP(79, _, _, _, _, _, _, _),
835 PINGROUP(80, _, _, _, _, _, _, _),
836 PINGROUP(81, _, _, _, _, _, _, _),
837 PINGROUP(82, _, _, _, _, _, _, _),
838 PINGROUP(83, _, _, _, _, _, _, _),
839 PINGROUP(84, _, _, _, _, _, _, _),
840 PINGROUP(85, _, _, _, _, _, _, _),
841 PINGROUP(86, _, _, _, _, _, _, _),
842 PINGROUP(87, _, _, _, _, _, _, _),
843 PINGROUP(88, _, _, _, _, _, _, _),
844 PINGROUP(89, _, _, _, _, _, _, _),
845 PINGROUP(90, _, _, _, _, _, _, _),
846 PINGROUP(91, _, _, _, _, _, _, _),
847 PINGROUP(92, ps_hold, _, _, _, _, _, _),
848 PINGROUP(93, tsif1, _, _, _, _, _, _),
849 PINGROUP(94, tsif1, _, _, _, _, _, _),
850 PINGROUP(95, tsif1, sdc5, _, _, _, _, _),
851 PINGROUP(96, tsif1, sdc5, _, _, _, _, _),
852 PINGROUP(97, tsif2, sdc5, _, _, _, _, _),
853 PINGROUP(98, tsif2, sdc5, _, _, _, _, _),
854 PINGROUP(99, tsif2, sdc5, _, _, _, _, _),
855 PINGROUP(100, tsif2, sdc5, _, _, _, _, _),
856 PINGROUP(101, mi2s, _, _, _, _, _, _),
857 PINGROUP(102, mi2s, _, _, _, _, _, _),
858 PINGROUP(103, mi2s, gsbi11, gp_clk_2a, _, _, _, _),
859 PINGROUP(104, mi2s, gsbi11, _, _, _, _, _),
860 PINGROUP(105, mi2s, gsbi11, vfe, _, _, _, _),
861 PINGROUP(106, mi2s, gsbi11, vfe, _, _, _, _),
862 PINGROUP(107, mi2s, _, _, _, _, _, _),
863 PINGROUP(108, i2s, _, _, _, _, _, _),
864 PINGROUP(109, i2s, _, _, _, _, _, _),
865 PINGROUP(110, i2s, _, _, _, _, _, _),
866 PINGROUP(111, pcm, _, _, _, _, _, _),
867 PINGROUP(112, pcm, _, _, _, _, _, _),
868 PINGROUP(113, pcm, _, _, _, _, _, _),
869 PINGROUP(114, pcm, _, _, _, _, _, _),
870 PINGROUP(115, i2s, gsbi12, gp_clk_0b, _, _, _, _),
871 PINGROUP(116, i2s, gsbi12, _, _, _, _, _),
872 PINGROUP(117, i2s, gsbi12, vfe, _, _, _, _),
873 PINGROUP(118, i2s, gsbi12, _, _, _, _, _),
874 PINGROUP(119, i2s, _, _, _, _, _, _),
875 PINGROUP(120, i2s, _, _, _, _, _, _),
876 PINGROUP(121, i2s, _, _, _, _, _, _),
877 PINGROUP(122, i2s, gp_clk_1b, _, _, _, _, _),
878 PINGROUP(123, _, gsbi2_spi_cs1_n, _, _, _, _, _),
879 PINGROUP(124, _, gsbi2_spi_cs2_n, _, _, _, _, _),
880 PINGROUP(125, _, gsbi2_spi_cs3_n, _, _, _, _, _),
881 PINGROUP(126, _, _, _, _, _, _, _),
882 PINGROUP(127, _, vsens_alarm, _, _, _, _, _),
883 PINGROUP(128, _, _, _, _, _, _, _),
884 PINGROUP(129, _, _, _, _, _, _, _),
885 PINGROUP(130, _, _, _, _, _, _, _),
886 PINGROUP(131, _, _, _, _, _, _, _),
887 PINGROUP(132, _, _, _, _, _, _, _),
888 PINGROUP(133, _, _, _, _, _, _, _),
889 PINGROUP(134, _, _, _, _, _, _, _),
890 PINGROUP(135, _, _, _, _, _, _, _),
891 PINGROUP(136, _, _, _, _, _, _, _),
892 PINGROUP(137, _, _, _, _, _, _, _),
893 PINGROUP(138, _, _, _, _, _, _, _),
894 PINGROUP(139, _, _, _, _, _, _, _),
895 PINGROUP(140, _, _, _, _, _, _, _),
896 PINGROUP(141, _, _, _, _, _, _, _),
897 PINGROUP(142, _, _, _, _, _, _, _),
898 PINGROUP(143, _, sdc2, _, _, _, _, _),
899 PINGROUP(144, _, sdc2, _, _, _, _, _),
900 PINGROUP(145, _, sdc2, _, _, _, _, _),
901 PINGROUP(146, _, sdc2, _, _, _, _, _),
902 PINGROUP(147, _, sdc2, _, _, _, _, _),
903 PINGROUP(148, _, sdc2, _, _, _, _, _),
904 PINGROUP(149, _, sdc2, _, _, _, _, _),
905 PINGROUP(150, _, sdc2, _, _, _, _, _),
906 PINGROUP(151, _, sdc2, _, _, _, _, _),
907 PINGROUP(152, _, sdc2, _, _, _, _, _),
908 PINGROUP(153, _, _, _, _, _, _, _),
909 PINGROUP(154, _, _, _, _, _, _, _),
910 PINGROUP(155, _, _, _, _, _, _, _),
911 PINGROUP(156, _, _, _, _, _, _, _),
912 PINGROUP(157, _, _, _, _, _, _, _),
913 PINGROUP(158, _, _, _, _, _, _, _),
914 PINGROUP(159, sdc1, _, _, _, _, _, _),
915 PINGROUP(160, sdc1, _, _, _, _, _, _),
916 PINGROUP(161, sdc1, _, _, _, _, _, _),
917 PINGROUP(162, sdc1, _, _, _, _, _, _),
918 PINGROUP(163, sdc1, _, _, _, _, _, _),
919 PINGROUP(164, sdc1, _, _, _, _, _, _),
920 PINGROUP(165, sdc1, _, _, _, _, _, _),
921 PINGROUP(166, sdc1, _, _, _, _, _, _),
922 PINGROUP(167, sdc1, _, _, _, _, _, _),
923 PINGROUP(168, sdc1, _, _, _, _, _, _),
924 PINGROUP(169, hdmi, _, _, _, _, _, _),
925 PINGROUP(170, hdmi, _, _, _, _, _, _),
926 PINGROUP(171, hdmi, _, _, _, _, _, _),
927 PINGROUP(172, hdmi, _, _, _, _, _, _),
929 SDC_PINGROUP(sdc4_clk, 0x20a0, -1, 6),
930 SDC_PINGROUP(sdc4_cmd, 0x20a0, 11, 3),
931 SDC_PINGROUP(sdc4_data, 0x20a0, 9, 0),
933 SDC_PINGROUP(sdc3_clk, 0x20a4, -1, 6),
934 SDC_PINGROUP(sdc3_cmd, 0x20a4, 11, 3),
935 SDC_PINGROUP(sdc3_data, 0x20a4, 9, 0),
938 #define NUM_GPIO_PINGROUPS 173
940 static const struct msm_pinctrl_soc_data msm8660_pinctrl = {
941 .pins = msm8660_pins,
942 .npins = ARRAY_SIZE(msm8660_pins),
943 .functions = msm8660_functions,
944 .nfunctions = ARRAY_SIZE(msm8660_functions),
945 .groups = msm8660_groups,
946 .ngroups = ARRAY_SIZE(msm8660_groups),
947 .ngpios = NUM_GPIO_PINGROUPS,
950 static int msm8660_pinctrl_probe(struct platform_device *pdev)
952 return msm_pinctrl_probe(pdev, &msm8660_pinctrl);
955 static const struct of_device_id msm8660_pinctrl_of_match[] = {
956 { .compatible = "qcom,msm8660-pinctrl", },
960 static struct platform_driver msm8660_pinctrl_driver = {
962 .name = "msm8660-pinctrl",
963 .of_match_table = msm8660_pinctrl_of_match,
965 .probe = msm8660_pinctrl_probe,
966 .remove = msm_pinctrl_remove,
969 static int __init msm8660_pinctrl_init(void)
971 return platform_driver_register(&msm8660_pinctrl_driver);
973 arch_initcall(msm8660_pinctrl_init);
975 static void __exit msm8660_pinctrl_exit(void)
977 platform_driver_unregister(&msm8660_pinctrl_driver);
979 module_exit(msm8660_pinctrl_exit);
981 MODULE_AUTHOR("Bjorn Andersson <bjorn.andersson@sonymobile.com>");
982 MODULE_DESCRIPTION("Qualcomm MSM8660 pinctrl driver");
983 MODULE_LICENSE("GPL v2");
984 MODULE_DEVICE_TABLE(of, msm8660_pinctrl_of_match);