Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [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 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 15 | #include <linux/i2c.h> |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 16 | #include <linux/msm_ssbi.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 17 | #include <asm/mach-types.h> |
| 18 | #include <asm/mach/arch.h> |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 19 | #include <asm/mach/mmc.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 20 | #include <mach/board.h> |
| 21 | #include <mach/msm_iomap.h> |
| 22 | #include <mach/gpio.h> |
| 23 | #include <mach/gpiomux.h> |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 24 | #include <mach/msm_spi.h> |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 25 | #include <linux/usb/android.h> |
| 26 | #include <linux/usb/msm_hsusb.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 27 | #include "timer.h" |
| 28 | #include "devices.h" |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 29 | #include "board-9615.h" |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 30 | #include "cpuidle.h" |
| 31 | #include "pm.h" |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 32 | |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 33 | static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = { |
| 34 | .irq_base = PM8018_IRQ_BASE, |
| 35 | .devirq = MSM_GPIO_TO_INT(87), |
| 36 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 37 | }; |
| 38 | |
| 39 | static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = { |
| 40 | .gpio_base = PM8018_GPIO_PM_TO_SYS(1), |
| 41 | }; |
| 42 | |
| 43 | static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = { |
| 44 | .mpp_base = PM8018_MPP_PM_TO_SYS(1), |
| 45 | }; |
| 46 | |
| 47 | static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = { |
| 48 | .rtc_write_enable = false, |
Ashay Jaiswal | db5e6dc | 2011-10-12 11:02:47 +0530 | [diff] [blame] | 49 | .rtc_alarm_powerup = false, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = { |
| 53 | .pull_up = 1, |
| 54 | .kpd_trigger_delay_us = 970, |
| 55 | .wakeup = 1, |
| 56 | }; |
| 57 | |
| 58 | static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = { |
| 59 | .priority = 0, |
| 60 | }; |
| 61 | |
| 62 | static struct pm8018_platform_data pm8018_platform_data __devinitdata = { |
| 63 | .irq_pdata = &pm8xxx_irq_pdata, |
| 64 | .gpio_pdata = &pm8xxx_gpio_pdata, |
| 65 | .mpp_pdata = &pm8xxx_mpp_pdata, |
| 66 | .rtc_pdata = &pm8xxx_rtc_pdata, |
| 67 | .pwrkey_pdata = &pm8xxx_pwrkey_pdata, |
| 68 | .misc_pdata = &pm8xxx_misc_pdata, |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 69 | .regulator_pdatas = msm_pm8018_regulator_pdata, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 70 | }; |
| 71 | |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 72 | static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = { |
| 73 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 74 | .slave = { |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 75 | .name = PM8018_CORE_DEV_NAME, |
| 76 | .platform_data = &pm8018_platform_data, |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 77 | }, |
| 78 | }; |
| 79 | |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 80 | static struct platform_device msm9615_device_rpm_regulator __devinitdata = { |
| 81 | .name = "rpm-regulator", |
| 82 | .id = -1, |
| 83 | .dev = { |
| 84 | .platform_data = &msm_rpm_regulator_9615_pdata, |
| 85 | }, |
| 86 | }; |
| 87 | |
Rohit Vaswani | f688fa6 | 2011-10-13 18:13:10 -0700 | [diff] [blame] | 88 | static struct gpiomux_setting ps_hold = { |
| 89 | .func = GPIOMUX_FUNC_1, |
| 90 | .drv = GPIOMUX_DRV_8MA, |
| 91 | .pull = GPIOMUX_PULL_NONE, |
| 92 | }; |
| 93 | |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 94 | static struct gpiomux_setting gsbi4 = { |
| 95 | .func = GPIOMUX_FUNC_1, |
| 96 | .drv = GPIOMUX_DRV_8MA, |
| 97 | .pull = GPIOMUX_PULL_NONE, |
| 98 | }; |
| 99 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 100 | static struct gpiomux_setting gsbi5 = { |
| 101 | .func = GPIOMUX_FUNC_1, |
| 102 | .drv = GPIOMUX_DRV_8MA, |
| 103 | .pull = GPIOMUX_PULL_NONE, |
| 104 | }; |
| 105 | |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 106 | static struct gpiomux_setting gsbi3 = { |
| 107 | .func = GPIOMUX_FUNC_1, |
| 108 | .drv = GPIOMUX_DRV_8MA, |
| 109 | .pull = GPIOMUX_PULL_NONE, |
| 110 | }; |
| 111 | |
| 112 | static struct gpiomux_setting gsbi3_cs1_config = { |
| 113 | .func = GPIOMUX_FUNC_4, |
| 114 | .drv = GPIOMUX_DRV_8MA, |
| 115 | .pull = GPIOMUX_PULL_NONE, |
| 116 | }; |
| 117 | |
Rohit Vaswani | f688fa6 | 2011-10-13 18:13:10 -0700 | [diff] [blame] | 118 | struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = { |
| 119 | { |
| 120 | .gpio = 83, |
| 121 | .settings = { |
| 122 | [GPIOMUX_SUSPENDED] = &ps_hold, |
| 123 | }, |
| 124 | }, |
| 125 | }; |
| 126 | |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 127 | struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = { |
| 128 | { |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 129 | .gpio = 8, /* GSBI3 QUP SPI_CLK */ |
| 130 | .settings = { |
| 131 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 132 | }, |
| 133 | }, |
| 134 | { |
| 135 | .gpio = 9, /* GSBI3 QUP SPI_CS_N */ |
| 136 | .settings = { |
| 137 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 138 | }, |
| 139 | }, |
| 140 | { |
| 141 | .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */ |
| 142 | .settings = { |
| 143 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 144 | }, |
| 145 | }, |
| 146 | { |
| 147 | .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */ |
| 148 | .settings = { |
| 149 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 150 | }, |
| 151 | }, |
| 152 | { |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 153 | .gpio = 12, /* GSBI4 UART */ |
| 154 | .settings = { |
| 155 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 156 | }, |
| 157 | }, |
| 158 | { |
| 159 | .gpio = 13, /* GSBI4 UART */ |
| 160 | .settings = { |
| 161 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 162 | }, |
| 163 | }, |
| 164 | { |
| 165 | .gpio = 14, /* GSBI4 UART */ |
| 166 | .settings = { |
| 167 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 168 | }, |
| 169 | }, |
| 170 | { |
| 171 | .gpio = 15, /* GSBI4 UART */ |
| 172 | .settings = { |
| 173 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 174 | }, |
| 175 | }, |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 176 | { |
| 177 | .gpio = 16, /* GSBI5 I2C QUP SCL */ |
| 178 | .settings = { |
| 179 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 180 | }, |
| 181 | }, |
| 182 | { |
| 183 | .gpio = 17, /* GSBI5 I2C QUP SDA */ |
| 184 | .settings = { |
| 185 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 186 | }, |
| 187 | }, |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 188 | { |
| 189 | /* GPIO 19 can be used for I2C/UART on GSBI5 */ |
| 190 | .gpio = 19, /* GSBI3 QUP SPI_CS_1 */ |
| 191 | .settings = { |
| 192 | [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config, |
| 193 | }, |
| 194 | }, |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 195 | }; |
| 196 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 197 | #if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\ |
| 198 | || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)) |
| 199 | |
| 200 | #define GPIO_SDCARD_PWR_EN 18 |
| 201 | |
| 202 | /* MDM9x15 have 2 SDCC controllers */ |
| 203 | enum sdcc_controllers { |
| 204 | SDCC1, |
| 205 | SDCC2, |
| 206 | MAX_SDCC_CONTROLLER |
| 207 | }; |
| 208 | |
| 209 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 210 | /* SDC1 pad data */ |
| 211 | static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = { |
| 212 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA}, |
| 213 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA}, |
| 214 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA} |
| 215 | }; |
| 216 | |
| 217 | static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = { |
| 218 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA}, |
| 219 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA}, |
| 220 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA} |
| 221 | }; |
| 222 | |
| 223 | static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = { |
| 224 | {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
| 225 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP}, |
| 226 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP} |
| 227 | }; |
| 228 | |
| 229 | static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = { |
| 230 | {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
| 231 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN}, |
| 232 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN} |
| 233 | }; |
| 234 | |
| 235 | static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = { |
| 236 | [SDCC1] = { |
| 237 | .on = sdc1_pad_pull_on_cfg, |
| 238 | .off = sdc1_pad_pull_off_cfg, |
| 239 | .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg) |
| 240 | }, |
| 241 | }; |
| 242 | |
| 243 | static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = { |
| 244 | [SDCC1] = { |
| 245 | .on = sdc1_pad_drv_on_cfg, |
| 246 | .off = sdc1_pad_drv_off_cfg, |
| 247 | .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg) |
| 248 | }, |
| 249 | }; |
| 250 | |
| 251 | static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = { |
| 252 | [SDCC1] = { |
| 253 | .pull = &mmc_pad_pull_data[SDCC1], |
| 254 | .drv = &mmc_pad_drv_data[SDCC1] |
| 255 | }, |
| 256 | }; |
| 257 | #endif |
| 258 | |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 259 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 260 | static struct gpiomux_setting sdcc2_clk_actv_cfg = { |
| 261 | .func = GPIOMUX_FUNC_1, |
| 262 | .drv = GPIOMUX_DRV_16MA, |
| 263 | .pull = GPIOMUX_PULL_NONE, |
| 264 | }; |
| 265 | |
| 266 | static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = { |
| 267 | .func = GPIOMUX_FUNC_1, |
| 268 | .drv = GPIOMUX_DRV_8MA, |
| 269 | .pull = GPIOMUX_PULL_UP, |
| 270 | }; |
| 271 | |
| 272 | static struct gpiomux_setting sdcc2_suspend_cfg = { |
| 273 | .func = GPIOMUX_FUNC_1, |
| 274 | .drv = GPIOMUX_DRV_2MA, |
| 275 | .pull = GPIOMUX_PULL_DOWN, |
| 276 | }; |
| 277 | |
| 278 | static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = { |
| 279 | { |
| 280 | /* SDC2_DATA_0 */ |
| 281 | .gpio = 25, |
| 282 | .settings = { |
| 283 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| 284 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 285 | }, |
| 286 | }, |
| 287 | { |
| 288 | /* SDC2_DATA_1 */ |
| 289 | .gpio = 26, |
| 290 | .settings = { |
| 291 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| 292 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 293 | }, |
| 294 | }, |
| 295 | { |
| 296 | /* SDC2_DATA_2 */ |
| 297 | .gpio = 27, |
| 298 | .settings = { |
| 299 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| 300 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 301 | }, |
| 302 | }, |
| 303 | { |
| 304 | /* SDC2_DATA_3 */ |
| 305 | .gpio = 28, |
| 306 | .settings = { |
| 307 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| 308 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 309 | }, |
| 310 | }, |
| 311 | { |
| 312 | /* SDC2_CMD GSBI1 */ |
| 313 | .gpio = 29, |
| 314 | .settings = { |
| 315 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| 316 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 317 | }, |
| 318 | }, |
| 319 | { |
| 320 | /* SDC2_CLK GSBI1 */ |
| 321 | .gpio = 30, |
| 322 | .settings = { |
| 323 | [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg, |
| 324 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 325 | }, |
| 326 | }, |
| 327 | }; |
| 328 | |
| 329 | static struct msm_mmc_gpio sdc2_gpio_cfg[] = { |
| 330 | {25, "sdc2_dat_0"}, |
| 331 | {26, "sdc2_dat_1"}, |
| 332 | {27, "sdc2_dat_2"}, |
| 333 | {28, "sdc2_dat_3"}, |
| 334 | {29, "sdc2_cmd"}, |
| 335 | {30, "sdc2_clk"}, |
| 336 | }; |
| 337 | |
| 338 | static struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = { |
| 339 | [SDCC2] = { |
| 340 | .gpio = sdc2_gpio_cfg, |
| 341 | .size = ARRAY_SIZE(sdc2_gpio_cfg), |
| 342 | }, |
| 343 | }; |
| 344 | #else |
| 345 | static struct msm_gpiomux_config msm9615_sdcc2_configs[0]; |
| 346 | #endif |
| 347 | |
| 348 | static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = { |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 349 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 350 | [SDCC1] = { |
| 351 | .is_gpio = 0, |
| 352 | .pad_data = &mmc_pad_data[SDCC1], |
| 353 | }, |
| 354 | #endif |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 355 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 356 | [SDCC2] = { |
| 357 | .is_gpio = 1, |
| 358 | .gpio_data = &mmc_gpio_data[SDCC2], |
| 359 | }, |
| 360 | #endif |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 361 | }; |
| 362 | |
| 363 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 364 | static unsigned int sdc1_sup_clk_rates[] = { |
| 365 | 400000, 24000000, 48000000 |
| 366 | }; |
| 367 | |
| 368 | static struct mmc_platform_data sdc1_data = { |
| 369 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 370 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 371 | .sup_clk_table = sdc1_sup_clk_rates, |
| 372 | .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates), |
| 373 | .sdcc_v4_sup = true, |
| 374 | .pin_data = &mmc_slot_pin_data[SDCC1], |
| 375 | }; |
| 376 | static struct mmc_platform_data *msm9615_sdc1_pdata = &sdc1_data; |
| 377 | #else |
| 378 | static struct mmc_platform_data *msm9615_sdc1_pdata; |
| 379 | #endif |
| 380 | |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 381 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 382 | static unsigned int sdc2_sup_clk_rates[] = { |
| 383 | 400000, 24000000, 48000000 |
| 384 | }; |
| 385 | |
| 386 | static struct mmc_platform_data sdc2_data = { |
| 387 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 388 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 389 | .sup_clk_table = sdc2_sup_clk_rates, |
| 390 | .sup_clk_cnt = ARRAY_SIZE(sdc2_sup_clk_rates), |
| 391 | .sdcc_v4_sup = true, |
| 392 | .pin_data = &mmc_slot_pin_data[SDCC2], |
| 393 | }; |
| 394 | static struct mmc_platform_data *msm9615_sdc2_pdata = &sdc2_data; |
| 395 | #else |
| 396 | static struct mmc_platform_data *msm9615_sdc2_pdata; |
| 397 | #endif |
| 398 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 399 | static void __init msm9615_init_mmc(void) |
| 400 | { |
| 401 | int ret; |
| 402 | |
| 403 | if (msm9615_sdc1_pdata) { |
| 404 | ret = gpio_request(GPIO_SDCARD_PWR_EN, "SDCARD_PWR_EN"); |
| 405 | |
| 406 | if (ret) { |
| 407 | pr_err("%s: sdcc1: Error requesting GPIO " |
| 408 | "SDCARD_PWR_EN:%d\n", __func__, ret); |
| 409 | } else { |
| 410 | ret = gpio_direction_output(GPIO_SDCARD_PWR_EN, 1); |
| 411 | if (ret) { |
| 412 | pr_err("%s: sdcc1: Error setting o/p direction" |
| 413 | " for GPIO SDCARD_PWR_EN:%d\n", |
| 414 | __func__, ret); |
| 415 | gpio_free(GPIO_SDCARD_PWR_EN); |
| 416 | } else { |
| 417 | msm_add_sdcc(1, msm9615_sdc1_pdata); |
| 418 | } |
| 419 | } |
| 420 | } |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 421 | |
| 422 | if (msm9615_sdc2_pdata) { |
| 423 | msm_gpiomux_install(msm9615_sdcc2_configs, |
| 424 | ARRAY_SIZE(msm9615_sdcc2_configs)); |
| 425 | |
| 426 | /* SDC2: External card slot */ |
| 427 | msm_add_sdcc(2, msm9615_sdc2_pdata); |
| 428 | } |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 429 | } |
| 430 | #else |
| 431 | static void __init msm9615_init_mmc(void) { } |
| 432 | #endif |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 433 | static struct msm_cpuidle_state msm_cstates[] __initdata = { |
| 434 | {0, 0, "C0", "WFI", |
| 435 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 436 | |
| 437 | {0, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 438 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 439 | |
| 440 | {0, 2, "C2", "POWER_COLLAPSE", |
| 441 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, |
| 442 | }; |
| 443 | static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 444 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 445 | .idle_supported = 1, |
| 446 | .suspend_supported = 1, |
| 447 | .idle_enabled = 0, |
| 448 | .suspend_enabled = 0, |
| 449 | }, |
| 450 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 451 | .idle_supported = 1, |
| 452 | .suspend_supported = 1, |
| 453 | .idle_enabled = 0, |
| 454 | .suspend_enabled = 0, |
| 455 | }, |
| 456 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 457 | .idle_supported = 1, |
| 458 | .suspend_supported = 1, |
| 459 | .idle_enabled = 1, |
| 460 | .suspend_enabled = 1, |
| 461 | }, |
| 462 | }; |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 463 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 464 | static int __init gpiomux_init(void) |
| 465 | { |
| 466 | int rc; |
| 467 | |
| 468 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 469 | if (rc) { |
| 470 | pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); |
| 471 | return rc; |
| 472 | } |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 473 | msm_gpiomux_install(msm9615_gsbi_configs, |
| 474 | ARRAY_SIZE(msm9615_gsbi_configs)); |
| 475 | |
Rohit Vaswani | f688fa6 | 2011-10-13 18:13:10 -0700 | [diff] [blame] | 476 | msm_gpiomux_install(msm9615_ps_hold_config, |
| 477 | ARRAY_SIZE(msm9615_ps_hold_config)); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 478 | return 0; |
| 479 | } |
| 480 | |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 481 | static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = { |
| 482 | .max_clock_speed = 24000000, |
| 483 | }; |
| 484 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 485 | static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = { |
| 486 | .clk_freq = 100000, |
| 487 | .src_clk_rate = 24000000, |
| 488 | }; |
| 489 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 490 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 491 | .mode = USB_PERIPHERAL, |
| 492 | .otg_control = OTG_NO_CONTROL, |
| 493 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
| 494 | .pclk_src_name = "dfab_usb_hs_clk", |
| 495 | }; |
| 496 | |
| 497 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 498 | { |
| 499 | return 0; |
| 500 | } |
| 501 | |
| 502 | static struct android_usb_platform_data android_usb_pdata = { |
| 503 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 504 | }; |
| 505 | |
| 506 | static struct platform_device android_usb_device = { |
| 507 | .name = "android_usb", |
| 508 | .id = -1, |
| 509 | .dev = { |
| 510 | .platform_data = &android_usb_pdata, |
| 511 | }, |
| 512 | }; |
| 513 | |
| 514 | static struct platform_device *common_devices[] = { |
| 515 | &msm9615_device_dmov, |
| 516 | &msm_device_smd, |
| 517 | &msm_device_otg, |
| 518 | &msm_device_gadget_peripheral, |
| 519 | &android_usb_device, |
| 520 | &msm9615_device_uart_gsbi4, |
| 521 | &msm9615_device_ssbi_pmic1, |
| 522 | &msm9615_device_qup_i2c_gsbi5, |
| 523 | &msm9615_device_qup_spi_gsbi3, |
| 524 | &msm_device_sps, |
| 525 | &msm9615_device_tsens, |
| 526 | &msm_device_nand, |
| 527 | &msm_rpm_device, |
| 528 | #ifdef CONFIG_HW_RANDOM_MSM |
| 529 | &msm_device_rng, |
| 530 | #endif |
| 531 | |
| 532 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 533 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame^] | 534 | &msm9615_qcrypto_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 535 | #endif |
| 536 | |
| 537 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 538 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame^] | 539 | &msm9615_qcedev_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 540 | #endif |
| 541 | }; |
| 542 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 543 | static void __init msm9615_i2c_init(void) |
| 544 | { |
| 545 | msm9615_device_qup_i2c_gsbi5.dev.platform_data = |
| 546 | &msm9615_i2c_qup_gsbi5_pdata; |
| 547 | } |
| 548 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 549 | static void __init msm9615_common_init(void) |
| 550 | { |
| 551 | msm9615_device_init(); |
| 552 | gpiomux_init(); |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 553 | msm9615_i2c_init(); |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 554 | regulator_suppress_info_printing(); |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 555 | platform_device_register(&msm9615_device_rpm_regulator); |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 556 | msm9615_device_qup_spi_gsbi3.dev.platform_data = |
| 557 | &msm9615_qup_spi_gsbi3_pdata; |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 558 | msm9615_device_ssbi_pmic1.dev.platform_data = |
| 559 | &msm9615_ssbi_pm8018_pdata; |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 560 | pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len; |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 561 | |
| 562 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 563 | msm_device_gadget_peripheral.dev.parent = &msm_device_otg.dev; |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 564 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 565 | |
| 566 | msm9615_init_mmc(); |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 567 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 568 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 569 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 570 | msm_pm_data); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | static void __init msm9615_cdp_init(void) |
| 574 | { |
| 575 | msm9615_common_init(); |
| 576 | } |
| 577 | |
| 578 | static void __init msm9615_mtp_init(void) |
| 579 | { |
| 580 | msm9615_common_init(); |
| 581 | } |
| 582 | |
| 583 | MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP") |
| 584 | .map_io = msm9615_map_io, |
| 585 | .init_irq = msm9615_init_irq, |
| 586 | .timer = &msm_timer, |
| 587 | .init_machine = msm9615_cdp_init, |
| 588 | MACHINE_END |
| 589 | |
| 590 | MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP") |
| 591 | .map_io = msm9615_map_io, |
| 592 | .init_irq = msm9615_init_irq, |
| 593 | .timer = &msm_timer, |
| 594 | .init_machine = msm9615_mtp_init, |
| 595 | MACHINE_END |