blob: e873498f8600bd5c43b04071336b083d54dd178d [file] [log] [blame]
Stepan Moskovchenko5ea3c312012-01-31 18:19:40 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <linux/platform_device.h>
17#include <linux/bootmem.h>
18#include <asm/mach-types.h>
19#include <asm/mach/mmc.h>
20#include <mach/msm_bus_board.h>
21#include <mach/board.h>
22#include <mach/gpio.h>
23#include <mach/gpiomux.h>
Joel Kingdacbc822012-01-25 13:30:57 -080024#include <mach/socinfo.h>
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080025#include "devices.h"
26#include "board-8064.h"
27
28#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
29static struct gpiomux_setting gpio_eth_config = {
30 .pull = GPIOMUX_PULL_NONE,
31 .drv = GPIOMUX_DRV_8MA,
32 .func = GPIOMUX_FUNC_GPIO,
33};
34
35/* The SPI configurations apply to GSBI 5*/
36static struct gpiomux_setting gpio_spi_config = {
37 .func = GPIOMUX_FUNC_2,
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -080038 .drv = GPIOMUX_DRV_12MA,
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080039 .pull = GPIOMUX_PULL_NONE,
40};
41
42/* The SPI configurations apply to GSBI 5 chip select 2*/
43static struct gpiomux_setting gpio_spi_cs2_config = {
44 .func = GPIOMUX_FUNC_3,
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -080045 .drv = GPIOMUX_DRV_12MA,
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080046 .pull = GPIOMUX_PULL_NONE,
47};
48
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -080049/* Chip selects for SPI clients */
50static struct gpiomux_setting gpio_spi_cs_config = {
51 .func = GPIOMUX_FUNC_GPIO,
52 .drv = GPIOMUX_DRV_12MA,
53 .pull = GPIOMUX_PULL_UP,
54};
55
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080056/* Chip selects for EPM SPI clients */
57static struct gpiomux_setting gpio_epm_spi_cs_config = {
58 .func = GPIOMUX_FUNC_3,
59 .drv = GPIOMUX_DRV_12MA,
60 .pull = GPIOMUX_PULL_UP,
61};
62
Stepan Moskovchenko2327a952011-12-14 16:31:28 -080063struct msm_gpiomux_config apq8064_ethernet_configs[] = {
64 {
65 .gpio = 43,
66 .settings = {
67 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
68 [GPIOMUX_ACTIVE] = &gpio_eth_config,
69 }
70 },
71};
72#endif
73
Terence Hampson2e1705f2012-04-11 19:55:29 -040074#ifdef CONFIG_MSM_VCAP
75static struct gpiomux_setting gpio_vcap_config[] = {
76 {
77 .func = GPIOMUX_FUNC_GPIO,
78 .drv = GPIOMUX_DRV_2MA,
79 .pull = GPIOMUX_PULL_DOWN,
80 },
81 {
82 .func = GPIOMUX_FUNC_1,
83 .drv = GPIOMUX_DRV_2MA,
84 .pull = GPIOMUX_PULL_DOWN,
85 },
86 {
87 .func = GPIOMUX_FUNC_2,
88 .drv = GPIOMUX_DRV_2MA,
89 .pull = GPIOMUX_PULL_DOWN,
90 },
91 {
92 .func = GPIOMUX_FUNC_3,
93 .drv = GPIOMUX_DRV_2MA,
94 .pull = GPIOMUX_PULL_DOWN,
95 },
96 {
97 .func = GPIOMUX_FUNC_4,
98 .drv = GPIOMUX_DRV_2MA,
99 .pull = GPIOMUX_PULL_DOWN,
100 },
101 {
102 .func = GPIOMUX_FUNC_5,
103 .drv = GPIOMUX_DRV_2MA,
104 .pull = GPIOMUX_PULL_DOWN,
105 },
106 {
107 .func = GPIOMUX_FUNC_6,
108 .drv = GPIOMUX_DRV_2MA,
109 .pull = GPIOMUX_PULL_DOWN,
110 },
111 {
112 .func = GPIOMUX_FUNC_7,
113 .drv = GPIOMUX_DRV_2MA,
114 .pull = GPIOMUX_PULL_DOWN,
115 },
116 {
117 .func = GPIOMUX_FUNC_8,
118 .drv = GPIOMUX_DRV_2MA,
119 .pull = GPIOMUX_PULL_DOWN,
120 },
121 {
122 .func = GPIOMUX_FUNC_9,
123 .drv = GPIOMUX_DRV_2MA,
124 .pull = GPIOMUX_PULL_DOWN,
125 },
126 {
127 .func = GPIOMUX_FUNC_A,
128 .drv = GPIOMUX_DRV_2MA,
129 .pull = GPIOMUX_PULL_DOWN,
130 },
131};
132
133struct msm_gpiomux_config vcap_configs[] = {
134 {
135 .gpio = 20,
136 .settings = {
137 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[7],
138 [GPIOMUX_ACTIVE] = &gpio_vcap_config[7],
139 }
140 },
141 {
142 .gpio = 25,
143 .settings = {
144 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
145 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
146 }
147 },
148 {
149 .gpio = 24,
150 .settings = {
151 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[1],
152 [GPIOMUX_ACTIVE] = &gpio_vcap_config[1],
153 }
154 },
155 {
156 .gpio = 23,
157 .settings = {
158 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
159 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
160 }
161 },
162 {
163 .gpio = 19,
164 .settings = {
165 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[8],
166 [GPIOMUX_ACTIVE] = &gpio_vcap_config[8],
167 }
168 },
169 {
170 .gpio = 22,
171 .settings = {
172 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
173 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
174 }
175 },
176 {
177 .gpio = 21,
178 .settings = {
179 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[7],
180 [GPIOMUX_ACTIVE] = &gpio_vcap_config[7],
181 }
182 },
183 {
184 .gpio = 12,
185 .settings = {
186 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[6],
187 [GPIOMUX_ACTIVE] = &gpio_vcap_config[6],
188 }
189 },
190 {
191 .gpio = 18,
192 .settings = {
193 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[9],
194 [GPIOMUX_ACTIVE] = &gpio_vcap_config[9],
195 }
196 },
197 {
198 .gpio = 11,
199 .settings = {
200 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[10],
201 [GPIOMUX_ACTIVE] = &gpio_vcap_config[10],
202 }
203 },
204 {
205 .gpio = 10,
206 .settings = {
207 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[9],
208 [GPIOMUX_ACTIVE] = &gpio_vcap_config[9],
209 }
210 },
211 {
212 .gpio = 9,
213 .settings = {
214 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
215 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
216 }
217 },
218 {
219 .gpio = 26,
220 .settings = {
221 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[1],
222 [GPIOMUX_ACTIVE] = &gpio_vcap_config[1],
223 }
224 },
225 {
226 .gpio = 8,
227 .settings = {
228 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[3],
229 [GPIOMUX_ACTIVE] = &gpio_vcap_config[3],
230 }
231 },
232 {
233 .gpio = 7,
234 .settings = {
235 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[7],
236 [GPIOMUX_ACTIVE] = &gpio_vcap_config[7],
237 }
238 },
239 {
240 .gpio = 6,
241 .settings = {
242 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[7],
243 [GPIOMUX_ACTIVE] = &gpio_vcap_config[7],
244 }
245 },
246 {
247 .gpio = 80,
248 .settings = {
249 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
250 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
251 }
252 },
253 {
254 .gpio = 86,
255 .settings = {
256 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[1],
257 [GPIOMUX_ACTIVE] = &gpio_vcap_config[1],
258 }
259 },
260 {
261 .gpio = 85,
262 .settings = {
263 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[4],
264 [GPIOMUX_ACTIVE] = &gpio_vcap_config[4],
265 }
266 },
267 {
268 .gpio = 84,
269 .settings = {
270 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[3],
271 [GPIOMUX_ACTIVE] = &gpio_vcap_config[3],
272 }
273 },
274 {
275 .gpio = 5,
276 .settings = {
277 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
278 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
279 }
280 },
281 {
282 .gpio = 4,
283 .settings = {
284 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[3],
285 [GPIOMUX_ACTIVE] = &gpio_vcap_config[3],
286 }
287 },
288 {
289 .gpio = 3,
290 .settings = {
291 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[6],
292 [GPIOMUX_ACTIVE] = &gpio_vcap_config[6],
293 }
294 },
295 {
296 .gpio = 2,
297 .settings = {
298 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[5],
299 [GPIOMUX_ACTIVE] = &gpio_vcap_config[5],
300 }
301 },
302 {
303 .gpio = 82,
304 .settings = {
305 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[4],
306 [GPIOMUX_ACTIVE] = &gpio_vcap_config[4],
307 }
308 },
309 {
310 .gpio = 83,
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[4],
313 [GPIOMUX_ACTIVE] = &gpio_vcap_config[4],
314 }
315 },
316 {
317 .gpio = 87,
318 .settings = {
319 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[2],
320 [GPIOMUX_ACTIVE] = &gpio_vcap_config[2],
321 }
322 },
323 {
324 .gpio = 13,
325 .settings = {
326 [GPIOMUX_SUSPENDED] = &gpio_vcap_config[6],
327 [GPIOMUX_ACTIVE] = &gpio_vcap_config[6],
328 }
329 },
330};
331#endif
332
David Keitel3c40fc52012-02-09 17:53:52 -0800333static struct gpiomux_setting gpio_i2c_config = {
334 .func = GPIOMUX_FUNC_1,
335 .drv = GPIOMUX_DRV_8MA,
336 .pull = GPIOMUX_PULL_NONE,
337};
338
339static struct gpiomux_setting gpio_i2c_config_sus = {
340 .func = GPIOMUX_FUNC_1,
341 .drv = GPIOMUX_DRV_2MA,
342 .pull = GPIOMUX_PULL_KEEPER,
343};
344
Joonwoo Parkca1516f2012-05-08 13:59:37 -0700345static struct gpiomux_setting mbhc_hs_detect = {
346 .func = GPIOMUX_FUNC_1,
347 .drv = GPIOMUX_DRV_2MA,
348 .pull = GPIOMUX_PULL_NONE,
349};
350
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800351static struct gpiomux_setting cdc_mclk = {
352 .func = GPIOMUX_FUNC_1,
353 .drv = GPIOMUX_DRV_8MA,
354 .pull = GPIOMUX_PULL_NONE,
355};
356
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800357static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
358 .func = GPIOMUX_FUNC_GPIO,
359 .drv = GPIOMUX_DRV_2MA,
360 .pull = GPIOMUX_PULL_UP,
361};
362
363static struct gpiomux_setting wcnss_5wire_active_cfg = {
364 .func = GPIOMUX_FUNC_1,
365 .drv = GPIOMUX_DRV_6MA,
366 .pull = GPIOMUX_PULL_DOWN,
367};
368
369
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800370static struct gpiomux_setting slimbus = {
371 .func = GPIOMUX_FUNC_1,
372 .drv = GPIOMUX_DRV_8MA,
373 .pull = GPIOMUX_PULL_KEEPER,
374};
375
Stepan Moskovchenko5ea3c312012-01-31 18:19:40 -0800376static struct gpiomux_setting gsbi1_uart_config = {
377 .func = GPIOMUX_FUNC_1,
378 .drv = GPIOMUX_DRV_16MA,
379 .pull = GPIOMUX_PULL_NONE,
380};
381
David Collinsf0d00732012-01-25 15:46:50 -0800382static struct gpiomux_setting ext_regulator_config = {
383 .func = GPIOMUX_FUNC_GPIO,
384 .drv = GPIOMUX_DRV_8MA,
385 .pull = GPIOMUX_PULL_NONE,
386 .dir = GPIOMUX_OUT_LOW,
387};
388
Jin Hong4bbbfba2012-02-02 21:48:07 -0800389static struct gpiomux_setting gsbi7_func1_cfg = {
390 .func = GPIOMUX_FUNC_1,
391 .drv = GPIOMUX_DRV_8MA,
392 .pull = GPIOMUX_PULL_NONE,
393};
394
395static struct gpiomux_setting gsbi7_func2_cfg = {
396 .func = GPIOMUX_FUNC_2,
397 .drv = GPIOMUX_DRV_8MA,
398 .pull = GPIOMUX_PULL_NONE,
399};
400
Jing Lin04601f92012-02-05 15:36:07 -0800401static struct gpiomux_setting gsbi3_suspended_cfg = {
402 .func = GPIOMUX_FUNC_1,
403 .drv = GPIOMUX_DRV_2MA,
404 .pull = GPIOMUX_PULL_KEEPER,
405};
406
407static struct gpiomux_setting gsbi3_active_cfg = {
408 .func = GPIOMUX_FUNC_1,
409 .drv = GPIOMUX_DRV_8MA,
410 .pull = GPIOMUX_PULL_NONE,
411};
412
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -0800413static struct gpiomux_setting hdmi_suspend_cfg = {
414 .func = GPIOMUX_FUNC_GPIO,
415 .drv = GPIOMUX_DRV_2MA,
416 .pull = GPIOMUX_PULL_DOWN,
417};
418
419static struct gpiomux_setting hdmi_active_1_cfg = {
420 .func = GPIOMUX_FUNC_1,
421 .drv = GPIOMUX_DRV_2MA,
422 .pull = GPIOMUX_PULL_UP,
423};
424
425static struct gpiomux_setting hdmi_active_2_cfg = {
426 .func = GPIOMUX_FUNC_1,
427 .drv = GPIOMUX_DRV_16MA,
428 .pull = GPIOMUX_PULL_DOWN,
429};
430
Joel King8f839b92012-04-01 14:37:46 -0700431static struct gpiomux_setting gsbi5_suspended_cfg = {
432 .func = GPIOMUX_FUNC_2,
433 .drv = GPIOMUX_DRV_12MA,
434 .pull = GPIOMUX_PULL_NONE,
435};
436
437static struct gpiomux_setting gsbi5_active_cfg = {
438 .func = GPIOMUX_FUNC_2,
439 .drv = GPIOMUX_DRV_12MA,
440 .pull = GPIOMUX_PULL_NONE,
441};
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +0530442
443static struct gpiomux_setting sx150x_suspended_cfg = {
444 .func = GPIOMUX_FUNC_GPIO,
445 .drv = GPIOMUX_DRV_8MA,
446 .pull = GPIOMUX_PULL_NONE,
447};
448
449static struct gpiomux_setting sx150x_active_cfg = {
450 .func = GPIOMUX_FUNC_GPIO,
451 .drv = GPIOMUX_DRV_8MA,
452 .pull = GPIOMUX_PULL_NONE,
453};
454
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800455static struct gpiomux_setting cyts_sleep_sus_cfg = {
456 .func = GPIOMUX_FUNC_GPIO,
457 .drv = GPIOMUX_DRV_6MA,
458 .pull = GPIOMUX_PULL_DOWN,
459};
460
461static struct gpiomux_setting cyts_sleep_act_cfg = {
462 .func = GPIOMUX_FUNC_GPIO,
463 .drv = GPIOMUX_DRV_6MA,
464 .pull = GPIOMUX_PULL_DOWN,
465};
466
467static struct gpiomux_setting cyts_int_act_cfg = {
468 .func = GPIOMUX_FUNC_GPIO,
469 .drv = GPIOMUX_DRV_8MA,
470 .pull = GPIOMUX_PULL_UP,
471};
472
473static struct gpiomux_setting cyts_int_sus_cfg = {
474 .func = GPIOMUX_FUNC_GPIO,
475 .drv = GPIOMUX_DRV_2MA,
476 .pull = GPIOMUX_PULL_DOWN,
477};
478
479static struct msm_gpiomux_config cyts_gpio_configs[] __initdata = {
480 { /* TS INTERRUPT */
481 .gpio = 6,
482 .settings = {
483 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
484 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
485 },
486 },
487 { /* TS SLEEP */
488 .gpio = 33,
489 .settings = {
490 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
491 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
492 },
493 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -0800494};
495
Amy Maloche9ba3ffe2012-04-26 10:31:20 -0700496#ifdef CONFIG_USB_EHCI_MSM_HSIC
497static struct gpiomux_setting hsic_act_cfg = {
498 .func = GPIOMUX_FUNC_1,
499 .drv = GPIOMUX_DRV_8MA,
500 .pull = GPIOMUX_PULL_NONE,
501};
502
503static struct gpiomux_setting hsic_sus_cfg = {
504 .func = GPIOMUX_FUNC_GPIO,
505 .drv = GPIOMUX_DRV_2MA,
506 .pull = GPIOMUX_PULL_DOWN,
507 .dir = GPIOMUX_OUT_LOW,
508};
509
510
Hemant Kumara945b472012-01-25 15:08:06 -0800511static struct msm_gpiomux_config apq8064_hsic_configs[] = {
512 {
513 .gpio = 88, /*HSIC_STROBE */
514 .settings = {
515 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
516 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
517 },
518 },
519 {
520 .gpio = 89, /* HSIC_DATA */
521 .settings = {
522 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
523 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
524 },
525 },
526};
527#endif
528
Jing Lin21ed4de2012-02-05 15:53:28 -0800529static struct gpiomux_setting mxt_reset_sus_cfg = {
530 .func = GPIOMUX_FUNC_GPIO,
531 .drv = GPIOMUX_DRV_6MA,
532 .pull = GPIOMUX_PULL_DOWN,
533};
534
535static struct gpiomux_setting mxt_reset_act_cfg = {
536 .func = GPIOMUX_FUNC_GPIO,
537 .drv = GPIOMUX_DRV_6MA,
538 .pull = GPIOMUX_PULL_UP,
539};
540
541static struct gpiomux_setting mxt_int_sus_cfg = {
542 .func = GPIOMUX_FUNC_GPIO,
543 .drv = GPIOMUX_DRV_2MA,
544 .pull = GPIOMUX_PULL_DOWN,
545};
546
547static struct gpiomux_setting mxt_int_act_cfg = {
548 .func = GPIOMUX_FUNC_GPIO,
549 .drv = GPIOMUX_DRV_8MA,
550 .pull = GPIOMUX_PULL_UP,
551};
552
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -0800553static struct msm_gpiomux_config apq8064_hdmi_configs[] __initdata = {
554 {
555 .gpio = 69,
556 .settings = {
557 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
558 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
559 },
560 },
561 {
562 .gpio = 70,
563 .settings = {
564 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
565 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
566 },
567 },
568 {
569 .gpio = 71,
570 .settings = {
571 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
572 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
573 },
574 },
575 {
576 .gpio = 72,
577 .settings = {
578 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
579 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
580 },
581 },
582};
583
Stepan Moskovchenko2327a952011-12-14 16:31:28 -0800584static struct msm_gpiomux_config apq8064_gsbi_configs[] __initdata = {
Stepan Moskovchenko5ea3c312012-01-31 18:19:40 -0800585 {
Jing Lin04601f92012-02-05 15:36:07 -0800586 .gpio = 8, /* GSBI3 I2C QUP SDA */
587 .settings = {
588 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
589 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
590 },
591 },
592 {
593 .gpio = 9, /* GSBI3 I2C QUP SCL */
594 .settings = {
595 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
596 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
597 },
598 },
599 {
Stepan Moskovchenko5ea3c312012-01-31 18:19:40 -0800600 .gpio = 18, /* GSBI1 UART TX */
601 .settings = {
602 [GPIOMUX_SUSPENDED] = &gsbi1_uart_config,
603 },
604 },
605 {
606 .gpio = 19, /* GSBI1 UART RX */
607 .settings = {
608 [GPIOMUX_SUSPENDED] = &gsbi1_uart_config,
609 },
610 },
Stepan Moskovchenko2327a952011-12-14 16:31:28 -0800611#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
612 {
613 .gpio = 51, /* GSBI5 QUP SPI_DATA_MOSI */
614 .settings = {
615 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
616 },
617 },
618 {
619 .gpio = 52, /* GSBI5 QUP SPI_DATA_MISO */
620 .settings = {
621 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
622 },
623 },
624 {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -0800625 .gpio = 53, /* Funny CS0 */
626 .settings = {
627 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
628 },
629 },
630 {
Stepan Moskovchenko2327a952011-12-14 16:31:28 -0800631 .gpio = 31, /* GSBI5 QUP SPI_CS2_N */
632 .settings = {
633 [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config,
634 },
635 },
636 {
637 .gpio = 54, /* GSBI5 QUP SPI_CLK */
638 .settings = {
639 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
640 },
641 },
642#endif
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -0800643 {
644 .gpio = 30, /* FP CS */
645 .settings = {
646 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
647 },
648 },
649 {
650 .gpio = 32, /* EPM CS */
651 .settings = {
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800652 [GPIOMUX_SUSPENDED] = &gpio_epm_spi_cs_config,
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -0800653 },
654 },
655 {
656 .gpio = 53, /* NOR CS */
657 .settings = {
658 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
659 },
660 },
Jin Hong4bbbfba2012-02-02 21:48:07 -0800661 {
662 .gpio = 82, /* GSBI7 UART2 TX */
663 .settings = {
664 [GPIOMUX_SUSPENDED] = &gsbi7_func2_cfg,
665 },
666 },
667 {
668 .gpio = 83, /* GSBI7 UART2 RX */
669 .settings = {
670 [GPIOMUX_SUSPENDED] = &gsbi7_func1_cfg,
671 },
672 },
David Keitel3c40fc52012-02-09 17:53:52 -0800673 {
674 .gpio = 21, /* GSBI1 QUP I2C_CLK */
675 .settings = {
676 [GPIOMUX_SUSPENDED] = &gpio_i2c_config_sus,
677 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
678 },
679 },
680 {
681 .gpio = 20, /* GSBI1 QUP I2C_DATA */
682 .settings = {
683 [GPIOMUX_SUSPENDED] = &gpio_i2c_config_sus,
684 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
685 },
686 },
Stepan Moskovchenko2327a952011-12-14 16:31:28 -0800687};
688
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800689static struct msm_gpiomux_config apq8064_slimbus_config[] __initdata = {
690 {
691 .gpio = 40, /* slimbus clk */
692 .settings = {
693 [GPIOMUX_SUSPENDED] = &slimbus,
694 },
695 },
696 {
697 .gpio = 41, /* slimbus data */
698 .settings = {
699 [GPIOMUX_SUSPENDED] = &slimbus,
700 },
701 },
702};
703
Santosh Mardieff9a742012-04-09 23:23:39 +0530704static struct gpiomux_setting spkr_i2c = {
705 .func = GPIOMUX_FUNC_1,
706 .drv = GPIOMUX_DRV_8MA,
707 .pull = GPIOMUX_PULL_KEEPER,
708};
709
710static struct msm_gpiomux_config mpq8064_spkr_i2s_config[] __initdata = {
711 {
712 .gpio = 47, /* spkr i2c sck */
713 .settings = {
714 [GPIOMUX_SUSPENDED] = &spkr_i2c,
715 },
716 },
717 {
718 .gpio = 48, /* spkr_i2s_ws */
719 .settings = {
720 [GPIOMUX_SUSPENDED] = &spkr_i2c,
721 },
722 },
723 {
724 .gpio = 49, /* spkr_i2s_dout */
725 .settings = {
726 [GPIOMUX_SUSPENDED] = &spkr_i2c,
727 },
728 },
729 {
730 .gpio = 50, /* spkr_i2s_mclk */
731 .settings = {
732 [GPIOMUX_SUSPENDED] = &spkr_i2c,
733 },
734 },
735};
736
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800737static struct msm_gpiomux_config apq8064_audio_codec_configs[] __initdata = {
738 {
Joonwoo Parkca1516f2012-05-08 13:59:37 -0700739 .gpio = 38,
740 .settings = {
741 [GPIOMUX_SUSPENDED] = &mbhc_hs_detect,
742 },
743 },
744 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800745 .gpio = 39,
746 .settings = {
747 [GPIOMUX_SUSPENDED] = &cdc_mclk,
748 },
749 },
750};
751
David Collinsf0d00732012-01-25 15:46:50 -0800752/* External 3.3 V regulator enable */
753static struct msm_gpiomux_config apq8064_ext_regulator_configs[] __initdata = {
754 {
755 .gpio = APQ8064_EXT_3P3V_REG_EN_GPIO,
756 .settings = {
757 [GPIOMUX_SUSPENDED] = &ext_regulator_config,
758 },
759 },
760};
761
Joel Kingdacbc822012-01-25 13:30:57 -0800762static struct gpiomux_setting ap2mdm_cfg = {
763 .func = GPIOMUX_FUNC_GPIO,
764 .drv = GPIOMUX_DRV_8MA,
765 .pull = GPIOMUX_PULL_DOWN,
766};
767
768static struct gpiomux_setting mdm2ap_status_cfg = {
769 .func = GPIOMUX_FUNC_GPIO,
770 .drv = GPIOMUX_DRV_8MA,
771 .pull = GPIOMUX_PULL_NONE,
772};
773
774static struct gpiomux_setting mdm2ap_errfatal_cfg = {
775 .func = GPIOMUX_FUNC_GPIO,
776 .drv = GPIOMUX_DRV_16MA,
777 .pull = GPIOMUX_PULL_DOWN,
778};
779
780static struct gpiomux_setting ap2mdm_pon_reset_n_cfg = {
781 .func = GPIOMUX_FUNC_GPIO,
782 .drv = GPIOMUX_DRV_8MA,
783 .pull = GPIOMUX_PULL_DOWN,
784};
785
Vamsi Krishna9e307cd2012-04-11 13:15:36 -0700786static struct gpiomux_setting ap2mdm_wakeup = {
787 .func = GPIOMUX_FUNC_GPIO,
788 .drv = GPIOMUX_DRV_8MA,
789 .pull = GPIOMUX_PULL_DOWN,
790};
791
Joel Kingdacbc822012-01-25 13:30:57 -0800792static struct msm_gpiomux_config mdm_configs[] __initdata = {
793 /* AP2MDM_STATUS */
794 {
795 .gpio = 48,
796 .settings = {
797 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
798 }
799 },
800 /* MDM2AP_STATUS */
801 {
802 .gpio = 49,
803 .settings = {
804 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
805 }
806 },
807 /* MDM2AP_ERRFATAL */
808 {
809 .gpio = 19,
810 .settings = {
811 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
812 }
813 },
814 /* AP2MDM_ERRFATAL */
815 {
816 .gpio = 18,
817 .settings = {
818 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
819 }
820 },
821 /* AP2MDM_PON_RESET_N */
822 {
823 .gpio = 27,
824 .settings = {
825 [GPIOMUX_SUSPENDED] = &ap2mdm_pon_reset_n_cfg,
826 }
Mohan Pallaka474b94b2012-01-25 12:59:58 +0530827 },
Vamsi Krishna9e307cd2012-04-11 13:15:36 -0700828 /* AP2MDM_WAKEUP */
829 {
830 .gpio = 35,
831 .settings = {
832 [GPIOMUX_SUSPENDED] = &ap2mdm_wakeup,
833 }
834 },
Mohan Pallaka474b94b2012-01-25 12:59:58 +0530835};
836
Kuirong Wangf23f8c52012-03-31 12:34:51 -0700837static struct gpiomux_setting mi2s_act_cfg = {
838 .func = GPIOMUX_FUNC_1,
839 .drv = GPIOMUX_DRV_8MA,
840 .pull = GPIOMUX_PULL_NONE,
841};
842
843static struct gpiomux_setting mi2s_sus_cfg = {
844 .func = GPIOMUX_FUNC_GPIO,
845 .drv = GPIOMUX_DRV_2MA,
846 .pull = GPIOMUX_PULL_DOWN,
847};
848
849static struct msm_gpiomux_config mpq8064_mi2s_configs[] __initdata = {
850 {
851 .gpio = 27, /* mi2s ws */
852 .settings = {
853 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
854 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
855 },
856 },
857 {
858 .gpio = 28, /* mi2s sclk */
859 .settings = {
860 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
861 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
862 },
863 },
864 {
865 .gpio = 29, /* mi2s dout3 */
866 .settings = {
867 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
868 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
869 },
870 },
871 {
872 .gpio = 30, /* mi2s dout2 */
873 .settings = {
874 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
875 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
876 },
877 },
878
879 {
880 .gpio = 31, /* mi2s dout1 */
881 .settings = {
882 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
883 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
884 },
885 },
886 {
887 .gpio = 32, /* mi2s dout0 */
888 .settings = {
889 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
890 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
891 },
892 },
893
894 {
895 .gpio = 33, /* mi2s mclk */
896 .settings = {
897 [GPIOMUX_ACTIVE] = &mi2s_act_cfg,
898 [GPIOMUX_SUSPENDED] = &mi2s_sus_cfg,
899 },
900 },
901};
Jing Lin21ed4de2012-02-05 15:53:28 -0800902static struct msm_gpiomux_config apq8064_mxt_configs[] __initdata = {
903 { /* TS INTERRUPT */
904 .gpio = 6,
905 .settings = {
906 [GPIOMUX_ACTIVE] = &mxt_int_act_cfg,
907 [GPIOMUX_SUSPENDED] = &mxt_int_sus_cfg,
908 },
909 },
910 { /* TS RESET */
911 .gpio = 33,
912 .settings = {
913 [GPIOMUX_ACTIVE] = &mxt_reset_act_cfg,
914 [GPIOMUX_SUSPENDED] = &mxt_reset_sus_cfg,
915 },
916 },
917};
918
Ankit Verma6b7e2ba2012-01-26 15:48:54 -0800919static struct msm_gpiomux_config wcnss_5wire_interface[] = {
920 {
921 .gpio = 64,
922 .settings = {
923 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
924 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
925 },
926 },
927 {
928 .gpio = 65,
929 .settings = {
930 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
931 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
932 },
933 },
934 {
935 .gpio = 66,
936 .settings = {
937 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
938 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
939 },
940 },
941 {
942 .gpio = 67,
943 .settings = {
944 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
945 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
946 },
947 },
948 {
949 .gpio = 68,
950 .settings = {
951 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
952 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
953 },
954 },
955};
956
Joel King8f839b92012-04-01 14:37:46 -0700957static struct msm_gpiomux_config mpq8064_gsbi5_i2c_configs[] __initdata = {
958 {
959 .gpio = 53, /* GSBI5 I2C QUP SDA */
960 .settings = {
961 [GPIOMUX_SUSPENDED] = &gsbi5_suspended_cfg,
962 [GPIOMUX_ACTIVE] = &gsbi5_active_cfg,
963 },
964 },
965 {
966 .gpio = 54, /* GSBI5 I2C QUP SCL */
967 .settings = {
968 [GPIOMUX_SUSPENDED] = &gsbi5_suspended_cfg,
969 [GPIOMUX_ACTIVE] = &gsbi5_active_cfg,
970 },
971 },
972};
973
Ravi Kumar V05931a22012-04-04 17:09:37 +0530974static struct gpiomux_setting ir_suspended_cfg = {
975 .func = GPIOMUX_FUNC_GPIO,
976 .drv = GPIOMUX_DRV_2MA,
977 .pull = GPIOMUX_PULL_UP,
978};
979
980static struct gpiomux_setting ir_active_cfg = {
981 .func = GPIOMUX_FUNC_GPIO,
982 .drv = GPIOMUX_DRV_8MA,
983 .pull = GPIOMUX_PULL_UP,
984};
985
986static struct msm_gpiomux_config mpq8064_ir_configs[] __initdata = {
987 {
988 .gpio = 88, /* GPIO IR */
989 .settings = {
990 [GPIOMUX_SUSPENDED] = &ir_suspended_cfg,
991 [GPIOMUX_ACTIVE] = &ir_active_cfg,
992 },
993 },
994};
995
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +0530996static struct msm_gpiomux_config sx150x_int_configs[] __initdata = {
997 {
998 .gpio = 81,
999 .settings = {
1000 [GPIOMUX_SUSPENDED] = &sx150x_suspended_cfg,
1001 [GPIOMUX_ACTIVE] = &sx150x_active_cfg,
1002 },
1003 },
1004};
1005
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001006void __init apq8064_init_gpiomux(void)
1007{
1008 int rc;
1009
1010 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1011 if (rc) {
1012 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1013 return;
1014 }
1015
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001016 msm_gpiomux_install(wcnss_5wire_interface,
1017 ARRAY_SIZE(wcnss_5wire_interface));
1018
Joel King8f839b92012-04-01 14:37:46 -07001019 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
1020 machine_is_mpq8064_dtv()) {
1021 msm_gpiomux_install(mpq8064_gsbi5_i2c_configs,
1022 ARRAY_SIZE(mpq8064_gsbi5_i2c_configs));
Terence Hampson2e1705f2012-04-11 19:55:29 -04001023#ifdef CONFIG_MSM_VCAP
1024 msm_gpiomux_install(vcap_configs,
1025 ARRAY_SIZE(vcap_configs));
1026#endif
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05301027 msm_gpiomux_install(sx150x_int_configs,
1028 ARRAY_SIZE(sx150x_int_configs));
Joel King8f839b92012-04-01 14:37:46 -07001029 } else {
1030 #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
1031 msm_gpiomux_install(apq8064_ethernet_configs,
1032 ARRAY_SIZE(apq8064_ethernet_configs));
1033 #endif
1034
1035 msm_gpiomux_install(apq8064_gsbi_configs,
1036 ARRAY_SIZE(apq8064_gsbi_configs));
1037 }
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001038
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001039 msm_gpiomux_install(apq8064_slimbus_config,
1040 ARRAY_SIZE(apq8064_slimbus_config));
1041
1042 msm_gpiomux_install(apq8064_audio_codec_configs,
1043 ARRAY_SIZE(apq8064_audio_codec_configs));
1044
Santosh Mardieff9a742012-04-09 23:23:39 +05301045 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
1046 machine_is_mpq8064_dtv()) {
1047 msm_gpiomux_install(mpq8064_spkr_i2s_config,
1048 ARRAY_SIZE(mpq8064_spkr_i2s_config));
1049 }
1050
Swaminathan Sathappan9e07aa92012-02-29 12:07:27 -08001051 pr_debug("%s(): audio-auxpcm: Include GPIO configs"
1052 " as audio is not the primary user"
1053 " for these GPIO Pins\n", __func__);
David Collinsf0d00732012-01-25 15:46:50 -08001054
Kuirong Wangf23f8c52012-03-31 12:34:51 -07001055 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
1056 machine_is_mpq8064_dtv())
1057 msm_gpiomux_install(mpq8064_mi2s_configs,
1058 ARRAY_SIZE(mpq8064_mi2s_configs));
1059
David Collinsf0d00732012-01-25 15:46:50 -08001060 msm_gpiomux_install(apq8064_ext_regulator_configs,
1061 ARRAY_SIZE(apq8064_ext_regulator_configs));
Joel Kingdacbc822012-01-25 13:30:57 -08001062
1063 if (machine_is_apq8064_mtp())
1064 msm_gpiomux_install(mdm_configs,
1065 ARRAY_SIZE(mdm_configs));
Hemant Kumara945b472012-01-25 15:08:06 -08001066
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001067 if (machine_is_apq8064_mtp())
1068 msm_gpiomux_install(cyts_gpio_configs,
1069 ARRAY_SIZE(cyts_gpio_configs));
1070
Hemant Kumara945b472012-01-25 15:08:06 -08001071#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumarf1ca9192012-02-07 18:59:33 -08001072 if (machine_is_apq8064_mtp())
1073 msm_gpiomux_install(apq8064_hsic_configs,
1074 ARRAY_SIZE(apq8064_hsic_configs));
Hemant Kumara945b472012-01-25 15:08:06 -08001075#endif
Jing Lin21ed4de2012-02-05 15:53:28 -08001076
1077 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
1078 msm_gpiomux_install(apq8064_mxt_configs,
1079 ARRAY_SIZE(apq8064_mxt_configs));
Aravind Venkateswaran0507c8c2012-02-16 17:16:05 -08001080
1081 msm_gpiomux_install(apq8064_hdmi_configs,
1082 ARRAY_SIZE(apq8064_hdmi_configs));
Ravi Kumar V05931a22012-04-04 17:09:37 +05301083
1084 if (machine_is_mpq8064_cdp())
1085 msm_gpiomux_install(mpq8064_ir_configs,
1086 ARRAY_SIZE(mpq8064_ir_configs));
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08001087}