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