blob: 3b99e6c133c21c21dfdc6fa5a545b5c77062a92f [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>
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -070030#include <linux/msm_tsens.h>
Olav Haugane6a0acd2012-04-05 09:29:12 -070031#include <linux/ion.h>
32#include <linux/memory.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070033#include <asm/mach-types.h>
34#include <asm/mach/arch.h>
Marc Zyngier89bdafd12011-12-22 11:39:20 +053035#include <asm/hardware/gic.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070036#include <mach/board.h>
37#include <mach/msm_iomap.h>
38#include <mach/gpio.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>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070048#include "timer.h"
49#include "devices.h"
David Collinsfb88c432011-08-25 15:12:47 -070050#include "board-9615.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080051#include "pm.h"
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -070052#include "acpuclock.h"
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -060053#include "pm-boot.h"
Venkat Sudhir5efc4912012-05-15 17:10:35 -070054#include <mach/gpiomux.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070055
Olav Haugane6a0acd2012-04-05 09:29:12 -070056#ifdef CONFIG_ION_MSM
57#define MSM_ION_AUDIO_SIZE 0xAF000
58#define MSM_ION_HEAP_NUM 3
59#define MSM_KERNEL_EBI_SIZE 0x51000
60
61static struct memtype_reserve msm9615_reserve_table[] __initdata = {
62 [MEMTYPE_SMI] = {
63 },
64 [MEMTYPE_EBI0] = {
65 .flags = MEMTYPE_FLAGS_1M_ALIGN,
66 },
67 [MEMTYPE_EBI1] = {
68 .flags = MEMTYPE_FLAGS_1M_ALIGN,
69 },
70};
71
72static int msm9615_paddr_to_memtype(unsigned int paddr)
73{
74 return MEMTYPE_EBI1;
75}
76
77static struct ion_co_heap_pdata co_ion_pdata = {
78 .adjacent_mem_id = INVALID_HEAP_ID,
79 .align = PAGE_SIZE,
80};
81
82static struct ion_platform_data ion_pdata = {
83 .nr = MSM_ION_HEAP_NUM,
84 .heaps = {
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 },
103 }
104};
105
106static struct platform_device ion_dev = {
107 .name = "ion-msm",
108 .id = 1,
109 .dev = { .platform_data = &ion_pdata },
110};
111
Stephen Boyd668d7652012-04-25 11:31:01 -0700112static void __init reserve_ion_memory(void)
Olav Haugane6a0acd2012-04-05 09:29:12 -0700113{
114 msm9615_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
115}
116
117static void __init msm9615_calculate_reserve_sizes(void)
118{
119 reserve_ion_memory();
120 msm9615_reserve_table[MEMTYPE_EBI1].size += MSM_KERNEL_EBI_SIZE;
121}
122
123static struct reserve_info msm9615_reserve_info __initdata = {
124 .memtype_reserve_table = msm9615_reserve_table,
125 .calculate_reserve_sizes = msm9615_calculate_reserve_sizes,
126 .paddr_to_memtype = msm9615_paddr_to_memtype,
127};
128#endif
129
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700130static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = {
131 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
132 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
133 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
134 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
135 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
136 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadossf9383d52012-04-19 09:42:49 -0700137 /* AMUX8 is used to read either Batt_id/Batt_therm.
138 * Current configuration is to support Batt_id. If clients
139 * want to read the Batt_therm, the scaling function needs to be
140 * updated to use ADC_SCALE_BATT_THERM instead of ADC_SCALE_DEFAULT.
141 * E.g.
142 * {"batt_therm", CHANNEL_BATT_ID_THERM, CHAN_PATH_SCALING1,
143 * AMUX_RSV2, ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
144 */
145 {"batt_id", CHANNEL_BATT_ID_THERM, CHAN_PATH_SCALING1,
146 AMUX_RSV2, ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700147 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
148 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
149 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
150 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
151 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
152 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
153 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
154 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
155};
156
157static struct pm8xxx_adc_properties pm8018_adc_data = {
158 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
159 .bitresolution = 15,
160 .bipolar = 0,
161};
162
163static struct pm8xxx_adc_platform_data pm8018_adc_pdata = {
164 .adc_channel = pm8018_adc_channels_data,
165 .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data),
166 .adc_prop = &pm8018_adc_data,
167};
168
David Collinsfb88c432011-08-25 15:12:47 -0700169static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
170 .irq_base = PM8018_IRQ_BASE,
171 .devirq = MSM_GPIO_TO_INT(87),
172 .irq_trigger_flag = IRQF_TRIGGER_LOW,
173};
174
175static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
176 .gpio_base = PM8018_GPIO_PM_TO_SYS(1),
177};
178
179static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
180 .mpp_base = PM8018_MPP_PM_TO_SYS(1),
181};
182
183static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
184 .rtc_write_enable = false,
Ashay Jaiswaldb5e6dc2011-10-12 11:02:47 +0530185 .rtc_alarm_powerup = false,
David Collinsfb88c432011-08-25 15:12:47 -0700186};
187
188static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
189 .pull_up = 1,
Jing Lineecdc062011-11-17 09:47:09 -0800190 .kpd_trigger_delay_us = 15625,
David Collinsfb88c432011-08-25 15:12:47 -0700191 .wakeup = 1,
192};
193
194static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
195 .priority = 0,
196};
197
Jay Chokshieb5d0d52011-09-28 17:16:20 -0700198#define PM8018_LED_KB_MAX_CURRENT 20 /* I = 20mA */
199#define PM8XXX_LED_PWM_PERIOD_US 1000
200
201/**
202 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
203 * driven using PWM feature.
204 */
205#define PM8XXX_PWM_CHANNEL_NONE -1
206
207static struct led_info pm8018_led_info[] = {
208 [0] = {
209 .name = "led:kb",
210 },
211};
212
213static struct led_platform_data pm8018_led_core_pdata = {
214 .num_leds = ARRAY_SIZE(pm8018_led_info),
215 .leds = pm8018_led_info,
216};
217
218static struct pm8xxx_led_config pm8018_led_configs[] = {
219 [0] = {
220 .id = PM8XXX_ID_LED_KB_LIGHT,
221 .mode = PM8XXX_LED_MODE_PWM3,
222 .max_current = PM8018_LED_KB_MAX_CURRENT,
223 .pwm_channel = 2,
224 .pwm_period_us = PM8XXX_LED_PWM_PERIOD_US,
225 },
226};
227
228static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
229 .led_core = &pm8018_led_core_pdata,
230 .configs = pm8018_led_configs,
231 .num_configs = ARRAY_SIZE(pm8018_led_configs),
232};
233
Jay Chokshidc8028b2011-12-01 16:17:34 -0800234#ifdef CONFIG_LTC4088_CHARGER
235static struct ltc4088_charger_platform_data ltc4088_chg_pdata = {
236 .gpio_mode_select_d0 = 7,
237 .gpio_mode_select_d1 = 6,
238 .gpio_mode_select_d2 = 4,
239};
240#endif
241
David Collinsfb88c432011-08-25 15:12:47 -0700242static struct pm8018_platform_data pm8018_platform_data __devinitdata = {
243 .irq_pdata = &pm8xxx_irq_pdata,
244 .gpio_pdata = &pm8xxx_gpio_pdata,
245 .mpp_pdata = &pm8xxx_mpp_pdata,
246 .rtc_pdata = &pm8xxx_rtc_pdata,
247 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
248 .misc_pdata = &pm8xxx_misc_pdata,
David Collins00b31e62011-08-31 20:00:10 -0700249 .regulator_pdatas = msm_pm8018_regulator_pdata,
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700250 .adc_pdata = &pm8018_adc_pdata,
Jay Chokshieb5d0d52011-09-28 17:16:20 -0700251 .leds_pdata = &pm8xxx_leds_pdata,
David Collinsfb88c432011-08-25 15:12:47 -0700252};
253
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700254static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = {
255 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
256 .slave = {
David Collinsfb88c432011-08-25 15:12:47 -0700257 .name = PM8018_CORE_DEV_NAME,
258 .platform_data = &pm8018_platform_data,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700259 },
260};
261
David Collinsbea297a2011-09-28 13:11:14 -0700262static struct platform_device msm9615_device_rpm_regulator __devinitdata = {
263 .name = "rpm-regulator",
264 .id = -1,
265 .dev = {
266 .platform_data = &msm_rpm_regulator_9615_pdata,
267 },
268};
269
David Collins0f9942a2011-10-31 09:47:34 -0700270static struct platform_device msm9615_device_ext_2p95v_vreg = {
271 .name = GPIO_REGULATOR_DEV_NAME,
272 .id = 18,
273 .dev = {
274 .platform_data =
275 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P95V],
276 },
277};
278
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600279static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
280 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
281 .v_addr = MSM_APCS_GLB_BASE + 0x24,
282};
283
Gagan Mac7a827642011-09-22 19:42:21 -0600284static void __init msm9615_init_buses(void)
285{
286#ifdef CONFIG_MSM_BUS_SCALING
287 msm_bus_rpm_set_mt_mask();
288 msm_bus_9615_sys_fabric_pdata.rpm_enabled = 1;
289 msm_bus_9615_sys_fabric.dev.platform_data =
290 &msm_bus_9615_sys_fabric_pdata;
291 msm_bus_def_fab.dev.platform_data = &msm_bus_9615_def_fab_pdata;
292#endif
293}
294
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800295#ifdef CONFIG_WCD9310_CODEC
296
297#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
298
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700299/*
300 * MDM9x15 I2S.
301 */
302static struct wcd9xxx_pdata wcd9xxx_i2c_platform_data = {
303 .irq = MSM_GPIO_TO_INT(85),
304 .irq_base = TABLA_INTERRUPT_BASE,
305 .num_irqs = NR_TABLA_IRQS,
306 .reset_gpio = 84,
307 .micbias = {
308 .ldoh_v = TABLA_LDOH_2P85_V,
309 .cfilt1_mv = 1800,
310 .cfilt2_mv = 1800,
311 .cfilt3_mv = 1800,
312 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
313 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
314 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
315 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
316 },
317 .regulator = {
318 {
319 .name = "CDC_VDD_CP",
320 .min_uV = 1800000,
321 .max_uV = 1800000,
322 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
323 },
324 {
325 .name = "CDC_VDDA_RX",
326 .min_uV = 1800000,
327 .max_uV = 1800000,
328 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
329 },
330 {
331 .name = "CDC_VDDA_TX",
332 .min_uV = 1800000,
333 .max_uV = 1800000,
334 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
335 },
336 {
337 .name = "VDDIO_CDC",
338 .min_uV = 1800000,
339 .max_uV = 1800000,
340 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
341 },
342 {
343 .name = "VDDD_CDC_D",
344 .min_uV = 1225000,
345 .max_uV = 1225000,
346 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
347 },
348 {
349 .name = "CDC_VDDA_A_1P2V",
350 .min_uV = 1225000,
351 .max_uV = 1225000,
352 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
353 }
354 },
355};
356
357static struct i2c_board_info wcd9xxx_device_info[] __initdata = {
358 {
359 I2C_BOARD_INFO("tabla top level", TABLA_I2C_SLAVE_ADDR),
360 .platform_data = &wcd9xxx_i2c_platform_data,
361 },
362 {
363 I2C_BOARD_INFO("tabla analog", TABLA_ANALOG_I2C_SLAVE_ADDR),
364 .platform_data = &wcd9xxx_i2c_platform_data,
365 },
366 {
367 I2C_BOARD_INFO("tabla digital1", TABLA_DIGITAL1_I2C_SLAVE_ADDR),
368 .platform_data = &wcd9xxx_i2c_platform_data,
369 },
370 {
371 I2C_BOARD_INFO("tabla digital2", TABLA_DIGITAL2_I2C_SLAVE_ADDR),
372 .platform_data = &wcd9xxx_i2c_platform_data,
373 },
374};
375
376static struct i2c_registry msm9615_i2c_devices[] __initdata = {
377 {
378 I2C_SURF | I2C_FFA | I2C_FLUID,
379 MSM_9615_GSBI5_QUP_I2C_BUS_ID,
380 wcd9xxx_device_info,
381 ARRAY_SIZE(wcd9xxx_device_info),
382 },
383};
384/*
385 * MDM9x15 I2S.
386 */
387
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800388/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
389 * 4 micbiases are used to power various analog and digital
390 * microphones operating at 1800 mV. Technically, all micbiases
391 * can source from single cfilter since all microphones operate
392 * at the same voltage level. The arrangement below is to make
393 * sure all cfilters are exercised. LDO_H regulator ouput level
394 * does not need to be as high as 2.85V. It is choosen for
395 * microphone sensitivity purpose.
396 */
397
398static struct wcd9xxx_pdata tabla20_platform_data = {
399 .slimbus_slave_device = {
400 .name = "tabla-slave",
401 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
402 },
Shiv Maliyappanahallid7147812012-05-17 12:43:03 -0700403 .irq = MSM_GPIO_TO_INT(85),
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800404 .irq_base = TABLA_INTERRUPT_BASE,
405 .num_irqs = NR_WCD9XXX_IRQS,
406 .reset_gpio = 84,
407 .micbias = {
408 .ldoh_v = TABLA_LDOH_2P85_V,
409 .cfilt1_mv = 1800,
410 .cfilt2_mv = 1800,
411 .cfilt3_mv = 1800,
412 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
413 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
414 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
415 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
416 },
417 .regulator = {
418 {
419 .name = "CDC_VDD_CP",
420 .min_uV = 1800000,
421 .max_uV = 1800000,
422 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
423 },
424 {
425 .name = "CDC_VDDA_RX",
426 .min_uV = 1800000,
427 .max_uV = 1800000,
428 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
429 },
430 {
431 .name = "CDC_VDDA_TX",
432 .min_uV = 1800000,
433 .max_uV = 1800000,
434 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
435 },
436 {
437 .name = "VDDIO_CDC",
438 .min_uV = 1800000,
439 .max_uV = 1800000,
440 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
441 },
442 {
443 .name = "VDDD_CDC_D",
444 .min_uV = 1225000,
445 .max_uV = 1225000,
446 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
447 },
448 {
449 .name = "CDC_VDDA_A_1P2V",
450 .min_uV = 1225000,
451 .max_uV = 1225000,
452 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
453 },
454 },
455};
456
457static struct slim_device msm_slim_tabla20 = {
458 .name = "tabla2x-slim",
459 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
460 .dev = {
461 .platform_data = &tabla20_platform_data,
462 },
463};
464#endif
465
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700466static struct slim_boardinfo msm_slim_devices[] = {
467 /* add slimbus slaves as needed */
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800468#ifdef CONFIG_WCD9310_CODEC
469 {
470 .bus_num = 1,
471 .slim_slave = &msm_slim_tabla20,
472 },
473#endif
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700474};
475
Harini Jayaraman738c9312011-09-08 15:22:38 -0600476static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
477 .max_clock_speed = 24000000,
478};
479
Harini Jayaramaneba52672011-09-08 15:13:00 -0600480static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
481 .clk_freq = 100000,
482 .src_clk_rate = 24000000,
483};
484
Amit Blay6a8d4f32011-11-21 10:36:25 +0200485#define USB_5V_EN 3
486#define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN)
487
Mayank Rana8549e632012-01-23 12:49:54 +0530488static int msm_hsusb_vbus_power(bool on)
Amit Blay6a8d4f32011-11-21 10:36:25 +0200489{
Amit Blaya4416f92012-01-24 21:03:52 +0200490 int rc;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200491 struct pm_gpio usb_vbus = {
492 .direction = PM_GPIO_DIR_OUT,
493 .pull = PM_GPIO_PULL_NO,
494 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200495 .vin_sel = 2,
496 .out_strength = PM_GPIO_STRENGTH_HIGH,
497 .function = PM_GPIO_FUNC_NORMAL,
498 .inv_int_pol = 0,
499 };
500
Amit Blaya4416f92012-01-24 21:03:52 +0200501 usb_vbus.output_value = on;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200502
Amit Blaya4416f92012-01-24 21:03:52 +0200503 rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus);
504 if (rc)
505 pr_err("failed to config usb_5v_en gpio\n");
Amit Blay6a8d4f32011-11-21 10:36:25 +0200506
Mayank Rana8549e632012-01-23 12:49:54 +0530507 return rc;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200508}
509
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530510static int shelby_phy_init_seq[] = {
511 0x44, 0x80,/* set VBUS valid threshold and
512 disconnect valid threshold */
513 0x38, 0x81, /* update DC voltage level */
Amit Blaydbaeff82012-04-02 22:13:36 +0300514 0x24, 0x82,/* set preemphasis and rise/fall time */
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530515 0x13, 0x83,/* set source impedance adjustment */
516 -1};
517
Ofir Cohen40a4e862011-12-08 15:17:52 +0200518#define USB_BAM_PHY_BASE 0x12502000
Ofir Cohen43473c82012-01-25 16:28:13 +0200519#define HSIC_BAM_PHY_BASE 0x12542000
Ofir Cohen40a4e862011-12-08 15:17:52 +0200520#define A2_BAM_PHY_BASE 0x124C2000
Lena Salmana66eddf2012-03-26 13:03:43 +0200521static struct usb_bam_pipe_connect msm_usb_bam_connections[2][4][2] = {
522 [0][0][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen40a4e862011-12-08 15:17:52 +0200523 .src_phy_addr = USB_BAM_PHY_BASE,
524 .src_pipe_index = 11,
525 .dst_phy_addr = A2_BAM_PHY_BASE,
526 .dst_pipe_index = 0,
Ofir Cohen29cd5752011-12-14 17:20:30 +0200527 .data_fifo_base_offset = 0x1100,
528 .data_fifo_size = 0x600,
529 .desc_fifo_base_offset = 0x1700,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200530 .desc_fifo_size = 0x300,
531 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200532 [0][0][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen40a4e862011-12-08 15:17:52 +0200533 .src_phy_addr = A2_BAM_PHY_BASE,
534 .src_pipe_index = 1,
535 .dst_phy_addr = USB_BAM_PHY_BASE,
536 .dst_pipe_index = 10,
537 .data_fifo_base_offset = 0xa00,
Ofir Cohen29cd5752011-12-14 17:20:30 +0200538 .data_fifo_size = 0x600,
539 .desc_fifo_base_offset = 0x1000,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200540 .desc_fifo_size = 0x100,
541 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200542 [0][1][USB_TO_PEER_PERIPHERAL] = {
Anna Perel21515162012-02-02 20:50:02 +0200543 .src_phy_addr = USB_BAM_PHY_BASE,
544 .src_pipe_index = 13,
545 .dst_phy_addr = A2_BAM_PHY_BASE,
546 .dst_pipe_index = 2,
547 .data_fifo_base_offset = 0x2100,
548 .data_fifo_size = 0x600,
549 .desc_fifo_base_offset = 0x2700,
550 .desc_fifo_size = 0x300,
551 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200552 [0][1][PEER_PERIPHERAL_TO_USB] = {
Anna Perel21515162012-02-02 20:50:02 +0200553 .src_phy_addr = A2_BAM_PHY_BASE,
554 .src_pipe_index = 3,
555 .dst_phy_addr = USB_BAM_PHY_BASE,
556 .dst_pipe_index = 12,
557 .data_fifo_base_offset = 0x1a00,
558 .data_fifo_size = 0x600,
559 .desc_fifo_base_offset = 0x2000,
560 .desc_fifo_size = 0x100,
561 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200562 [0][2][USB_TO_PEER_PERIPHERAL] = {
Anna Perel21515162012-02-02 20:50:02 +0200563 .src_phy_addr = USB_BAM_PHY_BASE,
564 .src_pipe_index = 15,
565 .dst_phy_addr = A2_BAM_PHY_BASE,
566 .dst_pipe_index = 4,
567 .data_fifo_base_offset = 0x3100,
568 .data_fifo_size = 0x600,
569 .desc_fifo_base_offset = 0x3700,
570 .desc_fifo_size = 0x300,
571 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200572 [0][2][PEER_PERIPHERAL_TO_USB] = {
Anna Perel21515162012-02-02 20:50:02 +0200573 .src_phy_addr = A2_BAM_PHY_BASE,
574 .src_pipe_index = 5,
575 .dst_phy_addr = USB_BAM_PHY_BASE,
576 .dst_pipe_index = 14,
577 .data_fifo_base_offset = 0x2a00,
578 .data_fifo_size = 0x600,
579 .desc_fifo_base_offset = 0x3000,
580 .desc_fifo_size = 0x100,
Lena Salmana66eddf2012-03-26 13:03:43 +0200581 },
582 [1][0][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200583 .src_phy_addr = HSIC_BAM_PHY_BASE,
584 .src_pipe_index = 1,
585 .dst_phy_addr = A2_BAM_PHY_BASE,
586 .dst_pipe_index = 0,
587 .data_fifo_base_offset = 0x1100,
588 .data_fifo_size = 0x600,
589 .desc_fifo_base_offset = 0x1700,
590 .desc_fifo_size = 0x300,
591 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200592 [1][0][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200593 .src_phy_addr = A2_BAM_PHY_BASE,
594 .src_pipe_index = 1,
595 .dst_phy_addr = HSIC_BAM_PHY_BASE,
596 .dst_pipe_index = 0,
597 .data_fifo_base_offset = 0xa00,
598 .data_fifo_size = 0x600,
599 .desc_fifo_base_offset = 0x1000,
600 .desc_fifo_size = 0x100,
601 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200602 [1][1][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200603 .src_phy_addr = HSIC_BAM_PHY_BASE,
604 .src_pipe_index = 3,
605 .dst_phy_addr = A2_BAM_PHY_BASE,
606 .dst_pipe_index = 2,
607 .data_fifo_base_offset = 0x2100,
608 .data_fifo_size = 0x600,
609 .desc_fifo_base_offset = 0x2700,
610 .desc_fifo_size = 0x300,
611 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200612 [1][1][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200613 .src_phy_addr = A2_BAM_PHY_BASE,
614 .src_pipe_index = 3,
615 .dst_phy_addr = HSIC_BAM_PHY_BASE,
616 .dst_pipe_index = 2,
617 .data_fifo_base_offset = 0x1a00,
618 .data_fifo_size = 0x600,
619 .desc_fifo_base_offset = 0x2000,
620 .desc_fifo_size = 0x100,
621 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200622 [1][2][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200623 .src_phy_addr = HSIC_BAM_PHY_BASE,
624 .src_pipe_index = 5,
625 .dst_phy_addr = A2_BAM_PHY_BASE,
626 .dst_pipe_index = 4,
627 .data_fifo_base_offset = 0x3100,
628 .data_fifo_size = 0x600,
629 .desc_fifo_base_offset = 0x3700,
630 .desc_fifo_size = 0x300,
631 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200632 [1][2][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200633 .src_phy_addr = A2_BAM_PHY_BASE,
634 .src_pipe_index = 5,
635 .dst_phy_addr = HSIC_BAM_PHY_BASE,
636 .dst_pipe_index = 4,
637 .data_fifo_base_offset = 0x2a00,
638 .data_fifo_size = 0x600,
639 .desc_fifo_base_offset = 0x3000,
640 .desc_fifo_size = 0x100,
641 }
Ofir Cohen40a4e862011-12-08 15:17:52 +0200642};
643
644static struct msm_usb_bam_platform_data msm_usb_bam_pdata = {
Lena Salmana66eddf2012-03-26 13:03:43 +0200645 .connections = &msm_usb_bam_connections[0][0][0],
Lena Salman57d167e2012-03-21 19:46:38 +0200646#ifndef CONFIG_USB_CI13XXX_MSM_HSIC
Ofir Cohen43473c82012-01-25 16:28:13 +0200647 .usb_active_bam = HSUSB_BAM,
Ofir Cohen43473c82012-01-25 16:28:13 +0200648#else
649 .usb_active_bam = HSIC_BAM,
Ofir Cohen43473c82012-01-25 16:28:13 +0200650#endif
Lena Salmana66eddf2012-03-26 13:03:43 +0200651 .usb_bam_num_pipes = 16,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200652};
653
Amit Blay5e4ec192011-10-20 09:16:54 +0200654static struct msm_otg_platform_data msm_otg_pdata = {
Amit Blay6a8d4f32011-11-21 10:36:25 +0200655 .mode = USB_OTG,
656 .otg_control = OTG_PHY_CONTROL,
Amit Blay5e4ec192011-10-20 09:16:54 +0200657 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200658 .vbus_power = msm_hsusb_vbus_power,
Ofir Cohen4da266f2012-01-03 10:19:29 +0200659 .disable_reset_on_disconnect = true,
Amit Blay5e4ec192011-10-20 09:16:54 +0200660};
661
Amit Blay4d57d362012-04-28 11:00:21 +0300662static struct msm_hsic_peripheral_platform_data msm_hsic_peripheral_pdata = {
663 .keep_core_clk_on_suspend_workaround = true,
664};
665
Amit Blay5f968cf2012-01-22 12:04:01 +0200666#define PID_MAGIC_ID 0x71432909
667#define SERIAL_NUM_MAGIC_ID 0x61945374
668#define SERIAL_NUMBER_LENGTH 127
669#define DLOAD_USB_BASE_ADD 0x2B0000C8
670
671struct magic_num_struct {
672 uint32_t pid;
673 uint32_t serial_num;
674};
675
676struct dload_struct {
677 uint32_t reserved1;
678 uint32_t reserved2;
679 uint32_t reserved3;
680 uint16_t reserved4;
681 uint16_t pid;
682 char serial_number[SERIAL_NUMBER_LENGTH];
683 uint16_t reserved5;
684 struct magic_num_struct magic_struct;
685};
686
Amit Blay5e4ec192011-10-20 09:16:54 +0200687static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
688{
Amit Blay5f968cf2012-01-22 12:04:01 +0200689 struct dload_struct __iomem *dload = 0;
690
691 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
692 if (!dload) {
693 pr_err("%s: cannot remap I/O memory region: %08x\n",
694 __func__, DLOAD_USB_BASE_ADD);
695 return -ENXIO;
696 }
697
698 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
699 __func__, dload, pid, snum);
700 /* update pid */
701 dload->magic_struct.pid = PID_MAGIC_ID;
702 dload->pid = pid;
703
704 /* update serial number */
705 dload->magic_struct.serial_num = 0;
706 if (!snum) {
707 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
708 goto out;
709 }
710
711 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
712 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
713out:
714 iounmap(dload);
Amit Blay5e4ec192011-10-20 09:16:54 +0200715 return 0;
716}
717
Rohit Vaswani149f0a72011-11-09 15:21:28 -0800718static struct platform_device msm_wlan_ar6000_pm_device = {
719 .name = "wlan_ar6000_pm_dev",
720 .id = -1,
721};
722
723static int __init msm9615_init_ar6000pm(void)
724{
725 return platform_device_register(&msm_wlan_ar6000_pm_device);
726}
727
Jay Chokshidc8028b2011-12-01 16:17:34 -0800728#ifdef CONFIG_LTC4088_CHARGER
729static struct platform_device msm_device_charger = {
730 .name = LTC4088_CHARGER_DEV_NAME,
731 .id = -1,
732 .dev = {
733 .platform_data = &ltc4088_chg_pdata,
734 },
735};
736#endif
737
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -0700738static struct tsens_platform_data msm_tsens_pdata = {
739 .tsens_factor = 1000,
740 .hw_type = MDM_9615,
741 .tsens_num_sensor = 5,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -0700742 .slope = {1176, 1162, 1162, 1149, 1176},
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -0700743};
744
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -0700745static struct platform_device msm_tsens_device = {
746 .name = "tsens8960-tm",
747 .id = -1,
748};
749
Amit Blay5e4ec192011-10-20 09:16:54 +0200750static struct platform_device *common_devices[] = {
751 &msm9615_device_dmov,
752 &msm_device_smd,
Jay Chokshidc8028b2011-12-01 16:17:34 -0800753#ifdef CONFIG_LTC4088_CHARGER
754 &msm_device_charger,
755#endif
Lena Salman57d167e2012-03-21 19:46:38 +0200756#ifndef CONFIG_USB_CI13XXX_MSM_HSIC
Amit Blay5e4ec192011-10-20 09:16:54 +0200757 &msm_device_otg,
Ofir Cohendca06cb2012-03-08 16:37:45 +0200758#endif
Ofir Cohen73c99e82012-01-15 13:38:14 +0200759 &msm_device_hsic_peripheral,
Amit Blay5e4ec192011-10-20 09:16:54 +0200760 &msm_device_gadget_peripheral,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200761 &msm_device_hsusb_host,
Lena Salman65bcf372012-02-14 15:33:32 +0200762 &msm_device_hsic_host,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200763 &msm_device_usb_bam,
Ofir Cohen94213a72012-05-03 14:26:32 +0300764 &msm_android_usb_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200765 &msm9615_device_uart_gsbi4,
David Collins0f9942a2011-10-31 09:47:34 -0700766 &msm9615_device_ext_2p95v_vreg,
Amit Blay5e4ec192011-10-20 09:16:54 +0200767 &msm9615_device_ssbi_pmic1,
768 &msm9615_device_qup_i2c_gsbi5,
769 &msm9615_device_qup_spi_gsbi3,
770 &msm_device_sps,
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700771 &msm9615_slim_ctrl,
Amit Blay5e4ec192011-10-20 09:16:54 +0200772 &msm_device_nand,
Eric Holmberg0c96e702011-11-08 18:04:31 -0700773 &msm_device_bam_dmux,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600774 &msm9615_rpm_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200775#ifdef CONFIG_HW_RANDOM_MSM
776 &msm_device_rng,
777#endif
Olav Haugane6a0acd2012-04-05 09:29:12 -0700778#ifdef CONFIG_ION_MSM
779 &ion_dev,
780#endif
Amit Blay5e4ec192011-10-20 09:16:54 +0200781
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800782 &msm_pcm,
783 &msm_multi_ch_pcm,
784 &msm_pcm_routing,
785 &msm_cpudai0,
786 &msm_cpudai1,
787 &msm_cpudai_bt_rx,
788 &msm_cpudai_bt_tx,
789 &msm_cpu_fe,
790 &msm_stub_codec,
791 &msm_voice,
792 &msm_voip,
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700793 &msm_i2s_cpudai0,
794 &msm_i2s_cpudai1,
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800795 &msm_pcm_hostless,
796 &msm_cpudai_afe_01_rx,
797 &msm_cpudai_afe_01_tx,
798 &msm_cpudai_afe_02_rx,
799 &msm_cpudai_afe_02_tx,
800 &msm_pcm_afe,
801 &msm_cpudai_auxpcm_rx,
802 &msm_cpudai_auxpcm_tx,
803
Amit Blay5e4ec192011-10-20 09:16:54 +0200804#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
805 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700806 &msm9615_qcrypto_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200807#endif
808
809#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
810 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700811 &msm9615_qcedev_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200812#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700813 &msm9615_device_watchdog,
Gagan Mac7a827642011-09-22 19:42:21 -0600814 &msm_bus_9615_sys_fabric,
815 &msm_bus_def_fab,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600816 &msm9615_rpm_log_device,
817 &msm9615_rpm_stat_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -0700818 &msm_tsens_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200819};
820
Harini Jayaramaneba52672011-09-08 15:13:00 -0600821static void __init msm9615_i2c_init(void)
822{
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700823 u8 mach_mask = 0;
824 int i;
825 /* Mask is hardcoded to SURF (CDP).
826 * works on MTP with same configuration.
827 */
828 mach_mask = I2C_SURF;
829 if (machine_is_msm9615_cdp())
830 mach_mask = I2C_SURF;
831 else if (machine_is_msm9615_mtp())
832 mach_mask = I2C_FFA;
833 else
834 pr_err("unmatched machine ID in register_i2c_devices\n");
Harini Jayaramaneba52672011-09-08 15:13:00 -0600835 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
836 &msm9615_i2c_qup_gsbi5_pdata;
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700837 for (i = 0; i < ARRAY_SIZE(msm9615_i2c_devices); ++i) {
838 if (msm9615_i2c_devices[i].machs & mach_mask) {
839 i2c_register_board_info(msm9615_i2c_devices[i].bus,
840 msm9615_i2c_devices[i].info,
841 msm9615_i2c_devices[i].len);
842 }
843 }
Harini Jayaramaneba52672011-09-08 15:13:00 -0600844}
845
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600846static void __init msm9615_reserve(void)
847{
Olav Haugane6a0acd2012-04-05 09:29:12 -0700848#ifdef CONFIG_ION_MSM
849 reserve_info = &msm9615_reserve_info;
850 msm_reserve();
851#endif
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600852}
853
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700854static void __init msm9615_common_init(void)
855{
Ofir Cohen94213a72012-05-03 14:26:32 +0300856 struct android_usb_platform_data *android_pdata =
857 msm_android_usb_device.dev.platform_data;
858
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700859 msm9615_device_init();
Rohit Vaswania6815892011-12-15 20:20:39 -0800860 msm9615_init_gpiomux();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600861 msm9615_i2c_init();
David Collins00b31e62011-08-31 20:00:10 -0700862 regulator_suppress_info_printing();
David Collinsbea297a2011-09-28 13:11:14 -0700863 platform_device_register(&msm9615_device_rpm_regulator);
Vikram Mulukutla2021c002011-12-16 12:32:59 -0800864 msm_xo_init();
Gagan Mac7a827642011-09-22 19:42:21 -0600865 msm_clock_init(&msm9615_clock_init_data);
866 msm9615_init_buses();
Harini Jayaraman738c9312011-09-08 15:22:38 -0600867 msm9615_device_qup_spi_gsbi3.dev.platform_data =
868 &msm9615_qup_spi_gsbi3_pdata;
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700869 msm9615_device_ssbi_pmic1.dev.platform_data =
870 &msm9615_ssbi_pm8018_pdata;
David Collins00b31e62011-08-31 20:00:10 -0700871 pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len;
Amit Blay5e4ec192011-10-20 09:16:54 +0200872
873 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530874 msm_otg_pdata.phy_init_seq = shelby_phy_init_seq;
Amit Blay4d57d362012-04-28 11:00:21 +0300875 msm_device_hsic_peripheral.dev.platform_data =
876 &msm_hsic_peripheral_pdata;
Ofir Cohen40a4e862011-12-08 15:17:52 +0200877 msm_device_usb_bam.dev.platform_data = &msm_usb_bam_pdata;
Rohit Vaswani09666872011-08-23 17:41:54 -0700878 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Krishna Kondadd794462011-10-01 00:19:29 -0700879
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -0700880 acpuclk_init(&acpuclk_9615_soc_data);
881
Rohit Vaswani149f0a72011-11-09 15:21:28 -0800882 /* Ensure ar6000pm device is registered before MMC/SDC */
883 msm9615_init_ar6000pm();
884
Krishna Kondadd794462011-10-01 00:19:29 -0700885 msm9615_init_mmc();
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700886 slim_register_board_info(msm_slim_devices,
887 ARRAY_SIZE(msm_slim_devices));
Ofir Cohen94213a72012-05-03 14:26:32 +0300888 android_pdata->update_pid_and_serial_num =
889 usb_diag_update_pid_and_serial_num;
Olav Haugane6a0acd2012-04-05 09:29:12 -0700890 msm_pm_boot_pdata.p_addr = allocate_contiguous_ebi_nomap(SZ_8, SZ_64K);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600891 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -0700892 msm_tsens_early_init(&msm_tsens_pdata);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700893}
894
895static void __init msm9615_cdp_init(void)
896{
897 msm9615_common_init();
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400898#ifdef CONFIG_FB_MSM
899 mdm9615_init_fb();
900#endif
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700901}
902
903static void __init msm9615_mtp_init(void)
904{
905 msm9615_common_init();
906}
907
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400908#ifdef CONFIG_FB_MSM
909static void __init mdm9615_allocate_memory_regions(void)
910{
911 mdm9615_allocate_fb_region();
912}
913#endif
914
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700915MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
916 .map_io = msm9615_map_io,
917 .init_irq = msm9615_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +0530918 .handle_irq = gic_handle_irq,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700919 .timer = &msm_timer,
920 .init_machine = msm9615_cdp_init,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600921 .reserve = msm9615_reserve,
Zhang Chang Kena48794b2012-03-31 17:45:21 -0400922#ifdef CONFIG_FB_MSM
923 .init_early = mdm9615_allocate_memory_regions,
924#endif
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700925MACHINE_END
926
927MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
928 .map_io = msm9615_map_io,
929 .init_irq = msm9615_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +0530930 .handle_irq = gic_handle_irq,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700931 .timer = &msm_timer,
932 .init_machine = msm9615_mtp_init,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600933 .reserve = msm9615_reserve,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700934MACHINE_END