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> |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 30 | #include <mach/msm_bus_board.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 31 | #include "timer.h" |
| 32 | #include "devices.h" |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 33 | #include "board-9615.h" |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 34 | #include "cpuidle.h" |
| 35 | #include "pm.h" |
Vikram Mulukutla | b5e1cda | 2011-10-04 16:17:22 -0700 | [diff] [blame] | 36 | #include "acpuclock.h" |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 37 | #include <linux/power/ltc4088-charger.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 38 | |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 39 | static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = { |
| 40 | {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 41 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 42 | {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 43 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 44 | {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 45 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 46 | {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 47 | ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM}, |
| 48 | {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 49 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 50 | {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 51 | ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM}, |
| 52 | {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 53 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 54 | {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 55 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 56 | {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 57 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
| 58 | }; |
| 59 | |
| 60 | static struct pm8xxx_adc_properties pm8018_adc_data = { |
| 61 | .adc_vdd_reference = 1800, /* milli-voltage for this adc */ |
| 62 | .bitresolution = 15, |
| 63 | .bipolar = 0, |
| 64 | }; |
| 65 | |
| 66 | static struct pm8xxx_adc_platform_data pm8018_adc_pdata = { |
| 67 | .adc_channel = pm8018_adc_channels_data, |
| 68 | .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data), |
| 69 | .adc_prop = &pm8018_adc_data, |
| 70 | }; |
| 71 | |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 72 | static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = { |
| 73 | .irq_base = PM8018_IRQ_BASE, |
| 74 | .devirq = MSM_GPIO_TO_INT(87), |
| 75 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 76 | }; |
| 77 | |
| 78 | static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = { |
| 79 | .gpio_base = PM8018_GPIO_PM_TO_SYS(1), |
| 80 | }; |
| 81 | |
| 82 | static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = { |
| 83 | .mpp_base = PM8018_MPP_PM_TO_SYS(1), |
| 84 | }; |
| 85 | |
| 86 | static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = { |
| 87 | .rtc_write_enable = false, |
Ashay Jaiswal | db5e6dc | 2011-10-12 11:02:47 +0530 | [diff] [blame] | 88 | .rtc_alarm_powerup = false, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = { |
| 92 | .pull_up = 1, |
Jing Lin | eecdc06 | 2011-11-17 09:47:09 -0800 | [diff] [blame] | 93 | .kpd_trigger_delay_us = 15625, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 94 | .wakeup = 1, |
| 95 | }; |
| 96 | |
| 97 | static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = { |
| 98 | .priority = 0, |
| 99 | }; |
| 100 | |
Jay Chokshi | eb5d0d5 | 2011-09-28 17:16:20 -0700 | [diff] [blame] | 101 | #define PM8018_LED_KB_MAX_CURRENT 20 /* I = 20mA */ |
| 102 | #define PM8XXX_LED_PWM_PERIOD_US 1000 |
| 103 | |
| 104 | /** |
| 105 | * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be |
| 106 | * driven using PWM feature. |
| 107 | */ |
| 108 | #define PM8XXX_PWM_CHANNEL_NONE -1 |
| 109 | |
| 110 | static struct led_info pm8018_led_info[] = { |
| 111 | [0] = { |
| 112 | .name = "led:kb", |
| 113 | }, |
| 114 | }; |
| 115 | |
| 116 | static struct led_platform_data pm8018_led_core_pdata = { |
| 117 | .num_leds = ARRAY_SIZE(pm8018_led_info), |
| 118 | .leds = pm8018_led_info, |
| 119 | }; |
| 120 | |
| 121 | static struct pm8xxx_led_config pm8018_led_configs[] = { |
| 122 | [0] = { |
| 123 | .id = PM8XXX_ID_LED_KB_LIGHT, |
| 124 | .mode = PM8XXX_LED_MODE_PWM3, |
| 125 | .max_current = PM8018_LED_KB_MAX_CURRENT, |
| 126 | .pwm_channel = 2, |
| 127 | .pwm_period_us = PM8XXX_LED_PWM_PERIOD_US, |
| 128 | }, |
| 129 | }; |
| 130 | |
| 131 | static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = { |
| 132 | .led_core = &pm8018_led_core_pdata, |
| 133 | .configs = pm8018_led_configs, |
| 134 | .num_configs = ARRAY_SIZE(pm8018_led_configs), |
| 135 | }; |
| 136 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 137 | #ifdef CONFIG_LTC4088_CHARGER |
| 138 | static struct ltc4088_charger_platform_data ltc4088_chg_pdata = { |
| 139 | .gpio_mode_select_d0 = 7, |
| 140 | .gpio_mode_select_d1 = 6, |
| 141 | .gpio_mode_select_d2 = 4, |
| 142 | }; |
| 143 | #endif |
| 144 | |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 145 | static struct pm8018_platform_data pm8018_platform_data __devinitdata = { |
| 146 | .irq_pdata = &pm8xxx_irq_pdata, |
| 147 | .gpio_pdata = &pm8xxx_gpio_pdata, |
| 148 | .mpp_pdata = &pm8xxx_mpp_pdata, |
| 149 | .rtc_pdata = &pm8xxx_rtc_pdata, |
| 150 | .pwrkey_pdata = &pm8xxx_pwrkey_pdata, |
| 151 | .misc_pdata = &pm8xxx_misc_pdata, |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 152 | .regulator_pdatas = msm_pm8018_regulator_pdata, |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 153 | .adc_pdata = &pm8018_adc_pdata, |
Jay Chokshi | eb5d0d5 | 2011-09-28 17:16:20 -0700 | [diff] [blame] | 154 | .leds_pdata = &pm8xxx_leds_pdata, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 155 | }; |
| 156 | |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 157 | static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = { |
| 158 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 159 | .slave = { |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 160 | .name = PM8018_CORE_DEV_NAME, |
| 161 | .platform_data = &pm8018_platform_data, |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 162 | }, |
| 163 | }; |
| 164 | |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 165 | static struct platform_device msm9615_device_rpm_regulator __devinitdata = { |
| 166 | .name = "rpm-regulator", |
| 167 | .id = -1, |
| 168 | .dev = { |
| 169 | .platform_data = &msm_rpm_regulator_9615_pdata, |
| 170 | }, |
| 171 | }; |
| 172 | |
David Collins | 0f9942a | 2011-10-31 09:47:34 -0700 | [diff] [blame] | 173 | static struct platform_device msm9615_device_ext_2p95v_vreg = { |
| 174 | .name = GPIO_REGULATOR_DEV_NAME, |
| 175 | .id = 18, |
| 176 | .dev = { |
| 177 | .platform_data = |
| 178 | &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P95V], |
| 179 | }, |
| 180 | }; |
| 181 | |
Rohit Vaswani | f688fa6 | 2011-10-13 18:13:10 -0700 | [diff] [blame] | 182 | static struct gpiomux_setting ps_hold = { |
| 183 | .func = GPIOMUX_FUNC_1, |
| 184 | .drv = GPIOMUX_DRV_8MA, |
| 185 | .pull = GPIOMUX_PULL_NONE, |
| 186 | }; |
| 187 | |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 188 | static struct gpiomux_setting gsbi4 = { |
| 189 | .func = GPIOMUX_FUNC_1, |
| 190 | .drv = GPIOMUX_DRV_8MA, |
| 191 | .pull = GPIOMUX_PULL_NONE, |
| 192 | }; |
| 193 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 194 | static struct gpiomux_setting gsbi5 = { |
| 195 | .func = GPIOMUX_FUNC_1, |
| 196 | .drv = GPIOMUX_DRV_8MA, |
| 197 | .pull = GPIOMUX_PULL_NONE, |
| 198 | }; |
| 199 | |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 200 | static struct gpiomux_setting gsbi3 = { |
| 201 | .func = GPIOMUX_FUNC_1, |
| 202 | .drv = GPIOMUX_DRV_8MA, |
| 203 | .pull = GPIOMUX_PULL_NONE, |
| 204 | }; |
| 205 | |
| 206 | static struct gpiomux_setting gsbi3_cs1_config = { |
| 207 | .func = GPIOMUX_FUNC_4, |
| 208 | .drv = GPIOMUX_DRV_8MA, |
| 209 | .pull = GPIOMUX_PULL_NONE, |
| 210 | }; |
| 211 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 212 | #ifdef CONFIG_LTC4088_CHARGER |
| 213 | static struct gpiomux_setting ltc4088_chg_cfg = { |
| 214 | .func = GPIOMUX_FUNC_GPIO, |
| 215 | .drv = GPIOMUX_DRV_8MA, |
| 216 | .pull = GPIOMUX_PULL_NONE, |
| 217 | }; |
| 218 | #endif |
| 219 | |
Rohit Vaswani | f688fa6 | 2011-10-13 18:13:10 -0700 | [diff] [blame] | 220 | struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = { |
| 221 | { |
| 222 | .gpio = 83, |
| 223 | .settings = { |
| 224 | [GPIOMUX_SUSPENDED] = &ps_hold, |
| 225 | }, |
| 226 | }, |
| 227 | }; |
| 228 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 229 | #ifdef CONFIG_LTC4088_CHARGER |
| 230 | static struct msm_gpiomux_config |
| 231 | msm9615_ltc4088_charger_config[] __initdata = { |
| 232 | { |
| 233 | .gpio = 4, |
| 234 | .settings = { |
| 235 | [GPIOMUX_SUSPENDED] = <c4088_chg_cfg, |
| 236 | }, |
| 237 | }, |
| 238 | { |
| 239 | .gpio = 6, |
| 240 | .settings = { |
| 241 | [GPIOMUX_SUSPENDED] = <c4088_chg_cfg, |
| 242 | }, |
| 243 | }, |
| 244 | { |
| 245 | .gpio = 7, |
| 246 | .settings = { |
| 247 | [GPIOMUX_SUSPENDED] = <c4088_chg_cfg, |
| 248 | }, |
| 249 | }, |
| 250 | }; |
| 251 | #endif |
| 252 | |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 253 | struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = { |
| 254 | { |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 255 | .gpio = 8, /* GSBI3 QUP SPI_CLK */ |
| 256 | .settings = { |
| 257 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 258 | }, |
| 259 | }, |
| 260 | { |
| 261 | .gpio = 9, /* GSBI3 QUP SPI_CS_N */ |
| 262 | .settings = { |
| 263 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 264 | }, |
| 265 | }, |
| 266 | { |
| 267 | .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */ |
| 268 | .settings = { |
| 269 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 270 | }, |
| 271 | }, |
| 272 | { |
| 273 | .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */ |
| 274 | .settings = { |
| 275 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 276 | }, |
| 277 | }, |
| 278 | { |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 279 | .gpio = 12, /* GSBI4 UART */ |
| 280 | .settings = { |
| 281 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 282 | }, |
| 283 | }, |
| 284 | { |
| 285 | .gpio = 13, /* GSBI4 UART */ |
| 286 | .settings = { |
| 287 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 288 | }, |
| 289 | }, |
| 290 | { |
| 291 | .gpio = 14, /* GSBI4 UART */ |
| 292 | .settings = { |
| 293 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 294 | }, |
| 295 | }, |
| 296 | { |
| 297 | .gpio = 15, /* GSBI4 UART */ |
| 298 | .settings = { |
| 299 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 300 | }, |
| 301 | }, |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 302 | { |
| 303 | .gpio = 16, /* GSBI5 I2C QUP SCL */ |
| 304 | .settings = { |
| 305 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 306 | }, |
| 307 | }, |
| 308 | { |
| 309 | .gpio = 17, /* GSBI5 I2C QUP SDA */ |
| 310 | .settings = { |
| 311 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 312 | }, |
| 313 | }, |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 314 | { |
| 315 | /* GPIO 19 can be used for I2C/UART on GSBI5 */ |
| 316 | .gpio = 19, /* GSBI3 QUP SPI_CS_1 */ |
| 317 | .settings = { |
| 318 | [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config, |
| 319 | }, |
| 320 | }, |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 321 | }; |
| 322 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 323 | #if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\ |
| 324 | || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)) |
| 325 | |
Krishna Konda | 7186bfe | 2011-10-17 15:36:54 -0700 | [diff] [blame] | 326 | #define GPIO_SDC1_HW_DET 80 |
Krishna Konda | 3b78ea7 | 2011-10-18 16:09:19 -0700 | [diff] [blame] | 327 | #define GPIO_SDC2_DAT1_WAKEUP 26 |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 328 | |
Stepan Moskovchenko | 73b943b | 2011-10-31 22:43:00 -0700 | [diff] [blame] | 329 | /* MDM9x15 has 2 SDCC controllers */ |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 330 | enum sdcc_controllers { |
| 331 | SDCC1, |
| 332 | SDCC2, |
| 333 | MAX_SDCC_CONTROLLER |
| 334 | }; |
| 335 | |
| 336 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
Krishna Konda | fea6018 | 2011-11-01 16:01:34 -0700 | [diff] [blame] | 337 | /* All SDCC controllers requires VDD/VCC voltage */ |
| 338 | static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = { |
| 339 | /* SDCC1 : External card slot connected */ |
| 340 | [SDCC1] = { |
| 341 | .name = "sdc_vdd", |
| 342 | /* |
| 343 | * This is a gpio-regulator and does not support |
| 344 | * regulator_set_voltage and regulator_set_optimum_mode |
| 345 | */ |
Krishna Konda | fea6018 | 2011-11-01 16:01:34 -0700 | [diff] [blame] | 346 | .high_vol_level = 2950000, |
| 347 | .low_vol_level = 2950000, |
| 348 | .hpm_uA = 600000, /* 600mA */ |
| 349 | } |
| 350 | }; |
| 351 | |
| 352 | /* All SDCC controllers may require voting for VDD PAD voltage */ |
| 353 | static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = { |
| 354 | /* SDCC1 : External card slot connected */ |
| 355 | [SDCC1] = { |
| 356 | .name = "sdc_vddp", |
Krishna Konda | fea6018 | 2011-11-01 16:01:34 -0700 | [diff] [blame] | 357 | .high_vol_level = 2950000, |
| 358 | .low_vol_level = 1850000, |
| 359 | .always_on = true, |
| 360 | .lpm_sup = true, |
| 361 | /* Max. Active current required is 16 mA */ |
| 362 | .hpm_uA = 16000, |
| 363 | /* |
| 364 | * Sleep current required is ~300 uA. But min. vote can be |
| 365 | * in terms of mA (min. 1 mA). So let's vote for 2 mA |
| 366 | * during sleep. |
| 367 | */ |
| 368 | .lpm_uA = 2000, |
| 369 | } |
| 370 | }; |
| 371 | |
| 372 | static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = { |
| 373 | /* SDCC1 : External card slot connected */ |
| 374 | [SDCC1] = { |
| 375 | .vdd_data = &mmc_vdd_reg_data[SDCC1], |
| 376 | .vddp_data = &mmc_vddp_reg_data[SDCC1], |
| 377 | } |
| 378 | }; |
| 379 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 380 | /* SDC1 pad data */ |
| 381 | static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = { |
| 382 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA}, |
| 383 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA}, |
| 384 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA} |
| 385 | }; |
| 386 | |
| 387 | static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = { |
| 388 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA}, |
| 389 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA}, |
| 390 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA} |
| 391 | }; |
| 392 | |
| 393 | static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = { |
| 394 | {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
| 395 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP}, |
| 396 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP} |
| 397 | }; |
| 398 | |
| 399 | static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = { |
| 400 | {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
| 401 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN}, |
| 402 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN} |
| 403 | }; |
| 404 | |
| 405 | static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = { |
| 406 | [SDCC1] = { |
| 407 | .on = sdc1_pad_pull_on_cfg, |
| 408 | .off = sdc1_pad_pull_off_cfg, |
| 409 | .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg) |
| 410 | }, |
| 411 | }; |
| 412 | |
| 413 | static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = { |
| 414 | [SDCC1] = { |
| 415 | .on = sdc1_pad_drv_on_cfg, |
| 416 | .off = sdc1_pad_drv_off_cfg, |
| 417 | .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg) |
| 418 | }, |
| 419 | }; |
| 420 | |
| 421 | static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = { |
| 422 | [SDCC1] = { |
| 423 | .pull = &mmc_pad_pull_data[SDCC1], |
| 424 | .drv = &mmc_pad_drv_data[SDCC1] |
| 425 | }, |
| 426 | }; |
| 427 | #endif |
| 428 | |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 429 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 430 | static struct gpiomux_setting sdcc2_clk_actv_cfg = { |
| 431 | .func = GPIOMUX_FUNC_1, |
| 432 | .drv = GPIOMUX_DRV_16MA, |
| 433 | .pull = GPIOMUX_PULL_NONE, |
| 434 | }; |
| 435 | |
| 436 | static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = { |
| 437 | .func = GPIOMUX_FUNC_1, |
| 438 | .drv = GPIOMUX_DRV_8MA, |
| 439 | .pull = GPIOMUX_PULL_UP, |
| 440 | }; |
| 441 | |
| 442 | static struct gpiomux_setting sdcc2_suspend_cfg = { |
| 443 | .func = GPIOMUX_FUNC_1, |
| 444 | .drv = GPIOMUX_DRV_2MA, |
| 445 | .pull = GPIOMUX_PULL_DOWN, |
| 446 | }; |
| 447 | |
| 448 | static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = { |
| 449 | { |
| 450 | /* SDC2_DATA_0 */ |
| 451 | .gpio = 25, |
| 452 | .settings = { |
| 453 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| 454 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 455 | }, |
| 456 | }, |
| 457 | { |
| 458 | /* SDC2_DATA_1 */ |
| 459 | .gpio = 26, |
| 460 | .settings = { |
| 461 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
Krishna Konda | 0b10fa1 | 2011-11-07 22:47:41 -0800 | [diff] [blame] | 462 | [GPIOMUX_SUSPENDED] = &sdcc2_cmd_data_0_3_actv_cfg, |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 463 | }, |
| 464 | }, |
| 465 | { |
| 466 | /* SDC2_DATA_2 */ |
| 467 | .gpio = 27, |
| 468 | .settings = { |
| 469 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| 470 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 471 | }, |
| 472 | }, |
| 473 | { |
| 474 | /* SDC2_DATA_3 */ |
| 475 | .gpio = 28, |
| 476 | .settings = { |
| 477 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| 478 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 479 | }, |
| 480 | }, |
| 481 | { |
Krishna Konda | 0b10fa1 | 2011-11-07 22:47:41 -0800 | [diff] [blame] | 482 | /* SDC2_CMD */ |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 483 | .gpio = 29, |
| 484 | .settings = { |
| 485 | [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg, |
| 486 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 487 | }, |
| 488 | }, |
| 489 | { |
Krishna Konda | 0b10fa1 | 2011-11-07 22:47:41 -0800 | [diff] [blame] | 490 | /* SDC2_CLK */ |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 491 | .gpio = 30, |
| 492 | .settings = { |
| 493 | [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg, |
| 494 | [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg, |
| 495 | }, |
| 496 | }, |
| 497 | }; |
| 498 | |
| 499 | static struct msm_mmc_gpio sdc2_gpio_cfg[] = { |
| 500 | {25, "sdc2_dat_0"}, |
| 501 | {26, "sdc2_dat_1"}, |
| 502 | {27, "sdc2_dat_2"}, |
| 503 | {28, "sdc2_dat_3"}, |
| 504 | {29, "sdc2_cmd"}, |
| 505 | {30, "sdc2_clk"}, |
| 506 | }; |
| 507 | |
| 508 | static struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = { |
| 509 | [SDCC2] = { |
| 510 | .gpio = sdc2_gpio_cfg, |
| 511 | .size = ARRAY_SIZE(sdc2_gpio_cfg), |
| 512 | }, |
| 513 | }; |
| 514 | #else |
| 515 | static struct msm_gpiomux_config msm9615_sdcc2_configs[0]; |
| 516 | #endif |
| 517 | |
| 518 | 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] | 519 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 520 | [SDCC1] = { |
| 521 | .is_gpio = 0, |
| 522 | .pad_data = &mmc_pad_data[SDCC1], |
| 523 | }, |
| 524 | #endif |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 525 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 526 | [SDCC2] = { |
| 527 | .is_gpio = 1, |
| 528 | .gpio_data = &mmc_gpio_data[SDCC2], |
| 529 | }, |
| 530 | #endif |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 531 | }; |
| 532 | |
| 533 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 534 | static unsigned int sdc1_sup_clk_rates[] = { |
| 535 | 400000, 24000000, 48000000 |
| 536 | }; |
| 537 | |
| 538 | static struct mmc_platform_data sdc1_data = { |
| 539 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 540 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 541 | .sup_clk_table = sdc1_sup_clk_rates, |
| 542 | .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates), |
Krishna Konda | fea6018 | 2011-11-01 16:01:34 -0700 | [diff] [blame] | 543 | .pclk_src_dfab = true, |
Krishna Konda | fea6018 | 2011-11-01 16:01:34 -0700 | [diff] [blame] | 544 | .vreg_data = &mmc_slot_vreg_data[SDCC1], |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 545 | .pin_data = &mmc_slot_pin_data[SDCC1], |
Krishna Konda | 7186bfe | 2011-10-17 15:36:54 -0700 | [diff] [blame] | 546 | #ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION |
| 547 | .status_gpio = GPIO_SDC1_HW_DET, |
| 548 | .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET), |
| 549 | .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
| 550 | #endif |
Krishna Konda | dbcf970 | 2011-11-07 18:45:48 -0800 | [diff] [blame] | 551 | .xpc_cap = 1, |
| 552 | .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | |
| 553 | MMC_CAP_MAX_CURRENT_400) |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 554 | }; |
| 555 | static struct mmc_platform_data *msm9615_sdc1_pdata = &sdc1_data; |
| 556 | #else |
| 557 | static struct mmc_platform_data *msm9615_sdc1_pdata; |
| 558 | #endif |
| 559 | |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 560 | #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT |
| 561 | static unsigned int sdc2_sup_clk_rates[] = { |
| 562 | 400000, 24000000, 48000000 |
| 563 | }; |
| 564 | |
| 565 | static struct mmc_platform_data sdc2_data = { |
| 566 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 567 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 568 | .sup_clk_table = sdc2_sup_clk_rates, |
| 569 | .sup_clk_cnt = ARRAY_SIZE(sdc2_sup_clk_rates), |
Krishna Konda | 890b1d1 | 2011-10-18 16:05:37 -0700 | [diff] [blame] | 570 | .pclk_src_dfab = 1, |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 571 | .pin_data = &mmc_slot_pin_data[SDCC2], |
Krishna Konda | 3b78ea7 | 2011-10-18 16:09:19 -0700 | [diff] [blame] | 572 | #ifdef CONFIG_MMC_MSM_SDIO_SUPPORT |
| 573 | .sdiowakeup_irq = MSM_GPIO_TO_INT(GPIO_SDC2_DAT1_WAKEUP), |
| 574 | #endif |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 575 | }; |
| 576 | static struct mmc_platform_data *msm9615_sdc2_pdata = &sdc2_data; |
| 577 | #else |
| 578 | static struct mmc_platform_data *msm9615_sdc2_pdata; |
| 579 | #endif |
| 580 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 581 | static void __init msm9615_init_mmc(void) |
| 582 | { |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 583 | if (msm9615_sdc1_pdata) { |
Krishna Konda | fea6018 | 2011-11-01 16:01:34 -0700 | [diff] [blame] | 584 | /* SDC1: External card slot for SD/MMC cards */ |
| 585 | msm_add_sdcc(1, msm9615_sdc1_pdata); |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 586 | } |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 587 | |
| 588 | if (msm9615_sdc2_pdata) { |
| 589 | msm_gpiomux_install(msm9615_sdcc2_configs, |
| 590 | ARRAY_SIZE(msm9615_sdcc2_configs)); |
| 591 | |
Krishna Konda | fea6018 | 2011-11-01 16:01:34 -0700 | [diff] [blame] | 592 | /* SDC2: External card slot used for WLAN */ |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 593 | msm_add_sdcc(2, msm9615_sdc2_pdata); |
| 594 | } |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 595 | } |
| 596 | #else |
| 597 | static void __init msm9615_init_mmc(void) { } |
| 598 | #endif |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 599 | static struct msm_cpuidle_state msm_cstates[] __initdata = { |
| 600 | {0, 0, "C0", "WFI", |
| 601 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 602 | |
| 603 | {0, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 604 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 605 | |
| 606 | {0, 2, "C2", "POWER_COLLAPSE", |
| 607 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, |
| 608 | }; |
| 609 | static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 610 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 611 | .idle_supported = 1, |
| 612 | .suspend_supported = 1, |
| 613 | .idle_enabled = 0, |
| 614 | .suspend_enabled = 0, |
| 615 | }, |
| 616 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 617 | .idle_supported = 1, |
| 618 | .suspend_supported = 1, |
| 619 | .idle_enabled = 0, |
| 620 | .suspend_enabled = 0, |
| 621 | }, |
| 622 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 623 | .idle_supported = 1, |
| 624 | .suspend_supported = 1, |
| 625 | .idle_enabled = 1, |
| 626 | .suspend_enabled = 1, |
| 627 | }, |
| 628 | }; |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 629 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 630 | static int __init gpiomux_init(void) |
| 631 | { |
| 632 | int rc; |
| 633 | |
| 634 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 635 | if (rc) { |
| 636 | pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); |
| 637 | return rc; |
| 638 | } |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 639 | msm_gpiomux_install(msm9615_gsbi_configs, |
| 640 | ARRAY_SIZE(msm9615_gsbi_configs)); |
| 641 | |
Rohit Vaswani | f688fa6 | 2011-10-13 18:13:10 -0700 | [diff] [blame] | 642 | msm_gpiomux_install(msm9615_ps_hold_config, |
| 643 | ARRAY_SIZE(msm9615_ps_hold_config)); |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 644 | #ifdef CONFIG_LTC4088_CHARGER |
| 645 | msm_gpiomux_install(msm9615_ltc4088_charger_config, |
| 646 | ARRAY_SIZE(msm9615_ltc4088_charger_config)); |
| 647 | #endif |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 648 | return 0; |
| 649 | } |
| 650 | |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 651 | static void __init msm9615_init_buses(void) |
| 652 | { |
| 653 | #ifdef CONFIG_MSM_BUS_SCALING |
| 654 | msm_bus_rpm_set_mt_mask(); |
| 655 | msm_bus_9615_sys_fabric_pdata.rpm_enabled = 1; |
| 656 | msm_bus_9615_sys_fabric.dev.platform_data = |
| 657 | &msm_bus_9615_sys_fabric_pdata; |
| 658 | msm_bus_def_fab.dev.platform_data = &msm_bus_9615_def_fab_pdata; |
| 659 | #endif |
| 660 | } |
| 661 | |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 662 | static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = { |
| 663 | .max_clock_speed = 24000000, |
| 664 | }; |
| 665 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 666 | static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = { |
| 667 | .clk_freq = 100000, |
| 668 | .src_clk_rate = 24000000, |
| 669 | }; |
| 670 | |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 671 | #define USB_5V_EN 3 |
| 672 | #define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN) |
| 673 | |
| 674 | static void msm_hsusb_vbus_power(bool on) |
| 675 | { |
| 676 | int rc; |
| 677 | static bool vbus_is_on; |
| 678 | struct pm_gpio usb_vbus = { |
| 679 | .direction = PM_GPIO_DIR_OUT, |
| 680 | .pull = PM_GPIO_PULL_NO, |
| 681 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 682 | .output_value = 0, |
| 683 | .vin_sel = 2, |
| 684 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 685 | .function = PM_GPIO_FUNC_NORMAL, |
| 686 | .inv_int_pol = 0, |
| 687 | }; |
| 688 | |
| 689 | if (vbus_is_on == on) |
| 690 | return; |
| 691 | |
| 692 | if (on) { |
| 693 | rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus); |
| 694 | if (rc) { |
| 695 | pr_err("failed to config usb_5v_en gpio\n"); |
| 696 | return; |
| 697 | } |
| 698 | |
| 699 | rc = gpio_request(PM_USB_5V_EN, |
| 700 | "usb_5v_en"); |
| 701 | if (rc < 0) { |
| 702 | pr_err("failed to request usb_5v_en gpio\n"); |
| 703 | return; |
| 704 | } |
| 705 | |
| 706 | rc = gpio_direction_output(PM_USB_5V_EN, 1); |
| 707 | if (rc) { |
| 708 | pr_err("%s: unable to set_direction for gpio [%d]\n", |
| 709 | __func__, PM_USB_5V_EN); |
| 710 | goto free_usb_5v_en; |
| 711 | } |
| 712 | |
| 713 | vbus_is_on = true; |
| 714 | return; |
| 715 | } |
| 716 | gpio_set_value(PM_USB_5V_EN, 0); |
| 717 | free_usb_5v_en: |
| 718 | gpio_free(PM_USB_5V_EN); |
| 719 | vbus_is_on = false; |
| 720 | } |
| 721 | |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 722 | static int shelby_phy_init_seq[] = { |
| 723 | 0x44, 0x80,/* set VBUS valid threshold and |
| 724 | disconnect valid threshold */ |
| 725 | 0x38, 0x81, /* update DC voltage level */ |
| 726 | 0x14, 0x82,/* set preemphasis and rise/fall time */ |
| 727 | 0x13, 0x83,/* set source impedance adjustment */ |
| 728 | -1}; |
| 729 | |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame^] | 730 | #define USB_BAM_PHY_BASE 0x12502000 |
| 731 | #define USB_BAM_PHY_SIZE 0x10000 |
| 732 | #define A2_BAM_PHY_BASE 0x124C2000 |
| 733 | static struct usb_bam_pipe_connect msm_usb_bam_connections[4][2] = { |
| 734 | [0][USB_TO_PEER_PERIPHERAL] = { |
| 735 | .src_phy_addr = USB_BAM_PHY_BASE, |
| 736 | .src_pipe_index = 11, |
| 737 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 738 | .dst_pipe_index = 0, |
| 739 | .data_fifo_base_offset = 0xf00, |
| 740 | .data_fifo_size = 0x400, |
| 741 | .desc_fifo_base_offset = 0x1300, |
| 742 | .desc_fifo_size = 0x300, |
| 743 | }, |
| 744 | [0][PEER_PERIPHERAL_TO_USB] = { |
| 745 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 746 | .src_pipe_index = 1, |
| 747 | .dst_phy_addr = USB_BAM_PHY_BASE, |
| 748 | .dst_pipe_index = 10, |
| 749 | .data_fifo_base_offset = 0xa00, |
| 750 | .data_fifo_size = 0x400, |
| 751 | .desc_fifo_base_offset = 0xe00, |
| 752 | .desc_fifo_size = 0x100, |
| 753 | }, |
| 754 | }; |
| 755 | |
| 756 | static struct msm_usb_bam_platform_data msm_usb_bam_pdata = { |
| 757 | .connections = &msm_usb_bam_connections[0][0], |
| 758 | .usb_bam_phy_base = USB_BAM_PHY_BASE, |
| 759 | .usb_bam_phy_size = USB_BAM_PHY_SIZE, |
| 760 | .usb_bam_num_pipes = 32, |
| 761 | }; |
| 762 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 763 | static struct msm_otg_platform_data msm_otg_pdata = { |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 764 | .mode = USB_OTG, |
| 765 | .otg_control = OTG_PHY_CONTROL, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 766 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 767 | .pclk_src_name = "dfab_usb_hs_clk", |
| 768 | .vbus_power = msm_hsusb_vbus_power, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 769 | }; |
| 770 | |
| 771 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 772 | { |
| 773 | return 0; |
| 774 | } |
| 775 | |
| 776 | static struct android_usb_platform_data android_usb_pdata = { |
| 777 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 778 | }; |
| 779 | |
| 780 | static struct platform_device android_usb_device = { |
| 781 | .name = "android_usb", |
| 782 | .id = -1, |
| 783 | .dev = { |
| 784 | .platform_data = &android_usb_pdata, |
| 785 | }, |
| 786 | }; |
| 787 | |
Rohit Vaswani | 149f0a7 | 2011-11-09 15:21:28 -0800 | [diff] [blame] | 788 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 789 | .name = "wlan_ar6000_pm_dev", |
| 790 | .id = -1, |
| 791 | }; |
| 792 | |
| 793 | static int __init msm9615_init_ar6000pm(void) |
| 794 | { |
| 795 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 796 | } |
| 797 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 798 | #ifdef CONFIG_LTC4088_CHARGER |
| 799 | static struct platform_device msm_device_charger = { |
| 800 | .name = LTC4088_CHARGER_DEV_NAME, |
| 801 | .id = -1, |
| 802 | .dev = { |
| 803 | .platform_data = <c4088_chg_pdata, |
| 804 | }, |
| 805 | }; |
| 806 | #endif |
| 807 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 808 | static struct platform_device *common_devices[] = { |
| 809 | &msm9615_device_dmov, |
| 810 | &msm_device_smd, |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 811 | #ifdef CONFIG_LTC4088_CHARGER |
| 812 | &msm_device_charger, |
| 813 | #endif |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 814 | &msm_device_otg, |
| 815 | &msm_device_gadget_peripheral, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 816 | &msm_device_hsusb_host, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame^] | 817 | &msm_device_usb_bam, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 818 | &android_usb_device, |
| 819 | &msm9615_device_uart_gsbi4, |
David Collins | 0f9942a | 2011-10-31 09:47:34 -0700 | [diff] [blame] | 820 | &msm9615_device_ext_2p95v_vreg, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 821 | &msm9615_device_ssbi_pmic1, |
| 822 | &msm9615_device_qup_i2c_gsbi5, |
| 823 | &msm9615_device_qup_spi_gsbi3, |
| 824 | &msm_device_sps, |
| 825 | &msm9615_device_tsens, |
| 826 | &msm_device_nand, |
Eric Holmberg | 0c96e70 | 2011-11-08 18:04:31 -0700 | [diff] [blame] | 827 | &msm_device_bam_dmux, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 828 | &msm_rpm_device, |
| 829 | #ifdef CONFIG_HW_RANDOM_MSM |
| 830 | &msm_device_rng, |
| 831 | #endif |
| 832 | |
| 833 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 834 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame] | 835 | &msm9615_qcrypto_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 836 | #endif |
| 837 | |
| 838 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 839 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame] | 840 | &msm9615_qcedev_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 841 | #endif |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 842 | &msm9615_device_watchdog, |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 843 | &msm_bus_9615_sys_fabric, |
| 844 | &msm_bus_def_fab, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 845 | }; |
| 846 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 847 | static void __init msm9615_i2c_init(void) |
| 848 | { |
| 849 | msm9615_device_qup_i2c_gsbi5.dev.platform_data = |
| 850 | &msm9615_i2c_qup_gsbi5_pdata; |
| 851 | } |
| 852 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 853 | static void __init msm9615_common_init(void) |
| 854 | { |
| 855 | msm9615_device_init(); |
| 856 | gpiomux_init(); |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 857 | msm9615_i2c_init(); |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 858 | regulator_suppress_info_printing(); |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 859 | platform_device_register(&msm9615_device_rpm_regulator); |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 860 | msm_clock_init(&msm9615_clock_init_data); |
| 861 | msm9615_init_buses(); |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 862 | msm9615_device_qup_spi_gsbi3.dev.platform_data = |
| 863 | &msm9615_qup_spi_gsbi3_pdata; |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 864 | msm9615_device_ssbi_pmic1.dev.platform_data = |
| 865 | &msm9615_ssbi_pm8018_pdata; |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 866 | pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len; |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 867 | |
| 868 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 869 | msm_otg_pdata.phy_init_seq = shelby_phy_init_seq; |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame^] | 870 | msm_device_usb_bam.dev.platform_data = &msm_usb_bam_pdata; |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 871 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 872 | |
Vikram Mulukutla | b5e1cda | 2011-10-04 16:17:22 -0700 | [diff] [blame] | 873 | acpuclk_init(&acpuclk_9615_soc_data); |
| 874 | |
Rohit Vaswani | 149f0a7 | 2011-11-09 15:21:28 -0800 | [diff] [blame] | 875 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 876 | msm9615_init_ar6000pm(); |
| 877 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 878 | msm9615_init_mmc(); |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 879 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 880 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 881 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 882 | msm_pm_data); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 883 | } |
| 884 | |
| 885 | static void __init msm9615_cdp_init(void) |
| 886 | { |
| 887 | msm9615_common_init(); |
| 888 | } |
| 889 | |
| 890 | static void __init msm9615_mtp_init(void) |
| 891 | { |
| 892 | msm9615_common_init(); |
| 893 | } |
| 894 | |
| 895 | MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP") |
| 896 | .map_io = msm9615_map_io, |
| 897 | .init_irq = msm9615_init_irq, |
| 898 | .timer = &msm_timer, |
| 899 | .init_machine = msm9615_cdp_init, |
| 900 | MACHINE_END |
| 901 | |
| 902 | MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP") |
| 903 | .map_io = msm9615_map_io, |
| 904 | .init_irq = msm9615_init_irq, |
| 905 | .timer = &msm_timer, |
| 906 | .init_machine = msm9615_mtp_init, |
| 907 | MACHINE_END |