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