blob: 6f36ef221c08e26b1f610e989be89dfd25e4008f [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 = {
28 .func = GPIOMUX_FUNC_9,
29 .drv = GPIOMUX_DRV_12MA,
30 .pull = GPIOMUX_PULL_NONE,
31};
32
33static struct gpiomux_setting gpio_spi_config = {
34 .func = GPIOMUX_FUNC_2,
35 .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 {
Abhimanyu Kapur2f9483f2012-09-27 16:44:23 -070047 .gpio = 8, /* BLSP1 UART TX */
Jin Hong690e3352012-05-02 09:25:05 -070048 .settings = {
49 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
50 },
51 },
52 {
Abhimanyu Kapur2f9483f2012-09-27 16:44:23 -070053 .gpio = 9, /* BLSP1 UART RX */
Jin Hong690e3352012-05-02 09:25:05 -070054 .settings = {
55 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
56 },
57 },
Rohit Vaswani0045df42012-06-29 16:21:48 -070058 {
David Collins50d4bcd2012-11-01 14:31:21 -070059 .gpio = 10, /* BLSP1 QUP3 I2C_DAT */
60 .settings = {
61 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
62 },
63 },
64 {
65 .gpio = 11, /* BLSP1 QUP3 I2C_CLK */
66 .settings = {
67 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
68 },
69 },
70 {
Rohit Vaswani0045df42012-06-29 16:21:48 -070071 .gpio = 69, /* BLSP6 QUP SPI_CS_N */
72 .settings = {
73 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
74 },
75 },
76 {
77 .gpio = 20, /* BLSP6 QUP SPI_DATA_MOSI */
78 .settings = {
79 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
80 },
81 },
82 {
83 .gpio = 21, /* BLSP6 QUP SPI_DATA_MISO */
84 .settings = {
85 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
86 },
87 },
88 {
89 .gpio = 23, /* BLSP6 QUP SPI_CLK */
90 .settings = {
91 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
92 },
93 },
94
Jin Hong690e3352012-05-02 09:25:05 -070095};
96
Oluwafemi Adeyemi4926a9e2012-09-14 17:39:59 -070097static struct gpiomux_setting sdc3_clk_active_cfg = {
98 .func = GPIOMUX_FUNC_1,
99 .drv = GPIOMUX_DRV_8MA,
100 .pull = GPIOMUX_PULL_NONE,
101};
102
103static struct gpiomux_setting sdc3_cmd_active_cfg = {
104 .func = GPIOMUX_FUNC_1,
105 .drv = GPIOMUX_DRV_8MA,
106 .pull = GPIOMUX_PULL_UP,
107};
108
109static struct gpiomux_setting sdc3_data_0_3_active_cfg = {
110 .func = GPIOMUX_FUNC_6,
111 .drv = GPIOMUX_DRV_8MA,
112 .pull = GPIOMUX_PULL_UP,
113};
114
115static struct gpiomux_setting sdc3_suspended_cfg = {
116 .func = GPIOMUX_FUNC_GPIO,
117 .drv = GPIOMUX_DRV_2MA,
118 .pull = GPIOMUX_PULL_DOWN,
119};
120
121static struct gpiomux_setting sdc3_data_1_suspended_cfg = {
122 .func = GPIOMUX_FUNC_GPIO,
123 .drv = GPIOMUX_DRV_2MA,
124 .pull = GPIOMUX_PULL_UP,
125};
126
127static struct msm_gpiomux_config sdc3_configs[] __initdata = {
128 {
129 .gpio = 25,
130 .settings = {
131 [GPIOMUX_ACTIVE] = &sdc3_clk_active_cfg,
132 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
133 },
134 },
135 {
136 .gpio = 24,
137 .settings = {
138 [GPIOMUX_ACTIVE] = &sdc3_cmd_active_cfg,
139 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
140 },
141
142 },
143 {
144 .gpio = 16,
145 .settings = {
146 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
147 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
148 },
149 },
150 {
151 .gpio = 17,
152 .settings = {
153 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
154 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspended_cfg,
155 },
156 },
157 {
158 .gpio = 18,
159 .settings = {
160 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
161 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
162 },
163 },
164 {
165 .gpio = 19,
166 .settings = {
167 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
168 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
169 },
170 },
171};
172
Pavan Kumar07c070b2012-10-29 18:58:49 -0700173static struct gpiomux_setting wlan_ath6kl_active_config = {
174 .func = GPIOMUX_FUNC_GPIO,
175 .drv = GPIOMUX_DRV_2MA,
176 .pull = GPIOMUX_PULL_NONE,
177 .dir = GPIOMUX_OUT_LOW,
178};
179
180static struct gpiomux_setting wlan_ath6kl_suspend_config = {
181 .func = GPIOMUX_FUNC_GPIO,
182 .drv = GPIOMUX_DRV_2MA,
183 .pull = GPIOMUX_PULL_NONE,
184 .dir = GPIOMUX_IN,
185};
186
187static struct msm_gpiomux_config wlan_ath6kl_configs[] __initdata = {
188 {
189 .gpio = 62,/* CHIP_PWD_L */
190 .settings = {
191 [GPIOMUX_ACTIVE] = &wlan_ath6kl_active_config,
192 [GPIOMUX_SUSPENDED] = &wlan_ath6kl_suspend_config,
193 },
194 },
195};
196
Jin Hong690e3352012-05-02 09:25:05 -0700197void __init msm9625_init_gpiomux(void)
198{
199 int rc;
200
201 rc = msm_gpiomux_init(NR_GPIO_IRQS);
202 if (rc) {
203 pr_err(KERN_ERR "msm9625_init_gpiomux failed %d\n", rc);
204 return;
205 }
206
207 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Oluwafemi Adeyemi4926a9e2012-09-14 17:39:59 -0700208 msm_gpiomux_install(sdc3_configs, ARRAY_SIZE(sdc3_configs));
Pavan Kumar07c070b2012-10-29 18:58:49 -0700209 msm_gpiomux_install(wlan_ath6kl_configs,
210 ARRAY_SIZE(wlan_ath6kl_configs));
Jin Hong690e3352012-05-02 09:25:05 -0700211}