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