blob: bada29c77e79bca98f8e70d8212740d273357fa7 [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07002 *
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 Blay5f968cf2012-01-22 12:04:01 +020015#include <linux/io.h>
Harini Jayaramaneba52672011-09-08 15:13:00 -060016#include <linux/i2c.h>
Sagar Dharia2a5378d2011-12-01 20:00:11 -070017#include <linux/slimbus/slimbus.h>
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -080018#ifdef CONFIG_WCD9310_CODEC
19#include <linux/mfd/wcd9xxx/core.h>
20#include <linux/mfd/wcd9xxx/pdata.h>
21#endif
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070022#include <linux/msm_ssbi.h>
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -060023#include <linux/memblock.h>
Rohit Vaswania6815892011-12-15 20:20:39 -080024#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 Mucklef132c6c2012-06-06 18:30:57 -070030#include <linux/gpio.h>
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -070031#include <linux/msm_tsens.h>
Olav Haugane6a0acd2012-04-05 09:29:12 -070032#include <linux/ion.h>
33#include <linux/memory.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070034#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
Marc Zyngier89bdafd12011-12-22 11:39:20 +053036#include <asm/hardware/gic.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070037#include <mach/board.h>
38#include <mach/msm_iomap.h>
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -080039#include <mach/socinfo.h>
Harini Jayaraman738c9312011-09-08 15:22:38 -060040#include <mach/msm_spi.h>
Gagan Mac7a827642011-09-22 19:42:21 -060041#include <mach/msm_bus_board.h>
Vikram Mulukutla2021c002011-12-16 12:32:59 -080042#include <mach/msm_xo.h>
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -080043#include <mach/dma.h>
Olav Haugane6a0acd2012-04-05 09:29:12 -070044#include <mach/ion.h>
45#include <mach/msm_memtypes.h>
Amit Blaye5bb35e2012-05-08 20:38:20 +030046#include <mach/cpuidle.h>
47#include <mach/usb_bam.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070048#include <mach/restart.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070049#include "timer.h"
50#include "devices.h"
David Collinsfb88c432011-08-25 15:12:47 -070051#include "board-9615.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080052#include "pm.h"
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -070053#include "acpuclock.h"
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -060054#include "pm-boot.h"
Venkat Sudhir5efc4912012-05-15 17:10:35 -070055#include <mach/gpiomux.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070056
Olav Haugane6a0acd2012-04-05 09:29:12 -070057#ifdef CONFIG_ION_MSM
58#define MSM_ION_AUDIO_SIZE 0xAF000
59#define MSM_ION_HEAP_NUM 3
60#define MSM_KERNEL_EBI_SIZE 0x51000
61
62static struct memtype_reserve msm9615_reserve_table[] __initdata = {
63 [MEMTYPE_SMI] = {
64 },
65 [MEMTYPE_EBI0] = {
66 .flags = MEMTYPE_FLAGS_1M_ALIGN,
67 },
68 [MEMTYPE_EBI1] = {
69 .flags = MEMTYPE_FLAGS_1M_ALIGN,
70 },
71};
72
73static int msm9615_paddr_to_memtype(unsigned int paddr)
74{
75 return MEMTYPE_EBI1;
76}
77
78static struct ion_co_heap_pdata co_ion_pdata = {
79 .adjacent_mem_id = INVALID_HEAP_ID,
80 .align = PAGE_SIZE,
81};
82
83static struct ion_platform_data ion_pdata = {
84 .nr = MSM_ION_HEAP_NUM,
85 .heaps = {
86 {
87 .id = ION_SYSTEM_HEAP_ID,
88 .type = ION_HEAP_TYPE_SYSTEM,
89 .name = ION_VMALLOC_HEAP_NAME,
90 },
91 {
92 .id = ION_IOMMU_HEAP_ID,
93 .type = ION_HEAP_TYPE_IOMMU,
94 .name = ION_IOMMU_HEAP_NAME,
95 },
96 {
97 .id = ION_AUDIO_HEAP_ID,
98 .type = ION_HEAP_TYPE_CARVEOUT,
99 .name = ION_AUDIO_HEAP_NAME,
100 .size = MSM_ION_AUDIO_SIZE,
101 .memory_type = ION_EBI_TYPE,
102 .extra_data = (void *) &co_ion_pdata,
103 },
104 }
105};
106
107static struct platform_device ion_dev = {
108 .name = "ion-msm",
109 .id = 1,
110 .dev = { .platform_data = &ion_pdata },
111};
112
Stephen Boyd668d7652012-04-25 11:31:01 -0700113static void __init reserve_ion_memory(void)
Olav Haugane6a0acd2012-04-05 09:29:12 -0700114{
115 msm9615_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
116}
117
118static void __init msm9615_calculate_reserve_sizes(void)
119{
120 reserve_ion_memory();
121 msm9615_reserve_table[MEMTYPE_EBI1].size += MSM_KERNEL_EBI_SIZE;
122}
123
124static struct reserve_info msm9615_reserve_info __initdata = {
125 .memtype_reserve_table = msm9615_reserve_table,
126 .calculate_reserve_sizes = msm9615_calculate_reserve_sizes,
127 .paddr_to_memtype = msm9615_paddr_to_memtype,
128};
129#endif
130
Jay Chokshi215f7be2012-02-09 18:30:44 -0800131struct pm8xxx_gpio_init {
132 unsigned gpio;
133 struct pm_gpio config;
134};
135
136struct pm8xxx_mpp_init {
137 unsigned mpp;
138 struct pm8xxx_mpp_config_data config;
139};
140
141#define PM8018_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
142 _func, _inv, _disable) \
143{ \
144 .gpio = PM8018_GPIO_PM_TO_SYS(_gpio), \
145 .config = { \
146 .direction = _dir, \
147 .output_buffer = _buf, \
148 .output_value = _val, \
149 .pull = _pull, \
150 .vin_sel = _vin, \
151 .out_strength = _out_strength, \
152 .function = _func, \
153 .inv_int_pol = _inv, \
154 .disable_pin = _disable, \
155 } \
156}
157
158#define PM8018_MPP_INIT(_mpp, _type, _level, _control) \
159{ \
160 .mpp = PM8018_MPP_PM_TO_SYS(_mpp), \
161 .config = { \
162 .type = PM8XXX_MPP_TYPE_##_type, \
163 .level = _level, \
164 .control = PM8XXX_MPP_##_control, \
165 } \
166}
167
168#define PM8018_GPIO_DISABLE(_gpio) \
169 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM8018_GPIO_VIN_S3, \
170 0, 0, 0, 1)
171
172#define PM8018_GPIO_OUTPUT(_gpio, _val, _strength) \
173 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
174 PM_GPIO_PULL_NO, PM8018_GPIO_VIN_S3, \
175 PM_GPIO_STRENGTH_##_strength, \
176 PM_GPIO_FUNC_NORMAL, 0, 0)
177
178#define PM8018_GPIO_INPUT(_gpio, _pull) \
179 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
180 _pull, PM8018_GPIO_VIN_S3, \
181 PM_GPIO_STRENGTH_NO, \
182 PM_GPIO_FUNC_NORMAL, 0, 0)
183
184#define PM8018_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
185 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
186 PM_GPIO_PULL_NO, PM8018_GPIO_VIN_S3, \
187 PM_GPIO_STRENGTH_HIGH, \
188 _func, 0, 0)
189
190#define PM8018_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
191 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
192 PM_GPIO_PULL_NO, _vin, \
193 PM_GPIO_STRENGTH_HIGH, \
194 PM_GPIO_FUNC_NORMAL, 0, 0)
195
196/* Initial PM8018 GPIO configurations */
197static struct pm8xxx_gpio_init pm8018_gpios[] __initdata = {
Pavan Kumar27556502012-05-21 18:38:01 -0700198 PM8018_GPIO_OUTPUT(2, 0, HIGH) /* EXT_LDO_EN_WLAN */
Jay Chokshi215f7be2012-02-09 18:30:44 -0800199};
200
201/* Initial PM8018 MPP configurations */
202static struct pm8xxx_mpp_init pm8018_mpps[] __initdata = {
203};
204
205void __init msm9615_pm8xxx_gpio_mpp_init(void)
206{
207 int i, rc;
208
209 for (i = 0; i < ARRAY_SIZE(pm8018_gpios); i++) {
210 rc = pm8xxx_gpio_config(pm8018_gpios[i].gpio,
211 &pm8018_gpios[i].config);
212 if (rc) {
213 pr_err("%s: pm8018_gpio_config: rc=%d\n", __func__, rc);
214 break;
215 }
216 }
217
218 for (i = 0; i < ARRAY_SIZE(pm8018_mpps); i++) {
219 rc = pm8xxx_mpp_config(pm8018_mpps[i].mpp,
220 &pm8018_mpps[i].config);
221 if (rc) {
222 pr_err("%s: pm8018_mpp_config: rc=%d\n", __func__, rc);
223 break;
224 }
225 }
226}
227
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700228static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = {
229 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
230 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
231 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
232 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
233 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
234 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadossf9383d52012-04-19 09:42:49 -0700235 /* AMUX8 is used to read either Batt_id/Batt_therm.
236 * Current configuration is to support Batt_id. If clients
237 * want to read the Batt_therm, the scaling function needs to be
238 * updated to use ADC_SCALE_BATT_THERM instead of ADC_SCALE_DEFAULT.
239 * E.g.
240 * {"batt_therm", CHANNEL_BATT_ID_THERM, CHAN_PATH_SCALING1,
241 * AMUX_RSV2, ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
242 */
243 {"batt_id", CHANNEL_BATT_ID_THERM, CHAN_PATH_SCALING1,
244 AMUX_RSV2, ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700245 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
246 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
247 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
248 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
249 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
250 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
251 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
252 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
253};
254
255static struct pm8xxx_adc_properties pm8018_adc_data = {
256 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
257 .bitresolution = 15,
258 .bipolar = 0,
259};
260
261static struct pm8xxx_adc_platform_data pm8018_adc_pdata = {
262 .adc_channel = pm8018_adc_channels_data,
263 .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data),
264 .adc_prop = &pm8018_adc_data,
265};
266
David Collinsfb88c432011-08-25 15:12:47 -0700267static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
268 .irq_base = PM8018_IRQ_BASE,
269 .devirq = MSM_GPIO_TO_INT(87),
270 .irq_trigger_flag = IRQF_TRIGGER_LOW,
271};
272
273static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
274 .gpio_base = PM8018_GPIO_PM_TO_SYS(1),
275};
276
277static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
278 .mpp_base = PM8018_MPP_PM_TO_SYS(1),
279};
280
281static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
282 .rtc_write_enable = false,
Ashay Jaiswaldb5e6dc2011-10-12 11:02:47 +0530283 .rtc_alarm_powerup = false,
David Collinsfb88c432011-08-25 15:12:47 -0700284};
285
286static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
287 .pull_up = 1,
Jing Lineecdc062011-11-17 09:47:09 -0800288 .kpd_trigger_delay_us = 15625,
David Collinsfb88c432011-08-25 15:12:47 -0700289 .wakeup = 1,
290};
291
292static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
293 .priority = 0,
294};
295
Jay Chokshieb5d0d52011-09-28 17:16:20 -0700296#define PM8018_LED_KB_MAX_CURRENT 20 /* I = 20mA */
297#define PM8XXX_LED_PWM_PERIOD_US 1000
298
299/**
300 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
301 * driven using PWM feature.
302 */
303#define PM8XXX_PWM_CHANNEL_NONE -1
304
305static struct led_info pm8018_led_info[] = {
306 [0] = {
307 .name = "led:kb",
308 },
309};
310
311static struct led_platform_data pm8018_led_core_pdata = {
312 .num_leds = ARRAY_SIZE(pm8018_led_info),
313 .leds = pm8018_led_info,
314};
315
316static struct pm8xxx_led_config pm8018_led_configs[] = {
317 [0] = {
318 .id = PM8XXX_ID_LED_KB_LIGHT,
319 .mode = PM8XXX_LED_MODE_PWM3,
320 .max_current = PM8018_LED_KB_MAX_CURRENT,
321 .pwm_channel = 2,
322 .pwm_period_us = PM8XXX_LED_PWM_PERIOD_US,
323 },
324};
325
326static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
327 .led_core = &pm8018_led_core_pdata,
328 .configs = pm8018_led_configs,
329 .num_configs = ARRAY_SIZE(pm8018_led_configs),
330};
331
Jay Chokshidc8028b2011-12-01 16:17:34 -0800332#ifdef CONFIG_LTC4088_CHARGER
333static struct ltc4088_charger_platform_data ltc4088_chg_pdata = {
334 .gpio_mode_select_d0 = 7,
335 .gpio_mode_select_d1 = 6,
336 .gpio_mode_select_d2 = 4,
337};
338#endif
339
David Collinsfb88c432011-08-25 15:12:47 -0700340static struct pm8018_platform_data pm8018_platform_data __devinitdata = {
341 .irq_pdata = &pm8xxx_irq_pdata,
342 .gpio_pdata = &pm8xxx_gpio_pdata,
343 .mpp_pdata = &pm8xxx_mpp_pdata,
344 .rtc_pdata = &pm8xxx_rtc_pdata,
345 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
346 .misc_pdata = &pm8xxx_misc_pdata,
David Collins00b31e62011-08-31 20:00:10 -0700347 .regulator_pdatas = msm_pm8018_regulator_pdata,
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700348 .adc_pdata = &pm8018_adc_pdata,
Jay Chokshieb5d0d52011-09-28 17:16:20 -0700349 .leds_pdata = &pm8xxx_leds_pdata,
David Collinsfb88c432011-08-25 15:12:47 -0700350};
351
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700352static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = {
353 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
354 .slave = {
David Collinsfb88c432011-08-25 15:12:47 -0700355 .name = PM8018_CORE_DEV_NAME,
356 .platform_data = &pm8018_platform_data,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700357 },
358};
359
David Collinsbea297a2011-09-28 13:11:14 -0700360static struct platform_device msm9615_device_rpm_regulator __devinitdata = {
361 .name = "rpm-regulator",
362 .id = -1,
363 .dev = {
364 .platform_data = &msm_rpm_regulator_9615_pdata,
365 },
366};
367
David Collins0f9942a2011-10-31 09:47:34 -0700368static struct platform_device msm9615_device_ext_2p95v_vreg = {
369 .name = GPIO_REGULATOR_DEV_NAME,
370 .id = 18,
371 .dev = {
372 .platform_data =
373 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P95V],
374 },
375};
376
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600377static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
378 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
379 .v_addr = MSM_APCS_GLB_BASE + 0x24,
380};
381
Gagan Mac7a827642011-09-22 19:42:21 -0600382static void __init msm9615_init_buses(void)
383{
384#ifdef CONFIG_MSM_BUS_SCALING
385 msm_bus_rpm_set_mt_mask();
386 msm_bus_9615_sys_fabric_pdata.rpm_enabled = 1;
387 msm_bus_9615_sys_fabric.dev.platform_data =
388 &msm_bus_9615_sys_fabric_pdata;
389 msm_bus_def_fab.dev.platform_data = &msm_bus_9615_def_fab_pdata;
390#endif
391}
392
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800393#ifdef CONFIG_WCD9310_CODEC
394
395#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
396
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700397/*
398 * MDM9x15 I2S.
399 */
400static struct wcd9xxx_pdata wcd9xxx_i2c_platform_data = {
401 .irq = MSM_GPIO_TO_INT(85),
402 .irq_base = TABLA_INTERRUPT_BASE,
403 .num_irqs = NR_TABLA_IRQS,
404 .reset_gpio = 84,
405 .micbias = {
406 .ldoh_v = TABLA_LDOH_2P85_V,
407 .cfilt1_mv = 1800,
408 .cfilt2_mv = 1800,
409 .cfilt3_mv = 1800,
410 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
411 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
412 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
413 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
414 },
415 .regulator = {
416 {
417 .name = "CDC_VDD_CP",
418 .min_uV = 1800000,
419 .max_uV = 1800000,
420 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
421 },
422 {
423 .name = "CDC_VDDA_RX",
424 .min_uV = 1800000,
425 .max_uV = 1800000,
426 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
427 },
428 {
429 .name = "CDC_VDDA_TX",
430 .min_uV = 1800000,
431 .max_uV = 1800000,
432 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
433 },
434 {
435 .name = "VDDIO_CDC",
436 .min_uV = 1800000,
437 .max_uV = 1800000,
438 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
439 },
440 {
441 .name = "VDDD_CDC_D",
442 .min_uV = 1225000,
443 .max_uV = 1225000,
444 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
445 },
446 {
447 .name = "CDC_VDDA_A_1P2V",
448 .min_uV = 1225000,
449 .max_uV = 1225000,
450 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
451 }
452 },
453};
454
455static struct i2c_board_info wcd9xxx_device_info[] __initdata = {
456 {
457 I2C_BOARD_INFO("tabla top level", TABLA_I2C_SLAVE_ADDR),
458 .platform_data = &wcd9xxx_i2c_platform_data,
459 },
460 {
461 I2C_BOARD_INFO("tabla analog", TABLA_ANALOG_I2C_SLAVE_ADDR),
462 .platform_data = &wcd9xxx_i2c_platform_data,
463 },
464 {
465 I2C_BOARD_INFO("tabla digital1", TABLA_DIGITAL1_I2C_SLAVE_ADDR),
466 .platform_data = &wcd9xxx_i2c_platform_data,
467 },
468 {
469 I2C_BOARD_INFO("tabla digital2", TABLA_DIGITAL2_I2C_SLAVE_ADDR),
470 .platform_data = &wcd9xxx_i2c_platform_data,
471 },
472};
473
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700474/*
475 * MDM9x15 I2S.
476 */
477
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800478/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
479 * 4 micbiases are used to power various analog and digital
480 * microphones operating at 1800 mV. Technically, all micbiases
481 * can source from single cfilter since all microphones operate
482 * at the same voltage level. The arrangement below is to make
483 * sure all cfilters are exercised. LDO_H regulator ouput level
484 * does not need to be as high as 2.85V. It is choosen for
485 * microphone sensitivity purpose.
486 */
487
488static struct wcd9xxx_pdata tabla20_platform_data = {
489 .slimbus_slave_device = {
490 .name = "tabla-slave",
491 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
492 },
Shiv Maliyappanahallid7147812012-05-17 12:43:03 -0700493 .irq = MSM_GPIO_TO_INT(85),
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800494 .irq_base = TABLA_INTERRUPT_BASE,
495 .num_irqs = NR_WCD9XXX_IRQS,
496 .reset_gpio = 84,
497 .micbias = {
498 .ldoh_v = TABLA_LDOH_2P85_V,
499 .cfilt1_mv = 1800,
500 .cfilt2_mv = 1800,
501 .cfilt3_mv = 1800,
502 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
503 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
504 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
505 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
506 },
507 .regulator = {
508 {
509 .name = "CDC_VDD_CP",
510 .min_uV = 1800000,
511 .max_uV = 1800000,
512 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
513 },
514 {
515 .name = "CDC_VDDA_RX",
516 .min_uV = 1800000,
517 .max_uV = 1800000,
518 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
519 },
520 {
521 .name = "CDC_VDDA_TX",
522 .min_uV = 1800000,
523 .max_uV = 1800000,
524 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
525 },
526 {
527 .name = "VDDIO_CDC",
528 .min_uV = 1800000,
529 .max_uV = 1800000,
530 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
531 },
532 {
533 .name = "VDDD_CDC_D",
534 .min_uV = 1225000,
535 .max_uV = 1225000,
536 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
537 },
538 {
539 .name = "CDC_VDDA_A_1P2V",
540 .min_uV = 1225000,
541 .max_uV = 1225000,
542 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
543 },
544 },
545};
546
547static struct slim_device msm_slim_tabla20 = {
548 .name = "tabla2x-slim",
549 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
550 .dev = {
551 .platform_data = &tabla20_platform_data,
552 },
553};
554#endif
555
Shiv Maliyappanahalli3631cfb2012-05-31 15:53:24 -0700556static struct i2c_registry msm9615_i2c_devices[] __initdata = {
557#ifdef CONFIG_WCD9310_CODEC
558 {
559 I2C_SURF | I2C_FFA | I2C_FLUID,
560 MSM_9615_GSBI5_QUP_I2C_BUS_ID,
561 wcd9xxx_device_info,
562 ARRAY_SIZE(wcd9xxx_device_info),
563 },
564#endif
565};
566
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700567static struct slim_boardinfo msm_slim_devices[] = {
568 /* add slimbus slaves as needed */
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800569#ifdef CONFIG_WCD9310_CODEC
570 {
571 .bus_num = 1,
572 .slim_slave = &msm_slim_tabla20,
573 },
574#endif
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700575};
576
Harini Jayaraman738c9312011-09-08 15:22:38 -0600577static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
578 .max_clock_speed = 24000000,
579};
580
Harini Jayaramaneba52672011-09-08 15:13:00 -0600581static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
582 .clk_freq = 100000,
583 .src_clk_rate = 24000000,
584};
585
Amit Blay6a8d4f32011-11-21 10:36:25 +0200586#define USB_5V_EN 3
587#define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN)
588
Mayank Rana8549e632012-01-23 12:49:54 +0530589static int msm_hsusb_vbus_power(bool on)
Amit Blay6a8d4f32011-11-21 10:36:25 +0200590{
Amit Blaya4416f92012-01-24 21:03:52 +0200591 int rc;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200592 struct pm_gpio usb_vbus = {
593 .direction = PM_GPIO_DIR_OUT,
594 .pull = PM_GPIO_PULL_NO,
595 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200596 .vin_sel = 2,
597 .out_strength = PM_GPIO_STRENGTH_HIGH,
598 .function = PM_GPIO_FUNC_NORMAL,
599 .inv_int_pol = 0,
600 };
601
Amit Blaya4416f92012-01-24 21:03:52 +0200602 usb_vbus.output_value = on;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200603
Amit Blaya4416f92012-01-24 21:03:52 +0200604 rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus);
605 if (rc)
606 pr_err("failed to config usb_5v_en gpio\n");
Amit Blay6a8d4f32011-11-21 10:36:25 +0200607
Mayank Rana8549e632012-01-23 12:49:54 +0530608 return rc;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200609}
610
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530611static int shelby_phy_init_seq[] = {
612 0x44, 0x80,/* set VBUS valid threshold and
613 disconnect valid threshold */
614 0x38, 0x81, /* update DC voltage level */
Amit Blaydbaeff82012-04-02 22:13:36 +0300615 0x24, 0x82,/* set preemphasis and rise/fall time */
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530616 0x13, 0x83,/* set source impedance adjustment */
617 -1};
618
Ofir Cohen40a4e862011-12-08 15:17:52 +0200619#define USB_BAM_PHY_BASE 0x12502000
Ofir Cohen43473c82012-01-25 16:28:13 +0200620#define HSIC_BAM_PHY_BASE 0x12542000
Ofir Cohen40a4e862011-12-08 15:17:52 +0200621#define A2_BAM_PHY_BASE 0x124C2000
Lena Salmana66eddf2012-03-26 13:03:43 +0200622static struct usb_bam_pipe_connect msm_usb_bam_connections[2][4][2] = {
623 [0][0][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen40a4e862011-12-08 15:17:52 +0200624 .src_phy_addr = USB_BAM_PHY_BASE,
625 .src_pipe_index = 11,
626 .dst_phy_addr = A2_BAM_PHY_BASE,
627 .dst_pipe_index = 0,
Ofir Cohen29cd5752011-12-14 17:20:30 +0200628 .data_fifo_base_offset = 0x1100,
629 .data_fifo_size = 0x600,
630 .desc_fifo_base_offset = 0x1700,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200631 .desc_fifo_size = 0x300,
632 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200633 [0][0][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen40a4e862011-12-08 15:17:52 +0200634 .src_phy_addr = A2_BAM_PHY_BASE,
635 .src_pipe_index = 1,
636 .dst_phy_addr = USB_BAM_PHY_BASE,
637 .dst_pipe_index = 10,
638 .data_fifo_base_offset = 0xa00,
Ofir Cohen29cd5752011-12-14 17:20:30 +0200639 .data_fifo_size = 0x600,
640 .desc_fifo_base_offset = 0x1000,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200641 .desc_fifo_size = 0x100,
642 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200643 [0][1][USB_TO_PEER_PERIPHERAL] = {
Anna Perel21515162012-02-02 20:50:02 +0200644 .src_phy_addr = USB_BAM_PHY_BASE,
645 .src_pipe_index = 13,
646 .dst_phy_addr = A2_BAM_PHY_BASE,
647 .dst_pipe_index = 2,
648 .data_fifo_base_offset = 0x2100,
649 .data_fifo_size = 0x600,
650 .desc_fifo_base_offset = 0x2700,
651 .desc_fifo_size = 0x300,
652 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200653 [0][1][PEER_PERIPHERAL_TO_USB] = {
Anna Perel21515162012-02-02 20:50:02 +0200654 .src_phy_addr = A2_BAM_PHY_BASE,
655 .src_pipe_index = 3,
656 .dst_phy_addr = USB_BAM_PHY_BASE,
657 .dst_pipe_index = 12,
658 .data_fifo_base_offset = 0x1a00,
659 .data_fifo_size = 0x600,
660 .desc_fifo_base_offset = 0x2000,
661 .desc_fifo_size = 0x100,
662 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200663 [0][2][USB_TO_PEER_PERIPHERAL] = {
Anna Perel21515162012-02-02 20:50:02 +0200664 .src_phy_addr = USB_BAM_PHY_BASE,
665 .src_pipe_index = 15,
666 .dst_phy_addr = A2_BAM_PHY_BASE,
667 .dst_pipe_index = 4,
668 .data_fifo_base_offset = 0x3100,
669 .data_fifo_size = 0x600,
670 .desc_fifo_base_offset = 0x3700,
671 .desc_fifo_size = 0x300,
672 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200673 [0][2][PEER_PERIPHERAL_TO_USB] = {
Anna Perel21515162012-02-02 20:50:02 +0200674 .src_phy_addr = A2_BAM_PHY_BASE,
675 .src_pipe_index = 5,
676 .dst_phy_addr = USB_BAM_PHY_BASE,
677 .dst_pipe_index = 14,
678 .data_fifo_base_offset = 0x2a00,
679 .data_fifo_size = 0x600,
680 .desc_fifo_base_offset = 0x3000,
681 .desc_fifo_size = 0x100,
Lena Salmana66eddf2012-03-26 13:03:43 +0200682 },
683 [1][0][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200684 .src_phy_addr = HSIC_BAM_PHY_BASE,
685 .src_pipe_index = 1,
686 .dst_phy_addr = A2_BAM_PHY_BASE,
687 .dst_pipe_index = 0,
688 .data_fifo_base_offset = 0x1100,
689 .data_fifo_size = 0x600,
690 .desc_fifo_base_offset = 0x1700,
691 .desc_fifo_size = 0x300,
692 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200693 [1][0][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200694 .src_phy_addr = A2_BAM_PHY_BASE,
695 .src_pipe_index = 1,
696 .dst_phy_addr = HSIC_BAM_PHY_BASE,
697 .dst_pipe_index = 0,
698 .data_fifo_base_offset = 0xa00,
699 .data_fifo_size = 0x600,
700 .desc_fifo_base_offset = 0x1000,
701 .desc_fifo_size = 0x100,
702 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200703 [1][1][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200704 .src_phy_addr = HSIC_BAM_PHY_BASE,
705 .src_pipe_index = 3,
706 .dst_phy_addr = A2_BAM_PHY_BASE,
707 .dst_pipe_index = 2,
708 .data_fifo_base_offset = 0x2100,
709 .data_fifo_size = 0x600,
710 .desc_fifo_base_offset = 0x2700,
711 .desc_fifo_size = 0x300,
712 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200713 [1][1][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200714 .src_phy_addr = A2_BAM_PHY_BASE,
715 .src_pipe_index = 3,
716 .dst_phy_addr = HSIC_BAM_PHY_BASE,
717 .dst_pipe_index = 2,
718 .data_fifo_base_offset = 0x1a00,
719 .data_fifo_size = 0x600,
720 .desc_fifo_base_offset = 0x2000,
721 .desc_fifo_size = 0x100,
722 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200723 [1][2][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200724 .src_phy_addr = HSIC_BAM_PHY_BASE,
725 .src_pipe_index = 5,
726 .dst_phy_addr = A2_BAM_PHY_BASE,
727 .dst_pipe_index = 4,
728 .data_fifo_base_offset = 0x3100,
729 .data_fifo_size = 0x600,
730 .desc_fifo_base_offset = 0x3700,
731 .desc_fifo_size = 0x300,
732 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200733 [1][2][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200734 .src_phy_addr = A2_BAM_PHY_BASE,
735 .src_pipe_index = 5,
736 .dst_phy_addr = HSIC_BAM_PHY_BASE,
737 .dst_pipe_index = 4,
738 .data_fifo_base_offset = 0x2a00,
739 .data_fifo_size = 0x600,
740 .desc_fifo_base_offset = 0x3000,
741 .desc_fifo_size = 0x100,
742 }
Ofir Cohen40a4e862011-12-08 15:17:52 +0200743};
744
745static struct msm_usb_bam_platform_data msm_usb_bam_pdata = {
Lena Salmana66eddf2012-03-26 13:03:43 +0200746 .connections = &msm_usb_bam_connections[0][0][0],
Lena Salman57d167e2012-03-21 19:46:38 +0200747#ifndef CONFIG_USB_CI13XXX_MSM_HSIC
Ofir Cohen43473c82012-01-25 16:28:13 +0200748 .usb_active_bam = HSUSB_BAM,
Ofir Cohen43473c82012-01-25 16:28:13 +0200749#else
750 .usb_active_bam = HSIC_BAM,
Ofir Cohen43473c82012-01-25 16:28:13 +0200751#endif
Lena Salmana66eddf2012-03-26 13:03:43 +0200752 .usb_bam_num_pipes = 16,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200753};
754
Amit Blay5e4ec192011-10-20 09:16:54 +0200755static struct msm_otg_platform_data msm_otg_pdata = {
Amit Blay6a8d4f32011-11-21 10:36:25 +0200756 .mode = USB_OTG,
757 .otg_control = OTG_PHY_CONTROL,
Amit Blay5e4ec192011-10-20 09:16:54 +0200758 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200759 .vbus_power = msm_hsusb_vbus_power,
Ofir Cohen4da266f2012-01-03 10:19:29 +0200760 .disable_reset_on_disconnect = true,
Amit Blay6fa647a2012-05-24 14:12:08 +0300761 .enable_lpm_on_dev_suspend = true,
Amit Blay5e4ec192011-10-20 09:16:54 +0200762};
763
Amit Blay4d57d362012-04-28 11:00:21 +0300764static struct msm_hsic_peripheral_platform_data msm_hsic_peripheral_pdata = {
765 .keep_core_clk_on_suspend_workaround = true,
766};
767
Amit Blay5f968cf2012-01-22 12:04:01 +0200768#define PID_MAGIC_ID 0x71432909
769#define SERIAL_NUM_MAGIC_ID 0x61945374
770#define SERIAL_NUMBER_LENGTH 127
771#define DLOAD_USB_BASE_ADD 0x2B0000C8
772
773struct magic_num_struct {
774 uint32_t pid;
775 uint32_t serial_num;
776};
777
778struct dload_struct {
779 uint32_t reserved1;
780 uint32_t reserved2;
781 uint32_t reserved3;
782 uint16_t reserved4;
783 uint16_t pid;
784 char serial_number[SERIAL_NUMBER_LENGTH];
785 uint16_t reserved5;
786 struct magic_num_struct magic_struct;
787};
788
Amit Blay5e4ec192011-10-20 09:16:54 +0200789static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
790{
Amit Blay5f968cf2012-01-22 12:04:01 +0200791 struct dload_struct __iomem *dload = 0;
792
793 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
794 if (!dload) {
795 pr_err("%s: cannot remap I/O memory region: %08x\n",
796 __func__, DLOAD_USB_BASE_ADD);
797 return -ENXIO;
798 }
799
800 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
801 __func__, dload, pid, snum);
802 /* update pid */
803 dload->magic_struct.pid = PID_MAGIC_ID;
804 dload->pid = pid;
805
806 /* update serial number */
807 dload->magic_struct.serial_num = 0;
808 if (!snum) {
809 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
810 goto out;
811 }
812
813 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
814 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
815out:
816 iounmap(dload);
Amit Blay5e4ec192011-10-20 09:16:54 +0200817 return 0;
818}
819
Rohit Vaswani149f0a72011-11-09 15:21:28 -0800820static struct platform_device msm_wlan_ar6000_pm_device = {
821 .name = "wlan_ar6000_pm_dev",
822 .id = -1,
823};
824
825static int __init msm9615_init_ar6000pm(void)
826{
827 return platform_device_register(&msm_wlan_ar6000_pm_device);
828}
829
Jay Chokshidc8028b2011-12-01 16:17:34 -0800830#ifdef CONFIG_LTC4088_CHARGER
831static struct platform_device msm_device_charger = {
832 .name = LTC4088_CHARGER_DEV_NAME,
833 .id = -1,
834 .dev = {
835 .platform_data = &ltc4088_chg_pdata,
836 },
837};
838#endif
839
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -0700840static struct tsens_platform_data msm_tsens_pdata = {
841 .tsens_factor = 1000,
842 .hw_type = MDM_9615,
843 .tsens_num_sensor = 5,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -0700844 .slope = {1176, 1162, 1162, 1149, 1176},
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -0700845};
846
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -0700847static struct platform_device msm_tsens_device = {
848 .name = "tsens8960-tm",
849 .id = -1,
850};
851
Amit Blay5e4ec192011-10-20 09:16:54 +0200852static struct platform_device *common_devices[] = {
853 &msm9615_device_dmov,
854 &msm_device_smd,
Jay Chokshidc8028b2011-12-01 16:17:34 -0800855#ifdef CONFIG_LTC4088_CHARGER
856 &msm_device_charger,
857#endif
Amit Blay5e4ec192011-10-20 09:16:54 +0200858 &msm_device_otg,
Ofir Cohen73c99e82012-01-15 13:38:14 +0200859 &msm_device_hsic_peripheral,
Amit Blay5e4ec192011-10-20 09:16:54 +0200860 &msm_device_gadget_peripheral,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200861 &msm_device_hsusb_host,
Lena Salman65bcf372012-02-14 15:33:32 +0200862 &msm_device_hsic_host,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200863 &msm_device_usb_bam,
Ofir Cohen94213a72012-05-03 14:26:32 +0300864 &msm_android_usb_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200865 &msm9615_device_uart_gsbi4,
David Collins0f9942a2011-10-31 09:47:34 -0700866 &msm9615_device_ext_2p95v_vreg,
Amit Blay5e4ec192011-10-20 09:16:54 +0200867 &msm9615_device_ssbi_pmic1,
868 &msm9615_device_qup_i2c_gsbi5,
869 &msm9615_device_qup_spi_gsbi3,
870 &msm_device_sps,
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700871 &msm9615_slim_ctrl,
Amit Blay5e4ec192011-10-20 09:16:54 +0200872 &msm_device_nand,
Eric Holmberg0c96e702011-11-08 18:04:31 -0700873 &msm_device_bam_dmux,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600874 &msm9615_rpm_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200875#ifdef CONFIG_HW_RANDOM_MSM
876 &msm_device_rng,
877#endif
Olav Haugane6a0acd2012-04-05 09:29:12 -0700878#ifdef CONFIG_ION_MSM
879 &ion_dev,
880#endif
Amit Blay5e4ec192011-10-20 09:16:54 +0200881
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800882 &msm_pcm,
883 &msm_multi_ch_pcm,
884 &msm_pcm_routing,
885 &msm_cpudai0,
886 &msm_cpudai1,
887 &msm_cpudai_bt_rx,
888 &msm_cpudai_bt_tx,
889 &msm_cpu_fe,
890 &msm_stub_codec,
891 &msm_voice,
892 &msm_voip,
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700893 &msm_i2s_cpudai0,
894 &msm_i2s_cpudai1,
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800895 &msm_pcm_hostless,
896 &msm_cpudai_afe_01_rx,
897 &msm_cpudai_afe_01_tx,
898 &msm_cpudai_afe_02_rx,
899 &msm_cpudai_afe_02_tx,
900 &msm_pcm_afe,
901 &msm_cpudai_auxpcm_rx,
902 &msm_cpudai_auxpcm_tx,
903
Amit Blay5e4ec192011-10-20 09:16:54 +0200904#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
905 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700906 &msm9615_qcrypto_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200907#endif
908
909#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
910 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700911 &msm9615_qcedev_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200912#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700913 &msm9615_device_watchdog,
Gagan Mac7a827642011-09-22 19:42:21 -0600914 &msm_bus_9615_sys_fabric,
915 &msm_bus_def_fab,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600916 &msm9615_rpm_log_device,
917 &msm9615_rpm_stat_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -0700918 &msm_tsens_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200919};
920
Harini Jayaramaneba52672011-09-08 15:13:00 -0600921static void __init msm9615_i2c_init(void)
922{
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700923 u8 mach_mask = 0;
924 int i;
925 /* Mask is hardcoded to SURF (CDP).
926 * works on MTP with same configuration.
927 */
928 mach_mask = I2C_SURF;
929 if (machine_is_msm9615_cdp())
930 mach_mask = I2C_SURF;
931 else if (machine_is_msm9615_mtp())
932 mach_mask = I2C_FFA;
933 else
934 pr_err("unmatched machine ID in register_i2c_devices\n");
Harini Jayaramaneba52672011-09-08 15:13:00 -0600935 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
936 &msm9615_i2c_qup_gsbi5_pdata;
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700937 for (i = 0; i < ARRAY_SIZE(msm9615_i2c_devices); ++i) {
938 if (msm9615_i2c_devices[i].machs & mach_mask) {
939 i2c_register_board_info(msm9615_i2c_devices[i].bus,
940 msm9615_i2c_devices[i].info,
941 msm9615_i2c_devices[i].len);
942 }
943 }
Harini Jayaramaneba52672011-09-08 15:13:00 -0600944}
945
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600946static void __init msm9615_reserve(void)
947{
Olav Haugane6a0acd2012-04-05 09:29:12 -0700948#ifdef CONFIG_ION_MSM
949 reserve_info = &msm9615_reserve_info;
950 msm_reserve();
951#endif
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600952}
953
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700954static void __init msm9615_common_init(void)
955{
Ofir Cohen94213a72012-05-03 14:26:32 +0300956 struct android_usb_platform_data *android_pdata =
957 msm_android_usb_device.dev.platform_data;
958
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700959 msm9615_device_init();
Rohit Vaswania6815892011-12-15 20:20:39 -0800960 msm9615_init_gpiomux();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600961 msm9615_i2c_init();
David Collins00b31e62011-08-31 20:00:10 -0700962 regulator_suppress_info_printing();
David Collinsbea297a2011-09-28 13:11:14 -0700963 platform_device_register(&msm9615_device_rpm_regulator);
Vikram Mulukutla2021c002011-12-16 12:32:59 -0800964 msm_xo_init();
Gagan Mac7a827642011-09-22 19:42:21 -0600965 msm_clock_init(&msm9615_clock_init_data);
966 msm9615_init_buses();
Harini Jayaraman738c9312011-09-08 15:22:38 -0600967 msm9615_device_qup_spi_gsbi3.dev.platform_data =
968 &msm9615_qup_spi_gsbi3_pdata;
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700969 msm9615_device_ssbi_pmic1.dev.platform_data =
970 &msm9615_ssbi_pm8018_pdata;
David Collins00b31e62011-08-31 20:00:10 -0700971 pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len;
Amit Blay5e4ec192011-10-20 09:16:54 +0200972
973 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530974 msm_otg_pdata.phy_init_seq = shelby_phy_init_seq;
Amit Blay4d57d362012-04-28 11:00:21 +0300975 msm_device_hsic_peripheral.dev.platform_data =
976 &msm_hsic_peripheral_pdata;
Ofir Cohen40a4e862011-12-08 15:17:52 +0200977 msm_device_usb_bam.dev.platform_data = &msm_usb_bam_pdata;
Rohit Vaswani09666872011-08-23 17:41:54 -0700978 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi215f7be2012-02-09 18:30:44 -0800979 msm9615_pm8xxx_gpio_mpp_init();
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -0700980 acpuclk_init(&acpuclk_9615_soc_data);
981
Rohit Vaswani149f0a72011-11-09 15:21:28 -0800982 /* Ensure ar6000pm device is registered before MMC/SDC */
983 msm9615_init_ar6000pm();
984
Krishna Kondadd794462011-10-01 00:19:29 -0700985 msm9615_init_mmc();
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700986 slim_register_board_info(msm_slim_devices,
987 ARRAY_SIZE(msm_slim_devices));
Ofir Cohen94213a72012-05-03 14:26:32 +0300988 android_pdata->update_pid_and_serial_num =
989 usb_diag_update_pid_and_serial_num;
Olav Haugane6a0acd2012-04-05 09:29:12 -0700990 msm_pm_boot_pdata.p_addr = allocate_contiguous_ebi_nomap(SZ_8, SZ_64K);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600991 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -0700992 msm_tsens_early_init(&msm_tsens_pdata);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700993}
994
995static void __init msm9615_cdp_init(void)
996{
997 msm9615_common_init();
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400998#ifdef CONFIG_FB_MSM
999 mdm9615_init_fb();
1000#endif
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001001}
1002
1003static void __init msm9615_mtp_init(void)
1004{
1005 msm9615_common_init();
1006}
1007
Zhang Chang Kena48794b2012-03-31 17:45:21 -04001008#ifdef CONFIG_FB_MSM
1009static void __init mdm9615_allocate_memory_regions(void)
1010{
1011 mdm9615_allocate_fb_region();
1012}
1013#endif
1014
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001015MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
1016 .map_io = msm9615_map_io,
1017 .init_irq = msm9615_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301018 .handle_irq = gic_handle_irq,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001019 .timer = &msm_timer,
1020 .init_machine = msm9615_cdp_init,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001021 .reserve = msm9615_reserve,
Zhang Chang Kena48794b2012-03-31 17:45:21 -04001022#ifdef CONFIG_FB_MSM
1023 .init_early = mdm9615_allocate_memory_regions,
1024#endif
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07001025 .restart = msm_restart,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001026MACHINE_END
1027
1028MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
1029 .map_io = msm9615_map_io,
1030 .init_irq = msm9615_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301031 .handle_irq = gic_handle_irq,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001032 .timer = &msm_timer,
1033 .init_machine = msm9615_mtp_init,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001034 .reserve = msm9615_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07001035 .restart = msm_restart,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001036MACHINE_END