blob: 1b33453da9205db62f1961443f58b847ac8ce635 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080043#include <linux/memory.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080044
45#include <asm/mach-types.h>
46#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070047#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080050
51#include <mach/board.h>
52#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053#include <mach/msm_spi.h>
54#ifdef CONFIG_USB_MSM_OTG_72K
55#include <mach/msm_hsusb.h>
56#else
57#include <linux/usb/msm_hsusb.h>
58#endif
59#include <linux/usb/android.h>
60#include <mach/usbdiag.h>
61#include <mach/socinfo.h>
62#include <mach/rpm.h>
63#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070064#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065#include <mach/msm_bus_board.h>
66#include <mach/msm_memtypes.h>
67#include <mach/dma.h>
68#include <mach/msm_dsps.h>
69#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070070#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080071
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072#ifdef CONFIG_WCD9310_CODEC
73#include <linux/slimbus/slimbus.h>
74#include <linux/mfd/wcd9310/core.h>
75#include <linux/mfd/wcd9310/pdata.h>
76#endif
77
Laura Abbottd6183792011-08-19 13:42:24 -070078#include <linux/ion.h>
79#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080080#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080081#include <mach/mdm-peripheral.h>
Laura Abbottd6183792011-08-19 13:42:24 -070082
Larry Bassel41a055b2011-12-06 16:15:14 -080083#include <linux/fmem.h>
84
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070085#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080086#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070087#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070088#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080089#include "board-8960.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090#include "pm.h"
91#include "cpuidle.h"
92#include "rpm_resources.h"
93#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070094#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070095#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070096#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060097#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070098#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080099
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700100static struct platform_device msm_fm_platform_init = {
101 .name = "iris_fm",
102 .id = -1,
103};
104
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700105#define KS8851_RST_GPIO 89
106#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530107#define HAP_SHIFT_LVL_OE_GPIO 47
108
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700109#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700110
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800111struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700112 [SX150X_CAM] = {
113 .gpio_base = GPIO_CAM_EXPANDER_BASE,
114 .oscio_is_gpo = false,
115 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530116 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700117 .io_open_drain_ena = 0x0,
118 .irq_summary = -1,
119 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200120 [SX150X_LIQUID] = {
121 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
122 .oscio_is_gpo = false,
123 .io_pullup_ena = 0x0c08,
124 .io_pulldn_ena = 0x4060,
125 .io_open_drain_ena = 0x000c,
126 .io_polarity = 0,
127 .irq_summary = -1,
128 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700129};
Nishant Pandit474f2252011-07-23 23:17:56 +0530130
131#endif
132
Haynes Mathew George9bc27652011-12-13 19:14:14 -0800133#define MSM_PMEM_ADSP_SIZE 0x4200000
Ben Romberger3ffcd812011-12-08 19:12:10 -0800134#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700135#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
136#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
137#else
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800138#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700139#endif
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800140#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700141
142#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbott6db11c92011-11-04 10:31:43 -0700143#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
144#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
Laura Abbott2d1760b2011-09-29 21:31:24 -0700145#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
Laura Abbott8c017362011-09-22 20:59:12 -0700146#define MSM_ION_HEAP_NUM 5
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800147#define MSM_LIQUID_ION_EBI_SIZE (MSM_LIQUID_PMEM_SIZE + 0x600000)
148static unsigned msm_ion_ebi_size = MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700149#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700150#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700151#define MSM_ION_HEAP_NUM 2
152#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700153
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700154#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
155static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
156static int __init pmem_kernel_ebi1_size_setup(char *p)
157{
158 pmem_kernel_ebi1_size = memparse(p, NULL);
159 return 0;
160}
161early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
162#endif
163
164#ifdef CONFIG_ANDROID_PMEM
165static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800166static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700167static int __init pmem_size_setup(char *p)
168{
169 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800170 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700171 return 0;
172}
173early_param("pmem_size", pmem_size_setup);
174
175static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
176
177static int __init pmem_adsp_size_setup(char *p)
178{
179 pmem_adsp_size = memparse(p, NULL);
180 return 0;
181}
182early_param("pmem_adsp_size", pmem_adsp_size_setup);
183
184static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
185
186static int __init pmem_audio_size_setup(char *p)
187{
188 pmem_audio_size = memparse(p, NULL);
189 return 0;
190}
191early_param("pmem_audio_size", pmem_audio_size_setup);
192#endif
193
194#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700195#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196static struct android_pmem_platform_data android_pmem_pdata = {
197 .name = "pmem",
198 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
199 .cached = 1,
200 .memory_type = MEMTYPE_EBI1,
201};
202
203static struct platform_device android_pmem_device = {
204 .name = "android_pmem",
205 .id = 0,
206 .dev = {.platform_data = &android_pmem_pdata},
207};
208
209static struct android_pmem_platform_data android_pmem_adsp_pdata = {
210 .name = "pmem_adsp",
211 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
212 .cached = 0,
213 .memory_type = MEMTYPE_EBI1,
214};
215static struct platform_device android_pmem_adsp_device = {
216 .name = "android_pmem",
217 .id = 2,
218 .dev = { .platform_data = &android_pmem_adsp_pdata },
219};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700220#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700221
222static struct android_pmem_platform_data android_pmem_audio_pdata = {
223 .name = "pmem_audio",
224 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
225 .cached = 0,
226 .memory_type = MEMTYPE_EBI1,
227};
228
229static struct platform_device android_pmem_audio_device = {
230 .name = "android_pmem",
231 .id = 4,
232 .dev = { .platform_data = &android_pmem_audio_pdata },
233};
234#endif
235
Larry Bassel41a055b2011-12-06 16:15:14 -0800236struct fmem_platform_data fmem_pdata = {
237};
238
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700239#define DSP_RAM_BASE_8960 0x8da00000
240#define DSP_RAM_SIZE_8960 0x1800000
241static int dspcrashd_pdata_8960 = 0xDEADDEAD;
242
243static struct resource resources_dspcrashd_8960[] = {
244 {
245 .name = "msm_dspcrashd",
246 .start = DSP_RAM_BASE_8960,
247 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
248 .flags = IORESOURCE_DMA,
249 },
250};
251
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800252static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700253 .name = "msm_dspcrashd",
254 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
255 .resource = resources_dspcrashd_8960,
256 .dev = { .platform_data = &dspcrashd_pdata_8960 },
257};
258
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700259static struct memtype_reserve msm8960_reserve_table[] __initdata = {
260 [MEMTYPE_SMI] = {
261 },
262 [MEMTYPE_EBI0] = {
263 .flags = MEMTYPE_FLAGS_1M_ALIGN,
264 },
265 [MEMTYPE_EBI1] = {
266 .flags = MEMTYPE_FLAGS_1M_ALIGN,
267 },
268};
269
270static void __init size_pmem_devices(void)
271{
272#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700273#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700274 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800275
276 if (!pmem_param_set && machine_is_msm8960_liquid())
277 pmem_size = MSM_LIQUID_PMEM_SIZE;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700278 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700279#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700280 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
281#endif
282}
283
284static void __init reserve_memory_for(struct android_pmem_platform_data *p)
285{
286 msm8960_reserve_table[p->memory_type].size += p->size;
287}
288
289static void __init reserve_pmem_memory(void)
290{
291#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700292#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700293 reserve_memory_for(&android_pmem_adsp_pdata);
294 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700295#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700296 reserve_memory_for(&android_pmem_audio_pdata);
297 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
298#endif
299}
300
Larry Bassel41a055b2011-12-06 16:15:14 -0800301static void __init reserve_fmem_memory(void)
302{
303}
304
Larry Basselb4126da2011-07-18 14:31:33 -0700305static int msm8960_paddr_to_memtype(unsigned int paddr)
306{
307 return MEMTYPE_EBI1;
308}
309
Laura Abbottd6183792011-08-19 13:42:24 -0700310#ifdef CONFIG_ION_MSM
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800311static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700312 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700313 .heaps = {
314 {
315 .id = ION_HEAP_SYSTEM_ID,
316 .type = ION_HEAP_TYPE_SYSTEM,
317 .name = ION_KMALLOC_HEAP_NAME,
318 },
319 {
320 .id = ION_HEAP_SYSTEM_CONTIG_ID,
321 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
322 .name = ION_VMALLOC_HEAP_NAME,
323 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700324#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700325 {
326 .id = ION_HEAP_EBI_ID,
327 .type = ION_HEAP_TYPE_CARVEOUT,
328 .name = ION_EBI1_HEAP_NAME,
329 .size = MSM_ION_EBI_SIZE,
330 .memory_type = ION_EBI_TYPE,
331 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700332 {
333 .id = ION_HEAP_ADSP_ID,
334 .type = ION_HEAP_TYPE_CARVEOUT,
335 .name = ION_ADSP_HEAP_NAME,
336 .size = MSM_ION_ADSP_SIZE,
337 .memory_type = ION_EBI_TYPE,
338 },
Laura Abbott8c017362011-09-22 20:59:12 -0700339 {
340 .id = ION_HEAP_IOMMU_ID,
341 .type = ION_HEAP_TYPE_IOMMU,
342 .name = ION_IOMMU_HEAP_NAME,
343 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700344#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700345 }
346};
347
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800348static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700349 .name = "ion-msm",
350 .id = 1,
351 .dev = { .platform_data = &ion_pdata },
352};
353#endif
354
Larry Bassel41a055b2011-12-06 16:15:14 -0800355struct platform_device fmem_device = {
356 .name = "fmem",
357 .id = 1,
358 .dev = { .platform_data = &fmem_pdata },
359};
360
Laura Abbottd6183792011-08-19 13:42:24 -0700361static void reserve_ion_memory(void)
362{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700363#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800364 unsigned int i;
365
366 if (!pmem_param_set && machine_is_msm8960_liquid()) {
367 msm_ion_ebi_size = MSM_LIQUID_ION_EBI_SIZE;
368 for (i = 0; i < ion_pdata.nr; i++) {
369 if (ion_pdata.heaps[i].id == ION_HEAP_EBI_ID) {
370 ion_pdata.heaps[i].size = msm_ion_ebi_size;
371 pr_debug("msm_ion_ebi_size 0x%x\n",
372 msm_ion_ebi_size);
373 break;
374 }
375 }
376 }
377 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_ion_ebi_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700378 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700379#endif
380}
Huaibin Yanga5419422011-12-08 23:52:10 -0800381
382static void __init reserve_mdp_memory(void)
383{
384 msm8960_mdp_writeback(msm8960_reserve_table);
385}
386
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700387static void __init msm8960_calculate_reserve_sizes(void)
388{
389 size_pmem_devices();
390 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700391 reserve_ion_memory();
Larry Bassel41a055b2011-12-06 16:15:14 -0800392 reserve_fmem_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800393 reserve_mdp_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700394}
395
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700396static struct reserve_info msm8960_reserve_info __initdata = {
397 .memtype_reserve_table = msm8960_reserve_table,
398 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
399 .paddr_to_memtype = msm8960_paddr_to_memtype,
400};
401
Larry Basselb4126da2011-07-18 14:31:33 -0700402static int msm8960_memory_bank_size(void)
403{
404 return 1<<29;
405}
406
407static void __init locate_unstable_memory(void)
408{
409 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
410 unsigned long bank_size;
411 unsigned long low, high;
412
413 bank_size = msm8960_memory_bank_size();
414 low = meminfo.bank[0].start;
415 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700416
417 /* Check if 32 bit overflow occured */
418 if (high < mb->start)
419 high = ~0UL;
420
Larry Basselb4126da2011-07-18 14:31:33 -0700421 low &= ~(bank_size - 1);
422
423 if (high - low <= bank_size)
424 return;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800425 msm8960_reserve_info.low_unstable_address = high -
426 MIN_MEMORY_BLOCK_SIZE;
427 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700428
Larry Basselb4126da2011-07-18 14:31:33 -0700429 msm8960_reserve_info.bank_size = bank_size;
430 pr_info("low unstable address %lx max size %lx bank size %lx\n",
431 msm8960_reserve_info.low_unstable_address,
432 msm8960_reserve_info.max_unstable_size,
433 msm8960_reserve_info.bank_size);
434}
435
Larry Basselb830e182011-10-14 10:46:55 -0700436static void __init place_movable_zone(void)
437{
438 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
439 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
440 pr_info("movable zone start %lx size %lx\n",
441 movable_reserved_start, movable_reserved_size);
442}
443
444static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700445{
446 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700447 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700448 place_movable_zone();
449}
450
451static void __init msm8960_reserve(void)
452{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700453 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800454 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700455}
456
Larry Bassela4414b12011-08-04 11:11:02 -0700457static int msm8960_change_memory_power(u64 start, u64 size,
458 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700459{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700460 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700461}
462
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700463static void __init msm8960_allocate_memory_regions(void)
464{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800465 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700466}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800467
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700468#ifdef CONFIG_WCD9310_CODEC
469
470#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
471
Patrick Lai3043fba2011-08-01 14:15:57 -0700472/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
473 * 4 micbiases are used to power various analog and digital
474 * microphones operating at 1800 mV. Technically, all micbiases
475 * can source from single cfilter since all microphones operate
476 * at the same voltage level. The arrangement below is to make
477 * sure all cfilters are exercised. LDO_H regulator ouput level
478 * does not need to be as high as 2.85V. It is choosen for
479 * microphone sensitivity purpose.
480 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700481static struct tabla_pdata tabla_platform_data = {
482 .slimbus_slave_device = {
483 .name = "tabla-slave",
484 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
485 },
486 .irq = MSM_GPIO_TO_INT(62),
487 .irq_base = TABLA_INTERRUPT_BASE,
488 .num_irqs = NR_TABLA_IRQS,
489 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700490 .micbias = {
491 .ldoh_v = TABLA_LDOH_2P85_V,
492 .cfilt1_mv = 1800,
493 .cfilt2_mv = 1800,
494 .cfilt3_mv = 1800,
495 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
496 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
497 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
498 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
499 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700500};
501
502static struct slim_device msm_slim_tabla = {
503 .name = "tabla-slim",
504 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
505 .dev = {
506 .platform_data = &tabla_platform_data,
507 },
508};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530509
510static struct tabla_pdata tabla20_platform_data = {
511 .slimbus_slave_device = {
512 .name = "tabla-slave",
513 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
514 },
515 .irq = MSM_GPIO_TO_INT(62),
516 .irq_base = TABLA_INTERRUPT_BASE,
517 .num_irqs = NR_TABLA_IRQS,
518 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
519 .micbias = {
520 .ldoh_v = TABLA_LDOH_2P85_V,
521 .cfilt1_mv = 1800,
522 .cfilt2_mv = 1800,
523 .cfilt3_mv = 1800,
524 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
525 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
526 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
527 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
528 }
529};
530
531static struct slim_device msm_slim_tabla20 = {
532 .name = "tabla2x-slim",
533 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
534 .dev = {
535 .platform_data = &tabla20_platform_data,
536 },
537};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700538#endif
539
540static struct slim_boardinfo msm_slim_devices[] = {
541#ifdef CONFIG_WCD9310_CODEC
542 {
543 .bus_num = 1,
544 .slim_slave = &msm_slim_tabla,
545 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530546 {
547 .bus_num = 1,
548 .slim_slave = &msm_slim_tabla20,
549 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700550#endif
551 /* add more slimbus slaves as needed */
552};
553
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700554#define MSM_WCNSS_PHYS 0x03000000
555#define MSM_WCNSS_SIZE 0x280000
556
557static struct resource resources_wcnss_wlan[] = {
558 {
559 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
560 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
561 .name = "wcnss_wlanrx_irq",
562 .flags = IORESOURCE_IRQ,
563 },
564 {
565 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
566 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
567 .name = "wcnss_wlantx_irq",
568 .flags = IORESOURCE_IRQ,
569 },
570 {
571 .start = MSM_WCNSS_PHYS,
572 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
573 .name = "wcnss_mmio",
574 .flags = IORESOURCE_MEM,
575 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700576 {
577 .start = 84,
578 .end = 88,
579 .name = "wcnss_gpios_5wire",
580 .flags = IORESOURCE_IO,
581 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700582};
583
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700584static struct qcom_wcnss_opts qcom_wcnss_pdata = {
585 .has_48mhz_xo = 1,
586};
587
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700588static struct platform_device msm_device_wcnss_wlan = {
589 .name = "wcnss_wlan",
590 .id = 0,
591 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
592 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700593 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700594};
595
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700596#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
597 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
598 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
599 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
600
601#define QCE_SIZE 0x10000
602#define QCE_0_BASE 0x18500000
603
604#define QCE_HW_KEY_SUPPORT 0
605#define QCE_SHA_HMAC_SUPPORT 1
606#define QCE_SHARE_CE_RESOURCE 1
607#define QCE_CE_SHARED 0
608
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800609/* Begin Bus scaling definitions */
610static struct msm_bus_vectors crypto_hw_init_vectors[] = {
611 {
612 .src = MSM_BUS_MASTER_ADM_PORT0,
613 .dst = MSM_BUS_SLAVE_EBI_CH0,
614 .ab = 0,
615 .ib = 0,
616 },
617 {
618 .src = MSM_BUS_MASTER_ADM_PORT1,
619 .dst = MSM_BUS_SLAVE_GSBI1_UART,
620 .ab = 0,
621 .ib = 0,
622 },
623};
624
625static struct msm_bus_vectors crypto_hw_active_vectors[] = {
626 {
627 .src = MSM_BUS_MASTER_ADM_PORT0,
628 .dst = MSM_BUS_SLAVE_EBI_CH0,
629 .ab = 70000000UL,
630 .ib = 70000000UL,
631 },
632 {
633 .src = MSM_BUS_MASTER_ADM_PORT1,
634 .dst = MSM_BUS_SLAVE_GSBI1_UART,
635 .ab = 2480000000UL,
636 .ib = 2480000000UL,
637 },
638};
639
640static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
641 {
642 ARRAY_SIZE(crypto_hw_init_vectors),
643 crypto_hw_init_vectors,
644 },
645 {
646 ARRAY_SIZE(crypto_hw_active_vectors),
647 crypto_hw_active_vectors,
648 },
649};
650
651static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
652 crypto_hw_bus_scale_usecases,
653 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
654 .name = "cryptohw",
655};
656/* End Bus Scaling Definitions*/
657
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700658static struct resource qcrypto_resources[] = {
659 [0] = {
660 .start = QCE_0_BASE,
661 .end = QCE_0_BASE + QCE_SIZE - 1,
662 .flags = IORESOURCE_MEM,
663 },
664 [1] = {
665 .name = "crypto_channels",
666 .start = DMOV_CE_IN_CHAN,
667 .end = DMOV_CE_OUT_CHAN,
668 .flags = IORESOURCE_DMA,
669 },
670 [2] = {
671 .name = "crypto_crci_in",
672 .start = DMOV_CE_IN_CRCI,
673 .end = DMOV_CE_IN_CRCI,
674 .flags = IORESOURCE_DMA,
675 },
676 [3] = {
677 .name = "crypto_crci_out",
678 .start = DMOV_CE_OUT_CRCI,
679 .end = DMOV_CE_OUT_CRCI,
680 .flags = IORESOURCE_DMA,
681 },
682};
683
684static struct resource qcedev_resources[] = {
685 [0] = {
686 .start = QCE_0_BASE,
687 .end = QCE_0_BASE + QCE_SIZE - 1,
688 .flags = IORESOURCE_MEM,
689 },
690 [1] = {
691 .name = "crypto_channels",
692 .start = DMOV_CE_IN_CHAN,
693 .end = DMOV_CE_OUT_CHAN,
694 .flags = IORESOURCE_DMA,
695 },
696 [2] = {
697 .name = "crypto_crci_in",
698 .start = DMOV_CE_IN_CRCI,
699 .end = DMOV_CE_IN_CRCI,
700 .flags = IORESOURCE_DMA,
701 },
702 [3] = {
703 .name = "crypto_crci_out",
704 .start = DMOV_CE_OUT_CRCI,
705 .end = DMOV_CE_OUT_CRCI,
706 .flags = IORESOURCE_DMA,
707 },
708};
709
710#endif
711
712#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
713 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
714
715static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
716 .ce_shared = QCE_CE_SHARED,
717 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
718 .hw_key_support = QCE_HW_KEY_SUPPORT,
719 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800720 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700721};
722
723static struct platform_device qcrypto_device = {
724 .name = "qcrypto",
725 .id = 0,
726 .num_resources = ARRAY_SIZE(qcrypto_resources),
727 .resource = qcrypto_resources,
728 .dev = {
729 .coherent_dma_mask = DMA_BIT_MASK(32),
730 .platform_data = &qcrypto_ce_hw_suppport,
731 },
732};
733#endif
734
735#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
736 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
737
738static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
739 .ce_shared = QCE_CE_SHARED,
740 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
741 .hw_key_support = QCE_HW_KEY_SUPPORT,
742 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800743 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700744};
745
746static struct platform_device qcedev_device = {
747 .name = "qce",
748 .id = 0,
749 .num_resources = ARRAY_SIZE(qcedev_resources),
750 .resource = qcedev_resources,
751 .dev = {
752 .coherent_dma_mask = DMA_BIT_MASK(32),
753 .platform_data = &qcedev_ce_hw_suppport,
754 },
755};
756#endif
757
Joel Kingb8352a12011-11-15 18:46:24 -0800758#define MDM2AP_ERRFATAL 70
759#define AP2MDM_ERRFATAL 95
760#define MDM2AP_STATUS 69
761#define AP2MDM_STATUS 94
762#define AP2MDM_PMIC_RESET_N 80
763#define AP2MDM_KPDPWR_N 81
764
Joel Kingb8352a12011-11-15 18:46:24 -0800765static struct resource mdm_resources[] = {
766 {
767 .start = MDM2AP_ERRFATAL,
768 .end = MDM2AP_ERRFATAL,
769 .name = "MDM2AP_ERRFATAL",
770 .flags = IORESOURCE_IO,
771 },
772 {
773 .start = AP2MDM_ERRFATAL,
774 .end = AP2MDM_ERRFATAL,
775 .name = "AP2MDM_ERRFATAL",
776 .flags = IORESOURCE_IO,
777 },
778 {
779 .start = MDM2AP_STATUS,
780 .end = MDM2AP_STATUS,
781 .name = "MDM2AP_STATUS",
782 .flags = IORESOURCE_IO,
783 },
784 {
785 .start = AP2MDM_STATUS,
786 .end = AP2MDM_STATUS,
787 .name = "AP2MDM_STATUS",
788 .flags = IORESOURCE_IO,
789 },
790 {
791 .start = AP2MDM_PMIC_RESET_N,
792 .end = AP2MDM_PMIC_RESET_N,
793 .name = "AP2MDM_PMIC_RESET_N",
794 .flags = IORESOURCE_IO,
795 },
796 {
797 .start = AP2MDM_KPDPWR_N,
798 .end = AP2MDM_KPDPWR_N,
799 .name = "AP2MDM_KPDPWR_N",
800 .flags = IORESOURCE_IO,
801 },
802};
803
804static struct mdm_platform_data mdm_platform_data = {
805 .mdm_version = "2.5",
806};
807
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800808static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800809 .name = "mdm2_modem",
810 .id = -1,
811 .num_resources = ARRAY_SIZE(mdm_resources),
812 .resource = mdm_resources,
813 .dev = {
814 .platform_data = &mdm_platform_data,
815 },
816};
817
818static struct platform_device *mdm_devices[] __initdata = {
819 &mdm_device,
820};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700821
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700822#define MSM_SHARED_RAM_PHYS 0x80000000
823
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800824static void __init msm8960_map_io(void)
825{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700826 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800827 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700828
829 if (socinfo_init() < 0)
830 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800831}
832
833static void __init msm8960_init_irq(void)
834{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700835 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800836 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700837 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800838
839 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700840 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800841
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700842 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
843 mb();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800844}
845
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846static void __init msm8960_init_buses(void)
847{
848#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -0600849 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -0600850 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
851 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
852 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
853 msm_bus_apps_fabric.dev.platform_data =
854 &msm_bus_8960_apps_fabric_pdata;
855 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
856 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
857 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
858 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700859#endif
860}
861
862static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
863 .max_clock_speed = 15060000,
864};
865
866#ifdef CONFIG_USB_MSM_OTG_72K
867static struct msm_otg_platform_data msm_otg_pdata;
868#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700869static void msm_hsusb_vbus_power(bool on)
870{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700871 static bool vbus_is_on;
872 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700873
874 if (vbus_is_on == on)
875 return;
876
877 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700878 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
879 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700880 if (IS_ERR(mvs_otg_switch)) {
881 pr_err("Unable to get mvs_otg_switch\n");
882 return;
883 }
884
Anji jonnala2936fd92011-11-09 15:39:22 +0530885 if (regulator_enable(mvs_otg_switch)) {
886 pr_err("unable to enable mvs_otg_switch\n");
David Collins57954fa2011-12-15 09:14:40 -0800887 goto put_mvs_otg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700888 }
Anji jonnala2936fd92011-11-09 15:39:22 +0530889
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700890 vbus_is_on = true;
891 return;
892 }
Anji jonnala2936fd92011-11-09 15:39:22 +0530893 regulator_disable(mvs_otg_switch);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700894put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +0530895 regulator_put(mvs_otg_switch);
896 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700897}
898
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530899static int wr_phy_init_seq[] = {
900 0x44, 0x80, /* set VBUS valid threshold
901 and disconnect valid threshold */
902 0x38, 0x81, /* update DC voltage level */
903 0x14, 0x82, /* set preemphasis and rise/fall time */
904 0x13, 0x83, /* set source impedance adjusment */
905 -1};
906
907static int liquid_v1_phy_init_seq[] = {
908 0x44, 0x80,/* set VBUS valid threshold
909 and disconnect valid threshold */
910 0x3C, 0x81,/* update DC voltage level */
911 0x18, 0x82,/* set preemphasis and rise/fall time */
912 0x23, 0x83,/* set source impedance sdjusment */
913 -1};
914
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700915static struct msm_otg_platform_data msm_otg_pdata = {
916 .mode = USB_OTG,
917 .otg_control = OTG_PMIC_CONTROL,
918 .phy_type = SNPS_28NM_INTEGRATED_PHY,
919 .pclk_src_name = "dfab_usb_hs_clk",
920 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
921 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +0530922 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700923};
924#endif
925
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530926#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530927#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530928static struct msm_hsic_host_platform_data msm_hsic_pdata = {
929 .strobe = 150,
930 .data = 151,
931};
932#else
933static struct msm_hsic_host_platform_data msm_hsic_pdata;
934#endif
935
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700936#define PID_MAGIC_ID 0x71432909
937#define SERIAL_NUM_MAGIC_ID 0x61945374
938#define SERIAL_NUMBER_LENGTH 127
939#define DLOAD_USB_BASE_ADD 0x2A03F0C8
940
941struct magic_num_struct {
942 uint32_t pid;
943 uint32_t serial_num;
944};
945
946struct dload_struct {
947 uint32_t reserved1;
948 uint32_t reserved2;
949 uint32_t reserved3;
950 uint16_t reserved4;
951 uint16_t pid;
952 char serial_number[SERIAL_NUMBER_LENGTH];
953 uint16_t reserved5;
954 struct magic_num_struct magic_struct;
955};
956
957static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
958{
959 struct dload_struct __iomem *dload = 0;
960
961 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
962 if (!dload) {
963 pr_err("%s: cannot remap I/O memory region: %08x\n",
964 __func__, DLOAD_USB_BASE_ADD);
965 return -ENXIO;
966 }
967
968 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
969 __func__, dload, pid, snum);
970 /* update pid */
971 dload->magic_struct.pid = PID_MAGIC_ID;
972 dload->pid = pid;
973
974 /* update serial number */
975 dload->magic_struct.serial_num = 0;
976 if (!snum) {
977 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
978 goto out;
979 }
980
981 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -0700982 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700983out:
984 iounmap(dload);
985 return 0;
986}
987
988static struct android_usb_platform_data android_usb_pdata = {
989 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
990};
991
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700992static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700993 .name = "android_usb",
994 .id = -1,
995 .dev = {
996 .platform_data = &android_usb_pdata,
997 },
998};
999
1000static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1001 0x03, 0x0f,
1002};
1003
1004static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1005 0x00, 0x24, 0x54, 0x10,
1006 0x09, 0x03, 0x01,
1007 0x10, 0x54, 0x30, 0x0C,
1008 0x24, 0x30, 0x0f,
1009};
1010
1011static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1012 0x00, 0x24, 0x54, 0x10,
1013 0x09, 0x07, 0x01, 0x0B,
1014 0x10, 0x54, 0x30, 0x0C,
1015 0x24, 0x30, 0x0f,
1016};
1017
1018static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1019 [0] = {
1020 .mode = MSM_SPM_MODE_CLOCK_GATING,
1021 .notify_rpm = false,
1022 .cmd = spm_wfi_cmd_sequence,
1023 },
1024 [1] = {
1025 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1026 .notify_rpm = false,
1027 .cmd = spm_power_collapse_without_rpm,
1028 },
1029 [2] = {
1030 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1031 .notify_rpm = true,
1032 .cmd = spm_power_collapse_with_rpm,
1033 },
1034};
1035
1036static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1037 [0] = {
1038 .reg_base_addr = MSM_SAW0_BASE,
1039 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1040 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001041 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001042#if defined(CONFIG_MSM_AVS_HW)
1043 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1044 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1045#endif
1046 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1047 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1048 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1049 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1050 .vctl_timeout_us = 50,
1051 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1052 .modes = msm_spm_seq_list,
1053 },
1054 [1] = {
1055 .reg_base_addr = MSM_SAW1_BASE,
1056 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1057 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001058 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001059#if defined(CONFIG_MSM_AVS_HW)
1060 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1061 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1062#endif
1063 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1064 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1065 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1066 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1067 .vctl_timeout_us = 50,
1068 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1069 .modes = msm_spm_seq_list,
1070 },
1071};
1072
1073static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1074 0x00, 0x20, 0x03, 0x20,
1075 0x00, 0x0f,
1076};
1077
1078static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1079 0x00, 0x20, 0x34, 0x64,
1080 0x48, 0x07, 0x48, 0x20,
1081 0x50, 0x64, 0x04, 0x34,
1082 0x50, 0x0f,
1083};
1084static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1085 0x00, 0x10, 0x34, 0x64,
1086 0x48, 0x07, 0x48, 0x10,
1087 0x50, 0x64, 0x04, 0x34,
1088 0x50, 0x0F,
1089};
1090
1091static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1092 [0] = {
1093 .mode = MSM_SPM_L2_MODE_RETENTION,
1094 .notify_rpm = false,
1095 .cmd = l2_spm_wfi_cmd_sequence,
1096 },
1097 [1] = {
1098 .mode = MSM_SPM_L2_MODE_GDHS,
1099 .notify_rpm = true,
1100 .cmd = l2_spm_gdhs_cmd_sequence,
1101 },
1102 [2] = {
1103 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1104 .notify_rpm = true,
1105 .cmd = l2_spm_power_off_cmd_sequence,
1106 },
1107};
1108
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001109static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1110 [0] = {
1111 .reg_base_addr = MSM_SAW_L2_BASE,
1112 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1113 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1114 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1115 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1116 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1117 .modes = msm_spm_l2_seq_list,
1118 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1119 },
1120};
1121
Mohan Pallaka5e490392011-09-09 15:18:41 +05301122#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1123#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1124
1125static struct msm_xo_voter *xo_handle_d1;
1126
1127static int isa1200_power(int on)
1128{
1129 int rc = 0;
1130
1131 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1132
1133 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1134 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1135 if (rc < 0) {
1136 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1137 __func__, on ? "" : "de-", rc);
1138 goto err_xo_vote;
1139 }
1140
1141 return 0;
1142
1143err_xo_vote:
1144 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1145 return rc;
1146}
1147
1148static int isa1200_dev_setup(bool enable)
1149{
1150 int rc = 0;
1151
1152 struct pm_gpio hap_gpio_config = {
1153 .direction = PM_GPIO_DIR_OUT,
1154 .pull = PM_GPIO_PULL_NO,
1155 .out_strength = PM_GPIO_STRENGTH_HIGH,
1156 .function = PM_GPIO_FUNC_NORMAL,
1157 .inv_int_pol = 0,
1158 .vin_sel = 2,
1159 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1160 .output_value = 0,
1161 };
1162
1163 if (enable == true) {
1164 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1165 if (rc) {
1166 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1167 __func__, PM_HAP_EN_GPIO, rc);
1168 return rc;
1169 }
1170
1171 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1172 if (rc) {
1173 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1174 __func__, PM_HAP_LEN_GPIO, rc);
1175 return rc;
1176 }
1177
1178 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1179 if (rc) {
1180 pr_err("%s: unable to request gpio %d (%d)\n",
1181 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1182 return rc;
1183 }
1184
1185 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1186 if (rc) {
1187 pr_err("%s: Unable to set direction\n", __func__);
1188 goto free_gpio;
1189 }
1190
1191 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1192 if (IS_ERR(xo_handle_d1)) {
1193 rc = PTR_ERR(xo_handle_d1);
1194 pr_err("%s: failed to get the handle for D1(%d)\n",
1195 __func__, rc);
1196 goto gpio_set_dir;
1197 }
1198 } else {
1199 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1200
1201 msm_xo_put(xo_handle_d1);
1202 }
1203
1204 return 0;
1205
1206gpio_set_dir:
1207 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1208free_gpio:
1209 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1210 return rc;
1211}
1212
1213static struct isa1200_regulator isa1200_reg_data[] = {
1214 {
1215 .name = "vcc_i2c",
1216 .min_uV = ISA_I2C_VTG_MIN_UV,
1217 .max_uV = ISA_I2C_VTG_MAX_UV,
1218 .load_uA = ISA_I2C_CURR_UA,
1219 },
1220};
1221
1222static struct isa1200_platform_data isa1200_1_pdata = {
1223 .name = "vibrator",
1224 .dev_setup = isa1200_dev_setup,
1225 .power_on = isa1200_power,
1226 .hap_en_gpio = PM_HAP_EN_GPIO,
1227 .hap_len_gpio = PM_HAP_LEN_GPIO,
1228 .max_timeout = 15000,
1229 .mode_ctrl = PWM_GEN_MODE,
1230 .pwm_fd = {
1231 .pwm_div = 256,
1232 },
1233 .is_erm = false,
1234 .smart_en = true,
1235 .ext_clk_en = true,
1236 .chip_en = 1,
1237 .regulator_info = isa1200_reg_data,
1238 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1239};
1240
1241static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1242 {
1243 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301244 },
1245};
1246
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001247#define CYTTSP_TS_GPIO_IRQ 11
1248#define CYTTSP_TS_SLEEP_GPIO 50
1249#define CYTTSP_TS_RESOUT_N_GPIO 52
1250
1251/*virtual key support */
1252static ssize_t tma340_vkeys_show(struct kobject *kobj,
1253 struct kobj_attribute *attr, char *buf)
1254{
1255 return snprintf(buf, 200,
1256 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1257 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1258 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1259 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1260 "\n");
1261}
1262
1263static struct kobj_attribute tma340_vkeys_attr = {
1264 .attr = {
1265 .mode = S_IRUGO,
1266 },
1267 .show = &tma340_vkeys_show,
1268};
1269
1270static struct attribute *tma340_properties_attrs[] = {
1271 &tma340_vkeys_attr.attr,
1272 NULL
1273};
1274
1275static struct attribute_group tma340_properties_attr_group = {
1276 .attrs = tma340_properties_attrs,
1277};
1278
1279
1280static int cyttsp_platform_init(struct i2c_client *client)
1281{
1282 int rc = 0;
1283 static struct kobject *tma340_properties_kobj;
1284
1285 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1286 tma340_properties_kobj = kobject_create_and_add("board_properties",
1287 NULL);
1288 if (tma340_properties_kobj)
1289 rc = sysfs_create_group(tma340_properties_kobj,
1290 &tma340_properties_attr_group);
1291 if (!tma340_properties_kobj || rc)
1292 pr_err("%s: failed to create board_properties\n",
1293 __func__);
1294
1295 return 0;
1296}
1297
1298static struct cyttsp_regulator regulator_data[] = {
1299 {
1300 .name = "vdd",
1301 .min_uV = CY_TMA300_VTG_MIN_UV,
1302 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301303 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1304 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001305 },
1306 /* TODO: Remove after runtime PM is enabled in I2C driver */
1307 {
1308 .name = "vcc_i2c",
1309 .min_uV = CY_I2C_VTG_MIN_UV,
1310 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301311 .hpm_load_uA = CY_I2C_CURR_UA,
1312 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001313 },
1314};
1315
1316static struct cyttsp_platform_data cyttsp_pdata = {
1317 .panel_maxx = 634,
1318 .panel_maxy = 1166,
1319 .disp_maxx = 616,
1320 .disp_maxy = 1023,
1321 .disp_minx = 0,
1322 .disp_miny = 16,
1323 .flags = 0x01,
1324 .gen = CY_GEN3, /* or */
1325 .use_st = CY_USE_ST,
1326 .use_mt = CY_USE_MT,
1327 .use_hndshk = CY_SEND_HNDSHK,
1328 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301329 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001330 .use_gestures = CY_USE_GESTURES,
1331 .fw_fname = "cyttsp_8960_cdp.hex",
1332 /* activate up to 4 groups
1333 * and set active distance
1334 */
1335 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1336 CY_GEST_GRP3 | CY_GEST_GRP4 |
1337 CY_ACT_DIST,
1338 /* change act_intrvl to customize the Active power state
1339 * scanning/processing refresh interval for Operating mode
1340 */
1341 .act_intrvl = CY_ACT_INTRVL_DFLT,
1342 /* change tch_tmout to customize the touch timeout for the
1343 * Active power state for Operating mode
1344 */
1345 .tch_tmout = CY_TCH_TMOUT_DFLT,
1346 /* change lp_intrvl to customize the Low Power power state
1347 * scanning/processing refresh interval for Operating mode
1348 */
1349 .lp_intrvl = CY_LP_INTRVL_DFLT,
1350 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1351 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1352 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1353 .regulator_info = regulator_data,
1354 .num_regulators = ARRAY_SIZE(regulator_data),
1355 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301356 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001357};
1358
1359static struct i2c_board_info cyttsp_info[] __initdata = {
1360 {
1361 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1362 .platform_data = &cyttsp_pdata,
1363#ifndef CY_USE_TIMER
1364 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1365#endif /* CY_USE_TIMER */
1366 },
1367};
1368
Mohan Pallaka50837382011-09-07 11:00:57 +05301369/* configuration data */
1370static const u8 mxt_config_data[] = {
1371 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001372 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301373 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001374 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001375 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1376 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1377 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1378 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1379 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1380 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301381 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001382 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301383 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001384 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301385 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001386 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1387 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1388 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1389 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301390 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001391 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1392 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301393 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001394 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1395 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301396 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1398 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301399 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001400 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1401 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301402 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001403 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301404 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001405 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301406 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001407 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301408 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001409 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301410 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001411 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301412};
1413
Amy Maloche08266db2011-11-04 11:07:16 -07001414#define MXT_TS_GPIO_IRQ 11
1415#define MXT_TS_LDO_EN_GPIO 50
1416#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301417
1418static void mxt_init_hw_liquid(void)
1419{
1420 int rc;
1421
Mohan Pallaka50837382011-09-07 11:00:57 +05301422 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1423 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001424 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1425 __func__, MXT_TS_LDO_EN_GPIO);
1426 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301427 }
1428
1429 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1430 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001431 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1432 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301433 goto err_ldo_gpio_req;
1434 }
1435
Mohan Pallaka50837382011-09-07 11:00:57 +05301436 return;
1437
Mohan Pallaka50837382011-09-07 11:00:57 +05301438err_ldo_gpio_req:
1439 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301440}
1441
1442static struct mxt_platform_data mxt_platform_data = {
1443 .config = mxt_config_data,
1444 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001445 .x_size = 1365,
1446 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301447 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001448 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001449 .reset_gpio = MXT_TS_RESET_GPIO,
1450 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301451};
1452
1453static struct i2c_board_info mxt_device_info[] __initdata = {
1454 {
1455 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1456 .platform_data = &mxt_platform_data,
1457 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1458 },
1459};
1460
Eugene Yasmand2316b82011-12-07 18:23:48 +02001461static struct i2c_board_info sii_device_info[] __initdata = {
1462 {
1463 I2C_BOARD_INFO("Sil-9244", 0x39),
1464 .flags = I2C_CLIENT_WAKE,
1465 .irq = MSM_GPIO_TO_INT(15),
1466 },
1467};
1468
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001469static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
1470{
1471}
1472
1473static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1474 .clk_freq = 100000,
1475 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001476 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1477};
1478
1479static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1480 .clk_freq = 100000,
1481 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001482 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1483};
1484
1485static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1486 .clk_freq = 100000,
1487 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001488 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1489};
1490
1491static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1492 .clk_freq = 100000,
1493 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001494 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1495};
1496
1497static struct msm_rpm_platform_data msm_rpm_data = {
1498 .reg_base_addrs = {
1499 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1500 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1501 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1502 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1503 },
1504
1505 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1506 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1507 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1508 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1509 .msm_apps_ipc_rpm_val = 4,
1510};
1511
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001512static struct ks8851_pdata spi_eth_pdata = {
1513 .irq_gpio = KS8851_IRQ_GPIO,
1514 .rst_gpio = KS8851_RST_GPIO,
1515};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001516
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001517static struct spi_board_info spi_board_info[] __initdata = {
1518 {
1519 .modalias = "ks8851",
1520 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1521 .max_speed_hz = 19200000,
1522 .bus_num = 0,
1523 .chip_select = 0,
1524 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001525 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001526 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001527 {
1528 .modalias = "dsi_novatek_3d_panel_spi",
1529 .max_speed_hz = 10800000,
1530 .bus_num = 0,
1531 .chip_select = 1,
1532 .mode = SPI_MODE_0,
1533 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001534};
1535
1536static struct platform_device msm_device_saw_core0 = {
1537 .name = "saw-regulator",
1538 .id = 0,
1539 .dev = {
1540 .platform_data = &msm_saw_regulator_pdata_s5,
1541 },
1542};
1543
1544static struct platform_device msm_device_saw_core1 = {
1545 .name = "saw-regulator",
1546 .id = 1,
1547 .dev = {
1548 .platform_data = &msm_saw_regulator_pdata_s6,
1549 },
1550};
1551
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001552static struct tsens_platform_data msm_tsens_pdata = {
1553 .slope = 910,
1554 .tsens_factor = 1000,
1555 .hw_type = MSM_8960,
1556 .tsens_num_sensor = 5,
1557};
1558
1559static struct platform_device msm_tsens_device = {
1560 .name = "tsens8960-tm",
1561 .id = -1,
1562 .dev = {
1563 .platform_data = &msm_tsens_pdata,
1564 },
1565};
1566
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001567#ifdef CONFIG_MSM_FAKE_BATTERY
1568static struct platform_device fish_battery_device = {
1569 .name = "fish_battery",
1570};
1571#endif
1572
David Collins26f05562011-06-20 09:56:28 -07001573static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001574 .name = GPIO_REGULATOR_DEV_NAME,
1575 .id = PM8921_MPP_PM_TO_SYS(7),
1576 .dev = {
1577 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1578 },
1579};
1580
David Collins26f05562011-06-20 09:56:28 -07001581static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001582 .name = GPIO_REGULATOR_DEV_NAME,
1583 .id = 91,
1584 .dev = {
1585 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1586 },
1587};
1588
David Collinsb10be1d2011-09-02 10:29:31 -07001589static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1590 .name = GPIO_REGULATOR_DEV_NAME,
1591 .id = PM8921_GPIO_PM_TO_SYS(17),
1592 .dev = {
1593 .platform_data =
1594 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1595 },
1596};
1597
David Collins35a78f52011-12-14 15:54:25 -08001598static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1599 .name = GPIO_REGULATOR_DEV_NAME,
1600 .id = PM8921_GPIO_PM_TO_SYS(42),
1601 .dev = {
1602 .platform_data =
1603 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1604 },
1605};
1606
David Collins26f05562011-06-20 09:56:28 -07001607static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1608 .name = "rpm-regulator",
1609 .id = -1,
1610 .dev = {
1611 .platform_data = &msm_rpm_regulator_pdata,
1612 },
1613};
1614
David Collins4c31a872011-08-31 10:07:10 -07001615static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1616 .phys_addr_base = 0x0010C000,
1617 .reg_offsets = {
1618 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1619 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1620 },
1621 .phys_size = SZ_8K,
1622 .log_len = 4096, /* log's buffer length in bytes */
1623 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1624};
1625
1626static struct platform_device msm_rpm_log_device = {
1627 .name = "msm_rpm_log",
1628 .id = -1,
1629 .dev = {
1630 .platform_data = &msm_rpm_log_pdata,
1631 },
1632};
1633
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001634static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001635 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001636 &msm_device_smd,
1637 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301638 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001639 &msm_device_saw_core0,
1640 &msm_device_saw_core1,
1641 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001642 &msm8960_device_ssbi_pmic,
David Collins35a78f52011-12-14 15:54:25 -08001643 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001644 &msm8960_device_qup_spi_gsbi1,
1645 &msm8960_device_qup_i2c_gsbi3,
1646 &msm8960_device_qup_i2c_gsbi4,
1647 &msm8960_device_qup_i2c_gsbi10,
1648#ifndef CONFIG_MSM_DSPS
1649 &msm8960_device_qup_i2c_gsbi12,
1650#endif
1651 &msm_slim_ctrl,
1652 &msm_device_wcnss_wlan,
1653#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1654 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1655 &qcrypto_device,
1656#endif
1657
1658#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1659 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1660 &qcedev_device,
1661#endif
1662#ifdef CONFIG_MSM_ROTATOR
1663 &msm_rotator_device,
1664#endif
1665 &msm_device_sps,
1666#ifdef CONFIG_MSM_FAKE_BATTERY
1667 &fish_battery_device,
1668#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001669 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001670#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001671#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001672 &android_pmem_device,
1673 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001674#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001675 &android_pmem_audio_device,
1676#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001677 &msm_device_vidc,
1678 &msm_device_bam_dmux,
1679 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001680
1681#ifdef CONFIG_HW_RANDOM_MSM
1682 &msm_device_rng,
1683#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001684 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07001685#ifdef CONFIG_ION_MSM
1686 &ion_dev,
1687#endif
David Collins4c31a872011-08-31 10:07:10 -07001688 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06001689 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001690 &msm_device_tz_log,
1691
Pratik Patel7831c082011-06-08 21:44:37 -07001692#ifdef CONFIG_MSM_QDSS
1693 &msm_etb_device,
1694 &msm_tpiu_device,
1695 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07001696 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07001697 &msm_ptm_device,
1698#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001699 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001700 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001701};
1702
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001703static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001704 &msm8960_device_otg,
1705 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001706 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301707 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001708 &android_usb_device,
1709 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001710 &msm_bus_apps_fabric,
1711 &msm_bus_sys_fabric,
1712 &msm_bus_mm_fabric,
1713 &msm_bus_sys_fpb,
1714 &msm_bus_cpss_fpb,
1715 &msm_pcm,
1716 &msm_pcm_routing,
1717 &msm_cpudai0,
1718 &msm_cpudai1,
1719 &msm_cpudai_hdmi_rx,
1720 &msm_cpudai_bt_rx,
1721 &msm_cpudai_bt_tx,
1722 &msm_cpudai_fm_rx,
1723 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001724 &msm_cpudai_auxpcm_rx,
1725 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001726 &msm_cpu_fe,
1727 &msm_stub_codec,
1728 &msm_voice,
1729 &msm_voip,
1730 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301731 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001732 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001733 &msm_cpudai_incall_record_rx,
1734 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001735
1736#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1737 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1738 &qcrypto_device,
1739#endif
1740
1741#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1742 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1743 &qcedev_device,
1744#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001745};
1746
1747static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001748 &msm_kgsl_3d0,
1749 &msm_kgsl_2d0,
1750 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001751#ifdef CONFIG_MSM_GEMINI
1752 &msm8960_gemini_device,
1753#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001754};
1755
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001756static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001757 &msm_8960_q6_lpass,
1758 &msm_8960_q6_mss_fw,
1759 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001760 &msm_8960_riva,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001761 &msm8960_device_otg,
1762 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001763 &msm_device_hsusb_host,
1764 &android_usb_device,
1765 &msm_pcm,
1766 &msm_pcm_routing,
1767 &msm_cpudai0,
1768 &msm_cpudai1,
1769 &msm_cpudai_hdmi_rx,
1770 &msm_cpudai_bt_rx,
1771 &msm_cpudai_bt_tx,
1772 &msm_cpudai_fm_rx,
1773 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001774 &msm_cpudai_auxpcm_rx,
1775 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001776 &msm_cpu_fe,
1777 &msm_stub_codec,
1778 &msm_kgsl_3d0,
1779#ifdef CONFIG_MSM_KGSL_2D
1780 &msm_kgsl_2d0,
1781 &msm_kgsl_2d1,
1782#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001783#ifdef CONFIG_MSM_GEMINI
1784 &msm8960_gemini_device,
1785#endif
1786 &msm_voice,
1787 &msm_voip,
1788 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301789 &msm_cpudai_afe_01_rx,
1790 &msm_cpudai_afe_01_tx,
1791 &msm_cpudai_afe_02_rx,
1792 &msm_cpudai_afe_02_tx,
1793 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301794 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001795 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001796 &msm_cpudai_incall_record_rx,
1797 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001798 &msm_pcm_hostless,
1799 &msm_bus_apps_fabric,
1800 &msm_bus_sys_fabric,
1801 &msm_bus_mm_fabric,
1802 &msm_bus_sys_fpb,
1803 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001804 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001805};
1806
1807static void __init msm8960_i2c_init(void)
1808{
1809 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1810 &msm8960_i2c_qup_gsbi4_pdata;
1811
1812 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1813 &msm8960_i2c_qup_gsbi3_pdata;
1814
1815 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1816 &msm8960_i2c_qup_gsbi10_pdata;
1817
1818 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1819 &msm8960_i2c_qup_gsbi12_pdata;
1820}
1821
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001822static void __init msm8960_gfx_init(void)
1823{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001824 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001825 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1826 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1827 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001828 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1829 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001830 }
1831}
1832
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001833static struct msm_cpuidle_state msm_cstates[] __initdata = {
1834 {0, 0, "C0", "WFI",
1835 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1836
1837 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1838 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1839
1840 {0, 2, "C2", "POWER_COLLAPSE",
1841 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1842
1843 {1, 0, "C0", "WFI",
1844 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1845
1846 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1847 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1848};
1849
1850static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1851 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1852 .idle_supported = 1,
1853 .suspend_supported = 1,
1854 .idle_enabled = 0,
1855 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001856 },
1857
1858 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1859 .idle_supported = 1,
1860 .suspend_supported = 1,
1861 .idle_enabled = 0,
1862 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001863 },
1864
1865 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1866 .idle_supported = 1,
1867 .suspend_supported = 1,
1868 .idle_enabled = 1,
1869 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001870 },
1871
1872 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1873 .idle_supported = 0,
1874 .suspend_supported = 1,
1875 .idle_enabled = 0,
1876 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001877 },
1878
1879 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1880 .idle_supported = 1,
1881 .suspend_supported = 1,
1882 .idle_enabled = 0,
1883 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001884 },
1885
1886 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1887 .idle_supported = 1,
1888 .suspend_supported = 0,
1889 .idle_enabled = 1,
1890 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001891 },
1892};
1893
1894static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1895 {
1896 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1897 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1898 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001899 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001900 },
1901
1902 {
1903 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1904 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1905 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001906 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907 },
1908
1909 {
1910 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1911 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1912 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001913 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001914 },
1915
1916 {
1917 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1918 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1919 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001920 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001921 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001922 {
1923 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1924 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1925 false,
1926 7000, 3500, 66600000, 5150,
1927 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001928
1929 {
1930 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1931 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1932 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001933 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001934 },
1935
1936 {
1937 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1938 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1939 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001940 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001941 },
1942
1943 {
1944 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1945 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1946 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001947 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001948 },
1949
1950 {
1951 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1952 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1953 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001954 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001955 },
1956};
1957
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001958static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1959 .mode = MSM_PM_BOOT_CONFIG_TZ,
1960};
1961
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001962#ifdef CONFIG_I2C
1963#define I2C_SURF 1
1964#define I2C_FFA (1 << 1)
1965#define I2C_RUMI (1 << 2)
1966#define I2C_SIM (1 << 3)
1967#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03001968#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001969
1970struct i2c_registry {
1971 u8 machs;
1972 int bus;
1973 struct i2c_board_info *info;
1974 int len;
1975};
1976
1977#ifdef CONFIG_MSM_CAMERA
1978static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
1979#ifdef CONFIG_IMX074
1980 {
1981 I2C_BOARD_INFO("imx074", 0x1A),
1982 },
1983#endif
1984#ifdef CONFIG_OV2720
1985 {
1986 I2C_BOARD_INFO("ov2720", 0x6C),
1987 },
1988#endif
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -08001989#ifdef CONFIG_MT9M114
1990 {
1991 I2C_BOARD_INFO("mt9m114", 0x48),
1992 },
1993#endif
Nishant Pandit474f2252011-07-23 23:17:56 +05301994#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
1995 {
1996 I2C_BOARD_INFO("sc628a", 0x6E),
1997 },
1998#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001999};
2000#endif
2001
2002/* Sensors DSPS platform data */
2003#ifdef CONFIG_MSM_DSPS
2004#define DSPS_PIL_GENERIC_NAME "dsps"
2005#endif /* CONFIG_MSM_DSPS */
2006
2007static void __init msm8960_init_dsps(void)
2008{
2009#ifdef CONFIG_MSM_DSPS
2010 struct msm_dsps_platform_data *pdata =
2011 msm_dsps_device.dev.platform_data;
2012 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2013 pdata->gpios = NULL;
2014 pdata->gpios_num = 0;
2015
2016 platform_device_register(&msm_dsps_device);
2017#endif /* CONFIG_MSM_DSPS */
2018}
2019
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002020static int hsic_peripheral_status = 1;
2021static DEFINE_MUTEX(hsic_status_lock);
2022
2023void peripheral_connect()
2024{
2025 mutex_lock(&hsic_status_lock);
2026 if (hsic_peripheral_status)
2027 goto out;
2028 platform_device_add(&msm_device_hsic_host);
2029 hsic_peripheral_status = 1;
2030out:
2031 mutex_unlock(&hsic_status_lock);
2032}
2033EXPORT_SYMBOL(peripheral_connect);
2034
2035void peripheral_disconnect()
2036{
2037 mutex_lock(&hsic_status_lock);
2038 if (!hsic_peripheral_status)
2039 goto out;
2040 platform_device_del(&msm_device_hsic_host);
2041 hsic_peripheral_status = 0;
2042out:
2043 mutex_unlock(&hsic_status_lock);
2044}
2045EXPORT_SYMBOL(peripheral_disconnect);
2046
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002047static void __init msm8960_init_hsic(void)
2048{
2049#ifdef CONFIG_USB_EHCI_MSM_HSIC
2050 uint32_t version = socinfo_get_version();
2051
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002052 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002053 return;
2054
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002055 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002056 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002057#endif
2058}
2059
Amir Samuelov5137e392011-09-21 17:31:25 +03002060#ifdef CONFIG_ISL9519_CHARGER
2061static struct isl_platform_data isl_data __initdata = {
2062 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2063 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2064 .max_system_voltage = 4200,
2065 .min_system_voltage = 3200,
2066 .chgcurrent = 1000, /* 1900, */
2067 .term_current = 400, /* Need fine tuning */
2068 .input_current = 2048,
2069};
2070
2071static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2072 {
2073 I2C_BOARD_INFO("isl9519q", 0x9),
2074 .irq = 0, /* Not required when notify-by-pmic */
2075 .platform_data = &isl_data,
2076 },
2077};
2078#endif /* CONFIG_ISL9519_CHARGER */
2079
Amir Samuelov755616d2011-12-13 16:34:46 +02002080static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2081 {
2082 I2C_BOARD_INFO("sx1508q", 0x20),
2083 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2084 },
2085};
2086
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002087static struct i2c_registry msm8960_i2c_devices[] __initdata = {
2088#ifdef CONFIG_MSM_CAMERA
2089 {
Amir Samuelov05f87802011-08-27 18:30:12 +03002090 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002091 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2092 msm_camera_boardinfo,
2093 ARRAY_SIZE(msm_camera_boardinfo),
2094 },
2095#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03002096#ifdef CONFIG_ISL9519_CHARGER
2097 {
2098 I2C_LIQUID,
2099 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2100 isl_charger_i2c_info,
2101 ARRAY_SIZE(isl_charger_i2c_info),
2102 },
2103#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002104 {
2105 I2C_SURF | I2C_FFA | I2C_FLUID,
2106 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2107 cyttsp_info,
2108 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002109 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302110 {
2111 I2C_LIQUID,
2112 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2113 mxt_device_info,
2114 ARRAY_SIZE(mxt_device_info),
2115 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302116 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302117 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302118 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002119 sii_device_info,
2120 ARRAY_SIZE(sii_device_info),
2121 },
2122 {
2123 I2C_LIQUID,
2124 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302125 msm_isa1200_board_info,
2126 ARRAY_SIZE(msm_isa1200_board_info),
2127 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002128 {
2129 I2C_LIQUID,
2130 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2131 liquid_io_expander_i2c_info,
2132 ARRAY_SIZE(liquid_io_expander_i2c_info),
2133 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002134};
2135#endif /* CONFIG_I2C */
2136
2137static void __init register_i2c_devices(void)
2138{
2139#ifdef CONFIG_I2C
2140 u8 mach_mask = 0;
2141 int i;
2142
2143 /* Build the matching 'supported_machs' bitmask */
2144 if (machine_is_msm8960_cdp())
2145 mach_mask = I2C_SURF;
2146 else if (machine_is_msm8960_rumi3())
2147 mach_mask = I2C_RUMI;
2148 else if (machine_is_msm8960_sim())
2149 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002150 else if (machine_is_msm8960_fluid())
2151 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002152 else if (machine_is_msm8960_liquid())
2153 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002154 else if (machine_is_msm8960_mtp())
2155 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002156 else
2157 pr_err("unmatched machine ID in register_i2c_devices\n");
2158
2159 /* Run the array and install devices as appropriate */
2160 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2161 if (msm8960_i2c_devices[i].machs & mach_mask)
2162 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2163 msm8960_i2c_devices[i].info,
2164 msm8960_i2c_devices[i].len);
2165 }
2166#endif
2167}
2168
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002169static void __init msm8960_sim_init(void)
2170{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002171 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2172 &msm8960_device_watchdog.dev.platform_data;
2173
2174 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002175 BUG_ON(msm_rpm_init(&msm_rpm_data));
2176 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2177 ARRAY_SIZE(msm_rpmrs_levels)));
2178 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002179 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002180 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002181 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002182
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002183 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002184 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002185 msm8960_i2c_init();
2186 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2187 msm_spm_l2_init(msm_spm_l2_data);
2188 msm8960_init_buses();
2189 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002190 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002191 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002192 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002193
2194 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2195 &msm8960_qup_spi_gsbi1_pdata;
2196 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2197
2198 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002199 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002200 slim_register_board_info(msm_slim_devices,
2201 ARRAY_SIZE(msm_slim_devices));
2202 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2203 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2204 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2205 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002206 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002207}
2208
2209static void __init msm8960_rumi3_init(void)
2210{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002211 BUG_ON(msm_rpm_init(&msm_rpm_data));
2212 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2213 ARRAY_SIZE(msm_rpmrs_levels)));
2214 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002215 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002216 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002217 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002218 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002219 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2220 &msm8960_qup_spi_gsbi1_pdata;
2221 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2222 msm8960_i2c_init();
2223 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2224 msm_spm_l2_init(msm_spm_l2_data);
2225 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002226 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002227 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002228 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002229 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002230 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002231 slim_register_board_info(msm_slim_devices,
2232 ARRAY_SIZE(msm_slim_devices));
2233 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2234 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2235 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2236 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002237 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002238}
2239
2240static void __init msm8960_cdp_init(void)
2241{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002242 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2243 pr_err("meminfo_init() failed!\n");
2244
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002245 BUG_ON(msm_rpm_init(&msm_rpm_data));
2246 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2247 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002248
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002249 regulator_suppress_info_printing();
2250 if (msm_xo_init())
2251 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002252 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002253 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302254 if (machine_is_msm8960_liquid())
2255 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002256 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302257 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2258 machine_is_msm8960_cdp()) {
2259 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2260 } else if (machine_is_msm8960_liquid()) {
2261 msm_otg_pdata.phy_init_seq =
2262 liquid_v1_phy_init_seq;
2263 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302264 msm_otg_pdata.swfi_latency =
2265 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302266#ifdef CONFIG_USB_EHCI_MSM_HSIC
2267 if (machine_is_msm8960_liquid()) {
2268 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2269 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2270 }
2271#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302272 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002273 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002274 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2275 &msm8960_qup_spi_gsbi1_pdata;
2276 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002277
2278 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302279 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2280 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2281 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002283 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002284 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2285 msm_spm_l2_init(msm_spm_l2_data);
2286 msm8960_init_buses();
2287 platform_add_devices(msm_footswitch_devices,
2288 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002289 if (machine_is_msm8960_liquid())
2290 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002291 if (machine_is_msm8960_cdp())
2292 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002293 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002294 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002295 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002296 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002297 msm8960_init_cam();
2298 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002299 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302300 if (machine_is_msm8960_liquid())
2301 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002302 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002303 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002304 slim_register_board_info(msm_slim_devices,
2305 ARRAY_SIZE(msm_slim_devices));
2306 msm8960_init_dsps();
2307 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2308 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2309 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2310 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002311 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002312 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Joel Kingb8352a12011-11-15 18:46:24 -08002313 if (PLATFORM_IS_CHARM25())
2314 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002315}
2316
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002317MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2318 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002319 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002320 .init_irq = msm8960_init_irq,
2321 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002322 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002323 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002324 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002325MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002326
2327MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2328 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002329 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002330 .init_irq = msm8960_init_irq,
2331 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002332 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002333 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002334 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002335MACHINE_END
2336
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002337MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2338 .map_io = msm8960_map_io,
2339 .reserve = msm8960_reserve,
2340 .init_irq = msm8960_init_irq,
2341 .timer = &msm_timer,
2342 .init_machine = msm8960_cdp_init,
2343 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002344 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002345MACHINE_END
2346
2347MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2348 .map_io = msm8960_map_io,
2349 .reserve = msm8960_reserve,
2350 .init_irq = msm8960_init_irq,
2351 .timer = &msm_timer,
2352 .init_machine = msm8960_cdp_init,
2353 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002354 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002355MACHINE_END
2356
2357MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2358 .map_io = msm8960_map_io,
2359 .reserve = msm8960_reserve,
2360 .init_irq = msm8960_init_irq,
2361 .timer = &msm_timer,
2362 .init_machine = msm8960_cdp_init,
2363 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002364 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002365MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002366
2367MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2368 .map_io = msm8960_map_io,
2369 .reserve = msm8960_reserve,
2370 .init_irq = msm8960_init_irq,
2371 .timer = &msm_timer,
2372 .init_machine = msm8960_cdp_init,
2373 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002374 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002375MACHINE_END