blob: 5d4d3795231b4685ea9a3bcde88d412d9f749c00 [file] [log] [blame]
Damir Didjusto93768d12013-01-17 11:30:47 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07002 *
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
Yue Ma10d88752014-02-20 17:12:05 -080014#include <linux/gpio.h>
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -070015#include <linux/init.h>
16#include <linux/ioport.h>
17#include <mach/board.h>
18#include <mach/gpio.h>
19#include <mach/gpiomux.h>
Stepan Moskovchenko95108b82012-11-27 14:28:11 -080020#include <mach/socinfo.h>
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -070021
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070022#define KS8851_IRQ_GPIO 94
Sathish Ambleye3154b42012-04-09 10:59:09 -070023
Yue Ma10d88752014-02-20 17:12:05 -080024#define WLAN_CLK 40
25#define WLAN_SET 39
26#define WLAN_DATA0 38
27#define WLAN_DATA1 37
28#define WLAN_DATA2 36
29
Joel King15ccbfa2013-04-12 17:41:16 -070030static struct gpiomux_setting ap2mdm_cfg = {
31 .func = GPIOMUX_FUNC_GPIO,
Tirtha Kanti Ghosh2d554cc2014-01-20 12:26:57 -080032 .drv = GPIOMUX_DRV_2MA,
Joel King15ccbfa2013-04-12 17:41:16 -070033 .pull = GPIOMUX_PULL_NONE,
Tirtha Kanti Ghosh2d554cc2014-01-20 12:26:57 -080034 .dir = GPIOMUX_OUT_LOW,
Joel King15ccbfa2013-04-12 17:41:16 -070035};
36
37static struct gpiomux_setting mdm2ap_status_cfg = {
38 .func = GPIOMUX_FUNC_GPIO,
Tirtha Kanti Ghosh2d554cc2014-01-20 12:26:57 -080039 .drv = GPIOMUX_DRV_2MA,
40 .pull = GPIOMUX_PULL_NONE,
41 .dir = GPIOMUX_OUT_LOW,
Joel King15ccbfa2013-04-12 17:41:16 -070042};
43
44static struct gpiomux_setting mdm2ap_errfatal_cfg = {
45 .func = GPIOMUX_FUNC_GPIO,
Tirtha Kanti Ghosh2d554cc2014-01-20 12:26:57 -080046 .drv = GPIOMUX_DRV_2MA,
47 .pull = GPIOMUX_PULL_NONE,
48 .dir = GPIOMUX_OUT_LOW,
Joel King15ccbfa2013-04-12 17:41:16 -070049};
50
51static struct gpiomux_setting mdm2ap_pblrdy = {
52 .func = GPIOMUX_FUNC_GPIO,
Tirtha Kanti Ghosh2d554cc2014-01-20 12:26:57 -080053 .drv = GPIOMUX_DRV_2MA,
Joel King15ccbfa2013-04-12 17:41:16 -070054 .pull = GPIOMUX_PULL_NONE,
55 .dir = GPIOMUX_IN,
56};
57
58
59static struct gpiomux_setting ap2mdm_soft_reset_cfg = {
60 .func = GPIOMUX_FUNC_GPIO,
Tirtha Kanti Ghosh2d554cc2014-01-20 12:26:57 -080061 .drv = GPIOMUX_DRV_2MA,
Joel King15ccbfa2013-04-12 17:41:16 -070062 .pull = GPIOMUX_PULL_NONE,
Tirtha Kanti Ghosh2d554cc2014-01-20 12:26:57 -080063 .dir = GPIOMUX_OUT_LOW,
Joel King15ccbfa2013-04-12 17:41:16 -070064};
65
66static struct gpiomux_setting ap2mdm_wakeup = {
67 .func = GPIOMUX_FUNC_GPIO,
Tirtha Kanti Ghosh2d554cc2014-01-20 12:26:57 -080068 .drv = GPIOMUX_DRV_2MA,
69 .pull = GPIOMUX_PULL_NONE,
70 .dir = GPIOMUX_OUT_LOW,
Joel King15ccbfa2013-04-12 17:41:16 -070071};
72
73static struct msm_gpiomux_config mdm_configs[] __initdata = {
74 /* AP2MDM_STATUS */
75 {
76 .gpio = 105,
77 .settings = {
78 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
79 }
80 },
81 /* MDM2AP_STATUS */
82 {
83 .gpio = 46,
84 .settings = {
85 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
86 }
87 },
88 /* MDM2AP_ERRFATAL */
89 {
90 .gpio = 82,
91 .settings = {
92 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
93 }
94 },
95 /* AP2MDM_ERRFATAL */
96 {
97 .gpio = 106,
98 .settings = {
99 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
100 }
101 },
102 /* AP2MDM_SOFT_RESET, aka AP2MDM_PON_RESET_N */
103 {
104 .gpio = 24,
105 .settings = {
106 [GPIOMUX_SUSPENDED] = &ap2mdm_soft_reset_cfg,
107 }
108 },
109 /* AP2MDM_WAKEUP */
110 {
111 .gpio = 104,
112 .settings = {
113 [GPIOMUX_SUSPENDED] = &ap2mdm_wakeup,
114 }
115 },
116 /* MDM2AP_PBL_READY*/
117 {
118 .gpio = 80,
119 .settings = {
120 [GPIOMUX_SUSPENDED] = &mdm2ap_pblrdy,
121 }
122 },
123};
124
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700125static struct gpiomux_setting gpio_uart_config = {
126 .func = GPIOMUX_FUNC_2,
127 .drv = GPIOMUX_DRV_16MA,
128 .pull = GPIOMUX_PULL_NONE,
129 .dir = GPIOMUX_OUT_HIGH,
130};
131
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600132static struct gpiomux_setting slimbus = {
133 .func = GPIOMUX_FUNC_1,
134 .drv = GPIOMUX_DRV_8MA,
135 .pull = GPIOMUX_PULL_KEEPER,
136};
137
Sathish Ambleye3154b42012-04-09 10:59:09 -0700138#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
139static struct gpiomux_setting gpio_eth_config = {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700140 .pull = GPIOMUX_PULL_UP,
141 .drv = GPIOMUX_DRV_2MA,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700142 .func = GPIOMUX_FUNC_GPIO,
143};
144
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700145static struct gpiomux_setting gpio_spi_cs2_config = {
Sathish Ambleye3154b42012-04-09 10:59:09 -0700146 .func = GPIOMUX_FUNC_4,
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700147 .drv = GPIOMUX_DRV_6MA,
148 .pull = GPIOMUX_PULL_DOWN,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700149};
150
151static struct gpiomux_setting gpio_spi_config = {
152 .func = GPIOMUX_FUNC_1,
153 .drv = GPIOMUX_DRV_12MA,
154 .pull = GPIOMUX_PULL_NONE,
155};
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530156static struct gpiomux_setting gpio_spi_susp_config = {
157 .func = GPIOMUX_FUNC_GPIO,
158 .drv = GPIOMUX_DRV_2MA,
159 .pull = GPIOMUX_PULL_DOWN,
160};
Sathish Ambleye3154b42012-04-09 10:59:09 -0700161
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700162static struct gpiomux_setting gpio_spi_cs1_config = {
163 .func = GPIOMUX_FUNC_GPIO,
164 .drv = GPIOMUX_DRV_6MA,
165 .pull = GPIOMUX_PULL_UP,
166};
167
Sathish Ambleye3154b42012-04-09 10:59:09 -0700168static struct msm_gpiomux_config msm_eth_configs[] = {
169 {
170 .gpio = KS8851_IRQ_GPIO,
171 .settings = {
172 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
173 }
174 },
175};
176#endif
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700177
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800178static struct gpiomux_setting gpio_suspend_config[] = {
179 {
180 .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
181 .drv = GPIOMUX_DRV_2MA,
182 .pull = GPIOMUX_PULL_NONE,
183 },
184 {
185 .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
186 .drv = GPIOMUX_DRV_2MA,
187 .pull = GPIOMUX_PULL_NONE,
188 .dir = GPIOMUX_OUT_LOW,
189 },
190};
191
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -0800192static struct gpiomux_setting gpio_epm_config = {
193 .func = GPIOMUX_FUNC_GPIO,
194 .drv = GPIOMUX_DRV_2MA,
Siddartha Mohanadoss4613d8b2013-07-08 14:44:57 -0700195 .pull = GPIOMUX_PULL_NONE,
196 .dir = GPIOMUX_OUT_HIGH,
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -0800197};
198
Siddartha Mohanadoss03e04b52013-06-11 14:46:59 -0700199static struct gpiomux_setting gpio_epm_marker_config = {
200 .func = GPIOMUX_FUNC_GPIO,
Siddartha Mohanadoss8164ef82013-07-12 14:07:20 -0700201 .drv = GPIOMUX_DRV_2MA,
202 .pull = GPIOMUX_PULL_NONE,
203 .dir = GPIOMUX_OUT_HIGH,
Siddartha Mohanadoss03e04b52013-06-11 14:46:59 -0700204};
205
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700206static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
207 .func = GPIOMUX_FUNC_GPIO,
208 .drv = GPIOMUX_DRV_2MA,
209 .pull = GPIOMUX_PULL_UP,
210};
211
212static struct gpiomux_setting wcnss_5wire_active_cfg = {
213 .func = GPIOMUX_FUNC_1,
214 .drv = GPIOMUX_DRV_6MA,
215 .pull = GPIOMUX_PULL_DOWN,
216};
217
Yue Ma10d88752014-02-20 17:12:05 -0800218static struct gpiomux_setting wcnss_5gpio_suspend_cfg = {
219 .func = GPIOMUX_FUNC_GPIO,
220 .drv = GPIOMUX_DRV_2MA,
221 .pull = GPIOMUX_PULL_UP,
222};
223
224static struct gpiomux_setting wcnss_5gpio_active_cfg = {
225 .func = GPIOMUX_FUNC_GPIO,
226 .drv = GPIOMUX_DRV_6MA,
227 .pull = GPIOMUX_PULL_DOWN,
228};
229
Ram Mohan Korukonda56ac5232013-03-20 23:48:34 +0530230static struct gpiomux_setting ath_gpio_active_cfg = {
231 .func = GPIOMUX_FUNC_GPIO,
232 .drv = GPIOMUX_DRV_2MA,
233 .pull = GPIOMUX_PULL_UP,
234};
235
236static struct gpiomux_setting ath_gpio_suspend_cfg = {
237 .func = GPIOMUX_FUNC_GPIO,
238 .drv = GPIOMUX_DRV_2MA,
239 .pull = GPIOMUX_PULL_DOWN,
240};
241
Jin Honga04caaa2012-05-23 10:28:27 -0700242static struct gpiomux_setting gpio_i2c_config = {
243 .func = GPIOMUX_FUNC_3,
Gilad Avidovb7d8bb12012-11-09 16:30:37 -0700244 /*
245 * Please keep I2C GPIOs drive-strength at minimum (2ma). It is a
246 * workaround for HW issue of glitches caused by rapid GPIO current-
247 * change.
248 */
249 .drv = GPIOMUX_DRV_2MA,
Jin Honga04caaa2012-05-23 10:28:27 -0700250 .pull = GPIOMUX_PULL_NONE,
251};
252
Amy Maloche0b294992013-08-29 10:29:54 -0700253static struct gpiomux_setting gpio_i2c_act_config = {
254 .func = GPIOMUX_FUNC_3,
255 /*
256 * Please keep I2C GPIOs drive-strength at minimum (2ma). It is a
257 * workaround for HW issue of glitches caused by rapid GPIO current-
258 * change.
259 */
260 .drv = GPIOMUX_DRV_2MA,
261 .pull = GPIOMUX_PULL_UP,
262};
263
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700264static struct gpiomux_setting lcd_en_act_cfg = {
265 .func = GPIOMUX_FUNC_GPIO,
266 .drv = GPIOMUX_DRV_8MA,
267 .pull = GPIOMUX_PULL_NONE,
Siddhartha Agrawal6ab3e1c2013-02-22 18:30:37 -0800268 .dir = GPIOMUX_OUT_HIGH,
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700269};
270
271static struct gpiomux_setting lcd_en_sus_cfg = {
272 .func = GPIOMUX_FUNC_GPIO,
273 .drv = GPIOMUX_DRV_2MA,
274 .pull = GPIOMUX_PULL_DOWN,
275};
Sathish Ambleye3154b42012-04-09 10:59:09 -0700276
Amy Maloche9e99a792012-08-15 23:27:51 -0700277static struct gpiomux_setting atmel_resout_sus_cfg = {
278 .func = GPIOMUX_FUNC_GPIO,
279 .drv = GPIOMUX_DRV_6MA,
280 .pull = GPIOMUX_PULL_DOWN,
281};
282
283static struct gpiomux_setting atmel_resout_act_cfg = {
284 .func = GPIOMUX_FUNC_GPIO,
285 .drv = GPIOMUX_DRV_6MA,
286 .pull = GPIOMUX_PULL_UP,
287};
288
289static struct gpiomux_setting atmel_int_act_cfg = {
290 .func = GPIOMUX_FUNC_GPIO,
291 .drv = GPIOMUX_DRV_8MA,
292 .pull = GPIOMUX_PULL_UP,
293};
294
295static struct gpiomux_setting atmel_int_sus_cfg = {
296 .func = GPIOMUX_FUNC_GPIO,
297 .drv = GPIOMUX_DRV_2MA,
298 .pull = GPIOMUX_PULL_DOWN,
299};
300
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700301static struct gpiomux_setting taiko_reset = {
302 .func = GPIOMUX_FUNC_GPIO,
303 .drv = GPIOMUX_DRV_6MA,
304 .pull = GPIOMUX_PULL_NONE,
305 .dir = GPIOMUX_OUT_LOW,
306};
307
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700308static struct gpiomux_setting taiko_int = {
309 .func = GPIOMUX_FUNC_GPIO,
310 .drv = GPIOMUX_DRV_2MA,
311 .pull = GPIOMUX_PULL_NONE,
312};
Amy Maloche527acc42012-12-07 18:40:54 -0800313static struct gpiomux_setting hap_lvl_shft_suspended_config = {
314 .func = GPIOMUX_FUNC_GPIO,
315 .drv = GPIOMUX_DRV_2MA,
316 .pull = GPIOMUX_PULL_DOWN,
317};
318
319static struct gpiomux_setting hap_lvl_shft_active_config = {
320 .func = GPIOMUX_FUNC_GPIO,
321 .drv = GPIOMUX_DRV_8MA,
322 .pull = GPIOMUX_PULL_UP,
323};
324static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
325 {
326 .gpio = 86,
327 .settings = {
328 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
329 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
330 },
331 },
332};
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700333
Amy Maloche9e99a792012-08-15 23:27:51 -0700334static struct msm_gpiomux_config msm_touch_configs[] __initdata = {
335 {
336 .gpio = 60, /* TOUCH RESET */
337 .settings = {
338 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
339 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
340 },
341 },
342 {
343 .gpio = 61, /* TOUCH IRQ */
344 .settings = {
345 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
346 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
347 },
348 },
349
350};
Ujwal Patel74b5df42012-08-13 22:50:13 -0700351
Manu Gautamac7265b2012-11-21 11:49:15 +0530352static struct gpiomux_setting hsic_sus_cfg = {
353 .func = GPIOMUX_FUNC_GPIO,
354 .drv = GPIOMUX_DRV_2MA,
355 .pull = GPIOMUX_PULL_DOWN,
Manu Gautamac7265b2012-11-21 11:49:15 +0530356};
357
358static struct gpiomux_setting hsic_act_cfg = {
359 .func = GPIOMUX_FUNC_1,
360 .drv = GPIOMUX_DRV_12MA,
361 .pull = GPIOMUX_PULL_NONE,
362};
363
364static struct gpiomux_setting hsic_hub_act_cfg = {
365 .func = GPIOMUX_FUNC_GPIO,
366 .drv = GPIOMUX_DRV_2MA,
367 .pull = GPIOMUX_PULL_UP,
368 .dir = GPIOMUX_IN,
369};
370
Vamsi Krishnac6c16fe2013-03-11 15:54:41 -0700371static struct gpiomux_setting hsic_resume_act_cfg = {
372 .func = GPIOMUX_FUNC_GPIO,
373 .drv = GPIOMUX_DRV_2MA,
374 .pull = GPIOMUX_PULL_DOWN,
375 .dir = GPIOMUX_OUT_LOW,
376};
377
378static struct gpiomux_setting hsic_resume_susp_cfg = {
379 .func = GPIOMUX_FUNC_GPIO,
380 .drv = GPIOMUX_DRV_2MA,
381 .pull = GPIOMUX_PULL_NONE,
382};
383
Manu Gautamac7265b2012-11-21 11:49:15 +0530384static struct msm_gpiomux_config msm_hsic_configs[] = {
385 {
386 .gpio = 144, /*HSIC_STROBE */
387 .settings = {
388 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
389 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
390 },
391 },
392 {
393 .gpio = 145, /* HSIC_DATA */
394 .settings = {
395 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
396 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
397 },
398 },
Vamsi Krishnac6c16fe2013-03-11 15:54:41 -0700399 {
400 .gpio = 80,
401 .settings = {
402 [GPIOMUX_ACTIVE] = &hsic_resume_act_cfg,
403 [GPIOMUX_SUSPENDED] = &hsic_resume_susp_cfg,
404 },
405 },
Manu Gautamac7265b2012-11-21 11:49:15 +0530406};
407
408static struct msm_gpiomux_config msm_hsic_hub_configs[] = {
409 {
410 .gpio = 50, /* HSIC_HUB_INT_N */
411 .settings = {
412 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
413 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
414 },
415 },
416};
417
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700418static struct gpiomux_setting mhl_suspend_config = {
419 .func = GPIOMUX_FUNC_GPIO,
420 .drv = GPIOMUX_DRV_2MA,
421 .pull = GPIOMUX_PULL_DOWN,
422};
423
424static struct gpiomux_setting mhl_active_1_cfg = {
425 .func = GPIOMUX_FUNC_1,
426 .drv = GPIOMUX_DRV_2MA,
427 .pull = GPIOMUX_PULL_UP,
428 .dir = GPIOMUX_OUT_HIGH,
429};
430
Ujwal Patel74b5df42012-08-13 22:50:13 -0700431static struct gpiomux_setting hdmi_suspend_cfg = {
432 .func = GPIOMUX_FUNC_GPIO,
433 .drv = GPIOMUX_DRV_2MA,
434 .pull = GPIOMUX_PULL_DOWN,
435};
436
437static struct gpiomux_setting hdmi_active_1_cfg = {
438 .func = GPIOMUX_FUNC_1,
439 .drv = GPIOMUX_DRV_2MA,
440 .pull = GPIOMUX_PULL_UP,
441};
442
443static struct gpiomux_setting hdmi_active_2_cfg = {
444 .func = GPIOMUX_FUNC_1,
445 .drv = GPIOMUX_DRV_16MA,
446 .pull = GPIOMUX_PULL_DOWN,
447};
448
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700449static struct msm_gpiomux_config msm_mhl_configs[] __initdata = {
450 {
451 /* mhl-sii8334 pwr */
452 .gpio = 12,
453 .settings = {
454 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
455 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
456 },
457 },
458 {
459 /* mhl-sii8334 intr */
460 .gpio = 82,
461 .settings = {
462 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
463 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
464 },
465 },
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700466};
467
468
Ujwal Patel74b5df42012-08-13 22:50:13 -0700469static struct msm_gpiomux_config msm_hdmi_configs[] __initdata = {
470 {
471 .gpio = 31,
472 .settings = {
473 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
474 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
475 },
476 },
477 {
478 .gpio = 32,
479 .settings = {
480 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
481 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
482 },
483 },
484 {
485 .gpio = 33,
486 .settings = {
487 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
488 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
489 },
490 },
491 {
492 .gpio = 34,
493 .settings = {
494 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
495 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
496 },
497 },
498};
499
Saket Saurabheac58342013-02-05 12:20:18 +0530500static struct gpiomux_setting gpio_uart7_active_cfg = {
501 .func = GPIOMUX_FUNC_3,
502 .drv = GPIOMUX_DRV_8MA,
503 .pull = GPIOMUX_PULL_NONE,
504};
505
506static struct gpiomux_setting gpio_uart7_suspend_cfg = {
507 .func = GPIOMUX_FUNC_GPIO,
508 .drv = GPIOMUX_DRV_2MA,
509 .pull = GPIOMUX_PULL_DOWN,
510};
511
512static struct msm_gpiomux_config msm_blsp2_uart7_configs[] __initdata = {
513 {
514 .gpio = 41, /* BLSP2 UART7 TX */
515 .settings = {
516 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
517 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
518 },
519 },
520 {
521 .gpio = 42, /* BLSP2 UART7 RX */
522 .settings = {
523 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
524 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
525 },
526 },
527 {
528 .gpio = 43, /* BLSP2 UART7 CTS */
529 .settings = {
530 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
531 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
532 },
533 },
534 {
535 .gpio = 44, /* BLSP2 UART7 RFR */
536 .settings = {
537 [GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
538 [GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
539 },
540 },
541};
542
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800543static struct msm_gpiomux_config msm_rumi_blsp_configs[] __initdata = {
544 {
545 .gpio = 45, /* BLSP2 UART8 TX */
546 .settings = {
547 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
548 },
549 },
550 {
551 .gpio = 46, /* BLSP2 UART8 RX */
552 .settings = {
553 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
554 },
555 },
556};
557
Siddhartha Agrawal6ab3e1c2013-02-22 18:30:37 -0800558static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
559 {
560 .gpio = 58,
561 .settings = {
562 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
563 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
564 },
565 },
566};
567
Siddartha Mohanadoss1f32be52013-05-17 13:29:50 -0700568static struct msm_gpiomux_config msm_epm_configs[] __initdata = {
569 {
570 .gpio = 81, /* EPM enable */
571 .settings = {
572 [GPIOMUX_SUSPENDED] = &gpio_epm_config,
573 },
574 },
Siddartha Mohanadoss03e04b52013-06-11 14:46:59 -0700575 {
576 .gpio = 85, /* EPM MARKER2 */
577 .settings = {
578 [GPIOMUX_SUSPENDED] = &gpio_epm_marker_config,
579 },
580 },
581 {
582 .gpio = 96, /* EPM MARKER1 */
583 .settings = {
584 [GPIOMUX_SUSPENDED] = &gpio_epm_marker_config,
585 },
586 },
Siddartha Mohanadoss1f32be52013-05-17 13:29:50 -0700587};
588
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700589static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
Sathish Ambleye3154b42012-04-09 10:59:09 -0700590#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
591 {
592 .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */
593 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530594 [GPIOMUX_ACTIVE] = &gpio_spi_config,
595 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700596 },
597 },
598 {
599 .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */
600 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530601 [GPIOMUX_ACTIVE] = &gpio_spi_config,
602 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700603 },
604 },
605 {
606 .gpio = 3, /* BLSP1 QUP SPI_CLK */
607 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530608 [GPIOMUX_ACTIVE] = &gpio_spi_config,
609 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700610 },
611 },
612 {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700613 .gpio = 9, /* BLSP1 QUP SPI_CS2A_N */
Sathish Ambleye3154b42012-04-09 10:59:09 -0700614 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530615 [GPIOMUX_ACTIVE] = &gpio_spi_cs2_config,
616 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700617 },
618 },
619 {
620 .gpio = 8, /* BLSP1 QUP SPI_CS1_N */
621 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530622 [GPIOMUX_ACTIVE] = &gpio_spi_cs1_config,
623 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700624 },
625 },
626#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700627 {
Amy Malochebc7e9672012-08-15 10:30:40 -0700628 .gpio = 6, /* BLSP1 QUP2 I2C_DAT */
629 .settings = {
630 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
Amy Maloche0b294992013-08-29 10:29:54 -0700631 [GPIOMUX_ACTIVE] = &gpio_i2c_act_config,
Amy Malochebc7e9672012-08-15 10:30:40 -0700632 },
633 },
634 {
635 .gpio = 7, /* BLSP1 QUP2 I2C_CLK */
636 .settings = {
637 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
Amy Maloche0b294992013-08-29 10:29:54 -0700638 [GPIOMUX_ACTIVE] = &gpio_i2c_act_config,
Amy Malochebc7e9672012-08-15 10:30:40 -0700639 },
640 },
641 {
Jin Honga04caaa2012-05-23 10:28:27 -0700642 .gpio = 83, /* BLSP11 QUP I2C_DAT */
643 .settings = {
644 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
645 },
646 },
647 {
648 .gpio = 84, /* BLSP11 QUP I2C_CLK */
649 .settings = {
650 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
651 },
652 },
653 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700654 .gpio = 4, /* BLSP2 UART TX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700655 .settings = {
656 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
657 },
658 },
659 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700660 .gpio = 5, /* BLSP2 UART RX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700661 .settings = {
662 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
663 },
664 },
Houston Hoffmanfd2ff9f2013-12-02 20:26:56 -0800665 { /* NFC */
666 .gpio = 29, /* BLSP1 QUP6 I2C_DAT */
667 .settings = {
668 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
669 },
670 },
671 { /* NFC */
672 .gpio = 30, /* BLSP1 QUP6 I2C_CLK */
673 .settings = {
674 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
675 },
676 },
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600677 {
678 .gpio = 53, /* BLSP2 QUP4 SPI_DATA_MOSI */
679 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800680 [GPIOMUX_ACTIVE] = &gpio_spi_config,
681 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600682 },
683 },
684 {
685 .gpio = 54, /* BLSP2 QUP4 SPI_DATA_MISO */
686 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800687 [GPIOMUX_ACTIVE] = &gpio_spi_config,
688 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600689 },
690 },
691 {
692 .gpio = 56, /* BLSP2 QUP4 SPI_CLK */
693 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800694 [GPIOMUX_ACTIVE] = &gpio_spi_config,
695 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600696 },
697 },
698 {
699 .gpio = 55, /* BLSP2 QUP4 SPI_CS0_N */
700 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800701 [GPIOMUX_ACTIVE] = &gpio_spi_config,
702 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600703 },
704 },
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700705};
706
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600707static struct msm_gpiomux_config msm8974_slimbus_config[] __initdata = {
708 {
709 .gpio = 70, /* slimbus clk */
710 .settings = {
711 [GPIOMUX_SUSPENDED] = &slimbus,
712 },
713 },
714 {
715 .gpio = 71, /* slimbus data */
716 .settings = {
717 [GPIOMUX_SUSPENDED] = &slimbus,
718 },
719 },
720};
721
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700722static struct gpiomux_setting cam_settings[] = {
723 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700724 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700725 .drv = GPIOMUX_DRV_2MA,
726 .pull = GPIOMUX_PULL_NONE,
727 },
728
729 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700730 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700731 .drv = GPIOMUX_DRV_2MA,
732 .pull = GPIOMUX_PULL_DOWN,
733 },
734
735 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700736 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700737 .drv = GPIOMUX_DRV_2MA,
738 .pull = GPIOMUX_PULL_KEEPER,
739 },
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700740
741 {
742 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
743 .drv = GPIOMUX_DRV_2MA,
744 .pull = GPIOMUX_PULL_NONE,
745 },
746
747 {
748 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
749 .drv = GPIOMUX_DRV_2MA,
750 .pull = GPIOMUX_PULL_DOWN,
751 },
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700752};
753
Subhash Jadavani77e6cd72013-01-15 18:44:51 +0530754static struct gpiomux_setting sd_card_det_active_config = {
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530755 .func = GPIOMUX_FUNC_GPIO,
756 .drv = GPIOMUX_DRV_2MA,
757 .pull = GPIOMUX_PULL_NONE,
758 .dir = GPIOMUX_IN,
759};
760
Subhash Jadavani77e6cd72013-01-15 18:44:51 +0530761static struct gpiomux_setting sd_card_det_sleep_config = {
762 .func = GPIOMUX_FUNC_GPIO,
763 .drv = GPIOMUX_DRV_2MA,
764 .pull = GPIOMUX_PULL_UP,
765 .dir = GPIOMUX_IN,
766};
767
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530768static struct msm_gpiomux_config sd_card_det __initdata = {
769 .gpio = 62,
770 .settings = {
Subhash Jadavani77e6cd72013-01-15 18:44:51 +0530771 [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
772 [GPIOMUX_SUSPENDED] = &sd_card_det_sleep_config,
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530773 },
774};
775
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700776static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
777 {
778 .gpio = 15, /* CAM_MCLK0 */
779 .settings = {
780 [GPIOMUX_ACTIVE] = &cam_settings[0],
781 [GPIOMUX_SUSPENDED] = &cam_settings[1],
782 },
783 },
784 {
785 .gpio = 16, /* CAM_MCLK1 */
786 .settings = {
787 [GPIOMUX_ACTIVE] = &cam_settings[0],
788 [GPIOMUX_SUSPENDED] = &cam_settings[1],
789 },
790 },
791 {
792 .gpio = 17, /* CAM_MCLK2 */
793 .settings = {
794 [GPIOMUX_ACTIVE] = &cam_settings[0],
795 [GPIOMUX_SUSPENDED] = &cam_settings[1],
796 },
797 },
798 {
799 .gpio = 18, /* WEBCAM1_RESET_N / CAM_MCLK3 */
800 .settings = {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700801 [GPIOMUX_ACTIVE] = &cam_settings[3],
802 [GPIOMUX_SUSPENDED] = &cam_settings[4],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700803 },
804 },
805 {
806 .gpio = 19, /* CCI_I2C_SDA0 */
807 .settings = {
808 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800809 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700810 },
811 },
812 {
813 .gpio = 20, /* CCI_I2C_SCL0 */
814 .settings = {
815 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800816 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700817 },
818 },
819 {
820 .gpio = 21, /* CCI_I2C_SDA1 */
821 .settings = {
822 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800823 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700824 },
825 },
826 {
827 .gpio = 22, /* CCI_I2C_SCL1 */
828 .settings = {
829 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800830 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700831 },
832 },
833 {
834 .gpio = 23, /* FLASH_LED_EN */
835 .settings = {
836 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800837 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700838 },
839 },
840 {
841 .gpio = 24, /* FLASH_LED_NOW */
842 .settings = {
843 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800844 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700845 },
846 },
847 {
848 .gpio = 25, /* WEBCAM2_RESET_N */
849 .settings = {
Sreesudhan Ramakrish Ramkumara92d0b72013-03-12 23:39:07 -0700850 [GPIOMUX_ACTIVE] = &cam_settings[3],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800851 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700852 },
853 },
854 {
855 .gpio = 26, /* CAM_IRQ */
856 .settings = {
857 [GPIOMUX_ACTIVE] = &cam_settings[0],
858 [GPIOMUX_SUSPENDED] = &cam_settings[1],
859 },
860 },
861 {
862 .gpio = 27, /* OIS_SYNC */
863 .settings = {
864 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800865 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700866 },
867 },
868 {
869 .gpio = 28, /* WEBCAM1_STANDBY */
870 .settings = {
Sreesudhan Ramakrish Ramkumara92d0b72013-03-12 23:39:07 -0700871 [GPIOMUX_ACTIVE] = &cam_settings[3],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800872 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700873 },
874 },
875 {
876 .gpio = 89, /* CAM1_STANDBY_N */
877 .settings = {
Sreesudhan Ramakrish Ramkumara92d0b72013-03-12 23:39:07 -0700878 [GPIOMUX_ACTIVE] = &cam_settings[3],
879 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700880 },
881 },
882 {
883 .gpio = 90, /* CAM1_RST_N */
884 .settings = {
Sreesudhan Ramakrish Ramkumara92d0b72013-03-12 23:39:07 -0700885 [GPIOMUX_ACTIVE] = &cam_settings[3],
886 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700887 },
888 },
889 {
890 .gpio = 91, /* CAM2_STANDBY_N */
891 .settings = {
Sreesudhan Ramakrish Ramkumara92d0b72013-03-12 23:39:07 -0700892 [GPIOMUX_ACTIVE] = &cam_settings[3],
893 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700894 },
895 },
896 {
897 .gpio = 92, /* CAM2_RST_N */
898 .settings = {
Sreesudhan Ramakrish Ramkumara92d0b72013-03-12 23:39:07 -0700899 [GPIOMUX_ACTIVE] = &cam_settings[3],
900 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700901 },
902 },
903};
Damir Didjusto04d3c362013-01-07 14:30:53 -0800904
Ilia Linbcdb0fb2013-07-09 08:35:39 +0300905static struct msm_gpiomux_config msm_sensor_configs_dragonboard[] __initdata = {
906 {
907 .gpio = 15, /* CAM_MCLK0 */
908 .settings = {
909 [GPIOMUX_ACTIVE] = &cam_settings[0],
910 [GPIOMUX_SUSPENDED] = &cam_settings[1],
911 },
912 },
913 {
914 .gpio = 16, /* CAM_MCLK1 */
915 .settings = {
916 [GPIOMUX_ACTIVE] = &cam_settings[0],
917 [GPIOMUX_SUSPENDED] = &cam_settings[1],
918 },
919 },
920 {
921 .gpio = 17, /* CAM_MCLK2 */
922 .settings = {
923 [GPIOMUX_ACTIVE] = &cam_settings[0],
924 [GPIOMUX_SUSPENDED] = &cam_settings[1],
925 },
926 },
927 {
928 .gpio = 18, /* WEBCAM1_RESET_N / CAM_MCLK3 */
929 .settings = {
930 [GPIOMUX_ACTIVE] = &cam_settings[3],
931 [GPIOMUX_SUSPENDED] = &cam_settings[4],
932 },
933 },
934 {
935 .gpio = 19, /* CCI_I2C_SDA0 */
936 .settings = {
937 [GPIOMUX_ACTIVE] = &cam_settings[0],
938 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
939 },
940 },
941 {
942 .gpio = 20, /* CCI_I2C_SCL0 */
943 .settings = {
944 [GPIOMUX_ACTIVE] = &cam_settings[0],
945 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
946 },
947 },
948 {
949 .gpio = 21, /* CCI_I2C_SDA1 */
950 .settings = {
951 [GPIOMUX_ACTIVE] = &cam_settings[0],
952 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
953 },
954 },
955 {
956 .gpio = 22, /* CCI_I2C_SCL1 */
957 .settings = {
958 [GPIOMUX_ACTIVE] = &cam_settings[0],
959 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
960 },
961 },
962 {
963 .gpio = 23, /* FLASH_LED_EN */
964 .settings = {
965 [GPIOMUX_ACTIVE] = &cam_settings[0],
966 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
967 },
968 },
969 {
970 .gpio = 24, /* FLASH_LED_NOW */
971 .settings = {
972 [GPIOMUX_ACTIVE] = &cam_settings[0],
973 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
974 },
975 },
976 {
977 .gpio = 25, /* WEBCAM2_RESET_N */
978 .settings = {
979 [GPIOMUX_ACTIVE] = &cam_settings[3],
980 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
981 },
982 },
983 {
984 .gpio = 26, /* CAM_IRQ */
985 .settings = {
986 [GPIOMUX_ACTIVE] = &cam_settings[0],
987 [GPIOMUX_SUSPENDED] = &cam_settings[1],
988 },
989 },
990 {
991 .gpio = 27, /* OIS_SYNC */
992 .settings = {
993 [GPIOMUX_ACTIVE] = &cam_settings[0],
994 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
995 },
996 },
997 {
998 .gpio = 28, /* WEBCAM1_STANDBY */
999 .settings = {
1000 [GPIOMUX_ACTIVE] = &cam_settings[3],
1001 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
1002 },
1003 },
1004 {
1005 .gpio = 89, /* CAM1_STANDBY_N */
1006 .settings = {
1007 [GPIOMUX_ACTIVE] = &cam_settings[3],
1008 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
1009 },
1010 },
1011 {
1012 .gpio = 90, /* CAM1_RST_N */
1013 .settings = {
1014 [GPIOMUX_ACTIVE] = &cam_settings[3],
1015 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
1016 },
1017 },
1018 {
1019 .gpio = 91, /* CAM2_STANDBY_N */
1020 .settings = {
1021 [GPIOMUX_ACTIVE] = &cam_settings[3],
1022 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
1023 },
1024 },
1025 {
1026 .gpio = 94, /* CAM2_RST_N */
1027 .settings = {
1028 [GPIOMUX_ACTIVE] = &cam_settings[3],
1029 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
1030 },
1031 },
1032};
1033
Banajit Goswami8521b122013-04-03 10:56:11 -07001034static struct gpiomux_setting auxpcm_act_cfg = {
Damir Didjusto04d3c362013-01-07 14:30:53 -08001035 .func = GPIOMUX_FUNC_1,
1036 .drv = GPIOMUX_DRV_8MA,
1037 .pull = GPIOMUX_PULL_NONE,
1038};
1039
1040
Banajit Goswami8521b122013-04-03 10:56:11 -07001041static struct gpiomux_setting auxpcm_sus_cfg = {
Damir Didjusto04d3c362013-01-07 14:30:53 -08001042 .func = GPIOMUX_FUNC_1,
1043 .drv = GPIOMUX_DRV_2MA,
1044 .pull = GPIOMUX_PULL_DOWN,
1045};
1046
Banajit Goswamic8dcf0f2013-04-09 18:21:23 -07001047/* Primary AUXPCM port sharing GPIO lines with Primary MI2S */
1048static struct msm_gpiomux_config msm8974_pri_pri_auxpcm_configs[] __initdata = {
Damir Didjusto04d3c362013-01-07 14:30:53 -08001049 {
1050 .gpio = 65,
1051 .settings = {
Banajit Goswami8521b122013-04-03 10:56:11 -07001052 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1053 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
Damir Didjusto04d3c362013-01-07 14:30:53 -08001054 },
1055 },
1056 {
1057 .gpio = 66,
1058 .settings = {
Banajit Goswami8521b122013-04-03 10:56:11 -07001059 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1060 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
Damir Didjusto04d3c362013-01-07 14:30:53 -08001061 },
1062 },
1063 {
1064 .gpio = 67,
1065 .settings = {
Banajit Goswami8521b122013-04-03 10:56:11 -07001066 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1067 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
Damir Didjusto04d3c362013-01-07 14:30:53 -08001068 },
1069 },
1070 {
1071 .gpio = 68,
1072 .settings = {
Banajit Goswami8521b122013-04-03 10:56:11 -07001073 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1074 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
1075 },
1076 },
1077};
1078
Banajit Goswamic8dcf0f2013-04-09 18:21:23 -07001079/* Primary AUXPCM port sharing GPIO lines with Tertiary MI2S */
1080static struct msm_gpiomux_config msm8974_pri_ter_auxpcm_configs[] __initdata = {
1081 {
1082 .gpio = 74,
1083 .settings = {
1084 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1085 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
1086 },
1087 },
1088 {
1089 .gpio = 75,
1090 .settings = {
1091 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1092 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
1093 },
1094 },
1095 {
1096 .gpio = 76,
1097 .settings = {
1098 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1099 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
1100 },
1101 },
1102 {
1103 .gpio = 77,
1104 .settings = {
1105 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1106 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
1107 },
1108 },
1109};
1110
Banajit Goswami8521b122013-04-03 10:56:11 -07001111static struct msm_gpiomux_config msm8974_sec_auxpcm_configs[] __initdata = {
1112 {
1113 .gpio = 79,
1114 .settings = {
1115 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1116 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
1117 },
1118 },
1119 {
1120 .gpio = 80,
1121 .settings = {
1122 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1123 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
1124 },
1125 },
1126 {
1127 .gpio = 81,
1128 .settings = {
1129 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1130 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
1131 },
1132 },
1133 {
1134 .gpio = 82,
1135 .settings = {
1136 [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
1137 [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
Damir Didjusto04d3c362013-01-07 14:30:53 -08001138 },
1139 },
1140};
1141
Sameer Thalappil8d686d42012-08-24 10:07:31 -07001142static struct msm_gpiomux_config wcnss_5wire_interface[] = {
1143 {
1144 .gpio = 36,
1145 .settings = {
1146 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1147 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1148 },
1149 },
1150 {
1151 .gpio = 37,
1152 .settings = {
1153 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1154 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1155 },
1156 },
1157 {
1158 .gpio = 38,
1159 .settings = {
1160 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1161 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1162 },
1163 },
1164 {
1165 .gpio = 39,
1166 .settings = {
1167 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1168 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1169 },
1170 },
1171 {
1172 .gpio = 40,
1173 .settings = {
1174 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
1175 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
1176 },
1177 },
1178};
Kevin Chanbdcf7ef2012-08-24 08:33:33 -07001179
Yue Ma10d88752014-02-20 17:12:05 -08001180static struct msm_gpiomux_config wcnss_5gpio_interface[] = {
1181 {
1182 .gpio = 36,
1183 .settings = {
1184 [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
1185 [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
1186 },
1187 },
1188 {
1189 .gpio = 37,
1190 .settings = {
1191 [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
1192 [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
1193 },
1194 },
1195 {
1196 .gpio = 38,
1197 .settings = {
1198 [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
1199 [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
1200 },
1201 },
1202 {
1203 .gpio = 39,
1204 .settings = {
1205 [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
1206 [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
1207 },
1208 },
1209 {
1210 .gpio = 40,
1211 .settings = {
1212 [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
1213 [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
1214 },
1215 },
1216};
Ram Mohan Korukonda56ac5232013-03-20 23:48:34 +05301217
1218static struct msm_gpiomux_config ath_gpio_configs[] = {
1219 {
1220 .gpio = 51,
1221 .settings = {
1222 [GPIOMUX_ACTIVE] = &ath_gpio_active_cfg,
1223 [GPIOMUX_SUSPENDED] = &ath_gpio_suspend_cfg,
1224 },
1225 },
1226 {
1227 .gpio = 79,
1228 .settings = {
1229 [GPIOMUX_ACTIVE] = &ath_gpio_active_cfg,
1230 [GPIOMUX_SUSPENDED] = &ath_gpio_suspend_cfg,
1231 },
1232 },
1233};
1234
Joonwoo Park187e9cb2012-08-24 22:47:53 -07001235static struct msm_gpiomux_config msm_taiko_config[] __initdata = {
1236 {
1237 .gpio = 63, /* SYS_RST_N */
1238 .settings = {
1239 [GPIOMUX_SUSPENDED] = &taiko_reset,
1240 },
Joonwoo Parkeb84dc72012-09-12 10:22:49 -07001241 },
1242 {
1243 .gpio = 72, /* CDC_INT */
1244 .settings = {
1245 [GPIOMUX_SUSPENDED] = &taiko_int,
1246 },
1247 },
Joonwoo Park187e9cb2012-08-24 22:47:53 -07001248};
1249
Subhash Jadavani102f0ce2012-12-14 21:25:59 +05301250static struct gpiomux_setting sdc3_clk_actv_cfg = {
1251 .func = GPIOMUX_FUNC_2,
1252 .drv = GPIOMUX_DRV_8MA,
1253 .pull = GPIOMUX_PULL_NONE,
1254};
1255
1256static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
1257 .func = GPIOMUX_FUNC_2,
1258 .drv = GPIOMUX_DRV_8MA,
1259 .pull = GPIOMUX_PULL_UP,
1260};
1261
1262static struct gpiomux_setting sdc3_suspend_cfg = {
1263 .func = GPIOMUX_FUNC_GPIO,
1264 .drv = GPIOMUX_DRV_2MA,
1265 .pull = GPIOMUX_PULL_DOWN,
1266};
1267
1268static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
1269 .func = GPIOMUX_FUNC_GPIO,
1270 .drv = GPIOMUX_DRV_8MA,
1271 .pull = GPIOMUX_PULL_UP,
1272};
1273
1274static struct msm_gpiomux_config msm8974_sdc3_configs[] __initdata = {
1275 {
1276 /* DAT3 */
1277 .gpio = 35,
1278 .settings = {
1279 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
1280 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
1281 },
1282 },
1283 {
1284 /* DAT2 */
1285 .gpio = 36,
1286 .settings = {
1287 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
1288 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
1289 },
1290 },
1291 {
1292 /* DAT1 */
1293 .gpio = 37,
1294 .settings = {
1295 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
1296 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
1297 },
1298 },
1299 {
1300 /* DAT0 */
1301 .gpio = 38,
1302 .settings = {
1303 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
1304 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
1305 },
1306 },
1307 {
1308 /* CMD */
1309 .gpio = 39,
1310 .settings = {
1311 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
1312 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
1313 },
1314 },
1315 {
1316 /* CLK */
1317 .gpio = 40,
1318 .settings = {
1319 [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
1320 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
1321 },
1322 },
1323};
1324
1325static void msm_gpiomux_sdc3_install(void)
1326{
1327 msm_gpiomux_install(msm8974_sdc3_configs,
1328 ARRAY_SIZE(msm8974_sdc3_configs));
1329}
Subhash Jadavani102f0ce2012-12-14 21:25:59 +05301330
1331#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
1332static struct gpiomux_setting sdc4_clk_actv_cfg = {
1333 .func = GPIOMUX_FUNC_2,
1334 .drv = GPIOMUX_DRV_8MA,
1335 .pull = GPIOMUX_PULL_NONE,
1336};
1337
1338static struct gpiomux_setting sdc4_cmd_data_0_3_actv_cfg = {
1339 .func = GPIOMUX_FUNC_2,
1340 .drv = GPIOMUX_DRV_8MA,
1341 .pull = GPIOMUX_PULL_UP,
1342};
1343
1344static struct gpiomux_setting sdc4_suspend_cfg = {
1345 .func = GPIOMUX_FUNC_GPIO,
1346 .drv = GPIOMUX_DRV_2MA,
1347 .pull = GPIOMUX_PULL_DOWN,
1348};
1349
1350static struct gpiomux_setting sdc4_data_1_suspend_cfg = {
1351 .func = GPIOMUX_FUNC_GPIO,
1352 .drv = GPIOMUX_DRV_8MA,
1353 .pull = GPIOMUX_PULL_UP,
1354};
1355
1356static struct msm_gpiomux_config msm8974_sdc4_configs[] __initdata = {
1357 {
1358 /* DAT3 */
1359 .gpio = 92,
1360 .settings = {
1361 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
1362 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
1363 },
1364 },
1365 {
1366 /* DAT2 */
1367 .gpio = 94,
1368 .settings = {
1369 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
1370 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
1371 },
1372 },
1373 {
1374 /* DAT1 */
1375 .gpio = 95,
1376 .settings = {
1377 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
1378 [GPIOMUX_SUSPENDED] = &sdc4_data_1_suspend_cfg,
1379 },
1380 },
1381 {
1382 /* DAT0 */
1383 .gpio = 96,
1384 .settings = {
1385 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
1386 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
1387 },
1388 },
1389 {
1390 /* CMD */
1391 .gpio = 91,
1392 .settings = {
1393 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
1394 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
1395 },
1396 },
1397 {
1398 /* CLK */
1399 .gpio = 93,
1400 .settings = {
1401 [GPIOMUX_ACTIVE] = &sdc4_clk_actv_cfg,
1402 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
1403 },
1404 },
1405};
1406
1407static void msm_gpiomux_sdc4_install(void)
1408{
1409 msm_gpiomux_install(msm8974_sdc4_configs,
1410 ARRAY_SIZE(msm8974_sdc4_configs));
1411}
1412#else
1413static void msm_gpiomux_sdc4_install(void) {}
1414#endif /* CONFIG_MMC_MSM_SDC4_SUPPORT */
1415
Asaf Pensob8f00b72013-05-05 19:28:58 +03001416static struct msm_gpiomux_config apq8074_dragonboard_ts_config[] __initdata = {
1417 {
1418 /* BLSP1 QUP I2C_DATA */
1419 .gpio = 2,
1420 .settings = {
1421 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
1422 },
1423 },
1424 {
1425 /* BLSP1 QUP I2C_CLK */
1426 .gpio = 3,
1427 .settings = {
1428 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
1429 },
1430 },
1431};
1432
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -07001433void __init msm_8974_init_gpiomux(void)
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07001434{
1435 int rc;
1436
Rohit Vaswani341c2032012-11-08 18:49:29 -08001437 rc = msm_gpiomux_init_dt();
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07001438 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -08001439 pr_err("%s failed %d\n", __func__, rc);
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07001440 return;
1441 }
1442
Xu Hand4fbf022013-08-30 14:29:01 -07001443 pr_err("%s:%d socinfo_get_version %x\n", __func__, __LINE__,
1444 socinfo_get_version());
1445 if (socinfo_get_version() >= 0x20000)
1446 msm_tlmm_misc_reg_write(TLMM_SPARE_REG, 0xf);
1447
Sathish Ambleye3154b42012-04-09 10:59:09 -07001448#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Ilia Linbcdb0fb2013-07-09 08:35:39 +03001449 if (!(of_board_is_dragonboard() && machine_is_apq8074()))
1450 msm_gpiomux_install(msm_eth_configs, \
1451 ARRAY_SIZE(msm_eth_configs));
Sathish Ambleye3154b42012-04-09 10:59:09 -07001452#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07001453 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Saket Saurabheac58342013-02-05 12:20:18 +05301454 msm_gpiomux_install(msm_blsp2_uart7_configs,
1455 ARRAY_SIZE(msm_blsp2_uart7_configs));
Sameer Thalappil8d686d42012-08-24 10:07:31 -07001456 msm_gpiomux_install(wcnss_5wire_interface,
1457 ARRAY_SIZE(wcnss_5wire_interface));
Ram Mohan Korukondaf0f07ec2013-04-13 10:26:11 -07001458 if (of_board_is_liquid())
1459 msm_gpiomux_install_nowrite(ath_gpio_configs,
1460 ARRAY_SIZE(ath_gpio_configs));
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -06001461 msm_gpiomux_install(msm8974_slimbus_config,
1462 ARRAY_SIZE(msm8974_slimbus_config));
1463
Amy Maloche9e99a792012-08-15 23:27:51 -07001464 msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));
Amy Maloche527acc42012-12-07 18:40:54 -08001465 msm_gpiomux_install(hap_lvl_shft_config,
1466 ARRAY_SIZE(hap_lvl_shft_config));
Kevin Chanbdcf7ef2012-08-24 08:33:33 -07001467
Ilia Linbcdb0fb2013-07-09 08:35:39 +03001468 if (of_board_is_dragonboard() && machine_is_apq8074())
1469 msm_gpiomux_install(msm_sensor_configs_dragonboard, \
1470 ARRAY_SIZE(msm_sensor_configs_dragonboard));
1471 else
1472 msm_gpiomux_install(msm_sensor_configs, \
1473 ARRAY_SIZE(msm_sensor_configs));
Joonwoo Park187e9cb2012-08-24 22:47:53 -07001474
Subhash Jadavani76aa7de2012-10-10 09:58:17 +05301475 msm_gpiomux_install(&sd_card_det, 1);
Ilia Lin7f527482013-05-21 13:59:48 +03001476
1477 if (machine_is_apq8074() && (of_board_is_liquid() || \
1478 of_board_is_dragonboard()))
1479 msm_gpiomux_sdc3_install();
1480
Ilia Linbcdb0fb2013-07-09 08:35:39 +03001481 if (!(of_board_is_dragonboard() && machine_is_apq8074()))
1482 msm_gpiomux_sdc4_install();
Subhash Jadavani76aa7de2012-10-10 09:58:17 +05301483
Joonwoo Park187e9cb2012-08-24 22:47:53 -07001484 msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));
Ujwal Patel74b5df42012-08-13 22:50:13 -07001485
Manu Gautamac7265b2012-11-21 11:49:15 +05301486 msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));
1487 msm_gpiomux_install(msm_hsic_hub_configs,
1488 ARRAY_SIZE(msm_hsic_hub_configs));
1489
Ujwal Patel74b5df42012-08-13 22:50:13 -07001490 msm_gpiomux_install(msm_hdmi_configs, ARRAY_SIZE(msm_hdmi_configs));
Stepan Moskovchenko82f0eab2013-04-02 19:52:28 -07001491 if (of_board_is_fluid())
Stepan Moskovchenkoebd05412013-02-07 20:39:56 -08001492 msm_gpiomux_install(msm_mhl_configs,
1493 ARRAY_SIZE(msm_mhl_configs));
Stepan Moskovchenko95108b82012-11-27 14:28:11 -08001494
Tanya Finkeld3685a32013-07-01 15:35:56 +03001495 if (of_board_is_liquid() ||
1496 (of_board_is_dragonboard() && machine_is_apq8074()))
Banajit Goswamic8dcf0f2013-04-09 18:21:23 -07001497 msm_gpiomux_install(msm8974_pri_ter_auxpcm_configs,
1498 ARRAY_SIZE(msm8974_pri_ter_auxpcm_configs));
1499 else
1500 msm_gpiomux_install(msm8974_pri_pri_auxpcm_configs,
1501 ARRAY_SIZE(msm8974_pri_pri_auxpcm_configs));
1502
Siddartha Mohanadoss1f32be52013-05-17 13:29:50 -07001503 if (of_board_is_cdp())
1504 msm_gpiomux_install(msm8974_sec_auxpcm_configs,
Banajit Goswami8521b122013-04-03 10:56:11 -07001505 ARRAY_SIZE(msm8974_sec_auxpcm_configs));
Siddartha Mohanadoss56714a52013-07-12 15:10:36 -07001506 else if (of_board_is_liquid() || of_board_is_fluid() ||
1507 of_board_is_mtp())
Siddartha Mohanadoss1f32be52013-05-17 13:29:50 -07001508 msm_gpiomux_install(msm_epm_configs,
1509 ARRAY_SIZE(msm_epm_configs));
Damir Didjusto04d3c362013-01-07 14:30:53 -08001510
Siddhartha Agrawal6ab3e1c2013-02-22 18:30:37 -08001511 msm_gpiomux_install_nowrite(msm_lcd_configs,
1512 ARRAY_SIZE(msm_lcd_configs));
1513
Stepan Moskovchenko82f0eab2013-04-02 19:52:28 -07001514 if (of_board_is_rumi())
Stepan Moskovchenko95108b82012-11-27 14:28:11 -08001515 msm_gpiomux_install(msm_rumi_blsp_configs,
1516 ARRAY_SIZE(msm_rumi_blsp_configs));
Joel King15ccbfa2013-04-12 17:41:16 -07001517
1518 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_MDM)
1519 msm_gpiomux_install(mdm_configs,
1520 ARRAY_SIZE(mdm_configs));
Asaf Pensob8f00b72013-05-05 19:28:58 +03001521
1522 if (of_board_is_dragonboard() && machine_is_apq8074())
1523 msm_gpiomux_install(apq8074_dragonboard_ts_config,
1524 ARRAY_SIZE(apq8074_dragonboard_ts_config));
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07001525}
Yue Ma10d88752014-02-20 17:12:05 -08001526
1527static void wcnss_switch_to_gpio(void)
1528{
1529 /* Switch MUX to GPIO */
1530 msm_gpiomux_install(wcnss_5gpio_interface,
1531 ARRAY_SIZE(wcnss_5gpio_interface));
1532
1533 /* Ensure GPIO config */
1534 gpio_direction_input(WLAN_DATA2);
1535 gpio_direction_input(WLAN_DATA1);
1536 gpio_direction_input(WLAN_DATA0);
1537 gpio_direction_output(WLAN_SET, 0);
1538 gpio_direction_output(WLAN_CLK, 0);
1539}
1540
1541static void wcnss_switch_to_5wire(void)
1542{
1543 msm_gpiomux_install(wcnss_5wire_interface,
1544 ARRAY_SIZE(wcnss_5wire_interface));
1545}
1546
1547u32 wcnss_rf_read_reg(u32 rf_reg_addr)
1548{
1549 int count = 0;
1550 u32 rf_cmd_and_addr = 0;
1551 u32 rf_data_received = 0;
1552 u32 rf_bit = 0;
1553
1554 wcnss_switch_to_gpio();
1555
1556 /* Reset the signal if it is already being used. */
1557 gpio_set_value(WLAN_SET, 0);
1558 gpio_set_value(WLAN_CLK, 0);
1559
1560 /* We start with cmd_set high WLAN_SET = 1. */
1561 gpio_set_value(WLAN_SET, 1);
1562
1563 gpio_direction_output(WLAN_DATA0, 1);
1564 gpio_direction_output(WLAN_DATA1, 1);
1565 gpio_direction_output(WLAN_DATA2, 1);
1566
1567 gpio_set_value(WLAN_DATA0, 0);
1568 gpio_set_value(WLAN_DATA1, 0);
1569 gpio_set_value(WLAN_DATA2, 0);
1570
1571 /* Prepare command and RF register address that need to sent out.
1572 * Make sure that we send only 14 bits from LSB.
1573 */
1574 rf_cmd_and_addr = (((WLAN_RF_READ_REG_CMD) |
1575 (rf_reg_addr << WLAN_RF_REG_ADDR_START_OFFSET)) &
1576 WLAN_RF_READ_CMD_MASK);
1577
1578 for (count = 0; count < 5; count++) {
1579 gpio_set_value(WLAN_CLK, 0);
1580
1581 rf_bit = (rf_cmd_and_addr & 0x1);
1582 gpio_set_value(WLAN_DATA0, rf_bit ? 1 : 0);
1583 rf_cmd_and_addr = (rf_cmd_and_addr >> 1);
1584
1585 rf_bit = (rf_cmd_and_addr & 0x1);
1586 gpio_set_value(WLAN_DATA1, rf_bit ? 1 : 0);
1587 rf_cmd_and_addr = (rf_cmd_and_addr >> 1);
1588
1589 rf_bit = (rf_cmd_and_addr & 0x1);
1590 gpio_set_value(WLAN_DATA2, rf_bit ? 1 : 0);
1591 rf_cmd_and_addr = (rf_cmd_and_addr >> 1);
1592
1593 /* Send the data out WLAN_CLK = 1 */
1594 gpio_set_value(WLAN_CLK, 1);
1595 }
1596
1597 /* Pull down the clock signal */
1598 gpio_set_value(WLAN_CLK, 0);
1599
1600 /* Configure data pins to input IO pins */
1601 gpio_direction_input(WLAN_DATA0);
1602 gpio_direction_input(WLAN_DATA1);
1603 gpio_direction_input(WLAN_DATA2);
1604
1605 for (count = 0; count < 2; count++) {
1606 gpio_set_value(WLAN_CLK, 1);
1607 gpio_set_value(WLAN_CLK, 0);
1608 }
1609
1610 rf_bit = 0;
1611 for (count = 0; count < 6; count++) {
1612 gpio_set_value(WLAN_CLK, 1);
1613 gpio_set_value(WLAN_CLK, 0);
1614
1615 rf_bit = gpio_get_value(WLAN_DATA0);
1616 rf_data_received |= (rf_bit << (count * 3 + 0));
1617
1618 if (count != 5) {
1619 rf_bit = gpio_get_value(WLAN_DATA1);
1620 rf_data_received |= (rf_bit << (count * 3 + 1));
1621
1622 rf_bit = gpio_get_value(WLAN_DATA2);
1623 rf_data_received |= (rf_bit << (count * 3 + 2));
1624 }
1625 }
1626
1627 gpio_set_value(WLAN_SET, 0);
1628 wcnss_switch_to_5wire();
1629
1630 return rf_data_received;
1631}