blob: 8f07ff05362a27aa81abc7c1d53558bd470d38ae [file] [log] [blame]
Jin Hong690e3352012-05-02 09:25:05 -07001/* Copyright (c) 2012, 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 <linux/ioport.h>
16#include <mach/board.h>
17#include <mach/gpio.h>
18#include <mach/gpiomux.h>
19
20static struct gpiomux_setting gpio_uart_config = {
Abhimanyu Kapur2f9483f2012-09-27 16:44:23 -070021 .func = GPIOMUX_FUNC_1,
22 .drv = GPIOMUX_DRV_8MA,
Jin Hong690e3352012-05-02 09:25:05 -070023 .pull = GPIOMUX_PULL_NONE,
24 .dir = GPIOMUX_OUT_HIGH,
25};
26
Rohit Vaswani0045df42012-06-29 16:21:48 -070027static struct gpiomux_setting gpio_spi_cs_config = {
Gilad Avidov09c78ec2012-10-18 09:34:35 -060028 .func = GPIOMUX_FUNC_1,
Rohit Vaswani0045df42012-06-29 16:21:48 -070029 .drv = GPIOMUX_DRV_12MA,
30 .pull = GPIOMUX_PULL_NONE,
31};
32
33static struct gpiomux_setting gpio_spi_config = {
Gilad Avidov09c78ec2012-10-18 09:34:35 -060034 .func = GPIOMUX_FUNC_1,
Rohit Vaswani0045df42012-06-29 16:21:48 -070035 .drv = GPIOMUX_DRV_12MA,
36 .pull = GPIOMUX_PULL_NONE,
37};
38
David Collins50d4bcd2012-11-01 14:31:21 -070039static struct gpiomux_setting gpio_i2c_config = {
40 .func = GPIOMUX_FUNC_3,
41 .drv = GPIOMUX_DRV_2MA,
42 .pull = GPIOMUX_PULL_NONE,
43};
44
Jin Hong690e3352012-05-02 09:25:05 -070045static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
46 {
Gilad Avidov09c78ec2012-10-18 09:34:35 -060047 .gpio = 4, /* BLSP1 QUP2 SPI_DATA_MOSI */
48 .settings = {
49 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
50 },
51 },
52 {
53 .gpio = 5, /* BLSP1 QUP2 SPI_DATA_MISO */
54 .settings = {
55 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
56 },
57 },
58 {
59 .gpio = 6, /* BLSP1 QUP2 SPI_CS_N */
60 .settings = {
61 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
62 },
63 },
64 {
65 .gpio = 7, /* BLSP1 QUP2 SPI_CLK */
66 .settings = {
67 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
68 },
69 },
70 {
Abhimanyu Kapur2f9483f2012-09-27 16:44:23 -070071 .gpio = 8, /* BLSP1 UART TX */
Jin Hong690e3352012-05-02 09:25:05 -070072 .settings = {
73 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
74 },
75 },
76 {
Abhimanyu Kapur2f9483f2012-09-27 16:44:23 -070077 .gpio = 9, /* BLSP1 UART RX */
Jin Hong690e3352012-05-02 09:25:05 -070078 .settings = {
79 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
80 },
81 },
Rohit Vaswani0045df42012-06-29 16:21:48 -070082 {
David Collins50d4bcd2012-11-01 14:31:21 -070083 .gpio = 10, /* BLSP1 QUP3 I2C_DAT */
84 .settings = {
85 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
86 },
87 },
88 {
89 .gpio = 11, /* BLSP1 QUP3 I2C_CLK */
90 .settings = {
91 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
92 },
93 },
Jin Hong690e3352012-05-02 09:25:05 -070094};
95
Oluwafemi Adeyemi4926a9e2012-09-14 17:39:59 -070096static struct gpiomux_setting sdc3_clk_active_cfg = {
97 .func = GPIOMUX_FUNC_1,
98 .drv = GPIOMUX_DRV_8MA,
99 .pull = GPIOMUX_PULL_NONE,
100};
101
102static struct gpiomux_setting sdc3_cmd_active_cfg = {
103 .func = GPIOMUX_FUNC_1,
104 .drv = GPIOMUX_DRV_8MA,
105 .pull = GPIOMUX_PULL_UP,
106};
107
108static struct gpiomux_setting sdc3_data_0_3_active_cfg = {
109 .func = GPIOMUX_FUNC_6,
110 .drv = GPIOMUX_DRV_8MA,
111 .pull = GPIOMUX_PULL_UP,
112};
113
114static struct gpiomux_setting sdc3_suspended_cfg = {
115 .func = GPIOMUX_FUNC_GPIO,
116 .drv = GPIOMUX_DRV_2MA,
117 .pull = GPIOMUX_PULL_DOWN,
118};
119
120static struct gpiomux_setting sdc3_data_1_suspended_cfg = {
121 .func = GPIOMUX_FUNC_GPIO,
122 .drv = GPIOMUX_DRV_2MA,
123 .pull = GPIOMUX_PULL_UP,
124};
125
126static struct msm_gpiomux_config sdc3_configs[] __initdata = {
127 {
128 .gpio = 25,
129 .settings = {
130 [GPIOMUX_ACTIVE] = &sdc3_clk_active_cfg,
131 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
132 },
133 },
134 {
135 .gpio = 24,
136 .settings = {
137 [GPIOMUX_ACTIVE] = &sdc3_cmd_active_cfg,
138 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
139 },
140
141 },
142 {
143 .gpio = 16,
144 .settings = {
145 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
146 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
147 },
148 },
149 {
150 .gpio = 17,
151 .settings = {
152 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
153 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspended_cfg,
154 },
155 },
156 {
157 .gpio = 18,
158 .settings = {
159 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
160 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
161 },
162 },
163 {
164 .gpio = 19,
165 .settings = {
166 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
167 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
168 },
169 },
170};
171
Pavan Kumar07c070b2012-10-29 18:58:49 -0700172static struct gpiomux_setting wlan_ath6kl_active_config = {
173 .func = GPIOMUX_FUNC_GPIO,
174 .drv = GPIOMUX_DRV_2MA,
175 .pull = GPIOMUX_PULL_NONE,
176 .dir = GPIOMUX_OUT_LOW,
177};
178
179static struct gpiomux_setting wlan_ath6kl_suspend_config = {
180 .func = GPIOMUX_FUNC_GPIO,
181 .drv = GPIOMUX_DRV_2MA,
182 .pull = GPIOMUX_PULL_NONE,
183 .dir = GPIOMUX_IN,
184};
185
186static struct msm_gpiomux_config wlan_ath6kl_configs[] __initdata = {
187 {
188 .gpio = 62,/* CHIP_PWD_L */
189 .settings = {
190 [GPIOMUX_ACTIVE] = &wlan_ath6kl_active_config,
191 [GPIOMUX_SUSPENDED] = &wlan_ath6kl_suspend_config,
192 },
193 },
194};
195
Jin Hong690e3352012-05-02 09:25:05 -0700196void __init msm9625_init_gpiomux(void)
197{
198 int rc;
199
200 rc = msm_gpiomux_init(NR_GPIO_IRQS);
201 if (rc) {
202 pr_err(KERN_ERR "msm9625_init_gpiomux failed %d\n", rc);
203 return;
204 }
205
206 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Oluwafemi Adeyemi4926a9e2012-09-14 17:39:59 -0700207 msm_gpiomux_install(sdc3_configs, ARRAY_SIZE(sdc3_configs));
Pavan Kumar07c070b2012-10-29 18:58:49 -0700208 msm_gpiomux_install(wlan_ath6kl_configs,
209 ARRAY_SIZE(wlan_ath6kl_configs));
Jin Hong690e3352012-05-02 09:25:05 -0700210}