blob: 0e1891882d42257f9278e056765c45d19f25f30a [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,
254 },
255 },
256 {
257 .gpio = 17, /* GSBI5 I2C QUP SDA */
258 .settings = {
259 [GPIOMUX_SUSPENDED] = &gsbi5,
260 },
261 },
262 {
263 /* GPIO 19 can be used for I2C/UART on GSBI5 */
264 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
265 .settings = {
266 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
267 },
268 },
269};
270
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700271static struct msm_gpiomux_config msm9615_slimbus_configs[] __initdata = {
272 {
273 .gpio = 20, /* Slimbus data */
274 .settings = {
275 [GPIOMUX_SUSPENDED] = &slimbus,
276 },
277 },
278 {
279 .gpio = 23, /* Slimbus clk */
280 .settings = {
281 [GPIOMUX_SUSPENDED] = &slimbus,
282 },
283 },
284};
285
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400286#ifdef CONFIG_FB_MSM_EBI2
287static struct msm_gpiomux_config msm9615_ebi2_lcdc_configs[] __initdata = {
288 {
289 .gpio = 21, /* a_d */
290 .settings = {
291 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_a_d,
292 },
293 },
294 {
295 .gpio = 22, /* cs */
296 .settings = {
297 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_cs,
298 },
299 },
300 {
301 .gpio = 24, /* rs */
302 .settings = {
303 [GPIOMUX_SUSPENDED] = &ebi2_lcdc_rs,
304 },
305 },
306};
307#endif
308
Rohit Vaswania6815892011-12-15 20:20:39 -0800309int __init msm9615_init_gpiomux(void)
310{
311 int rc;
312
313 rc = msm_gpiomux_init(NR_GPIO_IRQS);
314 if (rc) {
315 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
316 return rc;
317 }
318 msm_gpiomux_install(msm9615_gsbi_configs,
319 ARRAY_SIZE(msm9615_gsbi_configs));
320
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700321 msm_gpiomux_install(msm9615_slimbus_configs,
322 ARRAY_SIZE(msm9615_slimbus_configs));
323
Rohit Vaswania6815892011-12-15 20:20:39 -0800324 msm_gpiomux_install(msm9615_ps_hold_config,
325 ARRAY_SIZE(msm9615_ps_hold_config));
326 msm_gpiomux_install(msm9615_sdcc2_configs,
327 ARRAY_SIZE(msm9615_sdcc2_configs));
328#ifdef CONFIG_LTC4088_CHARGER
329 msm_gpiomux_install(msm9615_ltc4088_charger_config,
330 ARRAY_SIZE(msm9615_ltc4088_charger_config));
331#endif
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800332 msm_gpiomux_install(msm9615_audio_codec_configs,
333 ARRAY_SIZE(msm9615_audio_codec_configs));
Rohit Vaswania6815892011-12-15 20:20:39 -0800334
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400335#ifdef CONFIG_FB_MSM_EBI2
336 msm_gpiomux_install(msm9615_ebi2_lcdc_configs,
337 ARRAY_SIZE(msm9615_ebi2_lcdc_configs));
338#endif
339
Rohit Vaswania6815892011-12-15 20:20:39 -0800340 return 0;
341}