blob: 4baa8516fe2874081f60f637db9a7cdb69992056 [file] [log] [blame]
Rohit Vaswania6815892011-12-15 20:20:39 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
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
26static struct gpiomux_setting gsbi4 = {
27 .func = GPIOMUX_FUNC_1,
28 .drv = GPIOMUX_DRV_8MA,
29 .pull = GPIOMUX_PULL_NONE,
30};
31
32static struct gpiomux_setting gsbi5 = {
33 .func = GPIOMUX_FUNC_1,
34 .drv = GPIOMUX_DRV_8MA,
35 .pull = GPIOMUX_PULL_NONE,
36};
37
38static struct gpiomux_setting gsbi3 = {
39 .func = GPIOMUX_FUNC_1,
40 .drv = GPIOMUX_DRV_8MA,
41 .pull = GPIOMUX_PULL_NONE,
42};
43
44static struct gpiomux_setting gsbi3_cs1_config = {
45 .func = GPIOMUX_FUNC_4,
46 .drv = GPIOMUX_DRV_8MA,
47 .pull = GPIOMUX_PULL_NONE,
48};
49
50#ifdef CONFIG_LTC4088_CHARGER
51static struct gpiomux_setting ltc4088_chg_cfg = {
52 .func = GPIOMUX_FUNC_GPIO,
53 .drv = GPIOMUX_DRV_8MA,
54 .pull = GPIOMUX_PULL_NONE,
55};
56#endif
57
58static struct gpiomux_setting sdcc2_clk_actv_cfg = {
59 .func = GPIOMUX_FUNC_1,
60 .drv = GPIOMUX_DRV_16MA,
61 .pull = GPIOMUX_PULL_NONE,
62};
63
64static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = {
65 .func = GPIOMUX_FUNC_1,
66 .drv = GPIOMUX_DRV_8MA,
67 .pull = GPIOMUX_PULL_UP,
68};
69
70static struct gpiomux_setting sdcc2_suspend_cfg = {
71 .func = GPIOMUX_FUNC_1,
72 .drv = GPIOMUX_DRV_2MA,
73 .pull = GPIOMUX_PULL_DOWN,
74};
75
76static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = {
77 {
78 /* SDC2_DATA_0 */
79 .gpio = 25,
80 .settings = {
81 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
82 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
83 },
84 },
85 {
86 /* SDC2_DATA_1 */
87 .gpio = 26,
88 .settings = {
89 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
90 [GPIOMUX_SUSPENDED] = &sdcc2_cmd_data_0_3_actv_cfg,
91 },
92 },
93 {
94 /* SDC2_DATA_2 */
95 .gpio = 27,
96 .settings = {
97 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
98 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
99 },
100 },
101 {
102 /* SDC2_DATA_3 */
103 .gpio = 28,
104 .settings = {
105 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
106 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
107 },
108 },
109 {
110 /* SDC2_CMD */
111 .gpio = 29,
112 .settings = {
113 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
114 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
115 },
116 },
117 {
118 /* SDC2_CLK */
119 .gpio = 30,
120 .settings = {
121 [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg,
122 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
123 },
124 },
125};
126
127struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = {
128 {
129 .gpio = 83,
130 .settings = {
131 [GPIOMUX_SUSPENDED] = &ps_hold,
132 },
133 },
134};
135
136#ifdef CONFIG_LTC4088_CHARGER
137static struct msm_gpiomux_config
138 msm9615_ltc4088_charger_config[] __initdata = {
139 {
140 .gpio = 4,
141 .settings = {
142 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
143 },
144 },
145 {
146 .gpio = 6,
147 .settings = {
148 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
149 },
150 },
151 {
152 .gpio = 7,
153 .settings = {
154 [GPIOMUX_SUSPENDED] = &ltc4088_chg_cfg,
155 },
156 },
157};
158#endif
159
160struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
161 {
162 .gpio = 8, /* GSBI3 QUP SPI_CLK */
163 .settings = {
164 [GPIOMUX_SUSPENDED] = &gsbi3,
165 },
166 },
167 {
168 .gpio = 9, /* GSBI3 QUP SPI_CS_N */
169 .settings = {
170 [GPIOMUX_SUSPENDED] = &gsbi3,
171 },
172 },
173 {
174 .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
175 .settings = {
176 [GPIOMUX_SUSPENDED] = &gsbi3,
177 },
178 },
179 {
180 .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
181 .settings = {
182 [GPIOMUX_SUSPENDED] = &gsbi3,
183 },
184 },
185 {
186 .gpio = 12, /* GSBI4 UART */
187 .settings = {
188 [GPIOMUX_SUSPENDED] = &gsbi4,
189 },
190 },
191 {
192 .gpio = 13, /* GSBI4 UART */
193 .settings = {
194 [GPIOMUX_SUSPENDED] = &gsbi4,
195 },
196 },
197 {
198 .gpio = 14, /* GSBI4 UART */
199 .settings = {
200 [GPIOMUX_SUSPENDED] = &gsbi4,
201 },
202 },
203 {
204 .gpio = 15, /* GSBI4 UART */
205 .settings = {
206 [GPIOMUX_SUSPENDED] = &gsbi4,
207 },
208 },
209 {
210 .gpio = 16, /* GSBI5 I2C QUP SCL */
211 .settings = {
212 [GPIOMUX_SUSPENDED] = &gsbi5,
213 },
214 },
215 {
216 .gpio = 17, /* GSBI5 I2C QUP SDA */
217 .settings = {
218 [GPIOMUX_SUSPENDED] = &gsbi5,
219 },
220 },
221 {
222 /* GPIO 19 can be used for I2C/UART on GSBI5 */
223 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
224 .settings = {
225 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
226 },
227 },
228};
229
230int __init msm9615_init_gpiomux(void)
231{
232 int rc;
233
234 rc = msm_gpiomux_init(NR_GPIO_IRQS);
235 if (rc) {
236 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
237 return rc;
238 }
239 msm_gpiomux_install(msm9615_gsbi_configs,
240 ARRAY_SIZE(msm9615_gsbi_configs));
241
242 msm_gpiomux_install(msm9615_ps_hold_config,
243 ARRAY_SIZE(msm9615_ps_hold_config));
244 msm_gpiomux_install(msm9615_sdcc2_configs,
245 ARRAY_SIZE(msm9615_sdcc2_configs));
246#ifdef CONFIG_LTC4088_CHARGER
247 msm_gpiomux_install(msm9615_ltc4088_charger_config,
248 ARRAY_SIZE(msm9615_ltc4088_charger_config));
249#endif
250
251 return 0;
252}