Bingzhe Cai | 43bed2b | 2014-01-02 14:07:31 +0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 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 | |
Yue Ma | 10d8875 | 2014-02-20 17:12:05 -0800 | [diff] [blame] | 14 | #include <linux/gpio.h> |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 15 | #include <linux/init.h> |
| 16 | #include <linux/ioport.h> |
| 17 | #include <mach/board.h> |
| 18 | #include <mach/gpio.h> |
| 19 | #include <mach/gpiomux.h> |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 20 | #include <mach/socinfo.h> |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 21 | |
Yue Ma | 10d8875 | 2014-02-20 17:12:05 -0800 | [diff] [blame] | 22 | #define WLAN_CLK 27 |
| 23 | #define WLAN_SET 26 |
| 24 | #define WLAN_DATA0 25 |
| 25 | #define WLAN_DATA1 24 |
| 26 | #define WLAN_DATA2 23 |
| 27 | |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 28 | static struct gpiomux_setting gpio_spi_config = { |
| 29 | .func = GPIOMUX_FUNC_1, |
| 30 | .drv = GPIOMUX_DRV_6MA, |
| 31 | .pull = GPIOMUX_PULL_NONE, |
| 32 | }; |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 33 | static struct gpiomux_setting gpio_spi_susp_config = { |
| 34 | .func = GPIOMUX_FUNC_GPIO, |
| 35 | .drv = GPIOMUX_DRV_2MA, |
| 36 | .pull = GPIOMUX_PULL_DOWN, |
| 37 | }; |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 38 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 39 | static struct gpiomux_setting gpio_i2c_config = { |
| 40 | .func = GPIOMUX_FUNC_3, |
| 41 | .drv = GPIOMUX_DRV_2MA, |
| 42 | .pull = GPIOMUX_PULL_NONE, |
| 43 | }; |
| 44 | |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 45 | static struct gpiomux_setting gpio_cam_i2c_config = { |
| 46 | .func = GPIOMUX_FUNC_1, |
| 47 | .drv = GPIOMUX_DRV_2MA, |
| 48 | .pull = GPIOMUX_PULL_NONE, |
| 49 | }; |
| 50 | |
Bansidhar Gopalachari | e331f37 | 2013-09-25 19:50:43 +0100 | [diff] [blame] | 51 | static struct gpiomux_setting gpio_nfc_config = { |
| 52 | .func = GPIOMUX_FUNC_2, |
| 53 | .drv = GPIOMUX_DRV_2MA, |
| 54 | .pull = GPIOMUX_PULL_NONE, |
| 55 | }; |
| 56 | static struct gpiomux_setting gpio_nfc_sus_config = { |
| 57 | .func = GPIOMUX_FUNC_2, |
| 58 | .drv = GPIOMUX_DRV_2MA, |
| 59 | .pull = GPIOMUX_PULL_DOWN, |
| 60 | }; |
| 61 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 62 | static struct gpiomux_setting atmel_int_act_cfg = { |
| 63 | .func = GPIOMUX_FUNC_GPIO, |
| 64 | .drv = GPIOMUX_DRV_8MA, |
| 65 | .pull = GPIOMUX_PULL_UP, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 66 | }; |
| 67 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 68 | static struct gpiomux_setting atmel_int_sus_cfg = { |
| 69 | .func = GPIOMUX_FUNC_GPIO, |
| 70 | .drv = GPIOMUX_DRV_2MA, |
| 71 | .pull = GPIOMUX_PULL_DOWN, |
| 72 | }; |
| 73 | |
| 74 | static struct gpiomux_setting atmel_reset_act_cfg = { |
| 75 | .func = GPIOMUX_FUNC_GPIO, |
| 76 | .drv = GPIOMUX_DRV_6MA, |
| 77 | .pull = GPIOMUX_PULL_UP, |
| 78 | }; |
| 79 | |
| 80 | static struct gpiomux_setting atmel_reset_sus_cfg = { |
| 81 | .func = GPIOMUX_FUNC_GPIO, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 82 | .drv = GPIOMUX_DRV_6MA, |
| 83 | .pull = GPIOMUX_PULL_DOWN, |
| 84 | }; |
| 85 | |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 86 | static struct gpiomux_setting focaltech_int_act_cfg = { |
| 87 | .func = GPIOMUX_FUNC_GPIO, |
| 88 | .drv = GPIOMUX_DRV_8MA, |
| 89 | .pull = GPIOMUX_PULL_UP, |
| 90 | }; |
| 91 | |
| 92 | static struct gpiomux_setting focaltech_int_sus_cfg = { |
| 93 | .func = GPIOMUX_FUNC_GPIO, |
| 94 | .drv = GPIOMUX_DRV_2MA, |
| 95 | .pull = GPIOMUX_PULL_DOWN, |
| 96 | }; |
| 97 | |
| 98 | static struct gpiomux_setting focaltech_reset_act_cfg = { |
| 99 | .func = GPIOMUX_FUNC_GPIO, |
| 100 | .drv = GPIOMUX_DRV_6MA, |
| 101 | .pull = GPIOMUX_PULL_UP, |
| 102 | }; |
| 103 | |
| 104 | static struct gpiomux_setting focaltech_reset_sus_cfg = { |
| 105 | .func = GPIOMUX_FUNC_GPIO, |
| 106 | .drv = GPIOMUX_DRV_6MA, |
| 107 | .pull = GPIOMUX_PULL_UP, |
| 108 | }; |
| 109 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 110 | static struct gpiomux_setting wcnss_5wire_suspend_cfg = { |
| 111 | .func = GPIOMUX_FUNC_GPIO, |
| 112 | .drv = GPIOMUX_DRV_2MA, |
| 113 | .pull = GPIOMUX_PULL_UP, |
| 114 | }; |
| 115 | |
| 116 | static struct gpiomux_setting wcnss_5wire_active_cfg = { |
| 117 | .func = GPIOMUX_FUNC_1, |
| 118 | .drv = GPIOMUX_DRV_6MA, |
| 119 | .pull = GPIOMUX_PULL_DOWN, |
| 120 | }; |
| 121 | |
Yue Ma | 10d8875 | 2014-02-20 17:12:05 -0800 | [diff] [blame] | 122 | static struct gpiomux_setting wcnss_5gpio_suspend_cfg = { |
| 123 | .func = GPIOMUX_FUNC_GPIO, |
| 124 | .drv = GPIOMUX_DRV_2MA, |
| 125 | .pull = GPIOMUX_PULL_UP, |
| 126 | }; |
| 127 | |
| 128 | static struct gpiomux_setting wcnss_5gpio_active_cfg = { |
| 129 | .func = GPIOMUX_FUNC_GPIO, |
| 130 | .drv = GPIOMUX_DRV_6MA, |
| 131 | .pull = GPIOMUX_PULL_DOWN, |
| 132 | }; |
| 133 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 134 | static struct gpiomux_setting lcd_en_act_cfg = { |
| 135 | .func = GPIOMUX_FUNC_GPIO, |
| 136 | .drv = GPIOMUX_DRV_8MA, |
| 137 | .pull = GPIOMUX_PULL_NONE, |
| 138 | .dir = GPIOMUX_OUT_HIGH, |
| 139 | }; |
| 140 | |
| 141 | static struct gpiomux_setting lcd_en_sus_cfg = { |
| 142 | .func = GPIOMUX_FUNC_GPIO, |
| 143 | .drv = GPIOMUX_DRV_2MA, |
| 144 | .pull = GPIOMUX_PULL_DOWN, |
| 145 | }; |
| 146 | |
Xiaoming Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame] | 147 | static struct gpiomux_setting lcd_te_act_config = { |
| 148 | .func = GPIOMUX_FUNC_1, |
| 149 | .drv = GPIOMUX_DRV_2MA, |
| 150 | .pull = GPIOMUX_PULL_DOWN, |
| 151 | .dir = GPIOMUX_IN, |
| 152 | }; |
| 153 | |
| 154 | static struct gpiomux_setting lcd_te_sus_config = { |
| 155 | .func = GPIOMUX_FUNC_1, |
| 156 | .drv = GPIOMUX_DRV_2MA, |
| 157 | .pull = GPIOMUX_PULL_DOWN, |
| 158 | .dir = GPIOMUX_IN, |
| 159 | }; |
| 160 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 161 | static struct gpiomux_setting gpio_keys_active = { |
| 162 | .func = GPIOMUX_FUNC_GPIO, |
| 163 | .drv = GPIOMUX_DRV_2MA, |
| 164 | .pull = GPIOMUX_PULL_UP, |
| 165 | }; |
| 166 | |
| 167 | static struct gpiomux_setting gpio_keys_suspend = { |
| 168 | .func = GPIOMUX_FUNC_GPIO, |
| 169 | .drv = GPIOMUX_DRV_2MA, |
| 170 | .pull = GPIOMUX_PULL_NONE, |
| 171 | }; |
| 172 | |
Richard Liu | a1d406a | 2013-04-14 13:46:48 -0700 | [diff] [blame] | 173 | /* define gpio used as interrupt input */ |
| 174 | static struct gpiomux_setting gpio_int_act_cfg = { |
| 175 | .func = GPIOMUX_FUNC_GPIO, |
| 176 | .drv = GPIOMUX_DRV_2MA, |
| 177 | .pull = GPIOMUX_PULL_UP, |
| 178 | .dir = GPIOMUX_IN, |
| 179 | }; |
| 180 | |
| 181 | static struct gpiomux_setting gpio_int_sus_cfg = { |
| 182 | .func = GPIOMUX_FUNC_GPIO, |
| 183 | .drv = GPIOMUX_DRV_2MA, |
| 184 | .pull = GPIOMUX_PULL_UP, |
| 185 | .dir = GPIOMUX_IN, |
| 186 | }; |
| 187 | |
| 188 | static struct msm_gpiomux_config msm_gpio_int_configs[] __initdata = { |
| 189 | { |
| 190 | .gpio = 84, |
| 191 | .settings = { |
| 192 | [GPIOMUX_ACTIVE] = &gpio_int_act_cfg, |
| 193 | [GPIOMUX_SUSPENDED] = &gpio_int_sus_cfg, |
| 194 | }, |
| 195 | }, |
| 196 | }; |
| 197 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 198 | static struct msm_gpiomux_config msm_lcd_configs[] __initdata = { |
| 199 | { |
| 200 | .gpio = 41, |
| 201 | .settings = { |
| 202 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 203 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 204 | }, |
| 205 | }, |
| 206 | { |
| 207 | .gpio = 7, |
| 208 | .settings = { |
| 209 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 210 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 211 | }, |
| 212 | }, |
Xiaoming Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame] | 213 | { |
| 214 | .gpio = 12, |
| 215 | .settings = { |
| 216 | [GPIOMUX_ACTIVE] = &lcd_te_act_config, |
| 217 | [GPIOMUX_SUSPENDED] = &lcd_te_sus_config, |
| 218 | }, |
| 219 | }, |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 220 | }; |
| 221 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 222 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 223 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 224 | .gpio = 2, /* BLSP1 QUP1 I2C_SDA */ |
| 225 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 226 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 227 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 228 | }, |
| 229 | }, |
| 230 | { |
| 231 | .gpio = 3, /* BLSP1 QUP1 I2C_SCL */ |
| 232 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 233 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 234 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 235 | }, |
| 236 | }, |
| 237 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 238 | .gpio = 10, /* BLSP1 QUP3 I2C_SDA */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 239 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 240 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 241 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 242 | }, |
| 243 | }, |
| 244 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 245 | .gpio = 11, /* BLSP1 QUP3 I2C_SCL */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 246 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 247 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 248 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 249 | }, |
| 250 | }, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 251 | { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 252 | .gpio = 16, /* BLSP1 QUP6 I2C_SDA */ |
| 253 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 254 | [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config, |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 255 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 256 | }, |
| 257 | }, |
| 258 | { |
| 259 | .gpio = 17, /* BLSP1 QUP6 I2C_SCL */ |
| 260 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 261 | [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config, |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 262 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 263 | }, |
| 264 | }, |
Bansidhar Gopalachari | e331f37 | 2013-09-25 19:50:43 +0100 | [diff] [blame] | 265 | { |
| 266 | .gpio = 78, /* NFC CLK */ |
| 267 | .settings = { |
| 268 | [GPIOMUX_ACTIVE] = &gpio_nfc_config, |
| 269 | [GPIOMUX_SUSPENDED] = &gpio_nfc_sus_config, |
| 270 | }, |
| 271 | }, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 272 | }; |
| 273 | |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame] | 274 | static struct gpiomux_setting gpio_i2c_nfc_pvt_config = { |
| 275 | .func = GPIOMUX_FUNC_5, /*active 1*/ /* 0 */ |
| 276 | .drv = GPIOMUX_DRV_2MA, |
| 277 | .pull = GPIOMUX_PULL_NONE, |
| 278 | }; |
| 279 | |
| 280 | static struct msm_gpiomux_config msm_nfc_configs[] __initdata = { |
| 281 | { |
| 282 | .gpio = 8, /* BLSP1 QUP2 I2C_SDA */ |
| 283 | .settings = { |
| 284 | [GPIOMUX_ACTIVE] = &gpio_i2c_nfc_pvt_config, |
| 285 | [GPIOMUX_SUSPENDED] = &gpio_i2c_nfc_pvt_config, |
| 286 | }, |
| 287 | }, |
| 288 | { |
| 289 | .gpio = 9, /* BLSP1 QUP2 I2C_SCL */ |
| 290 | .settings = { |
| 291 | [GPIOMUX_ACTIVE] = &gpio_i2c_nfc_pvt_config, |
| 292 | [GPIOMUX_SUSPENDED] = &gpio_i2c_nfc_pvt_config, |
| 293 | }, |
| 294 | }, |
| 295 | }; |
| 296 | |
Houston Hoffman | 1cd68b2 | 2013-11-26 17:27:38 -0800 | [diff] [blame] | 297 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 298 | static struct msm_gpiomux_config msm_atmel_configs[] __initdata = { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 299 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 300 | .gpio = 0, /* TOUCH RESET */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 301 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 302 | [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg, |
| 303 | [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 304 | }, |
| 305 | }, |
| 306 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 307 | .gpio = 1, /* TOUCH INT */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 308 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 309 | [GPIOMUX_ACTIVE] = &atmel_int_act_cfg, |
| 310 | [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 311 | }, |
| 312 | }, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 313 | { |
| 314 | .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */ |
| 315 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 316 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 317 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 318 | }, |
| 319 | }, |
| 320 | { |
| 321 | .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */ |
| 322 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 323 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 324 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 325 | }, |
| 326 | }, |
| 327 | { |
| 328 | .gpio = 89, /* BLSP1 QUP4 SPI_CLK */ |
| 329 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 330 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 331 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 332 | }, |
| 333 | }, |
| 334 | { |
| 335 | .gpio = 88, /* BLSP1 QUP4 SPI_CS */ |
| 336 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 337 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 338 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 339 | }, |
| 340 | }, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 341 | }; |
| 342 | |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 343 | static struct msm_gpiomux_config msm_focaltech_configs[] __initdata = { |
| 344 | { |
| 345 | .gpio = 0, /* TOUCH RESET */ |
| 346 | .settings = { |
| 347 | [GPIOMUX_ACTIVE] = &focaltech_reset_act_cfg, |
| 348 | [GPIOMUX_SUSPENDED] = &focaltech_reset_sus_cfg, |
| 349 | }, |
| 350 | }, |
| 351 | { |
| 352 | .gpio = 1, /* TOUCH INT */ |
| 353 | .settings = { |
| 354 | [GPIOMUX_ACTIVE] = &focaltech_int_act_cfg, |
| 355 | [GPIOMUX_SUSPENDED] = &focaltech_int_sus_cfg, |
| 356 | }, |
| 357 | }, |
| 358 | { |
| 359 | .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */ |
| 360 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 361 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 362 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 363 | }, |
| 364 | }, |
| 365 | { |
| 366 | .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */ |
| 367 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 368 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 369 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 370 | }, |
| 371 | }, |
| 372 | { |
| 373 | .gpio = 89, /* BLSP1 QUP4 SPI_CLK */ |
| 374 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 375 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 376 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 377 | }, |
| 378 | }, |
| 379 | { |
| 380 | .gpio = 88, /* BLSP1 QUP4 SPI_CS */ |
| 381 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 382 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 383 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 384 | }, |
| 385 | }, |
| 386 | }; |
| 387 | |
| 388 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 389 | static struct msm_gpiomux_config wcnss_5wire_interface[] = { |
| 390 | { |
| 391 | .gpio = 23, |
| 392 | .settings = { |
| 393 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 394 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 395 | }, |
| 396 | }, |
| 397 | { |
| 398 | .gpio = 24, |
| 399 | .settings = { |
| 400 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 401 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 402 | }, |
| 403 | }, |
| 404 | { |
| 405 | .gpio = 25, |
| 406 | .settings = { |
| 407 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 408 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 409 | }, |
| 410 | }, |
| 411 | { |
| 412 | .gpio = 26, |
| 413 | .settings = { |
| 414 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 415 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 416 | }, |
| 417 | }, |
| 418 | { |
| 419 | .gpio = 27, |
| 420 | .settings = { |
| 421 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 422 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 423 | }, |
| 424 | }, |
| 425 | }; |
| 426 | |
Yue Ma | 10d8875 | 2014-02-20 17:12:05 -0800 | [diff] [blame] | 427 | static struct msm_gpiomux_config wcnss_5gpio_interface[] = { |
| 428 | { |
| 429 | .gpio = 23, |
| 430 | .settings = { |
| 431 | [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg, |
| 432 | [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg, |
| 433 | }, |
| 434 | }, |
| 435 | { |
| 436 | .gpio = 24, |
| 437 | .settings = { |
| 438 | [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg, |
| 439 | [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg, |
| 440 | }, |
| 441 | }, |
| 442 | { |
| 443 | .gpio = 25, |
| 444 | .settings = { |
| 445 | [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg, |
| 446 | [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg, |
| 447 | }, |
| 448 | }, |
| 449 | { |
| 450 | .gpio = 26, |
| 451 | .settings = { |
| 452 | [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg, |
| 453 | [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg, |
| 454 | }, |
| 455 | }, |
| 456 | { |
| 457 | .gpio = 27, |
| 458 | .settings = { |
| 459 | [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg, |
| 460 | [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg, |
| 461 | }, |
| 462 | }, |
| 463 | }; |
| 464 | |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 465 | static struct gpiomux_setting gpio_suspend_config[] = { |
| 466 | { |
| 467 | .func = GPIOMUX_FUNC_GPIO, /* IN-NP */ |
| 468 | .drv = GPIOMUX_DRV_2MA, |
| 469 | .pull = GPIOMUX_PULL_NONE, |
| 470 | }, |
| 471 | { |
| 472 | .func = GPIOMUX_FUNC_GPIO, /* O-LOW */ |
| 473 | .drv = GPIOMUX_DRV_2MA, |
| 474 | .pull = GPIOMUX_PULL_NONE, |
| 475 | .dir = GPIOMUX_OUT_LOW, |
| 476 | }, |
| 477 | }; |
| 478 | |
| 479 | static struct gpiomux_setting cam_settings[] = { |
| 480 | { |
| 481 | .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */ |
| 482 | .drv = GPIOMUX_DRV_2MA, |
| 483 | .pull = GPIOMUX_PULL_NONE, |
| 484 | }, |
| 485 | |
| 486 | { |
| 487 | .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */ |
| 488 | .drv = GPIOMUX_DRV_2MA, |
| 489 | .pull = GPIOMUX_PULL_DOWN, |
| 490 | }, |
| 491 | |
| 492 | { |
| 493 | .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */ |
| 494 | .drv = GPIOMUX_DRV_2MA, |
| 495 | .pull = GPIOMUX_PULL_KEEPER, |
| 496 | }, |
| 497 | |
| 498 | { |
| 499 | .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */ |
| 500 | .drv = GPIOMUX_DRV_2MA, |
| 501 | .pull = GPIOMUX_PULL_NONE, |
| 502 | }, |
| 503 | |
| 504 | { |
| 505 | .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */ |
| 506 | .drv = GPIOMUX_DRV_2MA, |
| 507 | .pull = GPIOMUX_PULL_DOWN, |
| 508 | }, |
| 509 | }; |
| 510 | |
Bingzhe Cai | 43bed2b | 2014-01-02 14:07:31 +0800 | [diff] [blame] | 511 | static struct gpiomux_setting accel_interrupt_config = { |
| 512 | .func = GPIOMUX_FUNC_GPIO, |
| 513 | .drv = GPIOMUX_DRV_6MA, |
| 514 | .pull = GPIOMUX_PULL_DOWN, |
| 515 | }; |
| 516 | |
Houston Hoffman | 1cd68b2 | 2013-11-26 17:27:38 -0800 | [diff] [blame] | 517 | static struct msm_gpiomux_config msm_non_qrd_configs[] __initdata = { |
| 518 | { |
| 519 | .gpio = 8, /* CAM1_STANDBY_N */ |
| 520 | .settings = { |
| 521 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 522 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 523 | }, |
| 524 | }, |
Bingzhe Cai | 43bed2b | 2014-01-02 14:07:31 +0800 | [diff] [blame] | 525 | { |
| 526 | .gpio = 81, /*ACCEL_INT1 */ |
| 527 | .settings = { |
| 528 | [GPIOMUX_ACTIVE] = &accel_interrupt_config, |
| 529 | [GPIOMUX_SUSPENDED] = &accel_interrupt_config, |
| 530 | }, |
| 531 | }, |
Houston Hoffman | 1cd68b2 | 2013-11-26 17:27:38 -0800 | [diff] [blame] | 532 | }; |
| 533 | |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 534 | static struct msm_gpiomux_config msm_sensor_configs[] __initdata = { |
| 535 | { |
| 536 | .gpio = 13, /* CAM_MCLK0 */ |
| 537 | .settings = { |
| 538 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 539 | [GPIOMUX_SUSPENDED] = &cam_settings[1], |
| 540 | }, |
| 541 | }, |
| 542 | { |
| 543 | .gpio = 14, /* CAM_MCLK1 */ |
| 544 | .settings = { |
| 545 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 546 | [GPIOMUX_SUSPENDED] = &cam_settings[1], |
| 547 | }, |
| 548 | }, |
| 549 | { |
| 550 | .gpio = 16, /* CCI_I2C_SDA */ |
| 551 | .settings = { |
| 552 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 553 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0], |
| 554 | }, |
| 555 | }, |
| 556 | { |
| 557 | .gpio = 17, /* CCI_I2C_SCL */ |
| 558 | .settings = { |
| 559 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 560 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0], |
| 561 | }, |
| 562 | }, |
| 563 | { |
| 564 | .gpio = 18, /* FLASH_LED_EN */ |
| 565 | .settings = { |
Lokesh Kumar Aakulu | 034626d | 2013-05-10 20:30:07 -0700 | [diff] [blame] | 566 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 567 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 568 | }, |
| 569 | }, |
| 570 | { |
| 571 | .gpio = 19, /* FLASH_LED_NOW */ |
| 572 | .settings = { |
Lokesh Kumar Aakulu | 034626d | 2013-05-10 20:30:07 -0700 | [diff] [blame] | 573 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 574 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 575 | }, |
| 576 | }, |
| 577 | { |
| 578 | .gpio = 8, /* CAM1_STANDBY_N */ |
| 579 | .settings = { |
| 580 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 581 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 582 | }, |
| 583 | }, |
| 584 | { |
| 585 | .gpio = 15, /* CAM1_RST_N */ |
| 586 | .settings = { |
| 587 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 588 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 589 | }, |
| 590 | }, |
| 591 | { |
| 592 | .gpio = 20, /* WEBCAM1_STANDBY */ |
| 593 | .settings = { |
| 594 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 595 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 596 | }, |
| 597 | }, |
| 598 | { |
| 599 | .gpio = 21, /* WEBCAM2_RESET_N */ |
| 600 | .settings = { |
| 601 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 602 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 603 | }, |
| 604 | }, |
| 605 | }; |
| 606 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 607 | static struct msm_gpiomux_config msm_keypad_configs[] __initdata = { |
| 608 | { |
| 609 | .gpio = 72, |
| 610 | .settings = { |
| 611 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 612 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 613 | }, |
| 614 | }, |
| 615 | { |
| 616 | .gpio = 73, |
| 617 | .settings = { |
| 618 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 619 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 620 | }, |
| 621 | }, |
| 622 | { |
| 623 | .gpio = 74, |
| 624 | .settings = { |
| 625 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 626 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 627 | }, |
| 628 | }, |
| 629 | }; |
| 630 | |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 631 | static struct gpiomux_setting sd_card_det_active_config = { |
| 632 | .func = GPIOMUX_FUNC_GPIO, |
| 633 | .drv = GPIOMUX_DRV_2MA, |
| 634 | .pull = GPIOMUX_PULL_NONE, |
| 635 | .dir = GPIOMUX_IN, |
| 636 | }; |
| 637 | |
| 638 | static struct gpiomux_setting sd_card_det_suspend_config = { |
| 639 | .func = GPIOMUX_FUNC_GPIO, |
| 640 | .drv = GPIOMUX_DRV_2MA, |
| 641 | .pull = GPIOMUX_PULL_UP, |
| 642 | .dir = GPIOMUX_IN, |
| 643 | }; |
| 644 | |
| 645 | static struct msm_gpiomux_config sd_card_det[] __initdata = { |
| 646 | { |
| 647 | .gpio = 42, |
| 648 | .settings = { |
| 649 | [GPIOMUX_ACTIVE] = &sd_card_det_active_config, |
| 650 | [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config, |
| 651 | }, |
| 652 | }, |
| 653 | }; |
| 654 | |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 655 | static struct gpiomux_setting interrupt_gpio_active = { |
| 656 | .func = GPIOMUX_FUNC_GPIO, |
| 657 | .drv = GPIOMUX_DRV_6MA, |
| 658 | .pull = GPIOMUX_PULL_UP, |
| 659 | }; |
| 660 | |
| 661 | static struct gpiomux_setting interrupt_gpio_suspend_pullup = { |
| 662 | .func = GPIOMUX_FUNC_GPIO, |
| 663 | .drv = GPIOMUX_DRV_6MA, |
| 664 | .pull = GPIOMUX_PULL_UP, |
| 665 | }; |
| 666 | |
| 667 | static struct gpiomux_setting interrupt_gpio_suspend_pulldown = { |
| 668 | .func = GPIOMUX_FUNC_GPIO, |
| 669 | .drv = GPIOMUX_DRV_6MA, |
| 670 | .pull = GPIOMUX_PULL_UP, |
| 671 | }; |
| 672 | |
| 673 | static struct msm_gpiomux_config msm_interrupt_configs[] __initdata = { |
| 674 | { |
Houston Hoffman | 17f2dc5 | 2014-01-29 08:15:06 -0800 | [diff] [blame] | 675 | .gpio = 75, /* NFC_CLK_REQ_IRQ*/ |
| 676 | .settings = { |
| 677 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 678 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup, |
| 679 | }, |
| 680 | }, |
| 681 | { |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 682 | .gpio = 77, /* NFC_IRQ */ |
| 683 | .settings = { |
| 684 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 685 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup, |
| 686 | }, |
| 687 | }, |
| 688 | { |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 689 | .gpio = 80, /*ALSP_INT */ |
| 690 | .settings = { |
| 691 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 692 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup, |
| 693 | }, |
| 694 | }, |
| 695 | { |
| 696 | .gpio = 81, /*ACCEL_INT1 */ |
| 697 | .settings = { |
| 698 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 699 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown, |
| 700 | }, |
| 701 | }, |
| 702 | { |
| 703 | .gpio = 82, /*ACCEL_INT2 */ |
| 704 | .settings = { |
| 705 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 706 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown, |
| 707 | }, |
| 708 | }, |
| 709 | }; |
| 710 | |
Kuirong Wang | 3ef74f0 | 2013-08-02 14:46:45 -0700 | [diff] [blame] | 711 | static struct gpiomux_setting gpio_cdc_dmic_cfg = { |
| 712 | .func = GPIOMUX_FUNC_1, |
| 713 | .drv = GPIOMUX_DRV_4MA, |
| 714 | .pull = GPIOMUX_PULL_NONE, |
| 715 | }; |
| 716 | |
| 717 | |
| 718 | static struct msm_gpiomux_config msm_cdc_dmic_configs[] __initdata = { |
| 719 | { |
| 720 | .gpio = 100, /* DMIC CLK */ |
| 721 | .settings = { |
| 722 | [GPIOMUX_SUSPENDED] = &gpio_cdc_dmic_cfg, |
| 723 | }, |
| 724 | }, |
| 725 | { |
| 726 | .gpio = 101, /* DMIC DATA */ |
| 727 | .settings = { |
| 728 | [GPIOMUX_SUSPENDED] = &gpio_cdc_dmic_cfg, |
| 729 | }, |
| 730 | }, |
| 731 | }; |
| 732 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 733 | void __init msm8610_init_gpiomux(void) |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 734 | { |
| 735 | int rc; |
| 736 | |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 737 | rc = msm_gpiomux_init_dt(); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 738 | if (rc) { |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 739 | pr_err("%s failed %d\n", __func__, rc); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 740 | return; |
| 741 | } |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 742 | |
| 743 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 744 | if (of_board_is_qrd()) { |
| 745 | msm_gpiomux_install(msm_focaltech_configs, |
| 746 | ARRAY_SIZE(msm_focaltech_configs)); |
| 747 | } else { |
| 748 | msm_gpiomux_install(msm_atmel_configs, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 749 | ARRAY_SIZE(msm_atmel_configs)); |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 750 | } |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 751 | msm_gpiomux_install(wcnss_5wire_interface, |
| 752 | ARRAY_SIZE(wcnss_5wire_interface)); |
Xiaoming Zhou | a329c94 | 2013-07-10 10:32:20 -0400 | [diff] [blame] | 753 | msm_gpiomux_install_nowrite(msm_lcd_configs, |
| 754 | ARRAY_SIZE(msm_lcd_configs)); |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 755 | msm_gpiomux_install(msm_keypad_configs, |
| 756 | ARRAY_SIZE(msm_keypad_configs)); |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 757 | msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det)); |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 758 | msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs)); |
Richard Liu | a1d406a | 2013-04-14 13:46:48 -0700 | [diff] [blame] | 759 | msm_gpiomux_install(msm_gpio_int_configs, |
| 760 | ARRAY_SIZE(msm_gpio_int_configs)); |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame] | 761 | if (of_board_is_qrd()) { |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 762 | msm_gpiomux_install(msm_interrupt_configs, |
| 763 | ARRAY_SIZE(msm_interrupt_configs)); |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame] | 764 | msm_gpiomux_install(msm_nfc_configs, |
| 765 | ARRAY_SIZE(msm_nfc_configs)); |
Houston Hoffman | 1cd68b2 | 2013-11-26 17:27:38 -0800 | [diff] [blame] | 766 | } else { |
| 767 | msm_gpiomux_install(msm_non_qrd_configs, |
| 768 | ARRAY_SIZE(msm_non_qrd_configs)); |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame] | 769 | } |
Kuirong Wang | 3ef74f0 | 2013-08-02 14:46:45 -0700 | [diff] [blame] | 770 | if (of_board_is_cdp()) |
| 771 | msm_gpiomux_install(msm_cdc_dmic_configs, |
| 772 | ARRAY_SIZE(msm_cdc_dmic_configs)); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 773 | } |
Yue Ma | 10d8875 | 2014-02-20 17:12:05 -0800 | [diff] [blame] | 774 | |
| 775 | static void wcnss_switch_to_gpio(void) |
| 776 | { |
| 777 | /* Switch MUX to GPIO */ |
| 778 | msm_gpiomux_install(wcnss_5gpio_interface, |
| 779 | ARRAY_SIZE(wcnss_5gpio_interface)); |
| 780 | |
| 781 | /* Ensure GPIO config */ |
| 782 | gpio_direction_input(WLAN_DATA2); |
| 783 | gpio_direction_input(WLAN_DATA1); |
| 784 | gpio_direction_input(WLAN_DATA0); |
| 785 | gpio_direction_output(WLAN_SET, 0); |
| 786 | gpio_direction_output(WLAN_CLK, 0); |
| 787 | } |
| 788 | |
| 789 | static void wcnss_switch_to_5wire(void) |
| 790 | { |
| 791 | msm_gpiomux_install(wcnss_5wire_interface, |
| 792 | ARRAY_SIZE(wcnss_5wire_interface)); |
| 793 | } |
| 794 | |
| 795 | u32 wcnss_rf_read_reg(u32 rf_reg_addr) |
| 796 | { |
| 797 | int count = 0; |
| 798 | u32 rf_cmd_and_addr = 0; |
| 799 | u32 rf_data_received = 0; |
| 800 | u32 rf_bit = 0; |
| 801 | |
| 802 | wcnss_switch_to_gpio(); |
| 803 | |
| 804 | /* Reset the signal if it is already being used. */ |
| 805 | gpio_set_value(WLAN_SET, 0); |
| 806 | gpio_set_value(WLAN_CLK, 0); |
| 807 | |
| 808 | /* We start with cmd_set high WLAN_SET = 1. */ |
| 809 | gpio_set_value(WLAN_SET, 1); |
| 810 | |
| 811 | gpio_direction_output(WLAN_DATA0, 1); |
| 812 | gpio_direction_output(WLAN_DATA1, 1); |
| 813 | gpio_direction_output(WLAN_DATA2, 1); |
| 814 | |
| 815 | gpio_set_value(WLAN_DATA0, 0); |
| 816 | gpio_set_value(WLAN_DATA1, 0); |
| 817 | gpio_set_value(WLAN_DATA2, 0); |
| 818 | |
| 819 | /* Prepare command and RF register address that need to sent out. |
| 820 | * Make sure that we send only 14 bits from LSB. |
| 821 | */ |
| 822 | rf_cmd_and_addr = (((WLAN_RF_READ_REG_CMD) | |
| 823 | (rf_reg_addr << WLAN_RF_REG_ADDR_START_OFFSET)) & |
| 824 | WLAN_RF_READ_CMD_MASK); |
| 825 | |
| 826 | for (count = 0; count < 5; count++) { |
| 827 | gpio_set_value(WLAN_CLK, 0); |
| 828 | |
| 829 | rf_bit = (rf_cmd_and_addr & 0x1); |
| 830 | gpio_set_value(WLAN_DATA0, rf_bit ? 1 : 0); |
| 831 | rf_cmd_and_addr = (rf_cmd_and_addr >> 1); |
| 832 | |
| 833 | rf_bit = (rf_cmd_and_addr & 0x1); |
| 834 | gpio_set_value(WLAN_DATA1, rf_bit ? 1 : 0); |
| 835 | rf_cmd_and_addr = (rf_cmd_and_addr >> 1); |
| 836 | |
| 837 | rf_bit = (rf_cmd_and_addr & 0x1); |
| 838 | gpio_set_value(WLAN_DATA2, rf_bit ? 1 : 0); |
| 839 | rf_cmd_and_addr = (rf_cmd_and_addr >> 1); |
| 840 | |
| 841 | /* Send the data out WLAN_CLK = 1 */ |
| 842 | gpio_set_value(WLAN_CLK, 1); |
| 843 | } |
| 844 | |
| 845 | /* Pull down the clock signal */ |
| 846 | gpio_set_value(WLAN_CLK, 0); |
| 847 | |
| 848 | /* Configure data pins to input IO pins */ |
| 849 | gpio_direction_input(WLAN_DATA0); |
| 850 | gpio_direction_input(WLAN_DATA1); |
| 851 | gpio_direction_input(WLAN_DATA2); |
| 852 | |
| 853 | for (count = 0; count < 2; count++) { |
| 854 | gpio_set_value(WLAN_CLK, 1); |
| 855 | gpio_set_value(WLAN_CLK, 0); |
| 856 | } |
| 857 | |
| 858 | rf_bit = 0; |
| 859 | for (count = 0; count < 6; count++) { |
| 860 | gpio_set_value(WLAN_CLK, 1); |
| 861 | gpio_set_value(WLAN_CLK, 0); |
| 862 | |
| 863 | rf_bit = gpio_get_value(WLAN_DATA0); |
| 864 | rf_data_received |= (rf_bit << (count * 3 + 0)); |
| 865 | |
| 866 | if (count != 5) { |
| 867 | rf_bit = gpio_get_value(WLAN_DATA1); |
| 868 | rf_data_received |= (rf_bit << (count * 3 + 1)); |
| 869 | |
| 870 | rf_bit = gpio_get_value(WLAN_DATA2); |
| 871 | rf_data_received |= (rf_bit << (count * 3 + 2)); |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | gpio_set_value(WLAN_SET, 0); |
| 876 | wcnss_switch_to_5wire(); |
| 877 | |
| 878 | return rf_data_received; |
| 879 | } |