blob: e61f00119bc9d0f111494c83ed4c2f32243e2cfc [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
88static struct msm_gpiomux_config msm9615_audio_codec_configs[] __initdata = {
89 {
90 .gpio = 24,
91 .settings = {
92 [GPIOMUX_SUSPENDED] = &cdc_mclk,
93 },
94 },
95};
96
Rohit Vaswania6815892011-12-15 20:20:39 -080097static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = {
98 {
99 /* SDC2_DATA_0 */
100 .gpio = 25,
101 .settings = {
102 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
103 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
104 },
105 },
106 {
107 /* SDC2_DATA_1 */
108 .gpio = 26,
109 .settings = {
110 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
111 [GPIOMUX_SUSPENDED] = &sdcc2_cmd_data_0_3_actv_cfg,
112 },
113 },
114 {
115 /* SDC2_DATA_2 */
116 .gpio = 27,
117 .settings = {
118 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
119 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
120 },
121 },
122 {
123 /* SDC2_DATA_3 */
124 .gpio = 28,
125 .settings = {
126 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
127 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
128 },
129 },
130 {
131 /* SDC2_CMD */
132 .gpio = 29,
133 .settings = {
134 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
135 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
136 },
137 },
138 {
139 /* SDC2_CLK */
140 .gpio = 30,
141 .settings = {
142 [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg,
143 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
144 },
145 },
146};
147
148struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = {
149 {
150 .gpio = 83,
151 .settings = {
152 [GPIOMUX_SUSPENDED] = &ps_hold,
153 },
154 },
155};
156
157#ifdef CONFIG_LTC4088_CHARGER
158static struct msm_gpiomux_config
159 msm9615_ltc4088_charger_config[] __initdata = {
160 {
161 .gpio = 4,
162 .settings = {
163 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
164 },
165 },
166 {
167 .gpio = 6,
168 .settings = {
169 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
170 },
171 },
172 {
173 .gpio = 7,
174 .settings = {
175 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
176 },
177 },
178};
179#endif
180
181struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
182 {
183 .gpio = 8, /* GSBI3 QUP SPI_CLK */
184 .settings = {
185 [GPIOMUX_SUSPENDED] = &gsbi3,
186 },
187 },
188 {
189 .gpio = 9, /* GSBI3 QUP SPI_CS_N */
190 .settings = {
191 [GPIOMUX_SUSPENDED] = &gsbi3,
192 },
193 },
194 {
195 .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
196 .settings = {
197 [GPIOMUX_SUSPENDED] = &gsbi3,
198 },
199 },
200 {
201 .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
202 .settings = {
203 [GPIOMUX_SUSPENDED] = &gsbi3,
204 },
205 },
206 {
207 .gpio = 12, /* GSBI4 UART */
208 .settings = {
209 [GPIOMUX_SUSPENDED] = &gsbi4,
210 },
211 },
212 {
213 .gpio = 13, /* GSBI4 UART */
214 .settings = {
215 [GPIOMUX_SUSPENDED] = &gsbi4,
216 },
217 },
218 {
219 .gpio = 14, /* GSBI4 UART */
220 .settings = {
221 [GPIOMUX_SUSPENDED] = &gsbi4,
222 },
223 },
224 {
225 .gpio = 15, /* GSBI4 UART */
226 .settings = {
227 [GPIOMUX_SUSPENDED] = &gsbi4,
228 },
229 },
230 {
231 .gpio = 16, /* GSBI5 I2C QUP SCL */
232 .settings = {
233 [GPIOMUX_SUSPENDED] = &gsbi5,
234 },
235 },
236 {
237 .gpio = 17, /* GSBI5 I2C QUP SDA */
238 .settings = {
239 [GPIOMUX_SUSPENDED] = &gsbi5,
240 },
241 },
242 {
243 /* GPIO 19 can be used for I2C/UART on GSBI5 */
244 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
245 .settings = {
246 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
247 },
248 },
249};
250
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700251static struct msm_gpiomux_config msm9615_slimbus_configs[] __initdata = {
252 {
253 .gpio = 20, /* Slimbus data */
254 .settings = {
255 [GPIOMUX_SUSPENDED] = &slimbus,
256 },
257 },
258 {
259 .gpio = 23, /* Slimbus clk */
260 .settings = {
261 [GPIOMUX_SUSPENDED] = &slimbus,
262 },
263 },
264};
265
Rohit Vaswania6815892011-12-15 20:20:39 -0800266int __init msm9615_init_gpiomux(void)
267{
268 int rc;
269
270 rc = msm_gpiomux_init(NR_GPIO_IRQS);
271 if (rc) {
272 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
273 return rc;
274 }
275 msm_gpiomux_install(msm9615_gsbi_configs,
276 ARRAY_SIZE(msm9615_gsbi_configs));
277
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700278 msm_gpiomux_install(msm9615_slimbus_configs,
279 ARRAY_SIZE(msm9615_slimbus_configs));
280
Rohit Vaswania6815892011-12-15 20:20:39 -0800281 msm_gpiomux_install(msm9615_ps_hold_config,
282 ARRAY_SIZE(msm9615_ps_hold_config));
283 msm_gpiomux_install(msm9615_sdcc2_configs,
284 ARRAY_SIZE(msm9615_sdcc2_configs));
285#ifdef CONFIG_LTC4088_CHARGER
286 msm_gpiomux_install(msm9615_ltc4088_charger_config,
287 ARRAY_SIZE(msm9615_ltc4088_charger_config));
288#endif
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800289 msm_gpiomux_install(msm9615_audio_codec_configs,
290 ARRAY_SIZE(msm9615_audio_codec_configs));
Rohit Vaswania6815892011-12-15 20:20:39 -0800291
292 return 0;
293}