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