blob: a9424d6abb5c72ce3bc1ac994e468bd68ab47d82 [file] [log] [blame]
Harini Jayaramana9873ab2011-12-20 17:29:48 -07001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002 *
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
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530869static int wr_phy_init_seq[] = {
870 0x44, 0x80, /* set VBUS valid threshold
871 and disconnect valid threshold */
872 0x38, 0x81, /* update DC voltage level */
873 0x14, 0x82, /* set preemphasis and rise/fall time */
874 0x13, 0x83, /* set source impedance adjusment */
875 -1};
876
877static int liquid_v1_phy_init_seq[] = {
878 0x44, 0x80,/* set VBUS valid threshold
879 and disconnect valid threshold */
880 0x3C, 0x81,/* update DC voltage level */
881 0x18, 0x82,/* set preemphasis and rise/fall time */
882 0x23, 0x83,/* set source impedance sdjusment */
883 -1};
884
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700885static struct msm_otg_platform_data msm_otg_pdata = {
886 .mode = USB_OTG,
887 .otg_control = OTG_PMIC_CONTROL,
888 .phy_type = SNPS_28NM_INTEGRATED_PHY,
889 .pclk_src_name = "dfab_usb_hs_clk",
890 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +0530891 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700892};
893#endif
894
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530895#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530896#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530897static struct msm_hsic_host_platform_data msm_hsic_pdata = {
898 .strobe = 150,
899 .data = 151,
900};
901#else
902static struct msm_hsic_host_platform_data msm_hsic_pdata;
903#endif
904
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905#define PID_MAGIC_ID 0x71432909
906#define SERIAL_NUM_MAGIC_ID 0x61945374
907#define SERIAL_NUMBER_LENGTH 127
908#define DLOAD_USB_BASE_ADD 0x2A03F0C8
909
910struct magic_num_struct {
911 uint32_t pid;
912 uint32_t serial_num;
913};
914
915struct dload_struct {
916 uint32_t reserved1;
917 uint32_t reserved2;
918 uint32_t reserved3;
919 uint16_t reserved4;
920 uint16_t pid;
921 char serial_number[SERIAL_NUMBER_LENGTH];
922 uint16_t reserved5;
923 struct magic_num_struct magic_struct;
924};
925
926static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
927{
928 struct dload_struct __iomem *dload = 0;
929
930 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
931 if (!dload) {
932 pr_err("%s: cannot remap I/O memory region: %08x\n",
933 __func__, DLOAD_USB_BASE_ADD);
934 return -ENXIO;
935 }
936
937 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
938 __func__, dload, pid, snum);
939 /* update pid */
940 dload->magic_struct.pid = PID_MAGIC_ID;
941 dload->pid = pid;
942
943 /* update serial number */
944 dload->magic_struct.serial_num = 0;
945 if (!snum) {
946 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
947 goto out;
948 }
949
950 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -0700951 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700952out:
953 iounmap(dload);
954 return 0;
955}
956
957static struct android_usb_platform_data android_usb_pdata = {
958 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
959};
960
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700961static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700962 .name = "android_usb",
963 .id = -1,
964 .dev = {
965 .platform_data = &android_usb_pdata,
966 },
967};
968
969static uint8_t spm_wfi_cmd_sequence[] __initdata = {
970 0x03, 0x0f,
971};
972
973static uint8_t spm_power_collapse_without_rpm[] __initdata = {
974 0x00, 0x24, 0x54, 0x10,
975 0x09, 0x03, 0x01,
976 0x10, 0x54, 0x30, 0x0C,
977 0x24, 0x30, 0x0f,
978};
979
980static uint8_t spm_power_collapse_with_rpm[] __initdata = {
981 0x00, 0x24, 0x54, 0x10,
982 0x09, 0x07, 0x01, 0x0B,
983 0x10, 0x54, 0x30, 0x0C,
984 0x24, 0x30, 0x0f,
985};
986
987static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
988 [0] = {
989 .mode = MSM_SPM_MODE_CLOCK_GATING,
990 .notify_rpm = false,
991 .cmd = spm_wfi_cmd_sequence,
992 },
993 [1] = {
994 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
995 .notify_rpm = false,
996 .cmd = spm_power_collapse_without_rpm,
997 },
998 [2] = {
999 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1000 .notify_rpm = true,
1001 .cmd = spm_power_collapse_with_rpm,
1002 },
1003};
1004
1005static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1006 [0] = {
1007 .reg_base_addr = MSM_SAW0_BASE,
1008 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1009 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001010 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001011#if defined(CONFIG_MSM_AVS_HW)
1012 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1013 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1014#endif
1015 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1016 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1017 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1018 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1019 .vctl_timeout_us = 50,
1020 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1021 .modes = msm_spm_seq_list,
1022 },
1023 [1] = {
1024 .reg_base_addr = MSM_SAW1_BASE,
1025 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1026 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001027 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001028#if defined(CONFIG_MSM_AVS_HW)
1029 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1030 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1031#endif
1032 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1033 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1034 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1035 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1036 .vctl_timeout_us = 50,
1037 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1038 .modes = msm_spm_seq_list,
1039 },
1040};
1041
1042static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1043 0x00, 0x20, 0x03, 0x20,
1044 0x00, 0x0f,
1045};
1046
1047static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1048 0x00, 0x20, 0x34, 0x64,
1049 0x48, 0x07, 0x48, 0x20,
1050 0x50, 0x64, 0x04, 0x34,
1051 0x50, 0x0f,
1052};
1053static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1054 0x00, 0x10, 0x34, 0x64,
1055 0x48, 0x07, 0x48, 0x10,
1056 0x50, 0x64, 0x04, 0x34,
1057 0x50, 0x0F,
1058};
1059
1060static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1061 [0] = {
1062 .mode = MSM_SPM_L2_MODE_RETENTION,
1063 .notify_rpm = false,
1064 .cmd = l2_spm_wfi_cmd_sequence,
1065 },
1066 [1] = {
1067 .mode = MSM_SPM_L2_MODE_GDHS,
1068 .notify_rpm = true,
1069 .cmd = l2_spm_gdhs_cmd_sequence,
1070 },
1071 [2] = {
1072 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1073 .notify_rpm = true,
1074 .cmd = l2_spm_power_off_cmd_sequence,
1075 },
1076};
1077
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001078static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1079 [0] = {
1080 .reg_base_addr = MSM_SAW_L2_BASE,
1081 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1082 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1083 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1084 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1085 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1086 .modes = msm_spm_l2_seq_list,
1087 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1088 },
1089};
1090
Mohan Pallaka5e490392011-09-09 15:18:41 +05301091#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1092#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1093
1094static struct msm_xo_voter *xo_handle_d1;
1095
1096static int isa1200_power(int on)
1097{
1098 int rc = 0;
1099
1100 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1101
1102 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1103 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1104 if (rc < 0) {
1105 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1106 __func__, on ? "" : "de-", rc);
1107 goto err_xo_vote;
1108 }
1109
1110 return 0;
1111
1112err_xo_vote:
1113 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1114 return rc;
1115}
1116
1117static int isa1200_dev_setup(bool enable)
1118{
1119 int rc = 0;
1120
1121 struct pm_gpio hap_gpio_config = {
1122 .direction = PM_GPIO_DIR_OUT,
1123 .pull = PM_GPIO_PULL_NO,
1124 .out_strength = PM_GPIO_STRENGTH_HIGH,
1125 .function = PM_GPIO_FUNC_NORMAL,
1126 .inv_int_pol = 0,
1127 .vin_sel = 2,
1128 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1129 .output_value = 0,
1130 };
1131
1132 if (enable == true) {
1133 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1134 if (rc) {
1135 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1136 __func__, PM_HAP_EN_GPIO, rc);
1137 return rc;
1138 }
1139
1140 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1141 if (rc) {
1142 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1143 __func__, PM_HAP_LEN_GPIO, rc);
1144 return rc;
1145 }
1146
1147 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1148 if (rc) {
1149 pr_err("%s: unable to request gpio %d (%d)\n",
1150 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1151 return rc;
1152 }
1153
1154 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1155 if (rc) {
1156 pr_err("%s: Unable to set direction\n", __func__);
1157 goto free_gpio;
1158 }
1159
1160 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1161 if (IS_ERR(xo_handle_d1)) {
1162 rc = PTR_ERR(xo_handle_d1);
1163 pr_err("%s: failed to get the handle for D1(%d)\n",
1164 __func__, rc);
1165 goto gpio_set_dir;
1166 }
1167 } else {
1168 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1169
1170 msm_xo_put(xo_handle_d1);
1171 }
1172
1173 return 0;
1174
1175gpio_set_dir:
1176 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1177free_gpio:
1178 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1179 return rc;
1180}
1181
1182static struct isa1200_regulator isa1200_reg_data[] = {
1183 {
1184 .name = "vcc_i2c",
1185 .min_uV = ISA_I2C_VTG_MIN_UV,
1186 .max_uV = ISA_I2C_VTG_MAX_UV,
1187 .load_uA = ISA_I2C_CURR_UA,
1188 },
1189};
1190
1191static struct isa1200_platform_data isa1200_1_pdata = {
1192 .name = "vibrator",
1193 .dev_setup = isa1200_dev_setup,
1194 .power_on = isa1200_power,
1195 .hap_en_gpio = PM_HAP_EN_GPIO,
1196 .hap_len_gpio = PM_HAP_LEN_GPIO,
1197 .max_timeout = 15000,
1198 .mode_ctrl = PWM_GEN_MODE,
1199 .pwm_fd = {
1200 .pwm_div = 256,
1201 },
1202 .is_erm = false,
1203 .smart_en = true,
1204 .ext_clk_en = true,
1205 .chip_en = 1,
1206 .regulator_info = isa1200_reg_data,
1207 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1208};
1209
1210static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1211 {
1212 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301213 },
1214};
1215
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001216#define CYTTSP_TS_GPIO_IRQ 11
1217#define CYTTSP_TS_SLEEP_GPIO 50
1218#define CYTTSP_TS_RESOUT_N_GPIO 52
1219
1220/*virtual key support */
1221static ssize_t tma340_vkeys_show(struct kobject *kobj,
1222 struct kobj_attribute *attr, char *buf)
1223{
1224 return snprintf(buf, 200,
1225 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1226 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1227 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1228 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1229 "\n");
1230}
1231
1232static struct kobj_attribute tma340_vkeys_attr = {
1233 .attr = {
1234 .mode = S_IRUGO,
1235 },
1236 .show = &tma340_vkeys_show,
1237};
1238
1239static struct attribute *tma340_properties_attrs[] = {
1240 &tma340_vkeys_attr.attr,
1241 NULL
1242};
1243
1244static struct attribute_group tma340_properties_attr_group = {
1245 .attrs = tma340_properties_attrs,
1246};
1247
1248
1249static int cyttsp_platform_init(struct i2c_client *client)
1250{
1251 int rc = 0;
1252 static struct kobject *tma340_properties_kobj;
1253
1254 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1255 tma340_properties_kobj = kobject_create_and_add("board_properties",
1256 NULL);
1257 if (tma340_properties_kobj)
1258 rc = sysfs_create_group(tma340_properties_kobj,
1259 &tma340_properties_attr_group);
1260 if (!tma340_properties_kobj || rc)
1261 pr_err("%s: failed to create board_properties\n",
1262 __func__);
1263
1264 return 0;
1265}
1266
1267static struct cyttsp_regulator regulator_data[] = {
1268 {
1269 .name = "vdd",
1270 .min_uV = CY_TMA300_VTG_MIN_UV,
1271 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301272 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1273 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001274 },
1275 /* TODO: Remove after runtime PM is enabled in I2C driver */
1276 {
1277 .name = "vcc_i2c",
1278 .min_uV = CY_I2C_VTG_MIN_UV,
1279 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301280 .hpm_load_uA = CY_I2C_CURR_UA,
1281 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282 },
1283};
1284
1285static struct cyttsp_platform_data cyttsp_pdata = {
1286 .panel_maxx = 634,
1287 .panel_maxy = 1166,
1288 .disp_maxx = 616,
1289 .disp_maxy = 1023,
1290 .disp_minx = 0,
1291 .disp_miny = 16,
1292 .flags = 0x01,
1293 .gen = CY_GEN3, /* or */
1294 .use_st = CY_USE_ST,
1295 .use_mt = CY_USE_MT,
1296 .use_hndshk = CY_SEND_HNDSHK,
1297 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301298 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001299 .use_gestures = CY_USE_GESTURES,
1300 .fw_fname = "cyttsp_8960_cdp.hex",
1301 /* activate up to 4 groups
1302 * and set active distance
1303 */
1304 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1305 CY_GEST_GRP3 | CY_GEST_GRP4 |
1306 CY_ACT_DIST,
1307 /* change act_intrvl to customize the Active power state
1308 * scanning/processing refresh interval for Operating mode
1309 */
1310 .act_intrvl = CY_ACT_INTRVL_DFLT,
1311 /* change tch_tmout to customize the touch timeout for the
1312 * Active power state for Operating mode
1313 */
1314 .tch_tmout = CY_TCH_TMOUT_DFLT,
1315 /* change lp_intrvl to customize the Low Power power state
1316 * scanning/processing refresh interval for Operating mode
1317 */
1318 .lp_intrvl = CY_LP_INTRVL_DFLT,
1319 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1320 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1321 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1322 .regulator_info = regulator_data,
1323 .num_regulators = ARRAY_SIZE(regulator_data),
1324 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301325 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326};
1327
1328static struct i2c_board_info cyttsp_info[] __initdata = {
1329 {
1330 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1331 .platform_data = &cyttsp_pdata,
1332#ifndef CY_USE_TIMER
1333 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1334#endif /* CY_USE_TIMER */
1335 },
1336};
1337
Mohan Pallaka50837382011-09-07 11:00:57 +05301338/* configuration data */
1339static const u8 mxt_config_data[] = {
1340 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001341 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301342 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001343 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1345 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1346 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1347 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1348 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1349 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301350 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001351 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301352 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001353 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301354 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001355 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1356 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1357 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1358 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301359 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001360 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1361 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301362 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001363 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1364 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301365 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001366 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1367 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301368 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001369 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1370 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301371 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001372 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301373 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001374 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301375 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001376 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301377 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001378 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301379 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001380 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301381};
1382
Amy Maloche08266db2011-11-04 11:07:16 -07001383#define MXT_TS_GPIO_IRQ 11
1384#define MXT_TS_LDO_EN_GPIO 50
1385#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301386
1387static void mxt_init_hw_liquid(void)
1388{
1389 int rc;
1390
Mohan Pallaka50837382011-09-07 11:00:57 +05301391 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1392 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001393 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1394 __func__, MXT_TS_LDO_EN_GPIO);
1395 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301396 }
1397
1398 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1399 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001400 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1401 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301402 goto err_ldo_gpio_req;
1403 }
1404
Mohan Pallaka50837382011-09-07 11:00:57 +05301405 return;
1406
Mohan Pallaka50837382011-09-07 11:00:57 +05301407err_ldo_gpio_req:
1408 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301409}
1410
1411static struct mxt_platform_data mxt_platform_data = {
1412 .config = mxt_config_data,
1413 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001414 .x_size = 1365,
1415 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301416 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001417 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001418 .reset_gpio = MXT_TS_RESET_GPIO,
1419 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301420};
1421
1422static struct i2c_board_info mxt_device_info[] __initdata = {
1423 {
1424 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1425 .platform_data = &mxt_platform_data,
1426 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1427 },
1428};
1429
Eugene Yasmand2316b82011-12-07 18:23:48 +02001430static struct i2c_board_info sii_device_info[] __initdata = {
1431 {
1432 I2C_BOARD_INFO("Sil-9244", 0x39),
1433 .flags = I2C_CLIENT_WAKE,
1434 .irq = MSM_GPIO_TO_INT(15),
1435 },
1436};
1437
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001438static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1439 .clk_freq = 100000,
1440 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001441};
1442
1443static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1444 .clk_freq = 100000,
1445 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001446};
1447
1448static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1449 .clk_freq = 100000,
1450 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001451};
1452
1453static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1454 .clk_freq = 100000,
1455 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001456};
1457
1458static struct msm_rpm_platform_data msm_rpm_data = {
1459 .reg_base_addrs = {
1460 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1461 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1462 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1463 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1464 },
1465
1466 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1467 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1468 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1469 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1470 .msm_apps_ipc_rpm_val = 4,
1471};
1472
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001473static struct ks8851_pdata spi_eth_pdata = {
1474 .irq_gpio = KS8851_IRQ_GPIO,
1475 .rst_gpio = KS8851_RST_GPIO,
1476};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001477
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001478static struct spi_board_info spi_board_info[] __initdata = {
1479 {
1480 .modalias = "ks8851",
1481 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1482 .max_speed_hz = 19200000,
1483 .bus_num = 0,
1484 .chip_select = 0,
1485 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001486 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001487 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001488 {
1489 .modalias = "dsi_novatek_3d_panel_spi",
1490 .max_speed_hz = 10800000,
1491 .bus_num = 0,
1492 .chip_select = 1,
1493 .mode = SPI_MODE_0,
1494 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001495};
1496
1497static struct platform_device msm_device_saw_core0 = {
1498 .name = "saw-regulator",
1499 .id = 0,
1500 .dev = {
1501 .platform_data = &msm_saw_regulator_pdata_s5,
1502 },
1503};
1504
1505static struct platform_device msm_device_saw_core1 = {
1506 .name = "saw-regulator",
1507 .id = 1,
1508 .dev = {
1509 .platform_data = &msm_saw_regulator_pdata_s6,
1510 },
1511};
1512
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001513static struct tsens_platform_data msm_tsens_pdata = {
1514 .slope = 910,
1515 .tsens_factor = 1000,
1516 .hw_type = MSM_8960,
1517 .tsens_num_sensor = 5,
1518};
1519
1520static struct platform_device msm_tsens_device = {
1521 .name = "tsens8960-tm",
1522 .id = -1,
1523 .dev = {
1524 .platform_data = &msm_tsens_pdata,
1525 },
1526};
1527
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001528#ifdef CONFIG_MSM_FAKE_BATTERY
1529static struct platform_device fish_battery_device = {
1530 .name = "fish_battery",
1531};
1532#endif
1533
David Collins26f05562011-06-20 09:56:28 -07001534static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001535 .name = GPIO_REGULATOR_DEV_NAME,
1536 .id = PM8921_MPP_PM_TO_SYS(7),
1537 .dev = {
1538 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1539 },
1540};
1541
David Collins26f05562011-06-20 09:56:28 -07001542static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001543 .name = GPIO_REGULATOR_DEV_NAME,
1544 .id = 91,
1545 .dev = {
1546 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1547 },
1548};
1549
David Collinsb10be1d2011-09-02 10:29:31 -07001550static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1551 .name = GPIO_REGULATOR_DEV_NAME,
1552 .id = PM8921_GPIO_PM_TO_SYS(17),
1553 .dev = {
1554 .platform_data =
1555 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1556 },
1557};
1558
David Collins35a78f52011-12-14 15:54:25 -08001559static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1560 .name = GPIO_REGULATOR_DEV_NAME,
1561 .id = PM8921_GPIO_PM_TO_SYS(42),
1562 .dev = {
1563 .platform_data =
1564 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1565 },
1566};
1567
David Collins26f05562011-06-20 09:56:28 -07001568static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1569 .name = "rpm-regulator",
1570 .id = -1,
1571 .dev = {
1572 .platform_data = &msm_rpm_regulator_pdata,
1573 },
1574};
1575
David Collins4c31a872011-08-31 10:07:10 -07001576static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1577 .phys_addr_base = 0x0010C000,
1578 .reg_offsets = {
1579 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1580 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1581 },
1582 .phys_size = SZ_8K,
1583 .log_len = 4096, /* log's buffer length in bytes */
1584 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1585};
1586
1587static struct platform_device msm_rpm_log_device = {
1588 .name = "msm_rpm_log",
1589 .id = -1,
1590 .dev = {
1591 .platform_data = &msm_rpm_log_pdata,
1592 },
1593};
1594
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001595static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001596 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001597 &msm_device_smd,
1598 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301599 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001600 &msm_device_saw_core0,
1601 &msm_device_saw_core1,
1602 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001603 &msm8960_device_ssbi_pmic,
David Collins35a78f52011-12-14 15:54:25 -08001604 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001605 &msm8960_device_qup_spi_gsbi1,
1606 &msm8960_device_qup_i2c_gsbi3,
1607 &msm8960_device_qup_i2c_gsbi4,
1608 &msm8960_device_qup_i2c_gsbi10,
1609#ifndef CONFIG_MSM_DSPS
1610 &msm8960_device_qup_i2c_gsbi12,
1611#endif
1612 &msm_slim_ctrl,
1613 &msm_device_wcnss_wlan,
1614#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1615 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1616 &qcrypto_device,
1617#endif
1618
1619#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1620 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1621 &qcedev_device,
1622#endif
1623#ifdef CONFIG_MSM_ROTATOR
1624 &msm_rotator_device,
1625#endif
1626 &msm_device_sps,
1627#ifdef CONFIG_MSM_FAKE_BATTERY
1628 &fish_battery_device,
1629#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001630 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001631#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001632#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001633 &android_pmem_device,
1634 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001635#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001636 &android_pmem_audio_device,
1637#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001638 &msm_device_vidc,
1639 &msm_device_bam_dmux,
1640 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001641
1642#ifdef CONFIG_HW_RANDOM_MSM
1643 &msm_device_rng,
1644#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001645 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07001646#ifdef CONFIG_ION_MSM
1647 &ion_dev,
1648#endif
David Collins4c31a872011-08-31 10:07:10 -07001649 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06001650 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001651 &msm_device_tz_log,
1652
Pratik Patel7831c082011-06-08 21:44:37 -07001653#ifdef CONFIG_MSM_QDSS
1654 &msm_etb_device,
1655 &msm_tpiu_device,
1656 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07001657 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07001658 &msm_ptm_device,
1659#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001660 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001661 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001662};
1663
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001664static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001665 &msm8960_device_otg,
1666 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001667 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301668 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001669 &android_usb_device,
1670 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001671 &msm_bus_apps_fabric,
1672 &msm_bus_sys_fabric,
1673 &msm_bus_mm_fabric,
1674 &msm_bus_sys_fpb,
1675 &msm_bus_cpss_fpb,
1676 &msm_pcm,
1677 &msm_pcm_routing,
1678 &msm_cpudai0,
1679 &msm_cpudai1,
1680 &msm_cpudai_hdmi_rx,
1681 &msm_cpudai_bt_rx,
1682 &msm_cpudai_bt_tx,
1683 &msm_cpudai_fm_rx,
1684 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001685 &msm_cpudai_auxpcm_rx,
1686 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687 &msm_cpu_fe,
1688 &msm_stub_codec,
1689 &msm_voice,
1690 &msm_voip,
1691 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301692 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001693 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001694 &msm_cpudai_incall_record_rx,
1695 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001696
1697#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1698 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1699 &qcrypto_device,
1700#endif
1701
1702#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1703 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1704 &qcedev_device,
1705#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001706};
1707
1708static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001709 &msm_kgsl_3d0,
1710 &msm_kgsl_2d0,
1711 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001712#ifdef CONFIG_MSM_GEMINI
1713 &msm8960_gemini_device,
1714#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001715};
1716
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001717static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001718 &msm_8960_q6_lpass,
1719 &msm_8960_q6_mss_fw,
1720 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001721 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001722 &msm_pil_tzapps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001723 &msm8960_device_otg,
1724 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001725 &msm_device_hsusb_host,
1726 &android_usb_device,
1727 &msm_pcm,
1728 &msm_pcm_routing,
1729 &msm_cpudai0,
1730 &msm_cpudai1,
1731 &msm_cpudai_hdmi_rx,
1732 &msm_cpudai_bt_rx,
1733 &msm_cpudai_bt_tx,
1734 &msm_cpudai_fm_rx,
1735 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001736 &msm_cpudai_auxpcm_rx,
1737 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001738 &msm_cpu_fe,
1739 &msm_stub_codec,
1740 &msm_kgsl_3d0,
1741#ifdef CONFIG_MSM_KGSL_2D
1742 &msm_kgsl_2d0,
1743 &msm_kgsl_2d1,
1744#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001745#ifdef CONFIG_MSM_GEMINI
1746 &msm8960_gemini_device,
1747#endif
1748 &msm_voice,
1749 &msm_voip,
1750 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301751 &msm_cpudai_afe_01_rx,
1752 &msm_cpudai_afe_01_tx,
1753 &msm_cpudai_afe_02_rx,
1754 &msm_cpudai_afe_02_tx,
1755 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301756 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001757 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001758 &msm_cpudai_incall_record_rx,
1759 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001760 &msm_pcm_hostless,
1761 &msm_bus_apps_fabric,
1762 &msm_bus_sys_fabric,
1763 &msm_bus_mm_fabric,
1764 &msm_bus_sys_fpb,
1765 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001766 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001767};
1768
1769static void __init msm8960_i2c_init(void)
1770{
1771 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1772 &msm8960_i2c_qup_gsbi4_pdata;
1773
1774 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1775 &msm8960_i2c_qup_gsbi3_pdata;
1776
1777 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1778 &msm8960_i2c_qup_gsbi10_pdata;
1779
1780 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1781 &msm8960_i2c_qup_gsbi12_pdata;
1782}
1783
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001784static void __init msm8960_gfx_init(void)
1785{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001786 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001787 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1788 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1789 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001790 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1791 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001792 }
1793}
1794
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001795static struct msm_cpuidle_state msm_cstates[] __initdata = {
1796 {0, 0, "C0", "WFI",
1797 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1798
1799 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1800 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1801
1802 {0, 2, "C2", "POWER_COLLAPSE",
1803 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1804
1805 {1, 0, "C0", "WFI",
1806 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1807
1808 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1809 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1810};
1811
1812static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1813 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1814 .idle_supported = 1,
1815 .suspend_supported = 1,
1816 .idle_enabled = 0,
1817 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001818 },
1819
1820 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1821 .idle_supported = 1,
1822 .suspend_supported = 1,
1823 .idle_enabled = 0,
1824 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001825 },
1826
1827 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1828 .idle_supported = 1,
1829 .suspend_supported = 1,
1830 .idle_enabled = 1,
1831 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001832 },
1833
1834 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1835 .idle_supported = 0,
1836 .suspend_supported = 1,
1837 .idle_enabled = 0,
1838 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001839 },
1840
1841 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1842 .idle_supported = 1,
1843 .suspend_supported = 1,
1844 .idle_enabled = 0,
1845 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001846 },
1847
1848 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1849 .idle_supported = 1,
1850 .suspend_supported = 0,
1851 .idle_enabled = 1,
1852 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001853 },
1854};
1855
1856static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1857 {
1858 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1859 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1860 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001861 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001862 },
1863
1864 {
1865 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1866 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1867 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001868 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001869 },
1870
1871 {
1872 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1873 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1874 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001875 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001876 },
1877
1878 {
1879 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1880 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1881 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001882 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001883 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001884 {
1885 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1886 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1887 false,
1888 7000, 3500, 66600000, 5150,
1889 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001890
1891 {
1892 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1893 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1894 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001895 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001896 },
1897
1898 {
1899 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1900 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1901 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001902 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903 },
1904
1905 {
1906 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1907 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1908 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001909 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001910 },
1911
1912 {
1913 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1914 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1915 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001916 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001917 },
1918};
1919
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001920static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1921 .mode = MSM_PM_BOOT_CONFIG_TZ,
1922};
1923
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001924#ifdef CONFIG_I2C
1925#define I2C_SURF 1
1926#define I2C_FFA (1 << 1)
1927#define I2C_RUMI (1 << 2)
1928#define I2C_SIM (1 << 3)
1929#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03001930#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001931
1932struct i2c_registry {
1933 u8 machs;
1934 int bus;
1935 struct i2c_board_info *info;
1936 int len;
1937};
1938
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001939/* Sensors DSPS platform data */
1940#ifdef CONFIG_MSM_DSPS
1941#define DSPS_PIL_GENERIC_NAME "dsps"
1942#endif /* CONFIG_MSM_DSPS */
1943
1944static void __init msm8960_init_dsps(void)
1945{
1946#ifdef CONFIG_MSM_DSPS
1947 struct msm_dsps_platform_data *pdata =
1948 msm_dsps_device.dev.platform_data;
1949 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
1950 pdata->gpios = NULL;
1951 pdata->gpios_num = 0;
1952
1953 platform_device_register(&msm_dsps_device);
1954#endif /* CONFIG_MSM_DSPS */
1955}
1956
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08001957static int hsic_peripheral_status = 1;
1958static DEFINE_MUTEX(hsic_status_lock);
1959
1960void peripheral_connect()
1961{
1962 mutex_lock(&hsic_status_lock);
1963 if (hsic_peripheral_status)
1964 goto out;
1965 platform_device_add(&msm_device_hsic_host);
1966 hsic_peripheral_status = 1;
1967out:
1968 mutex_unlock(&hsic_status_lock);
1969}
1970EXPORT_SYMBOL(peripheral_connect);
1971
1972void peripheral_disconnect()
1973{
1974 mutex_lock(&hsic_status_lock);
1975 if (!hsic_peripheral_status)
1976 goto out;
1977 platform_device_del(&msm_device_hsic_host);
1978 hsic_peripheral_status = 0;
1979out:
1980 mutex_unlock(&hsic_status_lock);
1981}
1982EXPORT_SYMBOL(peripheral_disconnect);
1983
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07001984static void __init msm8960_init_hsic(void)
1985{
1986#ifdef CONFIG_USB_EHCI_MSM_HSIC
1987 uint32_t version = socinfo_get_version();
1988
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08001989 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07001990 return;
1991
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001992 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08001993 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07001994#endif
1995}
1996
Amir Samuelov5137e392011-09-21 17:31:25 +03001997#ifdef CONFIG_ISL9519_CHARGER
1998static struct isl_platform_data isl_data __initdata = {
1999 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2000 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2001 .max_system_voltage = 4200,
2002 .min_system_voltage = 3200,
2003 .chgcurrent = 1000, /* 1900, */
2004 .term_current = 400, /* Need fine tuning */
2005 .input_current = 2048,
2006};
2007
2008static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2009 {
2010 I2C_BOARD_INFO("isl9519q", 0x9),
2011 .irq = 0, /* Not required when notify-by-pmic */
2012 .platform_data = &isl_data,
2013 },
2014};
2015#endif /* CONFIG_ISL9519_CHARGER */
2016
Amir Samuelov755616d2011-12-13 16:34:46 +02002017static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2018 {
2019 I2C_BOARD_INFO("sx1508q", 0x20),
2020 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2021 },
2022};
2023
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002024static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002025#ifdef CONFIG_ISL9519_CHARGER
2026 {
2027 I2C_LIQUID,
2028 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2029 isl_charger_i2c_info,
2030 ARRAY_SIZE(isl_charger_i2c_info),
2031 },
2032#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002033 {
2034 I2C_SURF | I2C_FFA | I2C_FLUID,
2035 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2036 cyttsp_info,
2037 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002038 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302039 {
2040 I2C_LIQUID,
2041 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2042 mxt_device_info,
2043 ARRAY_SIZE(mxt_device_info),
2044 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302045 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302046 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302047 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002048 sii_device_info,
2049 ARRAY_SIZE(sii_device_info),
2050 },
2051 {
2052 I2C_LIQUID,
2053 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302054 msm_isa1200_board_info,
2055 ARRAY_SIZE(msm_isa1200_board_info),
2056 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002057 {
2058 I2C_LIQUID,
2059 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2060 liquid_io_expander_i2c_info,
2061 ARRAY_SIZE(liquid_io_expander_i2c_info),
2062 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002063};
2064#endif /* CONFIG_I2C */
2065
2066static void __init register_i2c_devices(void)
2067{
2068#ifdef CONFIG_I2C
2069 u8 mach_mask = 0;
2070 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002071#ifdef CONFIG_MSM_CAMERA
2072 struct i2c_registry msm8960_camera_i2c_devices = {
2073 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2074 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2075 msm8960_camera_board_info.board_info,
2076 msm8960_camera_board_info.num_i2c_board_info,
2077 };
2078#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002079
2080 /* Build the matching 'supported_machs' bitmask */
2081 if (machine_is_msm8960_cdp())
2082 mach_mask = I2C_SURF;
2083 else if (machine_is_msm8960_rumi3())
2084 mach_mask = I2C_RUMI;
2085 else if (machine_is_msm8960_sim())
2086 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002087 else if (machine_is_msm8960_fluid())
2088 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002089 else if (machine_is_msm8960_liquid())
2090 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002091 else if (machine_is_msm8960_mtp())
2092 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002093 else
2094 pr_err("unmatched machine ID in register_i2c_devices\n");
2095
2096 /* Run the array and install devices as appropriate */
2097 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2098 if (msm8960_i2c_devices[i].machs & mach_mask)
2099 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2100 msm8960_i2c_devices[i].info,
2101 msm8960_i2c_devices[i].len);
2102 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002103#ifdef CONFIG_MSM_CAMERA
2104 if (msm8960_camera_i2c_devices.machs & mach_mask)
2105 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2106 msm8960_camera_i2c_devices.info,
2107 msm8960_camera_i2c_devices.len);
2108#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002109#endif
2110}
2111
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002112static void __init msm8960_sim_init(void)
2113{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002114 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2115 &msm8960_device_watchdog.dev.platform_data;
2116
2117 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002118 BUG_ON(msm_rpm_init(&msm_rpm_data));
2119 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2120 ARRAY_SIZE(msm_rpmrs_levels)));
2121 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002122 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002123 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002124 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002125
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002126 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002127 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002128 msm8960_i2c_init();
2129 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2130 msm_spm_l2_init(msm_spm_l2_data);
2131 msm8960_init_buses();
2132 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002133 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002134 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002135 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002136
2137 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2138 &msm8960_qup_spi_gsbi1_pdata;
2139 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2140
2141 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002142 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002143 slim_register_board_info(msm_slim_devices,
2144 ARRAY_SIZE(msm_slim_devices));
2145 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2146 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2147 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2148 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002149 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002150}
2151
2152static void __init msm8960_rumi3_init(void)
2153{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002154 BUG_ON(msm_rpm_init(&msm_rpm_data));
2155 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2156 ARRAY_SIZE(msm_rpmrs_levels)));
2157 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002158 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002159 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002160 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002161 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002162 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2163 &msm8960_qup_spi_gsbi1_pdata;
2164 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2165 msm8960_i2c_init();
2166 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2167 msm_spm_l2_init(msm_spm_l2_data);
2168 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002169 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002170 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002171 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002172 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002173 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002174 slim_register_board_info(msm_slim_devices,
2175 ARRAY_SIZE(msm_slim_devices));
2176 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2177 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2178 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2179 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002180 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002181}
2182
2183static void __init msm8960_cdp_init(void)
2184{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002185 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2186 pr_err("meminfo_init() failed!\n");
2187
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002188 BUG_ON(msm_rpm_init(&msm_rpm_data));
2189 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2190 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002191
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002192 regulator_suppress_info_printing();
2193 if (msm_xo_init())
2194 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002195 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002196 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302197 if (machine_is_msm8960_liquid())
2198 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002199 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302200 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2201 machine_is_msm8960_cdp()) {
2202 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2203 } else if (machine_is_msm8960_liquid()) {
2204 msm_otg_pdata.phy_init_seq =
2205 liquid_v1_phy_init_seq;
2206 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302207 msm_otg_pdata.swfi_latency =
2208 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302209#ifdef CONFIG_USB_EHCI_MSM_HSIC
2210 if (machine_is_msm8960_liquid()) {
2211 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2212 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2213 }
2214#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302215 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002216 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002217 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2218 &msm8960_qup_spi_gsbi1_pdata;
2219 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002220
2221 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302222 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2223 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2224 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002225 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002226 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002227 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2228 msm_spm_l2_init(msm_spm_l2_data);
2229 msm8960_init_buses();
2230 platform_add_devices(msm_footswitch_devices,
2231 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002232 if (machine_is_msm8960_liquid())
2233 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002234 if (machine_is_msm8960_cdp())
2235 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002236 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002237 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002238 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002239 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002240 msm8960_init_cam();
2241 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002242 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302243 if (machine_is_msm8960_liquid())
2244 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002245 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002246 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002247 slim_register_board_info(msm_slim_devices,
2248 ARRAY_SIZE(msm_slim_devices));
2249 msm8960_init_dsps();
2250 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2251 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2252 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2253 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002254 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002255 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Joel Kingb8352a12011-11-15 18:46:24 -08002256 if (PLATFORM_IS_CHARM25())
2257 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002258}
2259
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002260MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2261 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002262 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002263 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302264 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002265 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002266 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002267 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002268 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002269MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002270
2271MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2272 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002273 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002274 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302275 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002276 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002277 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002278 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002279 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002280MACHINE_END
2281
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2283 .map_io = msm8960_map_io,
2284 .reserve = msm8960_reserve,
2285 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302286 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002287 .timer = &msm_timer,
2288 .init_machine = msm8960_cdp_init,
2289 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002290 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002291MACHINE_END
2292
2293MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2294 .map_io = msm8960_map_io,
2295 .reserve = msm8960_reserve,
2296 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302297 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002298 .timer = &msm_timer,
2299 .init_machine = msm8960_cdp_init,
2300 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002301 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002302MACHINE_END
2303
2304MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2305 .map_io = msm8960_map_io,
2306 .reserve = msm8960_reserve,
2307 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302308 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309 .timer = &msm_timer,
2310 .init_machine = msm8960_cdp_init,
2311 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002312 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002313MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002314
2315MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2316 .map_io = msm8960_map_io,
2317 .reserve = msm8960_reserve,
2318 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302319 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002320 .timer = &msm_timer,
2321 .init_machine = msm8960_cdp_init,
2322 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002323 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002324MACHINE_END