blob: 3ef7dea70aea291252c6fba0a077bf60f2db807d [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>
Laura Abbottd6183792011-08-19 13:42:24 -070081
Larry Bassel41a055b2011-12-06 16:15:14 -080082#include <linux/fmem.h>
83
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070084#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080085#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070086#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070087#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080088#include "board-8960.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070089#include "pm.h"
90#include "cpuidle.h"
91#include "rpm_resources.h"
92#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070093#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070094#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070095#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060096#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070097#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080098
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070099static struct platform_device msm_fm_platform_init = {
100 .name = "iris_fm",
101 .id = -1,
102};
103
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700104#define KS8851_RST_GPIO 89
105#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530106#define HAP_SHIFT_LVL_OE_GPIO 47
107
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700108#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700109
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800110struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700111 [SX150X_CAM] = {
112 .gpio_base = GPIO_CAM_EXPANDER_BASE,
113 .oscio_is_gpo = false,
114 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530115 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700116 .io_open_drain_ena = 0x0,
117 .irq_summary = -1,
118 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200119 [SX150X_LIQUID] = {
120 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
121 .oscio_is_gpo = false,
122 .io_pullup_ena = 0x0c08,
123 .io_pulldn_ena = 0x4060,
124 .io_open_drain_ena = 0x000c,
125 .io_polarity = 0,
126 .irq_summary = -1,
127 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700128};
Nishant Pandit474f2252011-07-23 23:17:56 +0530129
130#endif
131
Haynes Mathew George9bc27652011-12-13 19:14:14 -0800132#define MSM_PMEM_ADSP_SIZE 0x4200000
Ben Romberger3ffcd812011-12-08 19:12:10 -0800133#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700134#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
135#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
136#else
Chetan Kalyana25d0762011-11-11 17:41:29 -0800137#define MSM_PMEM_SIZE 0x1C00000 /* 28 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700138#endif
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800139#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700140
141#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbott6db11c92011-11-04 10:31:43 -0700142#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
143#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
Laura Abbott2d1760b2011-09-29 21:31:24 -0700144#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
Laura Abbott8c017362011-09-22 20:59:12 -0700145#define MSM_ION_HEAP_NUM 5
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800146#define MSM_LIQUID_ION_EBI_SIZE (MSM_LIQUID_PMEM_SIZE + 0x600000)
147static unsigned msm_ion_ebi_size = MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700148#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700149#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700150#define MSM_ION_HEAP_NUM 2
151#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700152
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700153#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
154static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
155static int __init pmem_kernel_ebi1_size_setup(char *p)
156{
157 pmem_kernel_ebi1_size = memparse(p, NULL);
158 return 0;
159}
160early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
161#endif
162
163#ifdef CONFIG_ANDROID_PMEM
164static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800165static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166static int __init pmem_size_setup(char *p)
167{
168 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800169 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700170 return 0;
171}
172early_param("pmem_size", pmem_size_setup);
173
174static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
175
176static int __init pmem_adsp_size_setup(char *p)
177{
178 pmem_adsp_size = memparse(p, NULL);
179 return 0;
180}
181early_param("pmem_adsp_size", pmem_adsp_size_setup);
182
183static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
184
185static int __init pmem_audio_size_setup(char *p)
186{
187 pmem_audio_size = memparse(p, NULL);
188 return 0;
189}
190early_param("pmem_audio_size", pmem_audio_size_setup);
191#endif
192
193#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700194#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700195static struct android_pmem_platform_data android_pmem_pdata = {
196 .name = "pmem",
197 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
198 .cached = 1,
199 .memory_type = MEMTYPE_EBI1,
200};
201
202static struct platform_device android_pmem_device = {
203 .name = "android_pmem",
204 .id = 0,
205 .dev = {.platform_data = &android_pmem_pdata},
206};
207
208static struct android_pmem_platform_data android_pmem_adsp_pdata = {
209 .name = "pmem_adsp",
210 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
211 .cached = 0,
212 .memory_type = MEMTYPE_EBI1,
213};
214static struct platform_device android_pmem_adsp_device = {
215 .name = "android_pmem",
216 .id = 2,
217 .dev = { .platform_data = &android_pmem_adsp_pdata },
218};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700219#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700220
221static struct android_pmem_platform_data android_pmem_audio_pdata = {
222 .name = "pmem_audio",
223 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
224 .cached = 0,
225 .memory_type = MEMTYPE_EBI1,
226};
227
228static struct platform_device android_pmem_audio_device = {
229 .name = "android_pmem",
230 .id = 4,
231 .dev = { .platform_data = &android_pmem_audio_pdata },
232};
233#endif
234
Larry Bassel41a055b2011-12-06 16:15:14 -0800235struct fmem_platform_data fmem_pdata = {
236};
237
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700238#define DSP_RAM_BASE_8960 0x8da00000
239#define DSP_RAM_SIZE_8960 0x1800000
240static int dspcrashd_pdata_8960 = 0xDEADDEAD;
241
242static struct resource resources_dspcrashd_8960[] = {
243 {
244 .name = "msm_dspcrashd",
245 .start = DSP_RAM_BASE_8960,
246 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
247 .flags = IORESOURCE_DMA,
248 },
249};
250
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800251static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700252 .name = "msm_dspcrashd",
253 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
254 .resource = resources_dspcrashd_8960,
255 .dev = { .platform_data = &dspcrashd_pdata_8960 },
256};
257
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700258static struct memtype_reserve msm8960_reserve_table[] __initdata = {
259 [MEMTYPE_SMI] = {
260 },
261 [MEMTYPE_EBI0] = {
262 .flags = MEMTYPE_FLAGS_1M_ALIGN,
263 },
264 [MEMTYPE_EBI1] = {
265 .flags = MEMTYPE_FLAGS_1M_ALIGN,
266 },
267};
268
269static void __init size_pmem_devices(void)
270{
271#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700272#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700273 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800274
275 if (!pmem_param_set && machine_is_msm8960_liquid())
276 pmem_size = MSM_LIQUID_PMEM_SIZE;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700277 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700278#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
280#endif
281}
282
283static void __init reserve_memory_for(struct android_pmem_platform_data *p)
284{
285 msm8960_reserve_table[p->memory_type].size += p->size;
286}
287
288static void __init reserve_pmem_memory(void)
289{
290#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700291#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700292 reserve_memory_for(&android_pmem_adsp_pdata);
293 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700294#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295 reserve_memory_for(&android_pmem_audio_pdata);
296 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
297#endif
298}
299
Larry Bassel41a055b2011-12-06 16:15:14 -0800300static void __init reserve_fmem_memory(void)
301{
302}
303
Larry Basselb4126da2011-07-18 14:31:33 -0700304static int msm8960_paddr_to_memtype(unsigned int paddr)
305{
306 return MEMTYPE_EBI1;
307}
308
Laura Abbottd6183792011-08-19 13:42:24 -0700309#ifdef CONFIG_ION_MSM
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800310static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700311 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700312 .heaps = {
313 {
314 .id = ION_HEAP_SYSTEM_ID,
315 .type = ION_HEAP_TYPE_SYSTEM,
316 .name = ION_KMALLOC_HEAP_NAME,
317 },
318 {
319 .id = ION_HEAP_SYSTEM_CONTIG_ID,
320 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
321 .name = ION_VMALLOC_HEAP_NAME,
322 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700323#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700324 {
325 .id = ION_HEAP_EBI_ID,
326 .type = ION_HEAP_TYPE_CARVEOUT,
327 .name = ION_EBI1_HEAP_NAME,
328 .size = MSM_ION_EBI_SIZE,
329 .memory_type = ION_EBI_TYPE,
330 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700331 {
332 .id = ION_HEAP_ADSP_ID,
333 .type = ION_HEAP_TYPE_CARVEOUT,
334 .name = ION_ADSP_HEAP_NAME,
335 .size = MSM_ION_ADSP_SIZE,
336 .memory_type = ION_EBI_TYPE,
337 },
Laura Abbott8c017362011-09-22 20:59:12 -0700338 {
339 .id = ION_HEAP_IOMMU_ID,
340 .type = ION_HEAP_TYPE_IOMMU,
341 .name = ION_IOMMU_HEAP_NAME,
342 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700343#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700344 }
345};
346
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800347static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700348 .name = "ion-msm",
349 .id = 1,
350 .dev = { .platform_data = &ion_pdata },
351};
352#endif
353
Larry Bassel41a055b2011-12-06 16:15:14 -0800354struct platform_device fmem_device = {
355 .name = "fmem",
356 .id = 1,
357 .dev = { .platform_data = &fmem_pdata },
358};
359
Laura Abbottd6183792011-08-19 13:42:24 -0700360static void reserve_ion_memory(void)
361{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700362#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800363 unsigned int i;
364
365 if (!pmem_param_set && machine_is_msm8960_liquid()) {
366 msm_ion_ebi_size = MSM_LIQUID_ION_EBI_SIZE;
367 for (i = 0; i < ion_pdata.nr; i++) {
368 if (ion_pdata.heaps[i].id == ION_HEAP_EBI_ID) {
369 ion_pdata.heaps[i].size = msm_ion_ebi_size;
370 pr_debug("msm_ion_ebi_size 0x%x\n",
371 msm_ion_ebi_size);
372 break;
373 }
374 }
375 }
376 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_ion_ebi_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700377 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700378#endif
379}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700380static void __init msm8960_calculate_reserve_sizes(void)
381{
382 size_pmem_devices();
383 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700384 reserve_ion_memory();
Larry Bassel41a055b2011-12-06 16:15:14 -0800385 reserve_fmem_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700386}
387
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700388static struct reserve_info msm8960_reserve_info __initdata = {
389 .memtype_reserve_table = msm8960_reserve_table,
390 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
391 .paddr_to_memtype = msm8960_paddr_to_memtype,
392};
393
Larry Basselb4126da2011-07-18 14:31:33 -0700394static int msm8960_memory_bank_size(void)
395{
396 return 1<<29;
397}
398
399static void __init locate_unstable_memory(void)
400{
401 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
402 unsigned long bank_size;
403 unsigned long low, high;
404
405 bank_size = msm8960_memory_bank_size();
406 low = meminfo.bank[0].start;
407 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700408
409 /* Check if 32 bit overflow occured */
410 if (high < mb->start)
411 high = ~0UL;
412
Larry Basselb4126da2011-07-18 14:31:33 -0700413 low &= ~(bank_size - 1);
414
415 if (high - low <= bank_size)
416 return;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800417 msm8960_reserve_info.low_unstable_address = high -
418 MIN_MEMORY_BLOCK_SIZE;
419 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700420
Larry Basselb4126da2011-07-18 14:31:33 -0700421 msm8960_reserve_info.bank_size = bank_size;
422 pr_info("low unstable address %lx max size %lx bank size %lx\n",
423 msm8960_reserve_info.low_unstable_address,
424 msm8960_reserve_info.max_unstable_size,
425 msm8960_reserve_info.bank_size);
426}
427
Larry Basselb830e182011-10-14 10:46:55 -0700428static void __init place_movable_zone(void)
429{
430 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
431 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
432 pr_info("movable zone start %lx size %lx\n",
433 movable_reserved_start, movable_reserved_size);
434}
435
436static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700437{
438 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700439 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700440 place_movable_zone();
441}
442
443static void __init msm8960_reserve(void)
444{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700445 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800446 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700447}
448
Larry Bassela4414b12011-08-04 11:11:02 -0700449static int msm8960_change_memory_power(u64 start, u64 size,
450 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700451{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700452 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700453}
454
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700455static void __init msm8960_allocate_memory_regions(void)
456{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800457 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700458}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800459
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700460#ifdef CONFIG_WCD9310_CODEC
461
462#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
463
Patrick Lai3043fba2011-08-01 14:15:57 -0700464/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
465 * 4 micbiases are used to power various analog and digital
466 * microphones operating at 1800 mV. Technically, all micbiases
467 * can source from single cfilter since all microphones operate
468 * at the same voltage level. The arrangement below is to make
469 * sure all cfilters are exercised. LDO_H regulator ouput level
470 * does not need to be as high as 2.85V. It is choosen for
471 * microphone sensitivity purpose.
472 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700473static struct tabla_pdata tabla_platform_data = {
474 .slimbus_slave_device = {
475 .name = "tabla-slave",
476 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
477 },
478 .irq = MSM_GPIO_TO_INT(62),
479 .irq_base = TABLA_INTERRUPT_BASE,
480 .num_irqs = NR_TABLA_IRQS,
481 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700482 .micbias = {
483 .ldoh_v = TABLA_LDOH_2P85_V,
484 .cfilt1_mv = 1800,
485 .cfilt2_mv = 1800,
486 .cfilt3_mv = 1800,
487 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
488 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
489 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
490 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
491 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700492};
493
494static struct slim_device msm_slim_tabla = {
495 .name = "tabla-slim",
496 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
497 .dev = {
498 .platform_data = &tabla_platform_data,
499 },
500};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530501
502static struct tabla_pdata tabla20_platform_data = {
503 .slimbus_slave_device = {
504 .name = "tabla-slave",
505 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
506 },
507 .irq = MSM_GPIO_TO_INT(62),
508 .irq_base = TABLA_INTERRUPT_BASE,
509 .num_irqs = NR_TABLA_IRQS,
510 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
511 .micbias = {
512 .ldoh_v = TABLA_LDOH_2P85_V,
513 .cfilt1_mv = 1800,
514 .cfilt2_mv = 1800,
515 .cfilt3_mv = 1800,
516 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
517 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
518 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
519 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
520 }
521};
522
523static struct slim_device msm_slim_tabla20 = {
524 .name = "tabla2x-slim",
525 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
526 .dev = {
527 .platform_data = &tabla20_platform_data,
528 },
529};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700530#endif
531
532static struct slim_boardinfo msm_slim_devices[] = {
533#ifdef CONFIG_WCD9310_CODEC
534 {
535 .bus_num = 1,
536 .slim_slave = &msm_slim_tabla,
537 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530538 {
539 .bus_num = 1,
540 .slim_slave = &msm_slim_tabla20,
541 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700542#endif
543 /* add more slimbus slaves as needed */
544};
545
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700546#define MSM_WCNSS_PHYS 0x03000000
547#define MSM_WCNSS_SIZE 0x280000
548
549static struct resource resources_wcnss_wlan[] = {
550 {
551 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
552 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
553 .name = "wcnss_wlanrx_irq",
554 .flags = IORESOURCE_IRQ,
555 },
556 {
557 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
558 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
559 .name = "wcnss_wlantx_irq",
560 .flags = IORESOURCE_IRQ,
561 },
562 {
563 .start = MSM_WCNSS_PHYS,
564 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
565 .name = "wcnss_mmio",
566 .flags = IORESOURCE_MEM,
567 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700568 {
569 .start = 84,
570 .end = 88,
571 .name = "wcnss_gpios_5wire",
572 .flags = IORESOURCE_IO,
573 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700574};
575
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700576static struct qcom_wcnss_opts qcom_wcnss_pdata = {
577 .has_48mhz_xo = 1,
578};
579
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700580static struct platform_device msm_device_wcnss_wlan = {
581 .name = "wcnss_wlan",
582 .id = 0,
583 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
584 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700585 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700586};
587
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700588#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
589 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
590 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
591 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
592
593#define QCE_SIZE 0x10000
594#define QCE_0_BASE 0x18500000
595
596#define QCE_HW_KEY_SUPPORT 0
597#define QCE_SHA_HMAC_SUPPORT 1
598#define QCE_SHARE_CE_RESOURCE 1
599#define QCE_CE_SHARED 0
600
601static struct resource qcrypto_resources[] = {
602 [0] = {
603 .start = QCE_0_BASE,
604 .end = QCE_0_BASE + QCE_SIZE - 1,
605 .flags = IORESOURCE_MEM,
606 },
607 [1] = {
608 .name = "crypto_channels",
609 .start = DMOV_CE_IN_CHAN,
610 .end = DMOV_CE_OUT_CHAN,
611 .flags = IORESOURCE_DMA,
612 },
613 [2] = {
614 .name = "crypto_crci_in",
615 .start = DMOV_CE_IN_CRCI,
616 .end = DMOV_CE_IN_CRCI,
617 .flags = IORESOURCE_DMA,
618 },
619 [3] = {
620 .name = "crypto_crci_out",
621 .start = DMOV_CE_OUT_CRCI,
622 .end = DMOV_CE_OUT_CRCI,
623 .flags = IORESOURCE_DMA,
624 },
625};
626
627static struct resource qcedev_resources[] = {
628 [0] = {
629 .start = QCE_0_BASE,
630 .end = QCE_0_BASE + QCE_SIZE - 1,
631 .flags = IORESOURCE_MEM,
632 },
633 [1] = {
634 .name = "crypto_channels",
635 .start = DMOV_CE_IN_CHAN,
636 .end = DMOV_CE_OUT_CHAN,
637 .flags = IORESOURCE_DMA,
638 },
639 [2] = {
640 .name = "crypto_crci_in",
641 .start = DMOV_CE_IN_CRCI,
642 .end = DMOV_CE_IN_CRCI,
643 .flags = IORESOURCE_DMA,
644 },
645 [3] = {
646 .name = "crypto_crci_out",
647 .start = DMOV_CE_OUT_CRCI,
648 .end = DMOV_CE_OUT_CRCI,
649 .flags = IORESOURCE_DMA,
650 },
651};
652
653#endif
654
655#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
656 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
657
658static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
659 .ce_shared = QCE_CE_SHARED,
660 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
661 .hw_key_support = QCE_HW_KEY_SUPPORT,
662 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
663};
664
665static struct platform_device qcrypto_device = {
666 .name = "qcrypto",
667 .id = 0,
668 .num_resources = ARRAY_SIZE(qcrypto_resources),
669 .resource = qcrypto_resources,
670 .dev = {
671 .coherent_dma_mask = DMA_BIT_MASK(32),
672 .platform_data = &qcrypto_ce_hw_suppport,
673 },
674};
675#endif
676
677#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
678 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
679
680static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
681 .ce_shared = QCE_CE_SHARED,
682 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
683 .hw_key_support = QCE_HW_KEY_SUPPORT,
684 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
685};
686
687static struct platform_device qcedev_device = {
688 .name = "qce",
689 .id = 0,
690 .num_resources = ARRAY_SIZE(qcedev_resources),
691 .resource = qcedev_resources,
692 .dev = {
693 .coherent_dma_mask = DMA_BIT_MASK(32),
694 .platform_data = &qcedev_ce_hw_suppport,
695 },
696};
697#endif
698
Joel Kingb8352a12011-11-15 18:46:24 -0800699#define MDM2AP_ERRFATAL 70
700#define AP2MDM_ERRFATAL 95
701#define MDM2AP_STATUS 69
702#define AP2MDM_STATUS 94
703#define AP2MDM_PMIC_RESET_N 80
704#define AP2MDM_KPDPWR_N 81
705
Joel Kingb8352a12011-11-15 18:46:24 -0800706static struct resource mdm_resources[] = {
707 {
708 .start = MDM2AP_ERRFATAL,
709 .end = MDM2AP_ERRFATAL,
710 .name = "MDM2AP_ERRFATAL",
711 .flags = IORESOURCE_IO,
712 },
713 {
714 .start = AP2MDM_ERRFATAL,
715 .end = AP2MDM_ERRFATAL,
716 .name = "AP2MDM_ERRFATAL",
717 .flags = IORESOURCE_IO,
718 },
719 {
720 .start = MDM2AP_STATUS,
721 .end = MDM2AP_STATUS,
722 .name = "MDM2AP_STATUS",
723 .flags = IORESOURCE_IO,
724 },
725 {
726 .start = AP2MDM_STATUS,
727 .end = AP2MDM_STATUS,
728 .name = "AP2MDM_STATUS",
729 .flags = IORESOURCE_IO,
730 },
731 {
732 .start = AP2MDM_PMIC_RESET_N,
733 .end = AP2MDM_PMIC_RESET_N,
734 .name = "AP2MDM_PMIC_RESET_N",
735 .flags = IORESOURCE_IO,
736 },
737 {
738 .start = AP2MDM_KPDPWR_N,
739 .end = AP2MDM_KPDPWR_N,
740 .name = "AP2MDM_KPDPWR_N",
741 .flags = IORESOURCE_IO,
742 },
743};
744
745static struct mdm_platform_data mdm_platform_data = {
746 .mdm_version = "2.5",
747};
748
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800749static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800750 .name = "mdm2_modem",
751 .id = -1,
752 .num_resources = ARRAY_SIZE(mdm_resources),
753 .resource = mdm_resources,
754 .dev = {
755 .platform_data = &mdm_platform_data,
756 },
757};
758
759static struct platform_device *mdm_devices[] __initdata = {
760 &mdm_device,
761};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700762
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700763#define MSM_SHARED_RAM_PHYS 0x80000000
764
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800765static void __init msm8960_map_io(void)
766{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700767 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800768 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700769
770 if (socinfo_init() < 0)
771 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800772}
773
774static void __init msm8960_init_irq(void)
775{
776 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700777
778 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800779 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700780 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800781
782 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700783 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800784
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700785 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
786 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -0800787
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800788 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
789 * as they are configured as level, which does not play nice with
790 * handle_percpu_irq.
791 */
792 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
793 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +0100794 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800795 }
796}
797
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700798static void __init msm8960_init_buses(void)
799{
800#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -0600801 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -0600802 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
803 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
804 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
805 msm_bus_apps_fabric.dev.platform_data =
806 &msm_bus_8960_apps_fabric_pdata;
807 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
808 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
809 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
810 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700811#endif
812}
813
814static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
815 .max_clock_speed = 15060000,
816};
817
818#ifdef CONFIG_USB_MSM_OTG_72K
819static struct msm_otg_platform_data msm_otg_pdata;
820#else
821#define USB_5V_EN 42
822static void msm_hsusb_vbus_power(bool on)
823{
824 int rc;
825 static bool vbus_is_on;
826 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700827
828 if (vbus_is_on == on)
829 return;
830
831 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700832 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
833 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700834 if (IS_ERR(mvs_otg_switch)) {
835 pr_err("Unable to get mvs_otg_switch\n");
836 return;
837 }
838
839 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
840 "usb_5v_en");
841 if (rc < 0) {
842 pr_err("failed to request usb_5v_en gpio\n");
843 goto put_mvs_otg;
844 }
845
Anji jonnala2936fd92011-11-09 15:39:22 +0530846 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
847 if (rc) {
848 pr_err("%s: unable to set_direction for gpio [%d]\n",
849 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700850 goto free_usb_5v_en;
851 }
852
Anji jonnala2936fd92011-11-09 15:39:22 +0530853 if (regulator_enable(mvs_otg_switch)) {
854 pr_err("unable to enable mvs_otg_switch\n");
855 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700856 }
Anji jonnala2936fd92011-11-09 15:39:22 +0530857
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700858 vbus_is_on = true;
859 return;
860 }
Anji jonnala2936fd92011-11-09 15:39:22 +0530861 regulator_disable(mvs_otg_switch);
862err_ldo_gpio_set_dir:
Pavankumar Kondetic7a5e872011-12-09 14:50:16 +0530863 gpio_set_value_cansleep(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +0530865 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700866put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +0530867 regulator_put(mvs_otg_switch);
868 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700869}
870
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530871static int wr_phy_init_seq[] = {
872 0x44, 0x80, /* set VBUS valid threshold
873 and disconnect valid threshold */
874 0x38, 0x81, /* update DC voltage level */
875 0x14, 0x82, /* set preemphasis and rise/fall time */
876 0x13, 0x83, /* set source impedance adjusment */
877 -1};
878
879static int liquid_v1_phy_init_seq[] = {
880 0x44, 0x80,/* set VBUS valid threshold
881 and disconnect valid threshold */
882 0x3C, 0x81,/* update DC voltage level */
883 0x18, 0x82,/* set preemphasis and rise/fall time */
884 0x23, 0x83,/* set source impedance sdjusment */
885 -1};
886
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700887static struct msm_otg_platform_data msm_otg_pdata = {
888 .mode = USB_OTG,
889 .otg_control = OTG_PMIC_CONTROL,
890 .phy_type = SNPS_28NM_INTEGRATED_PHY,
891 .pclk_src_name = "dfab_usb_hs_clk",
892 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
893 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +0530894 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700895};
896#endif
897
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530898#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530899#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530900static struct msm_hsic_host_platform_data msm_hsic_pdata = {
901 .strobe = 150,
902 .data = 151,
903};
904#else
905static struct msm_hsic_host_platform_data msm_hsic_pdata;
906#endif
907
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700908#define PID_MAGIC_ID 0x71432909
909#define SERIAL_NUM_MAGIC_ID 0x61945374
910#define SERIAL_NUMBER_LENGTH 127
911#define DLOAD_USB_BASE_ADD 0x2A03F0C8
912
913struct magic_num_struct {
914 uint32_t pid;
915 uint32_t serial_num;
916};
917
918struct dload_struct {
919 uint32_t reserved1;
920 uint32_t reserved2;
921 uint32_t reserved3;
922 uint16_t reserved4;
923 uint16_t pid;
924 char serial_number[SERIAL_NUMBER_LENGTH];
925 uint16_t reserved5;
926 struct magic_num_struct magic_struct;
927};
928
929static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
930{
931 struct dload_struct __iomem *dload = 0;
932
933 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
934 if (!dload) {
935 pr_err("%s: cannot remap I/O memory region: %08x\n",
936 __func__, DLOAD_USB_BASE_ADD);
937 return -ENXIO;
938 }
939
940 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
941 __func__, dload, pid, snum);
942 /* update pid */
943 dload->magic_struct.pid = PID_MAGIC_ID;
944 dload->pid = pid;
945
946 /* update serial number */
947 dload->magic_struct.serial_num = 0;
948 if (!snum) {
949 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
950 goto out;
951 }
952
953 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -0700954 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700955out:
956 iounmap(dload);
957 return 0;
958}
959
960static struct android_usb_platform_data android_usb_pdata = {
961 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
962};
963
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700964static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700965 .name = "android_usb",
966 .id = -1,
967 .dev = {
968 .platform_data = &android_usb_pdata,
969 },
970};
971
972static uint8_t spm_wfi_cmd_sequence[] __initdata = {
973 0x03, 0x0f,
974};
975
976static uint8_t spm_power_collapse_without_rpm[] __initdata = {
977 0x00, 0x24, 0x54, 0x10,
978 0x09, 0x03, 0x01,
979 0x10, 0x54, 0x30, 0x0C,
980 0x24, 0x30, 0x0f,
981};
982
983static uint8_t spm_power_collapse_with_rpm[] __initdata = {
984 0x00, 0x24, 0x54, 0x10,
985 0x09, 0x07, 0x01, 0x0B,
986 0x10, 0x54, 0x30, 0x0C,
987 0x24, 0x30, 0x0f,
988};
989
990static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
991 [0] = {
992 .mode = MSM_SPM_MODE_CLOCK_GATING,
993 .notify_rpm = false,
994 .cmd = spm_wfi_cmd_sequence,
995 },
996 [1] = {
997 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
998 .notify_rpm = false,
999 .cmd = spm_power_collapse_without_rpm,
1000 },
1001 [2] = {
1002 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1003 .notify_rpm = true,
1004 .cmd = spm_power_collapse_with_rpm,
1005 },
1006};
1007
1008static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1009 [0] = {
1010 .reg_base_addr = MSM_SAW0_BASE,
1011 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1012 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001013 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001014#if defined(CONFIG_MSM_AVS_HW)
1015 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1016 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1017#endif
1018 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1019 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1020 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1021 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1022 .vctl_timeout_us = 50,
1023 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1024 .modes = msm_spm_seq_list,
1025 },
1026 [1] = {
1027 .reg_base_addr = MSM_SAW1_BASE,
1028 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1029 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001030 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001031#if defined(CONFIG_MSM_AVS_HW)
1032 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1033 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1034#endif
1035 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1036 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1037 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1038 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1039 .vctl_timeout_us = 50,
1040 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1041 .modes = msm_spm_seq_list,
1042 },
1043};
1044
1045static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1046 0x00, 0x20, 0x03, 0x20,
1047 0x00, 0x0f,
1048};
1049
1050static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1051 0x00, 0x20, 0x34, 0x64,
1052 0x48, 0x07, 0x48, 0x20,
1053 0x50, 0x64, 0x04, 0x34,
1054 0x50, 0x0f,
1055};
1056static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1057 0x00, 0x10, 0x34, 0x64,
1058 0x48, 0x07, 0x48, 0x10,
1059 0x50, 0x64, 0x04, 0x34,
1060 0x50, 0x0F,
1061};
1062
1063static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1064 [0] = {
1065 .mode = MSM_SPM_L2_MODE_RETENTION,
1066 .notify_rpm = false,
1067 .cmd = l2_spm_wfi_cmd_sequence,
1068 },
1069 [1] = {
1070 .mode = MSM_SPM_L2_MODE_GDHS,
1071 .notify_rpm = true,
1072 .cmd = l2_spm_gdhs_cmd_sequence,
1073 },
1074 [2] = {
1075 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1076 .notify_rpm = true,
1077 .cmd = l2_spm_power_off_cmd_sequence,
1078 },
1079};
1080
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001081static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1082 [0] = {
1083 .reg_base_addr = MSM_SAW_L2_BASE,
1084 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1085 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1086 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1087 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1088 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1089 .modes = msm_spm_l2_seq_list,
1090 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1091 },
1092};
1093
Mohan Pallaka5e490392011-09-09 15:18:41 +05301094#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1095#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1096
1097static struct msm_xo_voter *xo_handle_d1;
1098
1099static int isa1200_power(int on)
1100{
1101 int rc = 0;
1102
1103 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1104
1105 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1106 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1107 if (rc < 0) {
1108 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1109 __func__, on ? "" : "de-", rc);
1110 goto err_xo_vote;
1111 }
1112
1113 return 0;
1114
1115err_xo_vote:
1116 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1117 return rc;
1118}
1119
1120static int isa1200_dev_setup(bool enable)
1121{
1122 int rc = 0;
1123
1124 struct pm_gpio hap_gpio_config = {
1125 .direction = PM_GPIO_DIR_OUT,
1126 .pull = PM_GPIO_PULL_NO,
1127 .out_strength = PM_GPIO_STRENGTH_HIGH,
1128 .function = PM_GPIO_FUNC_NORMAL,
1129 .inv_int_pol = 0,
1130 .vin_sel = 2,
1131 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1132 .output_value = 0,
1133 };
1134
1135 if (enable == true) {
1136 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1137 if (rc) {
1138 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1139 __func__, PM_HAP_EN_GPIO, rc);
1140 return rc;
1141 }
1142
1143 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1144 if (rc) {
1145 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1146 __func__, PM_HAP_LEN_GPIO, rc);
1147 return rc;
1148 }
1149
1150 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1151 if (rc) {
1152 pr_err("%s: unable to request gpio %d (%d)\n",
1153 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1154 return rc;
1155 }
1156
1157 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1158 if (rc) {
1159 pr_err("%s: Unable to set direction\n", __func__);
1160 goto free_gpio;
1161 }
1162
1163 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1164 if (IS_ERR(xo_handle_d1)) {
1165 rc = PTR_ERR(xo_handle_d1);
1166 pr_err("%s: failed to get the handle for D1(%d)\n",
1167 __func__, rc);
1168 goto gpio_set_dir;
1169 }
1170 } else {
1171 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1172
1173 msm_xo_put(xo_handle_d1);
1174 }
1175
1176 return 0;
1177
1178gpio_set_dir:
1179 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1180free_gpio:
1181 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1182 return rc;
1183}
1184
1185static struct isa1200_regulator isa1200_reg_data[] = {
1186 {
1187 .name = "vcc_i2c",
1188 .min_uV = ISA_I2C_VTG_MIN_UV,
1189 .max_uV = ISA_I2C_VTG_MAX_UV,
1190 .load_uA = ISA_I2C_CURR_UA,
1191 },
1192};
1193
1194static struct isa1200_platform_data isa1200_1_pdata = {
1195 .name = "vibrator",
1196 .dev_setup = isa1200_dev_setup,
1197 .power_on = isa1200_power,
1198 .hap_en_gpio = PM_HAP_EN_GPIO,
1199 .hap_len_gpio = PM_HAP_LEN_GPIO,
1200 .max_timeout = 15000,
1201 .mode_ctrl = PWM_GEN_MODE,
1202 .pwm_fd = {
1203 .pwm_div = 256,
1204 },
1205 .is_erm = false,
1206 .smart_en = true,
1207 .ext_clk_en = true,
1208 .chip_en = 1,
1209 .regulator_info = isa1200_reg_data,
1210 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1211};
1212
1213static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1214 {
1215 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301216 },
1217};
1218
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001219#define CYTTSP_TS_GPIO_IRQ 11
1220#define CYTTSP_TS_SLEEP_GPIO 50
1221#define CYTTSP_TS_RESOUT_N_GPIO 52
1222
1223/*virtual key support */
1224static ssize_t tma340_vkeys_show(struct kobject *kobj,
1225 struct kobj_attribute *attr, char *buf)
1226{
1227 return snprintf(buf, 200,
1228 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1229 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1230 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1231 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1232 "\n");
1233}
1234
1235static struct kobj_attribute tma340_vkeys_attr = {
1236 .attr = {
1237 .mode = S_IRUGO,
1238 },
1239 .show = &tma340_vkeys_show,
1240};
1241
1242static struct attribute *tma340_properties_attrs[] = {
1243 &tma340_vkeys_attr.attr,
1244 NULL
1245};
1246
1247static struct attribute_group tma340_properties_attr_group = {
1248 .attrs = tma340_properties_attrs,
1249};
1250
1251
1252static int cyttsp_platform_init(struct i2c_client *client)
1253{
1254 int rc = 0;
1255 static struct kobject *tma340_properties_kobj;
1256
1257 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1258 tma340_properties_kobj = kobject_create_and_add("board_properties",
1259 NULL);
1260 if (tma340_properties_kobj)
1261 rc = sysfs_create_group(tma340_properties_kobj,
1262 &tma340_properties_attr_group);
1263 if (!tma340_properties_kobj || rc)
1264 pr_err("%s: failed to create board_properties\n",
1265 __func__);
1266
1267 return 0;
1268}
1269
1270static struct cyttsp_regulator regulator_data[] = {
1271 {
1272 .name = "vdd",
1273 .min_uV = CY_TMA300_VTG_MIN_UV,
1274 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301275 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1276 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001277 },
1278 /* TODO: Remove after runtime PM is enabled in I2C driver */
1279 {
1280 .name = "vcc_i2c",
1281 .min_uV = CY_I2C_VTG_MIN_UV,
1282 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301283 .hpm_load_uA = CY_I2C_CURR_UA,
1284 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001285 },
1286};
1287
1288static struct cyttsp_platform_data cyttsp_pdata = {
1289 .panel_maxx = 634,
1290 .panel_maxy = 1166,
1291 .disp_maxx = 616,
1292 .disp_maxy = 1023,
1293 .disp_minx = 0,
1294 .disp_miny = 16,
1295 .flags = 0x01,
1296 .gen = CY_GEN3, /* or */
1297 .use_st = CY_USE_ST,
1298 .use_mt = CY_USE_MT,
1299 .use_hndshk = CY_SEND_HNDSHK,
1300 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301301 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302 .use_gestures = CY_USE_GESTURES,
1303 .fw_fname = "cyttsp_8960_cdp.hex",
1304 /* activate up to 4 groups
1305 * and set active distance
1306 */
1307 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1308 CY_GEST_GRP3 | CY_GEST_GRP4 |
1309 CY_ACT_DIST,
1310 /* change act_intrvl to customize the Active power state
1311 * scanning/processing refresh interval for Operating mode
1312 */
1313 .act_intrvl = CY_ACT_INTRVL_DFLT,
1314 /* change tch_tmout to customize the touch timeout for the
1315 * Active power state for Operating mode
1316 */
1317 .tch_tmout = CY_TCH_TMOUT_DFLT,
1318 /* change lp_intrvl to customize the Low Power power state
1319 * scanning/processing refresh interval for Operating mode
1320 */
1321 .lp_intrvl = CY_LP_INTRVL_DFLT,
1322 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1323 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1324 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1325 .regulator_info = regulator_data,
1326 .num_regulators = ARRAY_SIZE(regulator_data),
1327 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301328 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001329};
1330
1331static struct i2c_board_info cyttsp_info[] __initdata = {
1332 {
1333 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1334 .platform_data = &cyttsp_pdata,
1335#ifndef CY_USE_TIMER
1336 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1337#endif /* CY_USE_TIMER */
1338 },
1339};
1340
Mohan Pallaka50837382011-09-07 11:00:57 +05301341/* configuration data */
1342static const u8 mxt_config_data[] = {
1343 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001344 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301345 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001346 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001347 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, 0, 0, 0, 0, 0, 0,
1350 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1351 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1352 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301353 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001354 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301355 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001356 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301357 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001358 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1359 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1360 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1361 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301362 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001363 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1364 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301365 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001366 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1367 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301368 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1370 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301371 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001372 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1373 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301374 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001375 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301376 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001377 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301378 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001379 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301380 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001381 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301382 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001383 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301384};
1385
1386#define MXT_TS_GPIO_IRQ 11
1387#define MXT_TS_LDO_EN_GPIO 50
1388#define MXT_TS_RESET_GPIO 52
1389
1390static void mxt_init_hw_liquid(void)
1391{
1392 int rc;
1393
1394 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
1395 if (rc) {
1396 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
1397 __func__, MXT_TS_GPIO_IRQ);
1398 return;
1399 }
1400
1401 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
1402 if (rc) {
1403 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
1404 __func__, MXT_TS_GPIO_IRQ);
1405 goto err_irq_gpio_req;
1406 }
1407
1408 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1409 if (rc) {
1410 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
1411 __func__, MXT_TS_LDO_EN_GPIO);
1412 goto err_irq_gpio_req;
1413 }
1414
1415 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1416 if (rc) {
1417 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
1418 __func__, MXT_TS_LDO_EN_GPIO);
1419 goto err_ldo_gpio_req;
1420 }
1421
1422 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
1423 if (rc) {
1424 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
1425 __func__, MXT_TS_RESET_GPIO);
1426 goto err_ldo_gpio_set_dir;
1427 }
1428
1429 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
1430 if (rc) {
1431 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
1432 __func__, MXT_TS_RESET_GPIO);
1433 goto err_reset_gpio_req;
1434 }
1435
1436 return;
1437
1438err_reset_gpio_req:
1439 gpio_free(MXT_TS_RESET_GPIO);
1440err_ldo_gpio_set_dir:
1441 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
1442err_ldo_gpio_req:
1443 gpio_free(MXT_TS_LDO_EN_GPIO);
1444err_irq_gpio_req:
1445 gpio_free(MXT_TS_GPIO_IRQ);
1446}
1447
1448static struct mxt_platform_data mxt_platform_data = {
1449 .config = mxt_config_data,
1450 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001451 .x_size = 1365,
1452 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301453 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001454 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05301455};
1456
1457static struct i2c_board_info mxt_device_info[] __initdata = {
1458 {
1459 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1460 .platform_data = &mxt_platform_data,
1461 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1462 },
1463};
1464
Eugene Yasmand2316b82011-12-07 18:23:48 +02001465static struct i2c_board_info sii_device_info[] __initdata = {
1466 {
1467 I2C_BOARD_INFO("Sil-9244", 0x39),
1468 .flags = I2C_CLIENT_WAKE,
1469 .irq = MSM_GPIO_TO_INT(15),
1470 },
1471};
1472
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001473static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
1474{
1475}
1476
1477static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1478 .clk_freq = 100000,
1479 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1481};
1482
1483static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1484 .clk_freq = 100000,
1485 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001486 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1487};
1488
1489static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1490 .clk_freq = 100000,
1491 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001492 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1493};
1494
1495static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1496 .clk_freq = 100000,
1497 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001498 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1499};
1500
1501static struct msm_rpm_platform_data msm_rpm_data = {
1502 .reg_base_addrs = {
1503 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1504 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1505 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1506 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1507 },
1508
1509 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1510 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1511 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1512 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1513 .msm_apps_ipc_rpm_val = 4,
1514};
1515
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001516static struct ks8851_pdata spi_eth_pdata = {
1517 .irq_gpio = KS8851_IRQ_GPIO,
1518 .rst_gpio = KS8851_RST_GPIO,
1519};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001520
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001521static struct spi_board_info spi_board_info[] __initdata = {
1522 {
1523 .modalias = "ks8851",
1524 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1525 .max_speed_hz = 19200000,
1526 .bus_num = 0,
1527 .chip_select = 0,
1528 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001529 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001530 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001531 {
1532 .modalias = "dsi_novatek_3d_panel_spi",
1533 .max_speed_hz = 10800000,
1534 .bus_num = 0,
1535 .chip_select = 1,
1536 .mode = SPI_MODE_0,
1537 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001538};
1539
1540static struct platform_device msm_device_saw_core0 = {
1541 .name = "saw-regulator",
1542 .id = 0,
1543 .dev = {
1544 .platform_data = &msm_saw_regulator_pdata_s5,
1545 },
1546};
1547
1548static struct platform_device msm_device_saw_core1 = {
1549 .name = "saw-regulator",
1550 .id = 1,
1551 .dev = {
1552 .platform_data = &msm_saw_regulator_pdata_s6,
1553 },
1554};
1555
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001556static struct tsens_platform_data msm_tsens_pdata = {
1557 .slope = 910,
1558 .tsens_factor = 1000,
1559 .hw_type = MSM_8960,
1560 .tsens_num_sensor = 5,
1561};
1562
1563static struct platform_device msm_tsens_device = {
1564 .name = "tsens8960-tm",
1565 .id = -1,
1566 .dev = {
1567 .platform_data = &msm_tsens_pdata,
1568 },
1569};
1570
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001571#ifdef CONFIG_MSM_FAKE_BATTERY
1572static struct platform_device fish_battery_device = {
1573 .name = "fish_battery",
1574};
1575#endif
1576
David Collins26f05562011-06-20 09:56:28 -07001577static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001578 .name = GPIO_REGULATOR_DEV_NAME,
1579 .id = PM8921_MPP_PM_TO_SYS(7),
1580 .dev = {
1581 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1582 },
1583};
1584
David Collins26f05562011-06-20 09:56:28 -07001585static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001586 .name = GPIO_REGULATOR_DEV_NAME,
1587 .id = 91,
1588 .dev = {
1589 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1590 },
1591};
1592
David Collinsb10be1d2011-09-02 10:29:31 -07001593static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1594 .name = GPIO_REGULATOR_DEV_NAME,
1595 .id = PM8921_GPIO_PM_TO_SYS(17),
1596 .dev = {
1597 .platform_data =
1598 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1599 },
1600};
1601
David Collins26f05562011-06-20 09:56:28 -07001602static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1603 .name = "rpm-regulator",
1604 .id = -1,
1605 .dev = {
1606 .platform_data = &msm_rpm_regulator_pdata,
1607 },
1608};
1609
David Collins4c31a872011-08-31 10:07:10 -07001610static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1611 .phys_addr_base = 0x0010C000,
1612 .reg_offsets = {
1613 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1614 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1615 },
1616 .phys_size = SZ_8K,
1617 .log_len = 4096, /* log's buffer length in bytes */
1618 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1619};
1620
1621static struct platform_device msm_rpm_log_device = {
1622 .name = "msm_rpm_log",
1623 .id = -1,
1624 .dev = {
1625 .platform_data = &msm_rpm_log_pdata,
1626 },
1627};
1628
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001629static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001630 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001631 &msm_device_smd,
1632 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301633 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001634 &msm_device_saw_core0,
1635 &msm_device_saw_core1,
1636 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001637 &msm8960_device_ssbi_pmic,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001638 &msm8960_device_qup_spi_gsbi1,
1639 &msm8960_device_qup_i2c_gsbi3,
1640 &msm8960_device_qup_i2c_gsbi4,
1641 &msm8960_device_qup_i2c_gsbi10,
1642#ifndef CONFIG_MSM_DSPS
1643 &msm8960_device_qup_i2c_gsbi12,
1644#endif
1645 &msm_slim_ctrl,
1646 &msm_device_wcnss_wlan,
1647#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1648 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1649 &qcrypto_device,
1650#endif
1651
1652#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1653 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1654 &qcedev_device,
1655#endif
1656#ifdef CONFIG_MSM_ROTATOR
1657 &msm_rotator_device,
1658#endif
1659 &msm_device_sps,
1660#ifdef CONFIG_MSM_FAKE_BATTERY
1661 &fish_battery_device,
1662#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001663 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001664#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001665#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001666 &android_pmem_device,
1667 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001668#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001669 &android_pmem_audio_device,
1670#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001671 &msm_device_vidc,
1672 &msm_device_bam_dmux,
1673 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001674
1675#ifdef CONFIG_HW_RANDOM_MSM
1676 &msm_device_rng,
1677#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001678 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07001679#ifdef CONFIG_ION_MSM
1680 &ion_dev,
1681#endif
David Collins4c31a872011-08-31 10:07:10 -07001682 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06001683 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001684 &msm_device_tz_log,
1685
Pratik Patel7831c082011-06-08 21:44:37 -07001686#ifdef CONFIG_MSM_QDSS
1687 &msm_etb_device,
1688 &msm_tpiu_device,
1689 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07001690 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07001691 &msm_ptm_device,
1692#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001693 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001694 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001695};
1696
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001697static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001698 &msm8960_device_otg,
1699 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301701 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001702 &android_usb_device,
1703 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001704 &msm_bus_apps_fabric,
1705 &msm_bus_sys_fabric,
1706 &msm_bus_mm_fabric,
1707 &msm_bus_sys_fpb,
1708 &msm_bus_cpss_fpb,
1709 &msm_pcm,
1710 &msm_pcm_routing,
1711 &msm_cpudai0,
1712 &msm_cpudai1,
1713 &msm_cpudai_hdmi_rx,
1714 &msm_cpudai_bt_rx,
1715 &msm_cpudai_bt_tx,
1716 &msm_cpudai_fm_rx,
1717 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001718 &msm_cpudai_auxpcm_rx,
1719 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001720 &msm_cpu_fe,
1721 &msm_stub_codec,
1722 &msm_voice,
1723 &msm_voip,
1724 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301725 &msm_compr_dsp,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001726
1727#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1728 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1729 &qcrypto_device,
1730#endif
1731
1732#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1733 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1734 &qcedev_device,
1735#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001736};
1737
1738static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001739 &msm_kgsl_3d0,
1740 &msm_kgsl_2d0,
1741 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001742#ifdef CONFIG_MSM_GEMINI
1743 &msm8960_gemini_device,
1744#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001745};
1746
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001747static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001748 &msm_8960_q6_lpass,
1749 &msm_8960_q6_mss_fw,
1750 &msm_8960_q6_mss_sw,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001751 &msm8960_device_otg,
1752 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001753 &msm_device_hsusb_host,
1754 &android_usb_device,
1755 &msm_pcm,
1756 &msm_pcm_routing,
1757 &msm_cpudai0,
1758 &msm_cpudai1,
1759 &msm_cpudai_hdmi_rx,
1760 &msm_cpudai_bt_rx,
1761 &msm_cpudai_bt_tx,
1762 &msm_cpudai_fm_rx,
1763 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001764 &msm_cpudai_auxpcm_rx,
1765 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001766 &msm_cpu_fe,
1767 &msm_stub_codec,
1768 &msm_kgsl_3d0,
1769#ifdef CONFIG_MSM_KGSL_2D
1770 &msm_kgsl_2d0,
1771 &msm_kgsl_2d1,
1772#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001773#ifdef CONFIG_MSM_GEMINI
1774 &msm8960_gemini_device,
1775#endif
1776 &msm_voice,
1777 &msm_voip,
1778 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301779 &msm_cpudai_afe_01_rx,
1780 &msm_cpudai_afe_01_tx,
1781 &msm_cpudai_afe_02_rx,
1782 &msm_cpudai_afe_02_tx,
1783 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301784 &msm_compr_dsp,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001785 &msm_pcm_hostless,
1786 &msm_bus_apps_fabric,
1787 &msm_bus_sys_fabric,
1788 &msm_bus_mm_fabric,
1789 &msm_bus_sys_fpb,
1790 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001791 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001792};
1793
1794static void __init msm8960_i2c_init(void)
1795{
1796 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1797 &msm8960_i2c_qup_gsbi4_pdata;
1798
1799 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1800 &msm8960_i2c_qup_gsbi3_pdata;
1801
1802 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1803 &msm8960_i2c_qup_gsbi10_pdata;
1804
1805 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1806 &msm8960_i2c_qup_gsbi12_pdata;
1807}
1808
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001809static void __init msm8960_gfx_init(void)
1810{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001811 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001812 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1813 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1814 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001815 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1816 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001817 }
1818}
1819
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001820static struct msm_cpuidle_state msm_cstates[] __initdata = {
1821 {0, 0, "C0", "WFI",
1822 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1823
1824 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1825 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1826
1827 {0, 2, "C2", "POWER_COLLAPSE",
1828 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1829
1830 {1, 0, "C0", "WFI",
1831 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1832
1833 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1834 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1835};
1836
1837static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1838 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1839 .idle_supported = 1,
1840 .suspend_supported = 1,
1841 .idle_enabled = 0,
1842 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001843 },
1844
1845 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1846 .idle_supported = 1,
1847 .suspend_supported = 1,
1848 .idle_enabled = 0,
1849 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001850 },
1851
1852 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1853 .idle_supported = 1,
1854 .suspend_supported = 1,
1855 .idle_enabled = 1,
1856 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001857 },
1858
1859 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1860 .idle_supported = 0,
1861 .suspend_supported = 1,
1862 .idle_enabled = 0,
1863 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001864 },
1865
1866 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1867 .idle_supported = 1,
1868 .suspend_supported = 1,
1869 .idle_enabled = 0,
1870 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001871 },
1872
1873 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1874 .idle_supported = 1,
1875 .suspend_supported = 0,
1876 .idle_enabled = 1,
1877 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001878 },
1879};
1880
1881static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1882 {
1883 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1884 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1885 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001886 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001887 },
1888
1889 {
1890 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1891 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1892 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001893 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001894 },
1895
1896 {
1897 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1898 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1899 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001900 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001901 },
1902
1903 {
1904 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1905 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1906 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001907 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001908 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001909 {
1910 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1911 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1912 false,
1913 7000, 3500, 66600000, 5150,
1914 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001915
1916 {
1917 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1918 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1919 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001920 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001921 },
1922
1923 {
1924 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1925 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1926 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001927 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001928 },
1929
1930 {
1931 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1932 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1933 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001934 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001935 },
1936
1937 {
1938 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1939 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1940 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001941 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001942 },
1943};
1944
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001945static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1946 .mode = MSM_PM_BOOT_CONFIG_TZ,
1947};
1948
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001949#ifdef CONFIG_I2C
1950#define I2C_SURF 1
1951#define I2C_FFA (1 << 1)
1952#define I2C_RUMI (1 << 2)
1953#define I2C_SIM (1 << 3)
1954#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03001955#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001956
1957struct i2c_registry {
1958 u8 machs;
1959 int bus;
1960 struct i2c_board_info *info;
1961 int len;
1962};
1963
1964#ifdef CONFIG_MSM_CAMERA
1965static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
1966#ifdef CONFIG_IMX074
1967 {
1968 I2C_BOARD_INFO("imx074", 0x1A),
1969 },
1970#endif
1971#ifdef CONFIG_OV2720
1972 {
1973 I2C_BOARD_INFO("ov2720", 0x6C),
1974 },
1975#endif
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -08001976#ifdef CONFIG_MT9M114
1977 {
1978 I2C_BOARD_INFO("mt9m114", 0x48),
1979 },
1980#endif
Nishant Pandit474f2252011-07-23 23:17:56 +05301981#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
1982 {
1983 I2C_BOARD_INFO("sc628a", 0x6E),
1984 },
1985#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001986};
1987#endif
1988
1989/* Sensors DSPS platform data */
1990#ifdef CONFIG_MSM_DSPS
1991#define DSPS_PIL_GENERIC_NAME "dsps"
1992#endif /* CONFIG_MSM_DSPS */
1993
1994static void __init msm8960_init_dsps(void)
1995{
1996#ifdef CONFIG_MSM_DSPS
1997 struct msm_dsps_platform_data *pdata =
1998 msm_dsps_device.dev.platform_data;
1999 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2000 pdata->gpios = NULL;
2001 pdata->gpios_num = 0;
2002
2003 platform_device_register(&msm_dsps_device);
2004#endif /* CONFIG_MSM_DSPS */
2005}
2006
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002007static void __init msm8960_init_hsic(void)
2008{
2009#ifdef CONFIG_USB_EHCI_MSM_HSIC
2010 uint32_t version = socinfo_get_version();
2011
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002012 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002013 return;
2014
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002015 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002016 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002017#endif
2018}
2019
Amir Samuelov5137e392011-09-21 17:31:25 +03002020#ifdef CONFIG_ISL9519_CHARGER
2021static struct isl_platform_data isl_data __initdata = {
2022 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2023 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2024 .max_system_voltage = 4200,
2025 .min_system_voltage = 3200,
2026 .chgcurrent = 1000, /* 1900, */
2027 .term_current = 400, /* Need fine tuning */
2028 .input_current = 2048,
2029};
2030
2031static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2032 {
2033 I2C_BOARD_INFO("isl9519q", 0x9),
2034 .irq = 0, /* Not required when notify-by-pmic */
2035 .platform_data = &isl_data,
2036 },
2037};
2038#endif /* CONFIG_ISL9519_CHARGER */
2039
Amir Samuelov755616d2011-12-13 16:34:46 +02002040static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2041 {
2042 I2C_BOARD_INFO("sx1508q", 0x20),
2043 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2044 },
2045};
2046
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002047static struct i2c_registry msm8960_i2c_devices[] __initdata = {
2048#ifdef CONFIG_MSM_CAMERA
2049 {
Amir Samuelov05f87802011-08-27 18:30:12 +03002050 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002051 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2052 msm_camera_boardinfo,
2053 ARRAY_SIZE(msm_camera_boardinfo),
2054 },
2055#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03002056#ifdef CONFIG_ISL9519_CHARGER
2057 {
2058 I2C_LIQUID,
2059 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2060 isl_charger_i2c_info,
2061 ARRAY_SIZE(isl_charger_i2c_info),
2062 },
2063#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002064 {
2065 I2C_SURF | I2C_FFA | I2C_FLUID,
2066 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2067 cyttsp_info,
2068 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002069 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302070 {
2071 I2C_LIQUID,
2072 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2073 mxt_device_info,
2074 ARRAY_SIZE(mxt_device_info),
2075 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302076 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302077 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302078 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002079 sii_device_info,
2080 ARRAY_SIZE(sii_device_info),
2081 },
2082 {
2083 I2C_LIQUID,
2084 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302085 msm_isa1200_board_info,
2086 ARRAY_SIZE(msm_isa1200_board_info),
2087 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002088 {
2089 I2C_LIQUID,
2090 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2091 liquid_io_expander_i2c_info,
2092 ARRAY_SIZE(liquid_io_expander_i2c_info),
2093 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002094};
2095#endif /* CONFIG_I2C */
2096
2097static void __init register_i2c_devices(void)
2098{
2099#ifdef CONFIG_I2C
2100 u8 mach_mask = 0;
2101 int i;
2102
2103 /* Build the matching 'supported_machs' bitmask */
2104 if (machine_is_msm8960_cdp())
2105 mach_mask = I2C_SURF;
2106 else if (machine_is_msm8960_rumi3())
2107 mach_mask = I2C_RUMI;
2108 else if (machine_is_msm8960_sim())
2109 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002110 else if (machine_is_msm8960_fluid())
2111 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002112 else if (machine_is_msm8960_liquid())
2113 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002114 else if (machine_is_msm8960_mtp())
2115 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002116 else
2117 pr_err("unmatched machine ID in register_i2c_devices\n");
2118
2119 /* Run the array and install devices as appropriate */
2120 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2121 if (msm8960_i2c_devices[i].machs & mach_mask)
2122 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2123 msm8960_i2c_devices[i].info,
2124 msm8960_i2c_devices[i].len);
2125 }
2126#endif
2127}
2128
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002129static void __init msm8960_sim_init(void)
2130{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002131 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2132 &msm8960_device_watchdog.dev.platform_data;
2133
2134 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002135 BUG_ON(msm_rpm_init(&msm_rpm_data));
2136 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2137 ARRAY_SIZE(msm_rpmrs_levels)));
2138 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002139 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002140 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002141 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002142
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002143 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002144 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002145 msm8960_i2c_init();
2146 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2147 msm_spm_l2_init(msm_spm_l2_data);
2148 msm8960_init_buses();
2149 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002150 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002151 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002152 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002153
2154 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2155 &msm8960_qup_spi_gsbi1_pdata;
2156 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2157
2158 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002159 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002160 slim_register_board_info(msm_slim_devices,
2161 ARRAY_SIZE(msm_slim_devices));
2162 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2163 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2164 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2165 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002166 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002167}
2168
2169static void __init msm8960_rumi3_init(void)
2170{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002171 BUG_ON(msm_rpm_init(&msm_rpm_data));
2172 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2173 ARRAY_SIZE(msm_rpmrs_levels)));
2174 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002175 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002176 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002177 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002178 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002179 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2180 &msm8960_qup_spi_gsbi1_pdata;
2181 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2182 msm8960_i2c_init();
2183 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2184 msm_spm_l2_init(msm_spm_l2_data);
2185 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002186 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002187 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002188 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002189 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002190 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002191 slim_register_board_info(msm_slim_devices,
2192 ARRAY_SIZE(msm_slim_devices));
2193 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2194 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2195 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2196 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002197 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002198}
2199
2200static void __init msm8960_cdp_init(void)
2201{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002202 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2203 pr_err("meminfo_init() failed!\n");
2204
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002205 BUG_ON(msm_rpm_init(&msm_rpm_data));
2206 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2207 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002208
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002209 regulator_suppress_info_printing();
2210 if (msm_xo_init())
2211 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002212 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002213 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302214 if (machine_is_msm8960_liquid())
2215 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002216 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302217 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2218 machine_is_msm8960_cdp()) {
2219 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2220 } else if (machine_is_msm8960_liquid()) {
2221 msm_otg_pdata.phy_init_seq =
2222 liquid_v1_phy_init_seq;
2223 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302224 msm_otg_pdata.swfi_latency =
2225 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302226#ifdef CONFIG_USB_EHCI_MSM_HSIC
2227 if (machine_is_msm8960_liquid()) {
2228 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2229 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2230 }
2231#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302232 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002233 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002234 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2235 &msm8960_qup_spi_gsbi1_pdata;
2236 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002237
2238 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302239 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2240 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2241 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002242 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002243 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002244 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2245 msm_spm_l2_init(msm_spm_l2_data);
2246 msm8960_init_buses();
2247 platform_add_devices(msm_footswitch_devices,
2248 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002249 if (machine_is_msm8960_liquid())
2250 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002251 if (machine_is_msm8960_cdp())
2252 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002253 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002254 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002255 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002256 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002257 msm8960_init_cam();
2258 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002259 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302260 if (machine_is_msm8960_liquid())
2261 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002262 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002263 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002264 slim_register_board_info(msm_slim_devices,
2265 ARRAY_SIZE(msm_slim_devices));
2266 msm8960_init_dsps();
2267 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2268 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2269 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2270 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002271 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002272 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Joel Kingb8352a12011-11-15 18:46:24 -08002273 if (PLATFORM_IS_CHARM25())
2274 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002275}
2276
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002277MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2278 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002279 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002280 .init_irq = msm8960_init_irq,
2281 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002282 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002283 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002284 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002285MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002286
2287MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2288 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002289 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002290 .init_irq = msm8960_init_irq,
2291 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002292 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002293 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002294 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002295MACHINE_END
2296
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002297MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2298 .map_io = msm8960_map_io,
2299 .reserve = msm8960_reserve,
2300 .init_irq = msm8960_init_irq,
2301 .timer = &msm_timer,
2302 .init_machine = msm8960_cdp_init,
2303 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002304 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002305MACHINE_END
2306
2307MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2308 .map_io = msm8960_map_io,
2309 .reserve = msm8960_reserve,
2310 .init_irq = msm8960_init_irq,
2311 .timer = &msm_timer,
2312 .init_machine = msm8960_cdp_init,
2313 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002314 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002315MACHINE_END
2316
2317MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2318 .map_io = msm8960_map_io,
2319 .reserve = msm8960_reserve,
2320 .init_irq = msm8960_init_irq,
2321 .timer = &msm_timer,
2322 .init_machine = msm8960_cdp_init,
2323 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002324 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002325MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002326
2327MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2328 .map_io = msm8960_map_io,
2329 .reserve = msm8960_reserve,
2330 .init_irq = msm8960_init_irq,
2331 .timer = &msm_timer,
2332 .init_machine = msm8960_cdp_init,
2333 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002334 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002335MACHINE_END