blob: 9339638ede1b3d4b6ca254777e991790fe5b5d39 [file] [log] [blame]
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Rohit Vaswania6815892011-12-15 20:20:39 -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>
Steve Mucklef132c6c2012-06-06 18:30:57 -070015#include <linux/gpio.h>
Rohit Vaswania6815892011-12-15 20:20:39 -080016#include <mach/gpiomux.h>
17#include <mach/board.h>
Rohit Vaswania6815892011-12-15 20:20:39 -080018#include "board-9615.h"
19
20static struct gpiomux_setting ps_hold = {
21 .func = GPIOMUX_FUNC_1,
22 .drv = GPIOMUX_DRV_8MA,
23 .pull = GPIOMUX_PULL_NONE,
24};
25
Sagar Dharia2a5378d2011-12-01 20:00:11 -070026static struct gpiomux_setting slimbus = {
27 .func = GPIOMUX_FUNC_2,
28 .drv = GPIOMUX_DRV_8MA,
29 .pull = GPIOMUX_PULL_KEEPER,
30};
31
Rohit Vaswania6815892011-12-15 20:20:39 -080032static struct gpiomux_setting gsbi4 = {
33 .func = GPIOMUX_FUNC_1,
34 .drv = GPIOMUX_DRV_8MA,
35 .pull = GPIOMUX_PULL_NONE,
36};
37
38static struct gpiomux_setting gsbi5 = {
39 .func = GPIOMUX_FUNC_1,
40 .drv = GPIOMUX_DRV_8MA,
41 .pull = GPIOMUX_PULL_NONE,
42};
43
44static struct gpiomux_setting gsbi3 = {
45 .func = GPIOMUX_FUNC_1,
46 .drv = GPIOMUX_DRV_8MA,
47 .pull = GPIOMUX_PULL_NONE,
48};
49
50static struct gpiomux_setting gsbi3_cs1_config = {
51 .func = GPIOMUX_FUNC_4,
52 .drv = GPIOMUX_DRV_8MA,
53 .pull = GPIOMUX_PULL_NONE,
54};
55
56#ifdef CONFIG_LTC4088_CHARGER
57static struct gpiomux_setting ltc4088_chg_cfg = {
58 .func = GPIOMUX_FUNC_GPIO,
59 .drv = GPIOMUX_DRV_8MA,
60 .pull = GPIOMUX_PULL_NONE,
61};
62#endif
63
64static struct gpiomux_setting sdcc2_clk_actv_cfg = {
65 .func = GPIOMUX_FUNC_1,
66 .drv = GPIOMUX_DRV_16MA,
67 .pull = GPIOMUX_PULL_NONE,
68};
69
70static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = {
71 .func = GPIOMUX_FUNC_1,
72 .drv = GPIOMUX_DRV_8MA,
73 .pull = GPIOMUX_PULL_UP,
74};
75
76static struct gpiomux_setting sdcc2_suspend_cfg = {
77 .func = GPIOMUX_FUNC_1,
78 .drv = GPIOMUX_DRV_2MA,
79 .pull = GPIOMUX_PULL_DOWN,
80};
81
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -080082static struct gpiomux_setting cdc_mclk = {
83 .func = GPIOMUX_FUNC_1,
84 .drv = GPIOMUX_DRV_8MA,
85 .pull = GPIOMUX_PULL_NONE,
86};
87
Zhang Chang Kena48794b2012-03-31 17:45:21 -040088#ifdef CONFIG_FB_MSM_EBI2
89static struct gpiomux_setting ebi2_lcdc_a_d = {
90 .func = GPIOMUX_FUNC_2,
91 .drv = GPIOMUX_DRV_12MA,
92 .pull = GPIOMUX_PULL_DOWN,
93};
94
95static struct gpiomux_setting ebi2_lcdc_cs = {
96 .func = GPIOMUX_FUNC_2,
97 .drv = GPIOMUX_DRV_12MA,
98 .pull = GPIOMUX_PULL_UP,
99};
100
101static struct gpiomux_setting ebi2_lcdc_rs = {
102 .func = GPIOMUX_FUNC_3,
103 .drv = GPIOMUX_DRV_12MA,
104 .pull = GPIOMUX_PULL_DOWN,
105};
106#endif
107
Pavan Kumar27556502012-05-21 18:38:01 -0700108static struct gpiomux_setting wlan_active_config = {
109 .func = GPIOMUX_FUNC_GPIO,
110 .drv = GPIOMUX_DRV_2MA,
111 .pull = GPIOMUX_PULL_NONE,
112 .dir = GPIOMUX_OUT_LOW,
113};
114
115static struct gpiomux_setting wlan_suspend_config = {
116 .func = GPIOMUX_FUNC_GPIO,
117 .drv = GPIOMUX_DRV_2MA,
118 .pull = GPIOMUX_PULL_NONE,
119 .dir = GPIOMUX_IN,
120};
121
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700122static struct gpiomux_setting tabla_reset = {
123 .func = GPIOMUX_FUNC_GPIO,
124 .drv = GPIOMUX_DRV_6MA,
125 .pull = GPIOMUX_PULL_NONE,
126 .dir = GPIOMUX_OUT_LOW,
127};
128
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800129static struct msm_gpiomux_config msm9615_audio_codec_configs[] __initdata = {
130 {
131 .gpio = 24,
132 .settings = {
133 [GPIOMUX_SUSPENDED] = &cdc_mclk,
134 },
135 },
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700136 {
137 .gpio = 84, /* SYS_RST_N */
138 .settings = {
139 [GPIOMUX_SUSPENDED] = &tabla_reset,
140 },
141 }
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800142};
143
Rohit Vaswania6815892011-12-15 20:20:39 -0800144static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = {
145 {
146 /* SDC2_DATA_0 */
147 .gpio = 25,
148 .settings = {
149 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
150 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
151 },
152 },
153 {
154 /* SDC2_DATA_1 */
155 .gpio = 26,
156 .settings = {
157 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
158 [GPIOMUX_SUSPENDED] = &sdcc2_cmd_data_0_3_actv_cfg,
159 },
160 },
161 {
162 /* SDC2_DATA_2 */
163 .gpio = 27,
164 .settings = {
165 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
166 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
167 },
168 },
169 {
170 /* SDC2_DATA_3 */
171 .gpio = 28,
172 .settings = {
173 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
174 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
175 },
176 },
177 {
178 /* SDC2_CMD */
179 .gpio = 29,
180 .settings = {
181 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
182 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
183 },
184 },
185 {
186 /* SDC2_CLK */
187 .gpio = 30,
188 .settings = {
189 [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg,
190 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
191 },
192 },
193};
194
195struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = {
196 {
197 .gpio = 83,
198 .settings = {
199 [GPIOMUX_SUSPENDED] = &ps_hold,
200 },
201 },
202};
203
204#ifdef CONFIG_LTC4088_CHARGER
205static struct msm_gpiomux_config
206 msm9615_ltc4088_charger_config[] __initdata = {
207 {
208 .gpio = 4,
209 .settings = {
210 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
211 },
212 },
213 {
214 .gpio = 6,
215 .settings = {
216 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
217 },
218 },
219 {
220 .gpio = 7,
221 .settings = {
222 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
223 },
224 },
225};
226#endif
227
228struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
229 {
230 .gpio = 8, /* GSBI3 QUP SPI_CLK */
231 .settings = {
232 [GPIOMUX_SUSPENDED] = &gsbi3,
233 },
234 },
235 {
236 .gpio = 9, /* GSBI3 QUP SPI_CS_N */
237 .settings = {
238 [GPIOMUX_SUSPENDED] = &gsbi3,
239 },
240 },
241 {
242 .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
243 .settings = {
244 [GPIOMUX_SUSPENDED] = &gsbi3,
245 },
246 },
247 {
248 .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
249 .settings = {
250 [GPIOMUX_SUSPENDED] = &gsbi3,
251 },
252 },
253 {
254 .gpio = 12, /* GSBI4 UART */
255 .settings = {
256 [GPIOMUX_SUSPENDED] = &gsbi4,
257 },
258 },
259 {
260 .gpio = 13, /* GSBI4 UART */
261 .settings = {
262 [GPIOMUX_SUSPENDED] = &gsbi4,
263 },
264 },
265 {
266 .gpio = 14, /* GSBI4 UART */
267 .settings = {
268 [GPIOMUX_SUSPENDED] = &gsbi4,
269 },
270 },
271 {
272 .gpio = 15, /* GSBI4 UART */
273 .settings = {
274 [GPIOMUX_SUSPENDED] = &gsbi4,
275 },
276 },
277 {
278 .gpio = 16, /* GSBI5 I2C QUP SCL */
279 .settings = {
280 [GPIOMUX_SUSPENDED] = &gsbi5,
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700281 [GPIOMUX_ACTIVE] = &gsbi5,
Rohit Vaswania6815892011-12-15 20:20:39 -0800282 },
283 },
284 {
285 .gpio = 17, /* GSBI5 I2C QUP SDA */
286 .settings = {
287 [GPIOMUX_SUSPENDED] = &gsbi5,
288 },
289 },
290 {
291 /* GPIO 19 can be used for I2C/UART on GSBI5 */
292 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
293 .settings = {
294 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
295 },
296 },
297};
298
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700299static struct msm_gpiomux_config msm9615_slimbus_configs[] __initdata = {
300 {
301 .gpio = 20, /* Slimbus data */
302 .settings = {
303 [GPIOMUX_SUSPENDED] = &slimbus,
304 },
305 },
306 {
307 .gpio = 23, /* Slimbus clk */
308 .settings = {
309 [GPIOMUX_SUSPENDED] = &slimbus,
310 },
311 },
312};
313
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400314#ifdef CONFIG_FB_MSM_EBI2
315static struct msm_gpiomux_config msm9615_ebi2_lcdc_configs[] __initdata = {
316 {
317 .gpio = 21, /* a_d */
318 .settings = {
319 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_a_d,
320 },
321 },
322 {
323 .gpio = 22, /* cs */
324 .settings = {
325 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_cs,
326 },
327 },
328 {
329 .gpio = 24, /* rs */
330 .settings = {
331 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_rs,
332 },
333 },
334};
335#endif
336
Pavan Kumar27556502012-05-21 18:38:01 -0700337static struct msm_gpiomux_config msm9615_wlan_configs[] __initdata = {
338 {
339 .gpio = 21,/* WLAN_RESET_N */
340 .settings = {
341 [GPIOMUX_ACTIVE] = &wlan_active_config,
342 [GPIOMUX_SUSPENDED] = &wlan_suspend_config,
343 },
344 },
345};
346
347
Rohit Vaswania6815892011-12-15 20:20:39 -0800348int __init msm9615_init_gpiomux(void)
349{
350 int rc;
351
352 rc = msm_gpiomux_init(NR_GPIO_IRQS);
353 if (rc) {
354 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
355 return rc;
356 }
357 msm_gpiomux_install(msm9615_gsbi_configs,
358 ARRAY_SIZE(msm9615_gsbi_configs));
359
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700360 msm_gpiomux_install(msm9615_slimbus_configs,
361 ARRAY_SIZE(msm9615_slimbus_configs));
362
Rohit Vaswania6815892011-12-15 20:20:39 -0800363 msm_gpiomux_install(msm9615_ps_hold_config,
364 ARRAY_SIZE(msm9615_ps_hold_config));
365 msm_gpiomux_install(msm9615_sdcc2_configs,
366 ARRAY_SIZE(msm9615_sdcc2_configs));
367#ifdef CONFIG_LTC4088_CHARGER
368 msm_gpiomux_install(msm9615_ltc4088_charger_config,
369 ARRAY_SIZE(msm9615_ltc4088_charger_config));
370#endif
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800371 msm_gpiomux_install(msm9615_audio_codec_configs,
372 ARRAY_SIZE(msm9615_audio_codec_configs));
Rohit Vaswania6815892011-12-15 20:20:39 -0800373
Pavan Kumar27556502012-05-21 18:38:01 -0700374 msm_gpiomux_install(msm9615_wlan_configs,
375 ARRAY_SIZE(msm9615_wlan_configs));
376
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400377#ifdef CONFIG_FB_MSM_EBI2
378 msm_gpiomux_install(msm9615_ebi2_lcdc_configs,
379 ARRAY_SIZE(msm9615_ebi2_lcdc_configs));
380#endif
381
Rohit Vaswania6815892011-12-15 20:20:39 -0800382 return 0;
383}