blob: 3df5000c63af6a209a3f70a38474e030f7a8b9e9 [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>
15#include <mach/gpiomux.h>
16#include <mach/board.h>
17#include <mach/gpio.h>
18#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
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800108static struct msm_gpiomux_config msm9615_audio_codec_configs[] __initdata = {
109 {
110 .gpio = 24,
111 .settings = {
112 [GPIOMUX_SUSPENDED] = &cdc_mclk,
113 },
114 },
115};
116
Rohit Vaswania6815892011-12-15 20:20:39 -0800117static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = {
118 {
119 /* SDC2_DATA_0 */
120 .gpio = 25,
121 .settings = {
122 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
123 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
124 },
125 },
126 {
127 /* SDC2_DATA_1 */
128 .gpio = 26,
129 .settings = {
130 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
131 [GPIOMUX_SUSPENDED] = &sdcc2_cmd_data_0_3_actv_cfg,
132 },
133 },
134 {
135 /* SDC2_DATA_2 */
136 .gpio = 27,
137 .settings = {
138 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
139 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
140 },
141 },
142 {
143 /* SDC2_DATA_3 */
144 .gpio = 28,
145 .settings = {
146 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
147 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
148 },
149 },
150 {
151 /* SDC2_CMD */
152 .gpio = 29,
153 .settings = {
154 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
155 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
156 },
157 },
158 {
159 /* SDC2_CLK */
160 .gpio = 30,
161 .settings = {
162 [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg,
163 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
164 },
165 },
166};
167
168struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = {
169 {
170 .gpio = 83,
171 .settings = {
172 [GPIOMUX_SUSPENDED] = &ps_hold,
173 },
174 },
175};
176
177#ifdef CONFIG_LTC4088_CHARGER
178static struct msm_gpiomux_config
179 msm9615_ltc4088_charger_config[] __initdata = {
180 {
181 .gpio = 4,
182 .settings = {
183 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
184 },
185 },
186 {
187 .gpio = 6,
188 .settings = {
189 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
190 },
191 },
192 {
193 .gpio = 7,
194 .settings = {
195 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
196 },
197 },
198};
199#endif
200
201struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
202 {
203 .gpio = 8, /* GSBI3 QUP SPI_CLK */
204 .settings = {
205 [GPIOMUX_SUSPENDED] = &gsbi3,
206 },
207 },
208 {
209 .gpio = 9, /* GSBI3 QUP SPI_CS_N */
210 .settings = {
211 [GPIOMUX_SUSPENDED] = &gsbi3,
212 },
213 },
214 {
215 .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
216 .settings = {
217 [GPIOMUX_SUSPENDED] = &gsbi3,
218 },
219 },
220 {
221 .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
222 .settings = {
223 [GPIOMUX_SUSPENDED] = &gsbi3,
224 },
225 },
226 {
227 .gpio = 12, /* GSBI4 UART */
228 .settings = {
229 [GPIOMUX_SUSPENDED] = &gsbi4,
230 },
231 },
232 {
233 .gpio = 13, /* GSBI4 UART */
234 .settings = {
235 [GPIOMUX_SUSPENDED] = &gsbi4,
236 },
237 },
238 {
239 .gpio = 14, /* GSBI4 UART */
240 .settings = {
241 [GPIOMUX_SUSPENDED] = &gsbi4,
242 },
243 },
244 {
245 .gpio = 15, /* GSBI4 UART */
246 .settings = {
247 [GPIOMUX_SUSPENDED] = &gsbi4,
248 },
249 },
250 {
251 .gpio = 16, /* GSBI5 I2C QUP SCL */
252 .settings = {
253 [GPIOMUX_SUSPENDED] = &gsbi5,
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700254 [GPIOMUX_ACTIVE] = &gsbi5,
Rohit Vaswania6815892011-12-15 20:20:39 -0800255 },
256 },
257 {
258 .gpio = 17, /* GSBI5 I2C QUP SDA */
259 .settings = {
260 [GPIOMUX_SUSPENDED] = &gsbi5,
261 },
262 },
263 {
264 /* GPIO 19 can be used for I2C/UART on GSBI5 */
265 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
266 .settings = {
267 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
268 },
269 },
270};
271
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700272static struct msm_gpiomux_config msm9615_slimbus_configs[] __initdata = {
273 {
274 .gpio = 20, /* Slimbus data */
275 .settings = {
276 [GPIOMUX_SUSPENDED] = &slimbus,
277 },
278 },
279 {
280 .gpio = 23, /* Slimbus clk */
281 .settings = {
282 [GPIOMUX_SUSPENDED] = &slimbus,
283 },
284 },
285};
286
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400287#ifdef CONFIG_FB_MSM_EBI2
288static struct msm_gpiomux_config msm9615_ebi2_lcdc_configs[] __initdata = {
289 {
290 .gpio = 21, /* a_d */
291 .settings = {
292 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_a_d,
293 },
294 },
295 {
296 .gpio = 22, /* cs */
297 .settings = {
298 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_cs,
299 },
300 },
301 {
302 .gpio = 24, /* rs */
303 .settings = {
304 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_rs,
305 },
306 },
307};
308#endif
309
Rohit Vaswania6815892011-12-15 20:20:39 -0800310int __init msm9615_init_gpiomux(void)
311{
312 int rc;
313
314 rc = msm_gpiomux_init(NR_GPIO_IRQS);
315 if (rc) {
316 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
317 return rc;
318 }
319 msm_gpiomux_install(msm9615_gsbi_configs,
320 ARRAY_SIZE(msm9615_gsbi_configs));
321
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700322 msm_gpiomux_install(msm9615_slimbus_configs,
323 ARRAY_SIZE(msm9615_slimbus_configs));
324
Rohit Vaswania6815892011-12-15 20:20:39 -0800325 msm_gpiomux_install(msm9615_ps_hold_config,
326 ARRAY_SIZE(msm9615_ps_hold_config));
327 msm_gpiomux_install(msm9615_sdcc2_configs,
328 ARRAY_SIZE(msm9615_sdcc2_configs));
329#ifdef CONFIG_LTC4088_CHARGER
330 msm_gpiomux_install(msm9615_ltc4088_charger_config,
331 ARRAY_SIZE(msm9615_ltc4088_charger_config));
332#endif
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800333 msm_gpiomux_install(msm9615_audio_codec_configs,
334 ARRAY_SIZE(msm9615_audio_codec_configs));
Rohit Vaswania6815892011-12-15 20:20:39 -0800335
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400336#ifdef CONFIG_FB_MSM_EBI2
337 msm_gpiomux_install(msm9615_ebi2_lcdc_configs,
338 ARRAY_SIZE(msm9615_ebi2_lcdc_configs));
339#endif
340
Rohit Vaswania6815892011-12-15 20:20:39 -0800341 return 0;
342}