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