Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. 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> |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 30 | #include <linux/gpio.h> |
Siddartha Mohanadoss | 7e25dc1 | 2012-03-19 11:19:27 -0700 | [diff] [blame] | 31 | #include <linux/msm_tsens.h> |
Mitchel Humpherys | 968bee0 | 2012-09-06 11:34:35 -0700 | [diff] [blame] | 32 | #include <linux/msm_ion.h> |
Olav Haugan | e6a0acd | 2012-04-05 09:29:12 -0700 | [diff] [blame] | 33 | #include <linux/memory.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 34 | #include <asm/mach-types.h> |
| 35 | #include <asm/mach/arch.h> |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 36 | #include <asm/hardware/gic.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 37 | #include <mach/board.h> |
| 38 | #include <mach/msm_iomap.h> |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 39 | #include <mach/socinfo.h> |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 40 | #include <mach/msm_spi.h> |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 41 | #include <mach/msm_bus_board.h> |
Vikram Mulukutla | 2021c00 | 2011-12-16 12:32:59 -0800 | [diff] [blame] | 42 | #include <mach/msm_xo.h> |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 43 | #include <mach/dma.h> |
Olav Haugan | e6a0acd | 2012-04-05 09:29:12 -0700 | [diff] [blame] | 44 | #include <mach/ion.h> |
| 45 | #include <mach/msm_memtypes.h> |
Amit Blay | e5bb35e | 2012-05-08 20:38:20 +0300 | [diff] [blame] | 46 | #include <mach/cpuidle.h> |
| 47 | #include <mach/usb_bam.h> |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 48 | #include <mach/restart.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 49 | #include "timer.h" |
| 50 | #include "devices.h" |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 51 | #include "board-9615.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 52 | #include "pm.h" |
Matt Wagantall | 33d01f5 | 2012-02-23 23:27:44 -0800 | [diff] [blame] | 53 | #include "clock.h" |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 54 | #include "pm-boot.h" |
Venkat Sudhir | 5efc491 | 2012-05-15 17:10:35 -0700 | [diff] [blame] | 55 | #include <mach/gpiomux.h> |
Ido Shayevitz | 479f2eb | 2012-06-27 10:39:57 +0300 | [diff] [blame] | 56 | #include "ci13xxx_udc.h" |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 57 | |
Olav Haugan | e6a0acd | 2012-04-05 09:29:12 -0700 | [diff] [blame] | 58 | #ifdef CONFIG_ION_MSM |
| 59 | #define MSM_ION_AUDIO_SIZE 0xAF000 |
| 60 | #define MSM_ION_HEAP_NUM 3 |
| 61 | #define MSM_KERNEL_EBI_SIZE 0x51000 |
| 62 | |
| 63 | static struct memtype_reserve msm9615_reserve_table[] __initdata = { |
| 64 | [MEMTYPE_SMI] = { |
| 65 | }, |
| 66 | [MEMTYPE_EBI0] = { |
| 67 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 68 | }, |
| 69 | [MEMTYPE_EBI1] = { |
| 70 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 71 | }, |
| 72 | }; |
| 73 | |
| 74 | static int msm9615_paddr_to_memtype(unsigned int paddr) |
| 75 | { |
| 76 | return MEMTYPE_EBI1; |
| 77 | } |
| 78 | |
| 79 | static struct ion_co_heap_pdata co_ion_pdata = { |
| 80 | .adjacent_mem_id = INVALID_HEAP_ID, |
| 81 | .align = PAGE_SIZE, |
| 82 | }; |
| 83 | |
Benjamin Gaignard | 63d8103 | 2012-06-25 15:27:30 -0700 | [diff] [blame] | 84 | static struct ion_platform_heap msm9615_heaps[] = { |
Olav Haugan | e6a0acd | 2012-04-05 09:29:12 -0700 | [diff] [blame] | 85 | { |
| 86 | .id = ION_SYSTEM_HEAP_ID, |
| 87 | .type = ION_HEAP_TYPE_SYSTEM, |
| 88 | .name = ION_VMALLOC_HEAP_NAME, |
| 89 | }, |
| 90 | { |
| 91 | .id = ION_IOMMU_HEAP_ID, |
| 92 | .type = ION_HEAP_TYPE_IOMMU, |
| 93 | .name = ION_IOMMU_HEAP_NAME, |
| 94 | }, |
| 95 | { |
| 96 | .id = ION_AUDIO_HEAP_ID, |
| 97 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 98 | .name = ION_AUDIO_HEAP_NAME, |
| 99 | .size = MSM_ION_AUDIO_SIZE, |
| 100 | .memory_type = ION_EBI_TYPE, |
| 101 | .extra_data = (void *) &co_ion_pdata, |
| 102 | }, |
Benjamin Gaignard | 63d8103 | 2012-06-25 15:27:30 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | static struct ion_platform_data ion_pdata = { |
| 106 | .nr = MSM_ION_HEAP_NUM, |
| 107 | .heaps = msm9615_heaps, |
Olav Haugan | e6a0acd | 2012-04-05 09:29:12 -0700 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | static struct platform_device ion_dev = { |
| 111 | .name = "ion-msm", |
| 112 | .id = 1, |
| 113 | .dev = { .platform_data = &ion_pdata }, |
| 114 | }; |
| 115 | |
Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 116 | static void __init reserve_ion_memory(void) |
Olav Haugan | e6a0acd | 2012-04-05 09:29:12 -0700 | [diff] [blame] | 117 | { |
| 118 | msm9615_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE; |
| 119 | } |
| 120 | |
| 121 | static void __init msm9615_calculate_reserve_sizes(void) |
| 122 | { |
| 123 | reserve_ion_memory(); |
| 124 | msm9615_reserve_table[MEMTYPE_EBI1].size += MSM_KERNEL_EBI_SIZE; |
| 125 | } |
| 126 | |
| 127 | static struct reserve_info msm9615_reserve_info __initdata = { |
| 128 | .memtype_reserve_table = msm9615_reserve_table, |
| 129 | .calculate_reserve_sizes = msm9615_calculate_reserve_sizes, |
| 130 | .paddr_to_memtype = msm9615_paddr_to_memtype, |
| 131 | }; |
| 132 | #endif |
| 133 | |
Jay Chokshi | 215f7be | 2012-02-09 18:30:44 -0800 | [diff] [blame] | 134 | struct pm8xxx_gpio_init { |
| 135 | unsigned gpio; |
| 136 | struct pm_gpio config; |
| 137 | }; |
| 138 | |
| 139 | struct pm8xxx_mpp_init { |
| 140 | unsigned mpp; |
| 141 | struct pm8xxx_mpp_config_data config; |
| 142 | }; |
| 143 | |
| 144 | #define PM8018_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \ |
| 145 | _func, _inv, _disable) \ |
| 146 | { \ |
| 147 | .gpio = PM8018_GPIO_PM_TO_SYS(_gpio), \ |
| 148 | .config = { \ |
| 149 | .direction = _dir, \ |
| 150 | .output_buffer = _buf, \ |
| 151 | .output_value = _val, \ |
| 152 | .pull = _pull, \ |
| 153 | .vin_sel = _vin, \ |
| 154 | .out_strength = _out_strength, \ |
| 155 | .function = _func, \ |
| 156 | .inv_int_pol = _inv, \ |
| 157 | .disable_pin = _disable, \ |
| 158 | } \ |
| 159 | } |
| 160 | |
| 161 | #define PM8018_MPP_INIT(_mpp, _type, _level, _control) \ |
| 162 | { \ |
| 163 | .mpp = PM8018_MPP_PM_TO_SYS(_mpp), \ |
| 164 | .config = { \ |
| 165 | .type = PM8XXX_MPP_TYPE_##_type, \ |
| 166 | .level = _level, \ |
| 167 | .control = PM8XXX_MPP_##_control, \ |
| 168 | } \ |
| 169 | } |
| 170 | |
| 171 | #define PM8018_GPIO_DISABLE(_gpio) \ |
| 172 | PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM8018_GPIO_VIN_S3, \ |
| 173 | 0, 0, 0, 1) |
| 174 | |
| 175 | #define PM8018_GPIO_OUTPUT(_gpio, _val, _strength) \ |
| 176 | PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
| 177 | PM_GPIO_PULL_NO, PM8018_GPIO_VIN_S3, \ |
| 178 | PM_GPIO_STRENGTH_##_strength, \ |
| 179 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 180 | |
| 181 | #define PM8018_GPIO_INPUT(_gpio, _pull) \ |
| 182 | PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \ |
| 183 | _pull, PM8018_GPIO_VIN_S3, \ |
| 184 | PM_GPIO_STRENGTH_NO, \ |
| 185 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 186 | |
| 187 | #define PM8018_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \ |
| 188 | PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
| 189 | PM_GPIO_PULL_NO, PM8018_GPIO_VIN_S3, \ |
| 190 | PM_GPIO_STRENGTH_HIGH, \ |
| 191 | _func, 0, 0) |
| 192 | |
| 193 | #define PM8018_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \ |
| 194 | PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
| 195 | PM_GPIO_PULL_NO, _vin, \ |
| 196 | PM_GPIO_STRENGTH_HIGH, \ |
| 197 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 198 | |
| 199 | /* Initial PM8018 GPIO configurations */ |
| 200 | static struct pm8xxx_gpio_init pm8018_gpios[] __initdata = { |
Pavan Kumar | 8eb05b3 | 2012-06-27 17:39:15 -0700 | [diff] [blame] | 201 | PM8018_GPIO_OUTPUT(2, 0, HIGH), /* EXT_LDO_EN_WLAN */ |
| 202 | PM8018_GPIO_OUTPUT(6, 0, LOW), /* WLAN_CLK_PWR_REQ */ |
Jay Chokshi | 215f7be | 2012-02-09 18:30:44 -0800 | [diff] [blame] | 203 | }; |
| 204 | |
| 205 | /* Initial PM8018 MPP configurations */ |
| 206 | static struct pm8xxx_mpp_init pm8018_mpps[] __initdata = { |
| 207 | }; |
| 208 | |
| 209 | void __init msm9615_pm8xxx_gpio_mpp_init(void) |
| 210 | { |
| 211 | int i, rc; |
| 212 | |
| 213 | for (i = 0; i < ARRAY_SIZE(pm8018_gpios); i++) { |
| 214 | rc = pm8xxx_gpio_config(pm8018_gpios[i].gpio, |
| 215 | &pm8018_gpios[i].config); |
| 216 | if (rc) { |
| 217 | pr_err("%s: pm8018_gpio_config: rc=%d\n", __func__, rc); |
| 218 | break; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | for (i = 0; i < ARRAY_SIZE(pm8018_mpps); i++) { |
| 223 | rc = pm8xxx_mpp_config(pm8018_mpps[i].mpp, |
| 224 | &pm8018_mpps[i].config); |
| 225 | if (rc) { |
| 226 | pr_err("%s: pm8018_mpp_config: rc=%d\n", __func__, rc); |
| 227 | break; |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 232 | static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = { |
| 233 | {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 234 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 235 | {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 236 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 237 | {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 238 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
Siddartha Mohanadoss | f9383d5 | 2012-04-19 09:42:49 -0700 | [diff] [blame] | 239 | /* AMUX8 is used to read either Batt_id/Batt_therm. |
| 240 | * Current configuration is to support Batt_id. If clients |
| 241 | * want to read the Batt_therm, the scaling function needs to be |
| 242 | * updated to use ADC_SCALE_BATT_THERM instead of ADC_SCALE_DEFAULT. |
| 243 | * E.g. |
| 244 | * {"batt_therm", CHANNEL_BATT_ID_THERM, CHAN_PATH_SCALING1, |
| 245 | * AMUX_RSV2, ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM}, |
| 246 | */ |
| 247 | {"batt_id", CHANNEL_BATT_ID_THERM, CHAN_PATH_SCALING1, |
| 248 | AMUX_RSV2, ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 249 | {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 250 | ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM}, |
| 251 | {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 252 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 253 | {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 254 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 255 | {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 256 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
Dipen Parmar | 1eaeec9 | 2013-01-02 11:45:33 +0530 | [diff] [blame] | 257 | {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0, |
| 258 | ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM}, |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 259 | }; |
| 260 | |
| 261 | static struct pm8xxx_adc_properties pm8018_adc_data = { |
| 262 | .adc_vdd_reference = 1800, /* milli-voltage for this adc */ |
| 263 | .bitresolution = 15, |
| 264 | .bipolar = 0, |
| 265 | }; |
| 266 | |
| 267 | static struct pm8xxx_adc_platform_data pm8018_adc_pdata = { |
| 268 | .adc_channel = pm8018_adc_channels_data, |
| 269 | .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data), |
| 270 | .adc_prop = &pm8018_adc_data, |
| 271 | }; |
| 272 | |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 273 | static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = { |
| 274 | .irq_base = PM8018_IRQ_BASE, |
| 275 | .devirq = MSM_GPIO_TO_INT(87), |
| 276 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 277 | }; |
| 278 | |
| 279 | static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = { |
| 280 | .gpio_base = PM8018_GPIO_PM_TO_SYS(1), |
| 281 | }; |
| 282 | |
| 283 | static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = { |
| 284 | .mpp_base = PM8018_MPP_PM_TO_SYS(1), |
| 285 | }; |
| 286 | |
| 287 | static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = { |
| 288 | .rtc_write_enable = false, |
Ashay Jaiswal | db5e6dc | 2011-10-12 11:02:47 +0530 | [diff] [blame] | 289 | .rtc_alarm_powerup = false, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 290 | }; |
| 291 | |
| 292 | static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = { |
| 293 | .pull_up = 1, |
Jing Lin | eecdc06 | 2011-11-17 09:47:09 -0800 | [diff] [blame] | 294 | .kpd_trigger_delay_us = 15625, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 295 | .wakeup = 1, |
| 296 | }; |
| 297 | |
| 298 | static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = { |
| 299 | .priority = 0, |
| 300 | }; |
| 301 | |
Jay Chokshi | eb5d0d5 | 2011-09-28 17:16:20 -0700 | [diff] [blame] | 302 | #define PM8018_LED_KB_MAX_CURRENT 20 /* I = 20mA */ |
| 303 | #define PM8XXX_LED_PWM_PERIOD_US 1000 |
| 304 | |
| 305 | /** |
| 306 | * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be |
| 307 | * driven using PWM feature. |
| 308 | */ |
| 309 | #define PM8XXX_PWM_CHANNEL_NONE -1 |
| 310 | |
| 311 | static struct led_info pm8018_led_info[] = { |
| 312 | [0] = { |
| 313 | .name = "led:kb", |
| 314 | }, |
| 315 | }; |
| 316 | |
| 317 | static struct led_platform_data pm8018_led_core_pdata = { |
| 318 | .num_leds = ARRAY_SIZE(pm8018_led_info), |
| 319 | .leds = pm8018_led_info, |
| 320 | }; |
| 321 | |
| 322 | static struct pm8xxx_led_config pm8018_led_configs[] = { |
| 323 | [0] = { |
| 324 | .id = PM8XXX_ID_LED_KB_LIGHT, |
| 325 | .mode = PM8XXX_LED_MODE_PWM3, |
| 326 | .max_current = PM8018_LED_KB_MAX_CURRENT, |
| 327 | .pwm_channel = 2, |
| 328 | .pwm_period_us = PM8XXX_LED_PWM_PERIOD_US, |
| 329 | }, |
| 330 | }; |
| 331 | |
| 332 | static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = { |
| 333 | .led_core = &pm8018_led_core_pdata, |
| 334 | .configs = pm8018_led_configs, |
| 335 | .num_configs = ARRAY_SIZE(pm8018_led_configs), |
| 336 | }; |
| 337 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 338 | #ifdef CONFIG_LTC4088_CHARGER |
| 339 | static struct ltc4088_charger_platform_data ltc4088_chg_pdata = { |
| 340 | .gpio_mode_select_d0 = 7, |
| 341 | .gpio_mode_select_d1 = 6, |
| 342 | .gpio_mode_select_d2 = 4, |
| 343 | }; |
| 344 | #endif |
| 345 | |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 346 | static struct pm8018_platform_data pm8018_platform_data __devinitdata = { |
| 347 | .irq_pdata = &pm8xxx_irq_pdata, |
| 348 | .gpio_pdata = &pm8xxx_gpio_pdata, |
| 349 | .mpp_pdata = &pm8xxx_mpp_pdata, |
| 350 | .rtc_pdata = &pm8xxx_rtc_pdata, |
| 351 | .pwrkey_pdata = &pm8xxx_pwrkey_pdata, |
| 352 | .misc_pdata = &pm8xxx_misc_pdata, |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 353 | .regulator_pdatas = msm_pm8018_regulator_pdata, |
Siddartha Mohanadoss | 5f60b45 | 2011-10-05 11:49:00 -0700 | [diff] [blame] | 354 | .adc_pdata = &pm8018_adc_pdata, |
Jay Chokshi | eb5d0d5 | 2011-09-28 17:16:20 -0700 | [diff] [blame] | 355 | .leds_pdata = &pm8xxx_leds_pdata, |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 356 | }; |
| 357 | |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 358 | static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = { |
| 359 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 360 | .slave = { |
David Collins | fb88c43 | 2011-08-25 15:12:47 -0700 | [diff] [blame] | 361 | .name = PM8018_CORE_DEV_NAME, |
| 362 | .platform_data = &pm8018_platform_data, |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 363 | }, |
| 364 | }; |
| 365 | |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 366 | static struct platform_device msm9615_device_rpm_regulator __devinitdata = { |
| 367 | .name = "rpm-regulator", |
| 368 | .id = -1, |
| 369 | .dev = { |
| 370 | .platform_data = &msm_rpm_regulator_9615_pdata, |
| 371 | }, |
| 372 | }; |
| 373 | |
David Collins | 0f9942a | 2011-10-31 09:47:34 -0700 | [diff] [blame] | 374 | static struct platform_device msm9615_device_ext_2p95v_vreg = { |
| 375 | .name = GPIO_REGULATOR_DEV_NAME, |
| 376 | .id = 18, |
| 377 | .dev = { |
| 378 | .platform_data = |
| 379 | &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P95V], |
| 380 | }, |
| 381 | }; |
| 382 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 383 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 384 | .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR, |
| 385 | .v_addr = MSM_APCS_GLB_BASE + 0x24, |
| 386 | }; |
| 387 | |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 388 | static void __init msm9615_init_buses(void) |
| 389 | { |
| 390 | #ifdef CONFIG_MSM_BUS_SCALING |
| 391 | msm_bus_rpm_set_mt_mask(); |
| 392 | msm_bus_9615_sys_fabric_pdata.rpm_enabled = 1; |
| 393 | msm_bus_9615_sys_fabric.dev.platform_data = |
| 394 | &msm_bus_9615_sys_fabric_pdata; |
| 395 | msm_bus_def_fab.dev.platform_data = &msm_bus_9615_def_fab_pdata; |
| 396 | #endif |
| 397 | } |
| 398 | |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 399 | #ifdef CONFIG_WCD9310_CODEC |
| 400 | |
| 401 | #define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS) |
| 402 | |
Venkat Sudhir | 5efc491 | 2012-05-15 17:10:35 -0700 | [diff] [blame] | 403 | /* |
| 404 | * MDM9x15 I2S. |
| 405 | */ |
| 406 | static struct wcd9xxx_pdata wcd9xxx_i2c_platform_data = { |
| 407 | .irq = MSM_GPIO_TO_INT(85), |
| 408 | .irq_base = TABLA_INTERRUPT_BASE, |
| 409 | .num_irqs = NR_TABLA_IRQS, |
| 410 | .reset_gpio = 84, |
| 411 | .micbias = { |
| 412 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 413 | .cfilt1_mv = 1800, |
| 414 | .cfilt2_mv = 1800, |
| 415 | .cfilt3_mv = 1800, |
| 416 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 417 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 418 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 419 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 420 | }, |
| 421 | .regulator = { |
| 422 | { |
| 423 | .name = "CDC_VDD_CP", |
| 424 | .min_uV = 1800000, |
| 425 | .max_uV = 1800000, |
| 426 | .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, |
| 427 | }, |
| 428 | { |
| 429 | .name = "CDC_VDDA_RX", |
| 430 | .min_uV = 1800000, |
| 431 | .max_uV = 1800000, |
| 432 | .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, |
| 433 | }, |
| 434 | { |
| 435 | .name = "CDC_VDDA_TX", |
| 436 | .min_uV = 1800000, |
| 437 | .max_uV = 1800000, |
| 438 | .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, |
| 439 | }, |
| 440 | { |
| 441 | .name = "VDDIO_CDC", |
| 442 | .min_uV = 1800000, |
| 443 | .max_uV = 1800000, |
| 444 | .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, |
| 445 | }, |
| 446 | { |
| 447 | .name = "VDDD_CDC_D", |
| 448 | .min_uV = 1225000, |
| 449 | .max_uV = 1225000, |
| 450 | .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, |
| 451 | }, |
| 452 | { |
| 453 | .name = "CDC_VDDA_A_1P2V", |
| 454 | .min_uV = 1225000, |
| 455 | .max_uV = 1225000, |
| 456 | .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, |
| 457 | } |
| 458 | }, |
| 459 | }; |
| 460 | |
| 461 | static struct i2c_board_info wcd9xxx_device_info[] __initdata = { |
| 462 | { |
| 463 | I2C_BOARD_INFO("tabla top level", TABLA_I2C_SLAVE_ADDR), |
| 464 | .platform_data = &wcd9xxx_i2c_platform_data, |
| 465 | }, |
| 466 | { |
| 467 | I2C_BOARD_INFO("tabla analog", TABLA_ANALOG_I2C_SLAVE_ADDR), |
| 468 | .platform_data = &wcd9xxx_i2c_platform_data, |
| 469 | }, |
| 470 | { |
| 471 | I2C_BOARD_INFO("tabla digital1", TABLA_DIGITAL1_I2C_SLAVE_ADDR), |
| 472 | .platform_data = &wcd9xxx_i2c_platform_data, |
| 473 | }, |
| 474 | { |
| 475 | I2C_BOARD_INFO("tabla digital2", TABLA_DIGITAL2_I2C_SLAVE_ADDR), |
| 476 | .platform_data = &wcd9xxx_i2c_platform_data, |
| 477 | }, |
| 478 | }; |
| 479 | |
Venkat Sudhir | 5efc491 | 2012-05-15 17:10:35 -0700 | [diff] [blame] | 480 | /* |
| 481 | * MDM9x15 I2S. |
| 482 | */ |
| 483 | |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 484 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 485 | * 4 micbiases are used to power various analog and digital |
| 486 | * microphones operating at 1800 mV. Technically, all micbiases |
| 487 | * can source from single cfilter since all microphones operate |
| 488 | * at the same voltage level. The arrangement below is to make |
| 489 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 490 | * does not need to be as high as 2.85V. It is choosen for |
| 491 | * microphone sensitivity purpose. |
| 492 | */ |
| 493 | |
| 494 | static struct wcd9xxx_pdata tabla20_platform_data = { |
| 495 | .slimbus_slave_device = { |
| 496 | .name = "tabla-slave", |
| 497 | .e_addr = {0, 0, 0x60, 0, 0x17, 2}, |
| 498 | }, |
Shiv Maliyappanahalli | d714781 | 2012-05-17 12:43:03 -0700 | [diff] [blame] | 499 | .irq = MSM_GPIO_TO_INT(85), |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 500 | .irq_base = TABLA_INTERRUPT_BASE, |
| 501 | .num_irqs = NR_WCD9XXX_IRQS, |
| 502 | .reset_gpio = 84, |
| 503 | .micbias = { |
| 504 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 505 | .cfilt1_mv = 1800, |
| 506 | .cfilt2_mv = 1800, |
| 507 | .cfilt3_mv = 1800, |
| 508 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 509 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 510 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 511 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 512 | }, |
| 513 | .regulator = { |
| 514 | { |
| 515 | .name = "CDC_VDD_CP", |
| 516 | .min_uV = 1800000, |
| 517 | .max_uV = 1800000, |
| 518 | .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, |
| 519 | }, |
| 520 | { |
| 521 | .name = "CDC_VDDA_RX", |
| 522 | .min_uV = 1800000, |
| 523 | .max_uV = 1800000, |
| 524 | .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, |
| 525 | }, |
| 526 | { |
| 527 | .name = "CDC_VDDA_TX", |
| 528 | .min_uV = 1800000, |
| 529 | .max_uV = 1800000, |
| 530 | .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, |
| 531 | }, |
| 532 | { |
| 533 | .name = "VDDIO_CDC", |
| 534 | .min_uV = 1800000, |
| 535 | .max_uV = 1800000, |
| 536 | .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, |
| 537 | }, |
| 538 | { |
| 539 | .name = "VDDD_CDC_D", |
| 540 | .min_uV = 1225000, |
| 541 | .max_uV = 1225000, |
| 542 | .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, |
| 543 | }, |
| 544 | { |
| 545 | .name = "CDC_VDDA_A_1P2V", |
| 546 | .min_uV = 1225000, |
| 547 | .max_uV = 1225000, |
| 548 | .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, |
| 549 | }, |
| 550 | }, |
| 551 | }; |
| 552 | |
| 553 | static struct slim_device msm_slim_tabla20 = { |
| 554 | .name = "tabla2x-slim", |
| 555 | .e_addr = {0, 1, 0x60, 0, 0x17, 2}, |
| 556 | .dev = { |
| 557 | .platform_data = &tabla20_platform_data, |
| 558 | }, |
| 559 | }; |
| 560 | #endif |
| 561 | |
Shiv Maliyappanahalli | 3631cfb | 2012-05-31 15:53:24 -0700 | [diff] [blame] | 562 | static struct i2c_registry msm9615_i2c_devices[] __initdata = { |
| 563 | #ifdef CONFIG_WCD9310_CODEC |
| 564 | { |
| 565 | I2C_SURF | I2C_FFA | I2C_FLUID, |
| 566 | MSM_9615_GSBI5_QUP_I2C_BUS_ID, |
| 567 | wcd9xxx_device_info, |
| 568 | ARRAY_SIZE(wcd9xxx_device_info), |
| 569 | }, |
| 570 | #endif |
| 571 | }; |
| 572 | |
Sagar Dharia | 2a5378d | 2011-12-01 20:00:11 -0700 | [diff] [blame] | 573 | static struct slim_boardinfo msm_slim_devices[] = { |
| 574 | /* add slimbus slaves as needed */ |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 575 | #ifdef CONFIG_WCD9310_CODEC |
| 576 | { |
| 577 | .bus_num = 1, |
| 578 | .slim_slave = &msm_slim_tabla20, |
| 579 | }, |
| 580 | #endif |
Sagar Dharia | 2a5378d | 2011-12-01 20:00:11 -0700 | [diff] [blame] | 581 | }; |
| 582 | |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 583 | static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = { |
| 584 | .max_clock_speed = 24000000, |
| 585 | }; |
| 586 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 587 | static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = { |
| 588 | .clk_freq = 100000, |
| 589 | .src_clk_rate = 24000000, |
| 590 | }; |
| 591 | |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 592 | #define USB_5V_EN 3 |
| 593 | #define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN) |
| 594 | |
Mayank Rana | 8549e63 | 2012-01-23 12:49:54 +0530 | [diff] [blame] | 595 | static int msm_hsusb_vbus_power(bool on) |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 596 | { |
Amit Blay | a4416f9 | 2012-01-24 21:03:52 +0200 | [diff] [blame] | 597 | int rc; |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 598 | struct pm_gpio usb_vbus = { |
| 599 | .direction = PM_GPIO_DIR_OUT, |
| 600 | .pull = PM_GPIO_PULL_NO, |
| 601 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 602 | .vin_sel = 2, |
| 603 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 604 | .function = PM_GPIO_FUNC_NORMAL, |
| 605 | .inv_int_pol = 0, |
| 606 | }; |
| 607 | |
Amit Blay | a4416f9 | 2012-01-24 21:03:52 +0200 | [diff] [blame] | 608 | usb_vbus.output_value = on; |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 609 | |
Amit Blay | a4416f9 | 2012-01-24 21:03:52 +0200 | [diff] [blame] | 610 | rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus); |
| 611 | if (rc) |
| 612 | pr_err("failed to config usb_5v_en gpio\n"); |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 613 | |
Mayank Rana | 8549e63 | 2012-01-23 12:49:54 +0530 | [diff] [blame] | 614 | return rc; |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 615 | } |
| 616 | |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 617 | static int shelby_phy_init_seq[] = { |
| 618 | 0x44, 0x80,/* set VBUS valid threshold and |
| 619 | disconnect valid threshold */ |
Chiranjeevi Velempati | f983aeb | 2012-08-23 08:16:50 +0530 | [diff] [blame] | 620 | 0x68, 0x81, /* update DC voltage level */ |
Amit Blay | dbaeff8 | 2012-04-02 22:13:36 +0300 | [diff] [blame] | 621 | 0x24, 0x82,/* set preemphasis and rise/fall time */ |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 622 | 0x13, 0x83,/* set source impedance adjustment */ |
| 623 | -1}; |
| 624 | |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 625 | #define USB_BAM_PHY_BASE 0x12502000 |
Ofir Cohen | 43473c8 | 2012-01-25 16:28:13 +0200 | [diff] [blame] | 626 | #define HSIC_BAM_PHY_BASE 0x12542000 |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 627 | #define A2_BAM_PHY_BASE 0x124C2000 |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 628 | static struct usb_bam_pipe_connect msm_usb_bam_connections[] = { |
| 629 | { |
| 630 | .name = "hsusb-a2-out-0", |
| 631 | .bam_type = HSUSB_BAM, |
| 632 | .peer_bam = A2_P_BAM, |
| 633 | .dir = USB_TO_PEER_PERIPHERAL, |
| 634 | .pipe_num = 0, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 635 | .src_phy_addr = USB_BAM_PHY_BASE, |
| 636 | .src_pipe_index = 11, |
| 637 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 638 | .dst_pipe_index = 0, |
Ofir Cohen | 29cd575 | 2011-12-14 17:20:30 +0200 | [diff] [blame] | 639 | .data_fifo_base_offset = 0x1100, |
| 640 | .data_fifo_size = 0x600, |
| 641 | .desc_fifo_base_offset = 0x1700, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 642 | .desc_fifo_size = 0x300, |
| 643 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 644 | { |
| 645 | .name = "hsusb-a2-in-0", |
| 646 | .bam_type = HSUSB_BAM, |
| 647 | .peer_bam = A2_P_BAM, |
| 648 | .dir = PEER_PERIPHERAL_TO_USB, |
| 649 | .pipe_num = 0, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 650 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 651 | .src_pipe_index = 1, |
| 652 | .dst_phy_addr = USB_BAM_PHY_BASE, |
| 653 | .dst_pipe_index = 10, |
| 654 | .data_fifo_base_offset = 0xa00, |
Ofir Cohen | 29cd575 | 2011-12-14 17:20:30 +0200 | [diff] [blame] | 655 | .data_fifo_size = 0x600, |
| 656 | .desc_fifo_base_offset = 0x1000, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 657 | .desc_fifo_size = 0x100, |
| 658 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 659 | { |
| 660 | .name = "hsusb-a2-out-1", |
| 661 | .bam_type = HSUSB_BAM, |
| 662 | .peer_bam = A2_P_BAM, |
| 663 | .dir = USB_TO_PEER_PERIPHERAL, |
| 664 | .pipe_num = 1, |
Anna Perel | 2151516 | 2012-02-02 20:50:02 +0200 | [diff] [blame] | 665 | .src_phy_addr = USB_BAM_PHY_BASE, |
| 666 | .src_pipe_index = 13, |
| 667 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 668 | .dst_pipe_index = 2, |
| 669 | .data_fifo_base_offset = 0x2100, |
| 670 | .data_fifo_size = 0x600, |
| 671 | .desc_fifo_base_offset = 0x2700, |
| 672 | .desc_fifo_size = 0x300, |
| 673 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 674 | { |
| 675 | .name = "hsusb-a2-in-1", |
| 676 | .bam_type = HSUSB_BAM, |
| 677 | .peer_bam = A2_P_BAM, |
| 678 | .dir = PEER_PERIPHERAL_TO_USB, |
| 679 | .pipe_num = 1, |
Anna Perel | 2151516 | 2012-02-02 20:50:02 +0200 | [diff] [blame] | 680 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 681 | .src_pipe_index = 3, |
| 682 | .dst_phy_addr = USB_BAM_PHY_BASE, |
| 683 | .dst_pipe_index = 12, |
| 684 | .data_fifo_base_offset = 0x1a00, |
| 685 | .data_fifo_size = 0x600, |
| 686 | .desc_fifo_base_offset = 0x2000, |
| 687 | .desc_fifo_size = 0x100, |
| 688 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 689 | { |
| 690 | .name = "hsusb-a2-out-2", |
| 691 | .bam_type = HSUSB_BAM, |
| 692 | .peer_bam = A2_P_BAM, |
| 693 | .dir = USB_TO_PEER_PERIPHERAL, |
| 694 | .pipe_num = 2, |
Anna Perel | 2151516 | 2012-02-02 20:50:02 +0200 | [diff] [blame] | 695 | .src_phy_addr = USB_BAM_PHY_BASE, |
| 696 | .src_pipe_index = 15, |
| 697 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 698 | .dst_pipe_index = 4, |
| 699 | .data_fifo_base_offset = 0x3100, |
| 700 | .data_fifo_size = 0x600, |
| 701 | .desc_fifo_base_offset = 0x3700, |
| 702 | .desc_fifo_size = 0x300, |
| 703 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 704 | { |
| 705 | .name = "hsusb-a2-in-2", |
| 706 | .bam_type = HSUSB_BAM, |
| 707 | .peer_bam = A2_P_BAM, |
| 708 | .dir = PEER_PERIPHERAL_TO_USB, |
| 709 | .pipe_num = 2, |
Anna Perel | 2151516 | 2012-02-02 20:50:02 +0200 | [diff] [blame] | 710 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 711 | .src_pipe_index = 5, |
| 712 | .dst_phy_addr = USB_BAM_PHY_BASE, |
| 713 | .dst_pipe_index = 14, |
| 714 | .data_fifo_base_offset = 0x2a00, |
| 715 | .data_fifo_size = 0x600, |
| 716 | .desc_fifo_base_offset = 0x3000, |
| 717 | .desc_fifo_size = 0x100, |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame] | 718 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 719 | { |
| 720 | .name = "hsic-a2-out-0", |
| 721 | .bam_type = HSIC_BAM, |
| 722 | .peer_bam = A2_P_BAM, |
| 723 | .dir = USB_TO_PEER_PERIPHERAL, |
| 724 | .pipe_num = 0, |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 725 | .src_phy_addr = HSIC_BAM_PHY_BASE, |
| 726 | .src_pipe_index = 1, |
| 727 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 728 | .dst_pipe_index = 0, |
| 729 | .data_fifo_base_offset = 0x1100, |
| 730 | .data_fifo_size = 0x600, |
| 731 | .desc_fifo_base_offset = 0x1700, |
| 732 | .desc_fifo_size = 0x300, |
| 733 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 734 | { |
| 735 | .name = "hsic-a2-in-0", |
| 736 | .bam_type = HSIC_BAM, |
| 737 | .peer_bam = A2_P_BAM, |
| 738 | .dir = PEER_PERIPHERAL_TO_USB, |
| 739 | .pipe_num = 0, |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 740 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 741 | .src_pipe_index = 1, |
| 742 | .dst_phy_addr = HSIC_BAM_PHY_BASE, |
| 743 | .dst_pipe_index = 0, |
| 744 | .data_fifo_base_offset = 0xa00, |
| 745 | .data_fifo_size = 0x600, |
| 746 | .desc_fifo_base_offset = 0x1000, |
| 747 | .desc_fifo_size = 0x100, |
| 748 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 749 | { |
| 750 | .name = "hsic-a2-out-1", |
| 751 | .bam_type = HSIC_BAM, |
| 752 | .peer_bam = A2_P_BAM, |
| 753 | .dir = USB_TO_PEER_PERIPHERAL, |
| 754 | .pipe_num = 1, |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 755 | .src_phy_addr = HSIC_BAM_PHY_BASE, |
| 756 | .src_pipe_index = 3, |
| 757 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 758 | .dst_pipe_index = 2, |
| 759 | .data_fifo_base_offset = 0x2100, |
| 760 | .data_fifo_size = 0x600, |
| 761 | .desc_fifo_base_offset = 0x2700, |
| 762 | .desc_fifo_size = 0x300, |
| 763 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 764 | { |
| 765 | .name = "hsic-a2-in-1", |
| 766 | .bam_type = HSIC_BAM, |
| 767 | .peer_bam = A2_P_BAM, |
| 768 | .dir = PEER_PERIPHERAL_TO_USB, |
| 769 | .pipe_num = 1, |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 770 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 771 | .src_pipe_index = 3, |
| 772 | .dst_phy_addr = HSIC_BAM_PHY_BASE, |
| 773 | .dst_pipe_index = 2, |
| 774 | .data_fifo_base_offset = 0x1a00, |
| 775 | .data_fifo_size = 0x600, |
| 776 | .desc_fifo_base_offset = 0x2000, |
| 777 | .desc_fifo_size = 0x100, |
| 778 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 779 | { |
| 780 | .name = "hsic-a2-out-2", |
| 781 | .bam_type = HSIC_BAM, |
| 782 | .peer_bam = A2_P_BAM, |
| 783 | .dir = USB_TO_PEER_PERIPHERAL, |
| 784 | .pipe_num = 2, |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 785 | .src_phy_addr = HSIC_BAM_PHY_BASE, |
| 786 | .src_pipe_index = 5, |
| 787 | .dst_phy_addr = A2_BAM_PHY_BASE, |
| 788 | .dst_pipe_index = 4, |
| 789 | .data_fifo_base_offset = 0x3100, |
| 790 | .data_fifo_size = 0x600, |
| 791 | .desc_fifo_base_offset = 0x3700, |
| 792 | .desc_fifo_size = 0x300, |
| 793 | }, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 794 | { |
| 795 | .name = "hsic-a2-in-2", |
| 796 | .bam_type = HSIC_BAM, |
| 797 | .peer_bam = A2_P_BAM, |
| 798 | .dir = PEER_PERIPHERAL_TO_USB, |
| 799 | .pipe_num = 2, |
Ofir Cohen | 057fb3e | 2012-02-05 15:25:47 +0200 | [diff] [blame] | 800 | .src_phy_addr = A2_BAM_PHY_BASE, |
| 801 | .src_pipe_index = 5, |
| 802 | .dst_phy_addr = HSIC_BAM_PHY_BASE, |
| 803 | .dst_pipe_index = 4, |
| 804 | .data_fifo_base_offset = 0x2a00, |
| 805 | .data_fifo_size = 0x600, |
| 806 | .desc_fifo_base_offset = 0x3000, |
| 807 | .desc_fifo_size = 0x100, |
| 808 | } |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 809 | }; |
| 810 | |
| 811 | static struct msm_usb_bam_platform_data msm_usb_bam_pdata = { |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 812 | .connections = &msm_usb_bam_connections[0], |
| 813 | .max_connections = sizeof(msm_usb_bam_connections) / |
| 814 | sizeof(struct usb_bam_pipe_connect), |
Lena Salman | a66eddf | 2012-03-26 13:03:43 +0200 | [diff] [blame] | 815 | .usb_bam_num_pipes = 16, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 816 | }; |
| 817 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 818 | static struct msm_otg_platform_data msm_otg_pdata = { |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 819 | .mode = USB_OTG, |
| 820 | .otg_control = OTG_PHY_CONTROL, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 821 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 822 | .vbus_power = msm_hsusb_vbus_power, |
Ofir Cohen | 4da266f | 2012-01-03 10:19:29 +0200 | [diff] [blame] | 823 | .disable_reset_on_disconnect = true, |
Amit Blay | 6fa647a | 2012-05-24 14:12:08 +0300 | [diff] [blame] | 824 | .enable_lpm_on_dev_suspend = true, |
Amit Blay | 9b6e58b | 2012-06-18 13:12:49 +0300 | [diff] [blame] | 825 | .core_clk_always_on_workaround = true, |
Amit Blay | d6f3828 | 2012-10-29 13:13:46 +0200 | [diff] [blame] | 826 | .delay_lpm_on_disconnect = true, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 827 | }; |
| 828 | |
Ido Shayevitz | 479f2eb | 2012-06-27 10:39:57 +0300 | [diff] [blame] | 829 | |
| 830 | static struct ci13xxx_platform_data msm_peripheral_pdata = { |
| 831 | .usb_core_id = 0, |
| 832 | }; |
| 833 | |
| 834 | static struct msm_hsic_peripheral_platform_data |
| 835 | msm_hsic_peripheral_pdata_private = { |
Amit Blay | 9b6e58b | 2012-06-18 13:12:49 +0300 | [diff] [blame] | 836 | .core_clk_always_on_workaround = true, |
Amit Blay | 4d57d36 | 2012-04-28 11:00:21 +0300 | [diff] [blame] | 837 | }; |
| 838 | |
Ido Shayevitz | 479f2eb | 2012-06-27 10:39:57 +0300 | [diff] [blame] | 839 | static struct ci13xxx_platform_data msm_hsic_peripheral_pdata = { |
| 840 | .usb_core_id = 1, |
| 841 | .prv_data = &msm_hsic_peripheral_pdata_private, |
| 842 | }; |
| 843 | |
Manu Gautam | 3c59839 | 2013-03-22 16:59:10 +0530 | [diff] [blame] | 844 | static struct msm_hsic_host_platform_data msm_hsic_pdata = { |
| 845 | .phy_sof_workaround = true, |
| 846 | }; |
| 847 | |
Amit Blay | 5f968cf | 2012-01-22 12:04:01 +0200 | [diff] [blame] | 848 | #define PID_MAGIC_ID 0x71432909 |
| 849 | #define SERIAL_NUM_MAGIC_ID 0x61945374 |
| 850 | #define SERIAL_NUMBER_LENGTH 127 |
| 851 | #define DLOAD_USB_BASE_ADD 0x2B0000C8 |
| 852 | |
| 853 | struct magic_num_struct { |
| 854 | uint32_t pid; |
| 855 | uint32_t serial_num; |
| 856 | }; |
| 857 | |
| 858 | struct dload_struct { |
| 859 | uint32_t reserved1; |
| 860 | uint32_t reserved2; |
| 861 | uint32_t reserved3; |
| 862 | uint16_t reserved4; |
| 863 | uint16_t pid; |
| 864 | char serial_number[SERIAL_NUMBER_LENGTH]; |
| 865 | uint16_t reserved5; |
| 866 | struct magic_num_struct magic_struct; |
| 867 | }; |
| 868 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 869 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 870 | { |
Amit Blay | 5f968cf | 2012-01-22 12:04:01 +0200 | [diff] [blame] | 871 | struct dload_struct __iomem *dload = 0; |
| 872 | |
| 873 | dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); |
| 874 | if (!dload) { |
| 875 | pr_err("%s: cannot remap I/O memory region: %08x\n", |
| 876 | __func__, DLOAD_USB_BASE_ADD); |
| 877 | return -ENXIO; |
| 878 | } |
| 879 | |
| 880 | pr_debug("%s: dload:%p pid:%x serial_num:%s\n", |
| 881 | __func__, dload, pid, snum); |
| 882 | /* update pid */ |
| 883 | dload->magic_struct.pid = PID_MAGIC_ID; |
| 884 | dload->pid = pid; |
| 885 | |
| 886 | /* update serial number */ |
| 887 | dload->magic_struct.serial_num = 0; |
| 888 | if (!snum) { |
| 889 | memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH); |
| 890 | goto out; |
| 891 | } |
| 892 | |
| 893 | dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; |
| 894 | strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); |
| 895 | out: |
| 896 | iounmap(dload); |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 897 | return 0; |
| 898 | } |
| 899 | |
Rohit Vaswani | 149f0a7 | 2011-11-09 15:21:28 -0800 | [diff] [blame] | 900 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 901 | .name = "wlan_ar6000_pm_dev", |
| 902 | .id = -1, |
| 903 | }; |
| 904 | |
| 905 | static int __init msm9615_init_ar6000pm(void) |
| 906 | { |
| 907 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 908 | } |
| 909 | |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 910 | #ifdef CONFIG_LTC4088_CHARGER |
| 911 | static struct platform_device msm_device_charger = { |
| 912 | .name = LTC4088_CHARGER_DEV_NAME, |
| 913 | .id = -1, |
| 914 | .dev = { |
| 915 | .platform_data = <c4088_chg_pdata, |
| 916 | }, |
| 917 | }; |
| 918 | #endif |
| 919 | |
Siddartha Mohanadoss | 7e25dc1 | 2012-03-19 11:19:27 -0700 | [diff] [blame] | 920 | static struct tsens_platform_data msm_tsens_pdata = { |
| 921 | .tsens_factor = 1000, |
| 922 | .hw_type = MDM_9615, |
| 923 | .tsens_num_sensor = 5, |
Siddartha Mohanadoss | 892ee47 | 2012-05-03 10:35:20 -0700 | [diff] [blame] | 924 | .slope = {1176, 1162, 1162, 1149, 1176}, |
Siddartha Mohanadoss | 7e25dc1 | 2012-03-19 11:19:27 -0700 | [diff] [blame] | 925 | }; |
| 926 | |
Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 927 | static struct platform_device msm_tsens_device = { |
| 928 | .name = "tsens8960-tm", |
| 929 | .id = -1, |
| 930 | }; |
| 931 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 932 | static struct platform_device *common_devices[] = { |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 933 | &msm9615_device_acpuclk, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 934 | &msm9615_device_dmov, |
| 935 | &msm_device_smd, |
Jay Chokshi | dc8028b | 2011-12-01 16:17:34 -0800 | [diff] [blame] | 936 | #ifdef CONFIG_LTC4088_CHARGER |
| 937 | &msm_device_charger, |
| 938 | #endif |
Stephen Boyd | a1cf76b | 2012-06-13 12:05:35 -0700 | [diff] [blame] | 939 | &msm_9615_q6_lpass, |
Stephen Boyd | 2efa996 | 2012-06-12 14:20:12 -0700 | [diff] [blame] | 940 | &msm_9615_q6_mss, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 941 | &msm_device_otg, |
Ofir Cohen | 73c99e8 | 2012-01-15 13:38:14 +0200 | [diff] [blame] | 942 | &msm_device_hsic_peripheral, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 943 | &msm_device_gadget_peripheral, |
Amit Blay | 6a8d4f3 | 2011-11-21 10:36:25 +0200 | [diff] [blame] | 944 | &msm_device_hsusb_host, |
Lena Salman | 65bcf37 | 2012-02-14 15:33:32 +0200 | [diff] [blame] | 945 | &msm_device_hsic_host, |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 946 | &msm_device_usb_bam, |
Ofir Cohen | 94213a7 | 2012-05-03 14:26:32 +0300 | [diff] [blame] | 947 | &msm_android_usb_device, |
Ofir Cohen | d8c07f9 | 2012-12-03 17:05:08 +0200 | [diff] [blame] | 948 | #ifdef CONFIG_USB_CI13XXX_MSM_HSIC |
Ido Shayevitz | 479f2eb | 2012-06-27 10:39:57 +0300 | [diff] [blame] | 949 | &msm_android_usb_hsic_device, |
Ofir Cohen | d8c07f9 | 2012-12-03 17:05:08 +0200 | [diff] [blame] | 950 | #endif |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 951 | &msm9615_device_uart_gsbi4, |
David Collins | 0f9942a | 2011-10-31 09:47:34 -0700 | [diff] [blame] | 952 | &msm9615_device_ext_2p95v_vreg, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 953 | &msm9615_device_ssbi_pmic1, |
| 954 | &msm9615_device_qup_i2c_gsbi5, |
| 955 | &msm9615_device_qup_spi_gsbi3, |
| 956 | &msm_device_sps, |
Sagar Dharia | 2a5378d | 2011-12-01 20:00:11 -0700 | [diff] [blame] | 957 | &msm9615_slim_ctrl, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 958 | &msm_device_nand, |
Eric Holmberg | 0c96e70 | 2011-11-08 18:04:31 -0700 | [diff] [blame] | 959 | &msm_device_bam_dmux, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 960 | &msm9615_rpm_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 961 | #ifdef CONFIG_HW_RANDOM_MSM |
| 962 | &msm_device_rng, |
| 963 | #endif |
Olav Haugan | e6a0acd | 2012-04-05 09:29:12 -0700 | [diff] [blame] | 964 | #ifdef CONFIG_ION_MSM |
| 965 | &ion_dev, |
| 966 | #endif |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 967 | |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 968 | &msm_pcm, |
| 969 | &msm_multi_ch_pcm, |
| 970 | &msm_pcm_routing, |
| 971 | &msm_cpudai0, |
| 972 | &msm_cpudai1, |
| 973 | &msm_cpudai_bt_rx, |
| 974 | &msm_cpudai_bt_tx, |
| 975 | &msm_cpu_fe, |
| 976 | &msm_stub_codec, |
| 977 | &msm_voice, |
Shiv Maliyappanahalli | 30561a5 | 2012-10-28 21:15:07 -0700 | [diff] [blame] | 978 | &msm_dtmf, |
Shiv Maliyappanahalli | ebdb306 | 2013-01-16 19:31:25 -0800 | [diff] [blame] | 979 | &msm_host_pcm_voice, |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 980 | &msm_voip, |
Venkat Sudhir | 5efc491 | 2012-05-15 17:10:35 -0700 | [diff] [blame] | 981 | &msm_i2s_cpudai0, |
| 982 | &msm_i2s_cpudai1, |
Damir Didjusto | add5444 | 2012-09-21 10:39:54 -0700 | [diff] [blame] | 983 | &msm_i2s_cpudai4, |
| 984 | &msm_i2s_cpudai5, |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 985 | &msm_pcm_hostless, |
| 986 | &msm_cpudai_afe_01_rx, |
| 987 | &msm_cpudai_afe_01_tx, |
| 988 | &msm_cpudai_afe_02_rx, |
| 989 | &msm_cpudai_afe_02_tx, |
| 990 | &msm_pcm_afe, |
| 991 | &msm_cpudai_auxpcm_rx, |
| 992 | &msm_cpudai_auxpcm_tx, |
Shiv Maliyappanahalli | 7f4dec5 | 2012-06-01 16:06:08 -0700 | [diff] [blame] | 993 | &msm_cpudai_sec_auxpcm_rx, |
| 994 | &msm_cpudai_sec_auxpcm_tx, |
Shiv Maliyappanahalli | c232126 | 2012-11-12 15:21:05 -0800 | [diff] [blame] | 995 | &msm_cpudai_stub, |
Prashanth Reddy | 14c862f | 2012-11-14 20:03:25 -0800 | [diff] [blame] | 996 | &msm_cpudai_incall_music_rx, |
| 997 | &msm_cpudai_incall_record_rx, |
| 998 | &msm_cpudai_incall_record_tx, |
Shiv Maliyappanahalli | 9ec55e9 | 2012-01-09 14:44:59 -0800 | [diff] [blame] | 999 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 1000 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1001 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame] | 1002 | &msm9615_qcrypto_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 1003 | #endif |
| 1004 | |
| 1005 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1006 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
Ramesh Masavarapu | aa28b5b | 2011-10-21 10:26:03 -0700 | [diff] [blame] | 1007 | &msm9615_qcedev_device, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 1008 | #endif |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 1009 | &msm9615_device_watchdog, |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 1010 | &msm_bus_9615_sys_fabric, |
| 1011 | &msm_bus_def_fab, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1012 | &msm9615_rpm_log_device, |
| 1013 | &msm9615_rpm_stat_device, |
Anji Jonnala | 9312992 | 2012-10-09 20:57:53 +0530 | [diff] [blame] | 1014 | &msm9615_rpm_master_stat_device, |
Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 1015 | &msm_tsens_device, |
Girish Mahadevan | 5594499 | 2012-10-26 11:03:07 -0600 | [diff] [blame] | 1016 | &msm9615_pm_8x60, |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 1017 | }; |
| 1018 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 1019 | static void __init msm9615_i2c_init(void) |
| 1020 | { |
Venkat Sudhir | 5efc491 | 2012-05-15 17:10:35 -0700 | [diff] [blame] | 1021 | u8 mach_mask = 0; |
| 1022 | int i; |
| 1023 | /* Mask is hardcoded to SURF (CDP). |
| 1024 | * works on MTP with same configuration. |
| 1025 | */ |
| 1026 | mach_mask = I2C_SURF; |
| 1027 | if (machine_is_msm9615_cdp()) |
| 1028 | mach_mask = I2C_SURF; |
| 1029 | else if (machine_is_msm9615_mtp()) |
| 1030 | mach_mask = I2C_FFA; |
| 1031 | else |
| 1032 | pr_err("unmatched machine ID in register_i2c_devices\n"); |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 1033 | msm9615_device_qup_i2c_gsbi5.dev.platform_data = |
| 1034 | &msm9615_i2c_qup_gsbi5_pdata; |
Venkat Sudhir | 5efc491 | 2012-05-15 17:10:35 -0700 | [diff] [blame] | 1035 | for (i = 0; i < ARRAY_SIZE(msm9615_i2c_devices); ++i) { |
| 1036 | if (msm9615_i2c_devices[i].machs & mach_mask) { |
| 1037 | i2c_register_board_info(msm9615_i2c_devices[i].bus, |
| 1038 | msm9615_i2c_devices[i].info, |
| 1039 | msm9615_i2c_devices[i].len); |
| 1040 | } |
| 1041 | } |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 1042 | } |
| 1043 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 1044 | static void __init msm9615_reserve(void) |
| 1045 | { |
Olav Haugan | e6a0acd | 2012-04-05 09:29:12 -0700 | [diff] [blame] | 1046 | #ifdef CONFIG_ION_MSM |
| 1047 | reserve_info = &msm9615_reserve_info; |
| 1048 | msm_reserve(); |
| 1049 | #endif |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 1050 | } |
| 1051 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1052 | static void __init msm9615_common_init(void) |
| 1053 | { |
Ofir Cohen | 94213a7 | 2012-05-03 14:26:32 +0300 | [diff] [blame] | 1054 | struct android_usb_platform_data *android_pdata = |
| 1055 | msm_android_usb_device.dev.platform_data; |
Ido Shayevitz | 479f2eb | 2012-06-27 10:39:57 +0300 | [diff] [blame] | 1056 | struct android_usb_platform_data *android_hsic_pdata = |
| 1057 | msm_android_usb_hsic_device.dev.platform_data; |
Ofir Cohen | 94213a7 | 2012-05-03 14:26:32 +0300 | [diff] [blame] | 1058 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1059 | msm9615_device_init(); |
Rohit Vaswani | b1cc493 | 2012-07-23 21:30:11 -0700 | [diff] [blame] | 1060 | platform_device_register(&msm_gpio_device); |
Rohit Vaswani | a681589 | 2011-12-15 20:20:39 -0800 | [diff] [blame] | 1061 | msm9615_init_gpiomux(); |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 1062 | msm9615_i2c_init(); |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 1063 | regulator_suppress_info_printing(); |
David Collins | bea297a | 2011-09-28 13:11:14 -0700 | [diff] [blame] | 1064 | platform_device_register(&msm9615_device_rpm_regulator); |
Vikram Mulukutla | 2021c00 | 2011-12-16 12:32:59 -0800 | [diff] [blame] | 1065 | msm_xo_init(); |
Gagan Mac | 7a82764 | 2011-09-22 19:42:21 -0600 | [diff] [blame] | 1066 | msm_clock_init(&msm9615_clock_init_data); |
| 1067 | msm9615_init_buses(); |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 1068 | msm9615_device_qup_spi_gsbi3.dev.platform_data = |
| 1069 | &msm9615_qup_spi_gsbi3_pdata; |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 1070 | msm9615_device_ssbi_pmic1.dev.platform_data = |
| 1071 | &msm9615_ssbi_pm8018_pdata; |
David Collins | 00b31e6 | 2011-08-31 20:00:10 -0700 | [diff] [blame] | 1072 | pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len; |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame] | 1073 | |
| 1074 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 1075 | msm_otg_pdata.phy_init_seq = shelby_phy_init_seq; |
Ido Shayevitz | 479f2eb | 2012-06-27 10:39:57 +0300 | [diff] [blame] | 1076 | msm_device_gadget_peripheral.dev.platform_data = |
| 1077 | &msm_peripheral_pdata; |
Amit Blay | 4d57d36 | 2012-04-28 11:00:21 +0300 | [diff] [blame] | 1078 | msm_device_hsic_peripheral.dev.platform_data = |
| 1079 | &msm_hsic_peripheral_pdata; |
Manu Gautam | 3c59839 | 2013-03-22 16:59:10 +0530 | [diff] [blame] | 1080 | msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata; |
Ofir Cohen | 40a4e86 | 2011-12-08 15:17:52 +0200 | [diff] [blame] | 1081 | msm_device_usb_bam.dev.platform_data = &msm_usb_bam_pdata; |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 1082 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Jay Chokshi | 215f7be | 2012-02-09 18:30:44 -0800 | [diff] [blame] | 1083 | msm9615_pm8xxx_gpio_mpp_init(); |
Vikram Mulukutla | b5e1cda | 2011-10-04 16:17:22 -0700 | [diff] [blame] | 1084 | |
Rohit Vaswani | 149f0a7 | 2011-11-09 15:21:28 -0800 | [diff] [blame] | 1085 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 1086 | msm9615_init_ar6000pm(); |
| 1087 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 1088 | msm9615_init_mmc(); |
Sagar Dharia | 2a5378d | 2011-12-01 20:00:11 -0700 | [diff] [blame] | 1089 | slim_register_board_info(msm_slim_devices, |
| 1090 | ARRAY_SIZE(msm_slim_devices)); |
Ido Shayevitz | 479f2eb | 2012-06-27 10:39:57 +0300 | [diff] [blame] | 1091 | |
Ofir Cohen | 94213a7 | 2012-05-03 14:26:32 +0300 | [diff] [blame] | 1092 | android_pdata->update_pid_and_serial_num = |
| 1093 | usb_diag_update_pid_and_serial_num; |
Ido Shayevitz | 479f2eb | 2012-06-27 10:39:57 +0300 | [diff] [blame] | 1094 | android_hsic_pdata->update_pid_and_serial_num = |
| 1095 | usb_diag_update_pid_and_serial_num; |
| 1096 | |
Olav Haugan | e6a0acd | 2012-04-05 09:29:12 -0700 | [diff] [blame] | 1097 | msm_pm_boot_pdata.p_addr = allocate_contiguous_ebi_nomap(SZ_8, SZ_64K); |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 1098 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Siddartha Mohanadoss | 7e25dc1 | 2012-03-19 11:19:27 -0700 | [diff] [blame] | 1099 | msm_tsens_early_init(&msm_tsens_pdata); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1100 | } |
| 1101 | |
| 1102 | static void __init msm9615_cdp_init(void) |
| 1103 | { |
| 1104 | msm9615_common_init(); |
Zhang Chang Ken | a48794b | 2012-03-31 17:45:21 -0400 | [diff] [blame] | 1105 | #ifdef CONFIG_FB_MSM |
| 1106 | mdm9615_init_fb(); |
| 1107 | #endif |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1108 | } |
| 1109 | |
| 1110 | static void __init msm9615_mtp_init(void) |
| 1111 | { |
| 1112 | msm9615_common_init(); |
| 1113 | } |
| 1114 | |
Zhang Chang Ken | a48794b | 2012-03-31 17:45:21 -0400 | [diff] [blame] | 1115 | #ifdef CONFIG_FB_MSM |
| 1116 | static void __init mdm9615_allocate_memory_regions(void) |
| 1117 | { |
| 1118 | mdm9615_allocate_fb_region(); |
| 1119 | } |
| 1120 | #endif |
| 1121 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1122 | MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP") |
| 1123 | .map_io = msm9615_map_io, |
| 1124 | .init_irq = msm9615_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 1125 | .handle_irq = gic_handle_irq, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1126 | .timer = &msm_timer, |
| 1127 | .init_machine = msm9615_cdp_init, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 1128 | .reserve = msm9615_reserve, |
Zhang Chang Ken | a48794b | 2012-03-31 17:45:21 -0400 | [diff] [blame] | 1129 | #ifdef CONFIG_FB_MSM |
| 1130 | .init_early = mdm9615_allocate_memory_regions, |
| 1131 | #endif |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 1132 | .restart = msm_restart, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1133 | MACHINE_END |
| 1134 | |
| 1135 | MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP") |
| 1136 | .map_io = msm9615_map_io, |
| 1137 | .init_irq = msm9615_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 1138 | .handle_irq = gic_handle_irq, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1139 | .timer = &msm_timer, |
| 1140 | .init_machine = msm9615_mtp_init, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 1141 | .reserve = msm9615_reserve, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 1142 | .restart = msm_restart, |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1143 | MACHINE_END |