Manu Gautam | 5143b25 | 2012-01-05 19:25:23 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 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> |
Amit Blay | 5f968cf | 2012-01-22 12:04:01 +0200 | [diff] [blame] | 15 | #include <linux/io.h> |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 16 | #include <linux/i2c.h> |
Sagar Dharia | 2a5378d | 2011-12-01 20:00:11 -0700 | [diff] [blame] | 17 | #include <linux/slimbus/slimbus.h> |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 18 | #ifdef CONFIG_WCD9310_CODEC |
| 19 | #include <linux/mfd/wcd9xxx/core.h> |
| 20 | #include <linux/mfd/wcd9xxx/pdata.h> |
| 21 | #endif |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 22 | #include <linux/msm_ssbi.h> |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 23 | #include <linux/memblock.h> |
Rohit Vaswani | a681589 | 2011-12-15 20:20:39 -0800 | [diff] [blame] | 24 | #include <linux/usb/android.h> |
| 25 | #include <linux/usb/msm_hsusb.h> |
| 26 | #include <linux/mfd/pm8xxx/pm8xxx-adc.h> |
| 27 | #include <linux/leds.h> |
| 28 | #include <linux/leds-pm8xxx.h> |
| 29 | #include <linux/power/ltc4088-charger.h> |
Siddartha Mohanadoss | 7e25dc1 | 2012-03-19 11:19:27 -0700 | [diff] [blame] | 30 | #include <linux/msm_tsens.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/mach/arch.h> |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 33 | #include <asm/hardware/gic.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 34 | #include <mach/board.h> |
| 35 | #include <mach/msm_iomap.h> |
| 36 | #include <mach/gpio.h> |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 37 | #include <mach/socinfo.h> |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 38 | #include <mach/msm_spi.h> |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 39 | #include <mach/msm_bus_board.h> |
Vikram Mulukutla | 2021c00 | 2011-12-16 12:32:59 -0800 | [diff] [blame] | 40 | #include <mach/msm_xo.h> |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 41 | #include <mach/dma.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 42 | #include "timer.h" |
| 43 | #include "devices.h" |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 44 | #include "board-9615.h" |
Abhijeet Dharmapurikar | efaca4f | 2011-12-27 16:24:07 -0800 | [diff] [blame] | 45 | #include <mach/cpuidle.h> |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 46 | #include "pm.h" |
Vikram Mulukutla | b5e1cda | 2011-10-04 16:17:22 -0700 | [diff] [blame] | 47 | #include "acpuclock.h" |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 48 | #include "pm-boot.h" |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 49 | |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 50 | static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = { |
| 51 | {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 52 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 53 | {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 54 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 55 | {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 56 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 57 | {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 58 | ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM}, |
| 59 | {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 60 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 61 | {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 62 | ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM}, |
| 63 | {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 64 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 65 | {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 66 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 67 | {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 68 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
| 69 | }; |
| 70 | |
| 71 | static struct pm8xxx_adc_properties pm8018_adc_data = { |
| 72 | .adc_vdd_reference = 1800, /* milli-voltage for this adc */ |
| 73 | .bitresolution = 15, |
| 74 | .bipolar = 0, |
| 75 | }; |
| 76 | |
| 77 | static struct pm8xxx_adc_platform_data pm8018_adc_pdata = { |
| 78 | .adc_channel = pm8018_adc_channels_data, |
| 79 | .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data), |
| 80 | .adc_prop = &pm8018_adc_data, |
| 81 | }; |
| 82 | |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 83 | static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = { |
| 84 | .irq_base = PM8018_IRQ_BASE, |
| 85 | .devirq = MSM_GPIO_TO_INT(87), |
| 86 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 87 | }; |
| 88 | |
| 89 | static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = { |
| 90 | .gpio_base = PM8018_GPIO_PM_TO_SYS(1), |
| 91 | }; |
| 92 | |
| 93 | static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = { |
| 94 | .mpp_base = PM8018_MPP_PM_TO_SYS(1), |
| 95 | }; |
| 96 | |
| 97 | static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = { |
| 98 | .rtc_write_enable = false, |
Ashay Jaiswal | db5e6dc | 2011-10-12 11:02:47 +0530 | [diff] [blame] | 99 | .rtc_alarm_powerup = false, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = { |
| 103 | .pull_up = 1, |
Jing Lin | eecdc06 | 2011-11-17 09:47:09 -0800 | [diff] [blame] | 104 | .kpd_trigger_delay_us = 15625, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 105 | .wakeup = 1, |
| 106 | }; |
| 107 | |
| 108 | static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = { |
| 109 | .priority = 0, |
| 110 | }; |
| 111 | |
Jay Chokshi | eb5d0d5 | 2011-09-28 17:16:20 -0700 | [diff] [blame] | 112 | #define PM8018_LED_KB_MAX_CURRENT 20 /* I = 20mA */ |
| 113 | #define PM8XXX_LED_PWM_PERIOD_US 1000 |
| 114 | |
| 115 | /** |
| 116 | * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be |
| 117 | * driven using PWM feature. |
| 118 | */ |
| 119 | #define PM8XXX_PWM_CHANNEL_NONE -1 |
| 120 | |
| 121 | static struct led_info pm8018_led_info[] = { |
| 122 | [0] = { |
| 123 | .name = "led:kb", |
| 124 | }, |
| 125 | }; |
| 126 | |
| 127 | static struct led_platform_data pm8018_led_core_pdata = { |
| 128 | .num_leds = ARRAY_SIZE(pm8018_led_info), |
| 129 | .leds = pm8018_led_info, |
| 130 | }; |
| 131 | |
| 132 | static struct pm8xxx_led_config pm8018_led_configs[] = { |
| 133 | [0] = { |
| 134 | .id = PM8XXX_ID_LED_KB_LIGHT, |
| 135 | .mode = PM8XXX_LED_MODE_PWM3, |
| 136 | .max_current = PM8018_LED_KB_MAX_CURRENT, |
| 137 | .pwm_channel = 2, |
| 138 | .pwm_period_us = PM8XXX_LED_PWM_PERIOD_US, |
| 139 | }, |
| 140 | }; |
| 141 | |
| 142 | static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = { |
| 143 | .led_core = &pm8018_led_core_pdata, |
| 144 | .configs = pm8018_led_configs, |
| 145 | .num_configs = ARRAY_SIZE(pm8018_led_configs), |
| 146 | }; |
| 147 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 148 | #ifdef CONFIG_LTC4088_CHARGER |
| 149 | static struct ltc4088_charger_platform_data ltc4088_chg_pdata = { |
| 150 | .gpio_mode_select_d0 = 7, |
| 151 | .gpio_mode_select_d1 = 6, |
| 152 | .gpio_mode_select_d2 = 4, |
| 153 | }; |
| 154 | #endif |
| 155 | |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 156 | static struct pm8018_platform_data pm8018_platform_data __devinitdata = { |
| 157 | .irq_pdata = &pm8xxx_irq_pdata, |
| 158 | .gpio_pdata = &pm8xxx_gpio_pdata, |
| 159 | .mpp_pdata = &pm8xxx_mpp_pdata, |
| 160 | .rtc_pdata = &pm8xxx_rtc_pdata, |
| 161 | .pwrkey_pdata = &pm8xxx_pwrkey_pdata, |
| 162 | .misc_pdata = &pm8xxx_misc_pdata, |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 163 | .regulator_pdatas = msm_pm8018_regulator_pdata, |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 164 | .adc_pdata = &pm8018_adc_pdata, |
Jay Chokshi | eb5d0d5 | 2011-09-28 17:16:20 -0700 | [diff] [blame] | 165 | .leds_pdata = &pm8xxx_leds_pdata, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 166 | }; |
| 167 | |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 168 | static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = { |
| 169 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 170 | .slave = { |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 171 | .name = PM8018_CORE_DEV_NAME, |
| 172 | .platform_data = &pm8018_platform_data, |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 173 | }, |
| 174 | }; |
| 175 | |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 176 | static struct platform_device msm9615_device_rpm_regulator __devinitdata = { |
| 177 | .name = "rpm-regulator", |
| 178 | .id = -1, |
| 179 | .dev = { |
| 180 | .platform_data = &msm_rpm_regulator_9615_pdata, |
| 181 | }, |
| 182 | }; |
| 183 | |
David Collins | 0f9942a | 2011-10-31 09:47:34 -0700 | [diff] [blame] | 184 | static struct platform_device msm9615_device_ext_2p95v_vreg = { |
| 185 | .name = GPIO_REGULATOR_DEV_NAME, |
| 186 | .id = 18, |
| 187 | .dev = { |
| 188 | .platform_data = |
| 189 | &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P95V], |
| 190 | }, |
| 191 | }; |
| 192 | |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 193 | static struct msm_cpuidle_state msm_cstates[] __initdata = { |
| 194 | {0, 0, "C0", "WFI", |
| 195 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 196 | |
| 197 | {0, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 198 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 199 | |
| 200 | {0, 2, "C2", "POWER_COLLAPSE", |
| 201 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, |
| 202 | }; |
| 203 | static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 204 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 205 | .idle_supported = 1, |
| 206 | .suspend_supported = 1, |
| 207 | .idle_enabled = 0, |
| 208 | .suspend_enabled = 0, |
| 209 | }, |
| 210 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 211 | .idle_supported = 1, |
| 212 | .suspend_supported = 1, |
| 213 | .idle_enabled = 0, |
| 214 | .suspend_enabled = 0, |
| 215 | }, |
| 216 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 217 | .idle_supported = 1, |
| 218 | .suspend_supported = 1, |
| 219 | .idle_enabled = 1, |
| 220 | .suspend_enabled = 1, |
| 221 | }, |
| 222 | }; |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 223 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 224 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 225 | .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR, |
| 226 | .v_addr = MSM_APCS_GLB_BASE + 0x24, |
| 227 | }; |
| 228 | |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 229 | static void __init msm9615_init_buses(void) |
| 230 | { |
| 231 | #ifdef CONFIG_MSM_BUS_SCALING |
| 232 | msm_bus_rpm_set_mt_mask(); |
| 233 | msm_bus_9615_sys_fabric_pdata.rpm_enabled = 1; |
| 234 | msm_bus_9615_sys_fabric.dev.platform_data = |
| 235 | &msm_bus_9615_sys_fabric_pdata; |
| 236 | msm_bus_def_fab.dev.platform_data = &msm_bus_9615_def_fab_pdata; |
| 237 | #endif |
| 238 | } |
| 239 | |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 240 | #ifdef CONFIG_WCD9310_CODEC |
| 241 | |
| 242 | #define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS) |
| 243 | |
| 244 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 245 | * 4 micbiases are used to power various analog and digital |
| 246 | * microphones operating at 1800 mV. Technically, all micbiases |
| 247 | * can source from single cfilter since all microphones operate |
| 248 | * at the same voltage level. The arrangement below is to make |
| 249 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 250 | * does not need to be as high as 2.85V. It is choosen for |
| 251 | * microphone sensitivity purpose. |
| 252 | */ |
| 253 | |
| 254 | static struct wcd9xxx_pdata tabla20_platform_data = { |
| 255 | .slimbus_slave_device = { |
| 256 | .name = "tabla-slave", |
| 257 | .e_addr = {0, 0, 0x60, 0, 0x17, 2}, |
| 258 | }, |
| 259 | .irq = 85, |
| 260 | .irq_base = TABLA_INTERRUPT_BASE, |
| 261 | .num_irqs = NR_WCD9XXX_IRQS, |
| 262 | .reset_gpio = 84, |
| 263 | .micbias = { |
| 264 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 265 | .cfilt1_mv = 1800, |
| 266 | .cfilt2_mv = 1800, |
| 267 | .cfilt3_mv = 1800, |
| 268 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 269 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 270 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 271 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 272 | }, |
| 273 | .regulator = { |
| 274 | { |
| 275 | .name = "CDC_VDD_CP", |
| 276 | .min_uV = 1800000, |
| 277 | .max_uV = 1800000, |
| 278 | .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, |
| 279 | }, |
| 280 | { |
| 281 | .name = "CDC_VDDA_RX", |
| 282 | .min_uV = 1800000, |
| 283 | .max_uV = 1800000, |
| 284 | .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, |
| 285 | }, |
| 286 | { |
| 287 | .name = "CDC_VDDA_TX", |
| 288 | .min_uV = 1800000, |
| 289 | .max_uV = 1800000, |
| 290 | .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, |
| 291 | }, |
| 292 | { |
| 293 | .name = "VDDIO_CDC", |
| 294 | .min_uV = 1800000, |
| 295 | .max_uV = 1800000, |
| 296 | .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, |
| 297 | }, |
| 298 | { |
| 299 | .name = "VDDD_CDC_D", |
| 300 | .min_uV = 1225000, |
| 301 | .max_uV = 1225000, |
| 302 | .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, |
| 303 | }, |
| 304 | { |
| 305 | .name = "CDC_VDDA_A_1P2V", |
| 306 | .min_uV = 1225000, |
| 307 | .max_uV = 1225000, |
| 308 | .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, |
| 309 | }, |
| 310 | }, |
| 311 | }; |
| 312 | |
| 313 | static struct slim_device msm_slim_tabla20 = { |
| 314 | .name = "tabla2x-slim", |
| 315 | .e_addr = {0, 1, 0x60, 0, 0x17, 2}, |
| 316 | .dev = { |
| 317 | .platform_data = &tabla20_platform_data, |
| 318 | }, |
| 319 | }; |
| 320 | #endif |
| 321 | |
Sagar Dharia | 2a5378d | 2011-12-01 20:00:11 -0700 | [diff] [blame] | 322 | static struct slim_boardinfo msm_slim_devices[] = { |
| 323 | /* add slimbus slaves as needed */ |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 324 | #ifdef CONFIG_WCD9310_CODEC |
| 325 | { |
| 326 | .bus_num = 1, |
| 327 | .slim_slave = &msm_slim_tabla20, |
| 328 | }, |
| 329 | #endif |
Sagar Dharia | 2a5378d | 2011-12-01 20:00:11 -0700 | [diff] [blame] | 330 | }; |
| 331 | |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 332 | static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = { |
| 333 | .max_clock_speed = 24000000, |
| 334 | }; |
| 335 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 336 | static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = { |
| 337 | .clk_freq = 100000, |
| 338 | .src_clk_rate = 24000000, |
| 339 | }; |
| 340 | |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 341 | #define USB_5V_EN 3 |
| 342 | #define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN) |
| 343 | |
Mayank Rana | 8549e63 | 2012-01-23 12:49:54 +0530 | [diff] [blame] | 344 | static int msm_hsusb_vbus_power(bool on) |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 345 | { |
Amit Blay | a4416f9 | 2012-01-24 21:03:52 +0200 | [diff] [blame] | 346 | int rc; |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 347 | struct pm_gpio usb_vbus = { |
| 348 | .direction = PM_GPIO_DIR_OUT, |
| 349 | .pull = PM_GPIO_PULL_NO, |
| 350 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 351 | .vin_sel = 2, |
| 352 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 353 | .function = PM_GPIO_FUNC_NORMAL, |
| 354 | .inv_int_pol = 0, |
| 355 | }; |
| 356 | |
Amit Blay | a4416f9 | 2012-01-24 21:03:52 +0200 | [diff] [blame] | 357 | usb_vbus.output_value = on; |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 358 | |
Amit Blay | a4416f9 | 2012-01-24 21:03:52 +0200 | [diff] [blame] | 359 | rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus); |
| 360 | if (rc) |
| 361 | pr_err("failed to config usb_5v_en gpio\n"); |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 362 | |
Mayank Rana | 8549e63 | 2012-01-23 12:49:54 +0530 | [diff] [blame] | 363 | return rc; |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 364 | } |
| 365 | |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 366 | static int shelby_phy_init_seq[] = { |
| 367 | 0x44, 0x80,/* set VBUS valid threshold and |
| 368 | disconnect valid threshold */ |
| 369 | 0x38, 0x81, /* update DC voltage level */ |
| 370 | 0x14, 0x82,/* set preemphasis and rise/fall time */ |
| 371 | 0x13, 0x83,/* set source impedance adjustment */ |
| 372 | -1}; |
| 373 | |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 374 | #define USB_BAM_PHY_BASE 0x12502000 |
Ofir Cohen | 43473c8 | 2012-01-25 16:28:13 +0200 | [diff] [blame] | 375 | #define HSIC_BAM_PHY_BASE 0x12542000 |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 376 | #define A2_BAM_PHY_BASE 0x124C2000 |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 377 | static struct usb_bam_pipe_connect msm_usb_bam_connections[2][4][2] = { |
| 378 | [0][0][USB_TO_PEER_PERIPHERAL] = { |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 379 | .src_phy_addr = USB_BAM_PHY_BASE, |
| 380 | .src_pipe_index = 11, |
| 381 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 382 | .dst_pipe_index = 0, |
Ofir Cohen | 29cd575 | 2011-12-14 17:20:30 +0200 | [diff] [blame] | 383 | .data_fifo_base_offset = 0x1100, |
| 384 | .data_fifo_size = 0x600, |
| 385 | .desc_fifo_base_offset = 0x1700, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 386 | .desc_fifo_size = 0x300, |
| 387 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 388 | [0][0][PEER_PERIPHERAL_TO_USB] = { |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 389 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 390 | .src_pipe_index = 1, |
| 391 | .dst_phy_addr = USB_BAM_PHY_BASE, |
| 392 | .dst_pipe_index = 10, |
| 393 | .data_fifo_base_offset = 0xa00, |
Ofir Cohen | 29cd575 | 2011-12-14 17:20:30 +0200 | [diff] [blame] | 394 | .data_fifo_size = 0x600, |
| 395 | .desc_fifo_base_offset = 0x1000, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 396 | .desc_fifo_size = 0x100, |
| 397 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 398 | [0][1][USB_TO_PEER_PERIPHERAL] = { |
Anna Perel | 2151516 | 2012-02-02 20:50:02 +0200 | [diff] [blame] | 399 | .src_phy_addr = USB_BAM_PHY_BASE, |
| 400 | .src_pipe_index = 13, |
| 401 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 402 | .dst_pipe_index = 2, |
| 403 | .data_fifo_base_offset = 0x2100, |
| 404 | .data_fifo_size = 0x600, |
| 405 | .desc_fifo_base_offset = 0x2700, |
| 406 | .desc_fifo_size = 0x300, |
| 407 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 408 | [0][1][PEER_PERIPHERAL_TO_USB] = { |
Anna Perel | 2151516 | 2012-02-02 20:50:02 +0200 | [diff] [blame] | 409 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 410 | .src_pipe_index = 3, |
| 411 | .dst_phy_addr = USB_BAM_PHY_BASE, |
| 412 | .dst_pipe_index = 12, |
| 413 | .data_fifo_base_offset = 0x1a00, |
| 414 | .data_fifo_size = 0x600, |
| 415 | .desc_fifo_base_offset = 0x2000, |
| 416 | .desc_fifo_size = 0x100, |
| 417 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 418 | [0][2][USB_TO_PEER_PERIPHERAL] = { |
Anna Perel | 2151516 | 2012-02-02 20:50:02 +0200 | [diff] [blame] | 419 | .src_phy_addr = USB_BAM_PHY_BASE, |
| 420 | .src_pipe_index = 15, |
| 421 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 422 | .dst_pipe_index = 4, |
| 423 | .data_fifo_base_offset = 0x3100, |
| 424 | .data_fifo_size = 0x600, |
| 425 | .desc_fifo_base_offset = 0x3700, |
| 426 | .desc_fifo_size = 0x300, |
| 427 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 428 | [0][2][PEER_PERIPHERAL_TO_USB] = { |
Anna Perel | 2151516 | 2012-02-02 20:50:02 +0200 | [diff] [blame] | 429 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 430 | .src_pipe_index = 5, |
| 431 | .dst_phy_addr = USB_BAM_PHY_BASE, |
| 432 | .dst_pipe_index = 14, |
| 433 | .data_fifo_base_offset = 0x2a00, |
| 434 | .data_fifo_size = 0x600, |
| 435 | .desc_fifo_base_offset = 0x3000, |
| 436 | .desc_fifo_size = 0x100, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 437 | }, |
| 438 | [1][0][USB_TO_PEER_PERIPHERAL] = { |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 439 | .src_phy_addr = HSIC_BAM_PHY_BASE, |
| 440 | .src_pipe_index = 1, |
| 441 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 442 | .dst_pipe_index = 0, |
| 443 | .data_fifo_base_offset = 0x1100, |
| 444 | .data_fifo_size = 0x600, |
| 445 | .desc_fifo_base_offset = 0x1700, |
| 446 | .desc_fifo_size = 0x300, |
| 447 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 448 | [1][0][PEER_PERIPHERAL_TO_USB] = { |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 449 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 450 | .src_pipe_index = 1, |
| 451 | .dst_phy_addr = HSIC_BAM_PHY_BASE, |
| 452 | .dst_pipe_index = 0, |
| 453 | .data_fifo_base_offset = 0xa00, |
| 454 | .data_fifo_size = 0x600, |
| 455 | .desc_fifo_base_offset = 0x1000, |
| 456 | .desc_fifo_size = 0x100, |
| 457 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 458 | [1][1][USB_TO_PEER_PERIPHERAL] = { |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 459 | .src_phy_addr = HSIC_BAM_PHY_BASE, |
| 460 | .src_pipe_index = 3, |
| 461 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 462 | .dst_pipe_index = 2, |
| 463 | .data_fifo_base_offset = 0x2100, |
| 464 | .data_fifo_size = 0x600, |
| 465 | .desc_fifo_base_offset = 0x2700, |
| 466 | .desc_fifo_size = 0x300, |
| 467 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 468 | [1][1][PEER_PERIPHERAL_TO_USB] = { |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 469 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 470 | .src_pipe_index = 3, |
| 471 | .dst_phy_addr = HSIC_BAM_PHY_BASE, |
| 472 | .dst_pipe_index = 2, |
| 473 | .data_fifo_base_offset = 0x1a00, |
| 474 | .data_fifo_size = 0x600, |
| 475 | .desc_fifo_base_offset = 0x2000, |
| 476 | .desc_fifo_size = 0x100, |
| 477 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 478 | [1][2][USB_TO_PEER_PERIPHERAL] = { |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 479 | .src_phy_addr = HSIC_BAM_PHY_BASE, |
| 480 | .src_pipe_index = 5, |
| 481 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 482 | .dst_pipe_index = 4, |
| 483 | .data_fifo_base_offset = 0x3100, |
| 484 | .data_fifo_size = 0x600, |
| 485 | .desc_fifo_base_offset = 0x3700, |
| 486 | .desc_fifo_size = 0x300, |
| 487 | }, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 488 | [1][2][PEER_PERIPHERAL_TO_USB] = { |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 489 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 490 | .src_pipe_index = 5, |
| 491 | .dst_phy_addr = HSIC_BAM_PHY_BASE, |
| 492 | .dst_pipe_index = 4, |
| 493 | .data_fifo_base_offset = 0x2a00, |
| 494 | .data_fifo_size = 0x600, |
| 495 | .desc_fifo_base_offset = 0x3000, |
| 496 | .desc_fifo_size = 0x100, |
| 497 | } |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 498 | }; |
| 499 | |
| 500 | static struct msm_usb_bam_platform_data msm_usb_bam_pdata = { |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 501 | .connections = &msm_usb_bam_connections[0][0][0], |
Lena Salman | 57d167e | 2012-03-21 19:46:38 +0200 | [diff] [blame] | 502 | #ifndef CONFIG_USB_CI13XXX_MSM_HSIC |
Ofir Cohen | 43473c8 | 2012-01-25 16:28:13 +0200 | [diff] [blame] | 503 | .usb_active_bam = HSUSB_BAM, |
Ofir Cohen | 43473c8 | 2012-01-25 16:28:13 +0200 | [diff] [blame] | 504 | #else |
| 505 | .usb_active_bam = HSIC_BAM, |
Ofir Cohen | 43473c8 | 2012-01-25 16:28:13 +0200 | [diff] [blame] | 506 | #endif |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame^] | 507 | .usb_bam_num_pipes = 16, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 508 | }; |
| 509 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 510 | static struct msm_otg_platform_data msm_otg_pdata = { |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 511 | .mode = USB_OTG, |
| 512 | .otg_control = OTG_PHY_CONTROL, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 513 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 514 | .vbus_power = msm_hsusb_vbus_power, |
Ofir Cohen | 4da266f | 2012-01-03 10:19:29 +0200 | [diff] [blame] | 515 | .disable_reset_on_disconnect = true, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 516 | }; |
| 517 | |
Amit Blay | 5f968cf | 2012-01-22 12:04:01 +0200 | [diff] [blame] | 518 | #define PID_MAGIC_ID 0x71432909 |
| 519 | #define SERIAL_NUM_MAGIC_ID 0x61945374 |
| 520 | #define SERIAL_NUMBER_LENGTH 127 |
| 521 | #define DLOAD_USB_BASE_ADD 0x2B0000C8 |
| 522 | |
| 523 | struct magic_num_struct { |
| 524 | uint32_t pid; |
| 525 | uint32_t serial_num; |
| 526 | }; |
| 527 | |
| 528 | struct dload_struct { |
| 529 | uint32_t reserved1; |
| 530 | uint32_t reserved2; |
| 531 | uint32_t reserved3; |
| 532 | uint16_t reserved4; |
| 533 | uint16_t pid; |
| 534 | char serial_number[SERIAL_NUMBER_LENGTH]; |
| 535 | uint16_t reserved5; |
| 536 | struct magic_num_struct magic_struct; |
| 537 | }; |
| 538 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 539 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 540 | { |
Amit Blay | 5f968cf | 2012-01-22 12:04:01 +0200 | [diff] [blame] | 541 | struct dload_struct __iomem *dload = 0; |
| 542 | |
| 543 | dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); |
| 544 | if (!dload) { |
| 545 | pr_err("%s: cannot remap I/O memory region: %08x\n", |
| 546 | __func__, DLOAD_USB_BASE_ADD); |
| 547 | return -ENXIO; |
| 548 | } |
| 549 | |
| 550 | pr_debug("%s: dload:%p pid:%x serial_num:%s\n", |
| 551 | __func__, dload, pid, snum); |
| 552 | /* update pid */ |
| 553 | dload->magic_struct.pid = PID_MAGIC_ID; |
| 554 | dload->pid = pid; |
| 555 | |
| 556 | /* update serial number */ |
| 557 | dload->magic_struct.serial_num = 0; |
| 558 | if (!snum) { |
| 559 | memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH); |
| 560 | goto out; |
| 561 | } |
| 562 | |
| 563 | dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; |
| 564 | strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); |
| 565 | out: |
| 566 | iounmap(dload); |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 567 | return 0; |
| 568 | } |
| 569 | |
| 570 | static struct android_usb_platform_data android_usb_pdata = { |
| 571 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 572 | }; |
| 573 | |
| 574 | static struct platform_device android_usb_device = { |
| 575 | .name = "android_usb", |
| 576 | .id = -1, |
| 577 | .dev = { |
| 578 | .platform_data = &android_usb_pdata, |
| 579 | }, |
| 580 | }; |
| 581 | |
Rohit Vaswani | 149f0a7 | 2011-11-09 15:21:28 -0800 | [diff] [blame] | 582 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 583 | .name = "wlan_ar6000_pm_dev", |
| 584 | .id = -1, |
| 585 | }; |
| 586 | |
| 587 | static int __init msm9615_init_ar6000pm(void) |
| 588 | { |
| 589 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 590 | } |
| 591 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 592 | #ifdef CONFIG_LTC4088_CHARGER |
| 593 | static struct platform_device msm_device_charger = { |
| 594 | .name = LTC4088_CHARGER_DEV_NAME, |
| 595 | .id = -1, |
| 596 | .dev = { |
| 597 | .platform_data = <c4088_chg_pdata, |
| 598 | }, |
| 599 | }; |
| 600 | #endif |
| 601 | |
Siddartha Mohanadoss | 7e25dc1 | 2012-03-19 11:19:27 -0700 | [diff] [blame] | 602 | static struct tsens_platform_data msm_tsens_pdata = { |
| 603 | .tsens_factor = 1000, |
| 604 | .hw_type = MDM_9615, |
| 605 | .tsens_num_sensor = 5, |
| 606 | .slope = {1176, 1176, 1154, 1176, 1111}, |
| 607 | }; |
| 608 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 609 | static struct platform_device *common_devices[] = { |
| 610 | &msm9615_device_dmov, |
| 611 | &msm_device_smd, |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 612 | #ifdef CONFIG_LTC4088_CHARGER |
| 613 | &msm_device_charger, |
| 614 | #endif |
Lena Salman | 57d167e | 2012-03-21 19:46:38 +0200 | [diff] [blame] | 615 | #ifndef CONFIG_USB_CI13XXX_MSM_HSIC |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 616 | &msm_device_otg, |
Ofir Cohen | dca06cb | 2012-03-08 16:37:45 +0200 | [diff] [blame] | 617 | #endif |
Ofir Cohen | 73c99e8 | 2012-01-15 13:38:14 +0200 | [diff] [blame] | 618 | &msm_device_hsic_peripheral, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 619 | &msm_device_gadget_peripheral, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 620 | &msm_device_hsusb_host, |
Lena Salman | 65bcf37 | 2012-02-14 15:33:32 +0200 | [diff] [blame] | 621 | &msm_device_hsic_host, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 622 | &msm_device_usb_bam, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 623 | &android_usb_device, |
| 624 | &msm9615_device_uart_gsbi4, |
David Collins | 0f9942a | 2011-10-31 09:47:34 -0700 | [diff] [blame] | 625 | &msm9615_device_ext_2p95v_vreg, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 626 | &msm9615_device_ssbi_pmic1, |
| 627 | &msm9615_device_qup_i2c_gsbi5, |
| 628 | &msm9615_device_qup_spi_gsbi3, |
| 629 | &msm_device_sps, |
Sagar Dharia | 2a5378d | 2011-12-01 20:00:11 -0700 | [diff] [blame] | 630 | &msm9615_slim_ctrl, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 631 | &msm_device_nand, |
Eric Holmberg | 0c96e70 | 2011-11-08 18:04:31 -0700 | [diff] [blame] | 632 | &msm_device_bam_dmux, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 633 | &msm9615_rpm_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 634 | #ifdef CONFIG_HW_RANDOM_MSM |
| 635 | &msm_device_rng, |
| 636 | #endif |
| 637 | |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 638 | &msm_pcm, |
| 639 | &msm_multi_ch_pcm, |
| 640 | &msm_pcm_routing, |
| 641 | &msm_cpudai0, |
| 642 | &msm_cpudai1, |
| 643 | &msm_cpudai_bt_rx, |
| 644 | &msm_cpudai_bt_tx, |
| 645 | &msm_cpu_fe, |
| 646 | &msm_stub_codec, |
| 647 | &msm_voice, |
| 648 | &msm_voip, |
| 649 | &msm_pcm_hostless, |
| 650 | &msm_cpudai_afe_01_rx, |
| 651 | &msm_cpudai_afe_01_tx, |
| 652 | &msm_cpudai_afe_02_rx, |
| 653 | &msm_cpudai_afe_02_tx, |
| 654 | &msm_pcm_afe, |
| 655 | &msm_cpudai_auxpcm_rx, |
| 656 | &msm_cpudai_auxpcm_tx, |
| 657 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 658 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 659 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame] | 660 | &msm9615_qcrypto_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 661 | #endif |
| 662 | |
| 663 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 664 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame] | 665 | &msm9615_qcedev_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 666 | #endif |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 667 | &msm9615_device_watchdog, |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 668 | &msm_bus_9615_sys_fabric, |
| 669 | &msm_bus_def_fab, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 670 | &msm9615_rpm_log_device, |
| 671 | &msm9615_rpm_stat_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 672 | }; |
| 673 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 674 | static void __init msm9615_i2c_init(void) |
| 675 | { |
| 676 | msm9615_device_qup_i2c_gsbi5.dev.platform_data = |
| 677 | &msm9615_i2c_qup_gsbi5_pdata; |
| 678 | } |
| 679 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 680 | static void __init msm9615_reserve(void) |
| 681 | { |
| 682 | msm_pm_boot_pdata.p_addr = memblock_alloc(SZ_8, SZ_64K); |
| 683 | } |
| 684 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 685 | static void __init msm9615_common_init(void) |
| 686 | { |
| 687 | msm9615_device_init(); |
Rohit Vaswani | a681589 | 2011-12-15 20:20:39 -0800 | [diff] [blame] | 688 | msm9615_init_gpiomux(); |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 689 | msm9615_i2c_init(); |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 690 | regulator_suppress_info_printing(); |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 691 | platform_device_register(&msm9615_device_rpm_regulator); |
Vikram Mulukutla | 2021c00 | 2011-12-16 12:32:59 -0800 | [diff] [blame] | 692 | msm_xo_init(); |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 693 | msm_clock_init(&msm9615_clock_init_data); |
| 694 | msm9615_init_buses(); |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 695 | msm9615_device_qup_spi_gsbi3.dev.platform_data = |
| 696 | &msm9615_qup_spi_gsbi3_pdata; |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 697 | msm9615_device_ssbi_pmic1.dev.platform_data = |
| 698 | &msm9615_ssbi_pm8018_pdata; |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 699 | pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len; |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 700 | |
| 701 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 702 | msm_otg_pdata.phy_init_seq = shelby_phy_init_seq; |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 703 | msm_device_usb_bam.dev.platform_data = &msm_usb_bam_pdata; |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 704 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 705 | |
Vikram Mulukutla | b5e1cda | 2011-10-04 16:17:22 -0700 | [diff] [blame] | 706 | acpuclk_init(&acpuclk_9615_soc_data); |
| 707 | |
Rohit Vaswani | 149f0a7 | 2011-11-09 15:21:28 -0800 | [diff] [blame] | 708 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 709 | msm9615_init_ar6000pm(); |
| 710 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 711 | msm9615_init_mmc(); |
Sagar Dharia | 2a5378d | 2011-12-01 20:00:11 -0700 | [diff] [blame] | 712 | slim_register_board_info(msm_slim_devices, |
| 713 | ARRAY_SIZE(msm_slim_devices)); |
Maheshkumar Sivasubramanian | 4923db2 | 2011-09-15 09:28:15 -0600 | [diff] [blame] | 714 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 715 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 716 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 717 | msm_pm_data); |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 718 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Siddartha Mohanadoss | 7e25dc1 | 2012-03-19 11:19:27 -0700 | [diff] [blame] | 719 | msm_tsens_early_init(&msm_tsens_pdata); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 720 | } |
| 721 | |
| 722 | static void __init msm9615_cdp_init(void) |
| 723 | { |
| 724 | msm9615_common_init(); |
| 725 | } |
| 726 | |
| 727 | static void __init msm9615_mtp_init(void) |
| 728 | { |
| 729 | msm9615_common_init(); |
| 730 | } |
| 731 | |
| 732 | MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP") |
| 733 | .map_io = msm9615_map_io, |
| 734 | .init_irq = msm9615_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 735 | .handle_irq = gic_handle_irq, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 736 | .timer = &msm_timer, |
| 737 | .init_machine = msm9615_cdp_init, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 738 | .reserve = msm9615_reserve, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 739 | MACHINE_END |
| 740 | |
| 741 | MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP") |
| 742 | .map_io = msm9615_map_io, |
| 743 | .init_irq = msm9615_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 744 | .handle_irq = gic_handle_irq, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 745 | .timer = &msm_timer, |
| 746 | .init_machine = msm9615_mtp_init, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 747 | .reserve = msm9615_reserve, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 748 | MACHINE_END |