blob: c4e174b81cee856ddb09d92f9d3e0fc22d291aaf [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
Jin Hong690e3352012-05-02 09:25:05 -070039static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
40 {
Abhimanyu Kapur2f9483f2012-09-27 16:44:23 -070041 .gpio = 8, /* BLSP1 UART TX */
Jin Hong690e3352012-05-02 09:25:05 -070042 .settings = {
43 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
44 },
45 },
46 {
Abhimanyu Kapur2f9483f2012-09-27 16:44:23 -070047 .gpio = 9, /* BLSP1 UART RX */
Jin Hong690e3352012-05-02 09:25:05 -070048 .settings = {
49 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
50 },
51 },
Rohit Vaswani0045df42012-06-29 16:21:48 -070052 {
53 .gpio = 69, /* BLSP6 QUP SPI_CS_N */
54 .settings = {
55 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
56 },
57 },
58 {
59 .gpio = 20, /* BLSP6 QUP SPI_DATA_MOSI */
60 .settings = {
61 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
62 },
63 },
64 {
65 .gpio = 21, /* BLSP6 QUP SPI_DATA_MISO */
66 .settings = {
67 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
68 },
69 },
70 {
71 .gpio = 23, /* BLSP6 QUP SPI_CLK */
72 .settings = {
73 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
74 },
75 },
76
Jin Hong690e3352012-05-02 09:25:05 -070077};
78
Oluwafemi Adeyemi4926a9e2012-09-14 17:39:59 -070079static struct gpiomux_setting sdc3_clk_active_cfg = {
80 .func = GPIOMUX_FUNC_1,
81 .drv = GPIOMUX_DRV_8MA,
82 .pull = GPIOMUX_PULL_NONE,
83};
84
85static struct gpiomux_setting sdc3_cmd_active_cfg = {
86 .func = GPIOMUX_FUNC_1,
87 .drv = GPIOMUX_DRV_8MA,
88 .pull = GPIOMUX_PULL_UP,
89};
90
91static struct gpiomux_setting sdc3_data_0_3_active_cfg = {
92 .func = GPIOMUX_FUNC_6,
93 .drv = GPIOMUX_DRV_8MA,
94 .pull = GPIOMUX_PULL_UP,
95};
96
97static struct gpiomux_setting sdc3_suspended_cfg = {
98 .func = GPIOMUX_FUNC_GPIO,
99 .drv = GPIOMUX_DRV_2MA,
100 .pull = GPIOMUX_PULL_DOWN,
101};
102
103static struct gpiomux_setting sdc3_data_1_suspended_cfg = {
104 .func = GPIOMUX_FUNC_GPIO,
105 .drv = GPIOMUX_DRV_2MA,
106 .pull = GPIOMUX_PULL_UP,
107};
108
109static struct msm_gpiomux_config sdc3_configs[] __initdata = {
110 {
111 .gpio = 25,
112 .settings = {
113 [GPIOMUX_ACTIVE] = &sdc3_clk_active_cfg,
114 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
115 },
116 },
117 {
118 .gpio = 24,
119 .settings = {
120 [GPIOMUX_ACTIVE] = &sdc3_cmd_active_cfg,
121 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
122 },
123
124 },
125 {
126 .gpio = 16,
127 .settings = {
128 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
129 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
130 },
131 },
132 {
133 .gpio = 17,
134 .settings = {
135 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
136 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspended_cfg,
137 },
138 },
139 {
140 .gpio = 18,
141 .settings = {
142 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
143 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
144 },
145 },
146 {
147 .gpio = 19,
148 .settings = {
149 [GPIOMUX_ACTIVE] = &sdc3_data_0_3_active_cfg,
150 [GPIOMUX_SUSPENDED] = &sdc3_suspended_cfg,
151 },
152 },
153};
154
Jin Hong690e3352012-05-02 09:25:05 -0700155void __init msm9625_init_gpiomux(void)
156{
157 int rc;
158
159 rc = msm_gpiomux_init(NR_GPIO_IRQS);
160 if (rc) {
161 pr_err(KERN_ERR "msm9625_init_gpiomux failed %d\n", rc);
162 return;
163 }
164
165 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Oluwafemi Adeyemi4926a9e2012-09-14 17:39:59 -0700166 msm_gpiomux_install(sdc3_configs, ARRAY_SIZE(sdc3_configs));
Jin Hong690e3352012-05-02 09:25:05 -0700167}