blob: dc436272aa64a39ff6ebc7b5789c9645df05d046 [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
Laura Abbott2d1760b2011-09-29 21:31:24 -0700139
140
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
Laura Abbott2d1760b2011-09-29 21:31:24 -0700146#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700147#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700148#define MSM_ION_HEAP_NUM 2
149#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700150
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700151#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
152static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
153static int __init pmem_kernel_ebi1_size_setup(char *p)
154{
155 pmem_kernel_ebi1_size = memparse(p, NULL);
156 return 0;
157}
158early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
159#endif
160
161#ifdef CONFIG_ANDROID_PMEM
162static unsigned pmem_size = MSM_PMEM_SIZE;
163static int __init pmem_size_setup(char *p)
164{
165 pmem_size = memparse(p, NULL);
166 return 0;
167}
168early_param("pmem_size", pmem_size_setup);
169
170static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
171
172static int __init pmem_adsp_size_setup(char *p)
173{
174 pmem_adsp_size = memparse(p, NULL);
175 return 0;
176}
177early_param("pmem_adsp_size", pmem_adsp_size_setup);
178
179static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
180
181static int __init pmem_audio_size_setup(char *p)
182{
183 pmem_audio_size = memparse(p, NULL);
184 return 0;
185}
186early_param("pmem_audio_size", pmem_audio_size_setup);
187#endif
188
189#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700190#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191static struct android_pmem_platform_data android_pmem_pdata = {
192 .name = "pmem",
193 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
194 .cached = 1,
195 .memory_type = MEMTYPE_EBI1,
196};
197
198static struct platform_device android_pmem_device = {
199 .name = "android_pmem",
200 .id = 0,
201 .dev = {.platform_data = &android_pmem_pdata},
202};
203
204static struct android_pmem_platform_data android_pmem_adsp_pdata = {
205 .name = "pmem_adsp",
206 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
207 .cached = 0,
208 .memory_type = MEMTYPE_EBI1,
209};
210static struct platform_device android_pmem_adsp_device = {
211 .name = "android_pmem",
212 .id = 2,
213 .dev = { .platform_data = &android_pmem_adsp_pdata },
214};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700215#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700216
217static struct android_pmem_platform_data android_pmem_audio_pdata = {
218 .name = "pmem_audio",
219 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
220 .cached = 0,
221 .memory_type = MEMTYPE_EBI1,
222};
223
224static struct platform_device android_pmem_audio_device = {
225 .name = "android_pmem",
226 .id = 4,
227 .dev = { .platform_data = &android_pmem_audio_pdata },
228};
229#endif
230
Larry Bassel41a055b2011-12-06 16:15:14 -0800231struct fmem_platform_data fmem_pdata = {
232};
233
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700234#define DSP_RAM_BASE_8960 0x8da00000
235#define DSP_RAM_SIZE_8960 0x1800000
236static int dspcrashd_pdata_8960 = 0xDEADDEAD;
237
238static struct resource resources_dspcrashd_8960[] = {
239 {
240 .name = "msm_dspcrashd",
241 .start = DSP_RAM_BASE_8960,
242 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
243 .flags = IORESOURCE_DMA,
244 },
245};
246
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800247static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700248 .name = "msm_dspcrashd",
249 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
250 .resource = resources_dspcrashd_8960,
251 .dev = { .platform_data = &dspcrashd_pdata_8960 },
252};
253
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700254static struct memtype_reserve msm8960_reserve_table[] __initdata = {
255 [MEMTYPE_SMI] = {
256 },
257 [MEMTYPE_EBI0] = {
258 .flags = MEMTYPE_FLAGS_1M_ALIGN,
259 },
260 [MEMTYPE_EBI1] = {
261 .flags = MEMTYPE_FLAGS_1M_ALIGN,
262 },
263};
264
265static void __init size_pmem_devices(void)
266{
267#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700268#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700269 android_pmem_adsp_pdata.size = pmem_adsp_size;
270 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700271#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700272 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
273#endif
274}
275
276static void __init reserve_memory_for(struct android_pmem_platform_data *p)
277{
278 msm8960_reserve_table[p->memory_type].size += p->size;
279}
280
281static void __init reserve_pmem_memory(void)
282{
283#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700284#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700285 reserve_memory_for(&android_pmem_adsp_pdata);
286 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700287#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288 reserve_memory_for(&android_pmem_audio_pdata);
289 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
290#endif
291}
292
Larry Bassel41a055b2011-12-06 16:15:14 -0800293static void __init reserve_fmem_memory(void)
294{
295}
296
Larry Basselb4126da2011-07-18 14:31:33 -0700297static int msm8960_paddr_to_memtype(unsigned int paddr)
298{
299 return MEMTYPE_EBI1;
300}
301
Laura Abbottd6183792011-08-19 13:42:24 -0700302#ifdef CONFIG_ION_MSM
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800303static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700304 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700305 .heaps = {
306 {
307 .id = ION_HEAP_SYSTEM_ID,
308 .type = ION_HEAP_TYPE_SYSTEM,
309 .name = ION_KMALLOC_HEAP_NAME,
310 },
311 {
312 .id = ION_HEAP_SYSTEM_CONTIG_ID,
313 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
314 .name = ION_VMALLOC_HEAP_NAME,
315 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700316#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700317 {
318 .id = ION_HEAP_EBI_ID,
319 .type = ION_HEAP_TYPE_CARVEOUT,
320 .name = ION_EBI1_HEAP_NAME,
321 .size = MSM_ION_EBI_SIZE,
322 .memory_type = ION_EBI_TYPE,
323 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700324 {
325 .id = ION_HEAP_ADSP_ID,
326 .type = ION_HEAP_TYPE_CARVEOUT,
327 .name = ION_ADSP_HEAP_NAME,
328 .size = MSM_ION_ADSP_SIZE,
329 .memory_type = ION_EBI_TYPE,
330 },
Laura Abbott8c017362011-09-22 20:59:12 -0700331 {
332 .id = ION_HEAP_IOMMU_ID,
333 .type = ION_HEAP_TYPE_IOMMU,
334 .name = ION_IOMMU_HEAP_NAME,
335 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700336#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700337 }
338};
339
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800340static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700341 .name = "ion-msm",
342 .id = 1,
343 .dev = { .platform_data = &ion_pdata },
344};
345#endif
346
Larry Bassel41a055b2011-12-06 16:15:14 -0800347struct platform_device fmem_device = {
348 .name = "fmem",
349 .id = 1,
350 .dev = { .platform_data = &fmem_pdata },
351};
352
Laura Abbottd6183792011-08-19 13:42:24 -0700353static void reserve_ion_memory(void)
354{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700355#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -0700356 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700357 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700358#endif
359}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700360static void __init msm8960_calculate_reserve_sizes(void)
361{
362 size_pmem_devices();
363 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700364 reserve_ion_memory();
Larry Bassel41a055b2011-12-06 16:15:14 -0800365 reserve_fmem_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700366}
367
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700368static struct reserve_info msm8960_reserve_info __initdata = {
369 .memtype_reserve_table = msm8960_reserve_table,
370 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
371 .paddr_to_memtype = msm8960_paddr_to_memtype,
372};
373
Larry Basselb4126da2011-07-18 14:31:33 -0700374static int msm8960_memory_bank_size(void)
375{
376 return 1<<29;
377}
378
379static void __init locate_unstable_memory(void)
380{
381 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
382 unsigned long bank_size;
383 unsigned long low, high;
384
385 bank_size = msm8960_memory_bank_size();
386 low = meminfo.bank[0].start;
387 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700388
389 /* Check if 32 bit overflow occured */
390 if (high < mb->start)
391 high = ~0UL;
392
Larry Basselb4126da2011-07-18 14:31:33 -0700393 low &= ~(bank_size - 1);
394
395 if (high - low <= bank_size)
396 return;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800397 msm8960_reserve_info.low_unstable_address = high -
398 MIN_MEMORY_BLOCK_SIZE;
399 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700400
Larry Basselb4126da2011-07-18 14:31:33 -0700401 msm8960_reserve_info.bank_size = bank_size;
402 pr_info("low unstable address %lx max size %lx bank size %lx\n",
403 msm8960_reserve_info.low_unstable_address,
404 msm8960_reserve_info.max_unstable_size,
405 msm8960_reserve_info.bank_size);
406}
407
Larry Basselb830e182011-10-14 10:46:55 -0700408static void __init place_movable_zone(void)
409{
410 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
411 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
412 pr_info("movable zone start %lx size %lx\n",
413 movable_reserved_start, movable_reserved_size);
414}
415
416static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700417{
418 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700419 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700420 place_movable_zone();
421}
422
423static void __init msm8960_reserve(void)
424{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700425 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800426 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700427}
428
Larry Bassela4414b12011-08-04 11:11:02 -0700429static int msm8960_change_memory_power(u64 start, u64 size,
430 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700431{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700432 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700433}
434
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700435static void __init msm8960_allocate_memory_regions(void)
436{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800437 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700438}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800439
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700440#ifdef CONFIG_WCD9310_CODEC
441
442#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
443
Patrick Lai3043fba2011-08-01 14:15:57 -0700444/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
445 * 4 micbiases are used to power various analog and digital
446 * microphones operating at 1800 mV. Technically, all micbiases
447 * can source from single cfilter since all microphones operate
448 * at the same voltage level. The arrangement below is to make
449 * sure all cfilters are exercised. LDO_H regulator ouput level
450 * does not need to be as high as 2.85V. It is choosen for
451 * microphone sensitivity purpose.
452 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700453static struct tabla_pdata tabla_platform_data = {
454 .slimbus_slave_device = {
455 .name = "tabla-slave",
456 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
457 },
458 .irq = MSM_GPIO_TO_INT(62),
459 .irq_base = TABLA_INTERRUPT_BASE,
460 .num_irqs = NR_TABLA_IRQS,
461 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700462 .micbias = {
463 .ldoh_v = TABLA_LDOH_2P85_V,
464 .cfilt1_mv = 1800,
465 .cfilt2_mv = 1800,
466 .cfilt3_mv = 1800,
467 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
468 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
469 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
470 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
471 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700472};
473
474static struct slim_device msm_slim_tabla = {
475 .name = "tabla-slim",
476 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
477 .dev = {
478 .platform_data = &tabla_platform_data,
479 },
480};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530481
482static struct tabla_pdata tabla20_platform_data = {
483 .slimbus_slave_device = {
484 .name = "tabla-slave",
485 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
486 },
487 .irq = MSM_GPIO_TO_INT(62),
488 .irq_base = TABLA_INTERRUPT_BASE,
489 .num_irqs = NR_TABLA_IRQS,
490 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
491 .micbias = {
492 .ldoh_v = TABLA_LDOH_2P85_V,
493 .cfilt1_mv = 1800,
494 .cfilt2_mv = 1800,
495 .cfilt3_mv = 1800,
496 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
497 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
498 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
499 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
500 }
501};
502
503static struct slim_device msm_slim_tabla20 = {
504 .name = "tabla2x-slim",
505 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
506 .dev = {
507 .platform_data = &tabla20_platform_data,
508 },
509};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700510#endif
511
512static struct slim_boardinfo msm_slim_devices[] = {
513#ifdef CONFIG_WCD9310_CODEC
514 {
515 .bus_num = 1,
516 .slim_slave = &msm_slim_tabla,
517 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530518 {
519 .bus_num = 1,
520 .slim_slave = &msm_slim_tabla20,
521 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700522#endif
523 /* add more slimbus slaves as needed */
524};
525
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700526#define MSM_WCNSS_PHYS 0x03000000
527#define MSM_WCNSS_SIZE 0x280000
528
529static struct resource resources_wcnss_wlan[] = {
530 {
531 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
532 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
533 .name = "wcnss_wlanrx_irq",
534 .flags = IORESOURCE_IRQ,
535 },
536 {
537 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
538 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
539 .name = "wcnss_wlantx_irq",
540 .flags = IORESOURCE_IRQ,
541 },
542 {
543 .start = MSM_WCNSS_PHYS,
544 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
545 .name = "wcnss_mmio",
546 .flags = IORESOURCE_MEM,
547 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700548 {
549 .start = 84,
550 .end = 88,
551 .name = "wcnss_gpios_5wire",
552 .flags = IORESOURCE_IO,
553 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700554};
555
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700556static struct qcom_wcnss_opts qcom_wcnss_pdata = {
557 .has_48mhz_xo = 1,
558};
559
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700560static struct platform_device msm_device_wcnss_wlan = {
561 .name = "wcnss_wlan",
562 .id = 0,
563 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
564 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700565 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700566};
567
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
569 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
570 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
571 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
572
573#define QCE_SIZE 0x10000
574#define QCE_0_BASE 0x18500000
575
576#define QCE_HW_KEY_SUPPORT 0
577#define QCE_SHA_HMAC_SUPPORT 1
578#define QCE_SHARE_CE_RESOURCE 1
579#define QCE_CE_SHARED 0
580
581static struct resource qcrypto_resources[] = {
582 [0] = {
583 .start = QCE_0_BASE,
584 .end = QCE_0_BASE + QCE_SIZE - 1,
585 .flags = IORESOURCE_MEM,
586 },
587 [1] = {
588 .name = "crypto_channels",
589 .start = DMOV_CE_IN_CHAN,
590 .end = DMOV_CE_OUT_CHAN,
591 .flags = IORESOURCE_DMA,
592 },
593 [2] = {
594 .name = "crypto_crci_in",
595 .start = DMOV_CE_IN_CRCI,
596 .end = DMOV_CE_IN_CRCI,
597 .flags = IORESOURCE_DMA,
598 },
599 [3] = {
600 .name = "crypto_crci_out",
601 .start = DMOV_CE_OUT_CRCI,
602 .end = DMOV_CE_OUT_CRCI,
603 .flags = IORESOURCE_DMA,
604 },
605};
606
607static struct resource qcedev_resources[] = {
608 [0] = {
609 .start = QCE_0_BASE,
610 .end = QCE_0_BASE + QCE_SIZE - 1,
611 .flags = IORESOURCE_MEM,
612 },
613 [1] = {
614 .name = "crypto_channels",
615 .start = DMOV_CE_IN_CHAN,
616 .end = DMOV_CE_OUT_CHAN,
617 .flags = IORESOURCE_DMA,
618 },
619 [2] = {
620 .name = "crypto_crci_in",
621 .start = DMOV_CE_IN_CRCI,
622 .end = DMOV_CE_IN_CRCI,
623 .flags = IORESOURCE_DMA,
624 },
625 [3] = {
626 .name = "crypto_crci_out",
627 .start = DMOV_CE_OUT_CRCI,
628 .end = DMOV_CE_OUT_CRCI,
629 .flags = IORESOURCE_DMA,
630 },
631};
632
633#endif
634
635#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
636 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
637
638static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
639 .ce_shared = QCE_CE_SHARED,
640 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
641 .hw_key_support = QCE_HW_KEY_SUPPORT,
642 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
643};
644
645static struct platform_device qcrypto_device = {
646 .name = "qcrypto",
647 .id = 0,
648 .num_resources = ARRAY_SIZE(qcrypto_resources),
649 .resource = qcrypto_resources,
650 .dev = {
651 .coherent_dma_mask = DMA_BIT_MASK(32),
652 .platform_data = &qcrypto_ce_hw_suppport,
653 },
654};
655#endif
656
657#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
658 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
659
660static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
661 .ce_shared = QCE_CE_SHARED,
662 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
663 .hw_key_support = QCE_HW_KEY_SUPPORT,
664 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
665};
666
667static struct platform_device qcedev_device = {
668 .name = "qce",
669 .id = 0,
670 .num_resources = ARRAY_SIZE(qcedev_resources),
671 .resource = qcedev_resources,
672 .dev = {
673 .coherent_dma_mask = DMA_BIT_MASK(32),
674 .platform_data = &qcedev_ce_hw_suppport,
675 },
676};
677#endif
678
Joel Kingb8352a12011-11-15 18:46:24 -0800679#define MDM2AP_ERRFATAL 70
680#define AP2MDM_ERRFATAL 95
681#define MDM2AP_STATUS 69
682#define AP2MDM_STATUS 94
683#define AP2MDM_PMIC_RESET_N 80
684#define AP2MDM_KPDPWR_N 81
685
Joel Kingb8352a12011-11-15 18:46:24 -0800686static struct resource mdm_resources[] = {
687 {
688 .start = MDM2AP_ERRFATAL,
689 .end = MDM2AP_ERRFATAL,
690 .name = "MDM2AP_ERRFATAL",
691 .flags = IORESOURCE_IO,
692 },
693 {
694 .start = AP2MDM_ERRFATAL,
695 .end = AP2MDM_ERRFATAL,
696 .name = "AP2MDM_ERRFATAL",
697 .flags = IORESOURCE_IO,
698 },
699 {
700 .start = MDM2AP_STATUS,
701 .end = MDM2AP_STATUS,
702 .name = "MDM2AP_STATUS",
703 .flags = IORESOURCE_IO,
704 },
705 {
706 .start = AP2MDM_STATUS,
707 .end = AP2MDM_STATUS,
708 .name = "AP2MDM_STATUS",
709 .flags = IORESOURCE_IO,
710 },
711 {
712 .start = AP2MDM_PMIC_RESET_N,
713 .end = AP2MDM_PMIC_RESET_N,
714 .name = "AP2MDM_PMIC_RESET_N",
715 .flags = IORESOURCE_IO,
716 },
717 {
718 .start = AP2MDM_KPDPWR_N,
719 .end = AP2MDM_KPDPWR_N,
720 .name = "AP2MDM_KPDPWR_N",
721 .flags = IORESOURCE_IO,
722 },
723};
724
725static struct mdm_platform_data mdm_platform_data = {
726 .mdm_version = "2.5",
727};
728
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800729static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800730 .name = "mdm2_modem",
731 .id = -1,
732 .num_resources = ARRAY_SIZE(mdm_resources),
733 .resource = mdm_resources,
734 .dev = {
735 .platform_data = &mdm_platform_data,
736 },
737};
738
739static struct platform_device *mdm_devices[] __initdata = {
740 &mdm_device,
741};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700742
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700743#define MSM_SHARED_RAM_PHYS 0x80000000
744
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800745static void __init msm8960_map_io(void)
746{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700747 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800748 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700749
750 if (socinfo_init() < 0)
751 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800752}
753
754static void __init msm8960_init_irq(void)
755{
756 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700757
758 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800759 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700760 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800761
762 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700763 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800764
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700765 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
766 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -0800767
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800768 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
769 * as they are configured as level, which does not play nice with
770 * handle_percpu_irq.
771 */
772 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
773 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +0100774 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800775 }
776}
777
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700778static void __init msm8960_init_buses(void)
779{
780#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -0600781 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -0600782 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
783 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
784 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
785 msm_bus_apps_fabric.dev.platform_data =
786 &msm_bus_8960_apps_fabric_pdata;
787 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
788 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
789 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
790 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700791#endif
792}
793
794static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
795 .max_clock_speed = 15060000,
796};
797
798#ifdef CONFIG_USB_MSM_OTG_72K
799static struct msm_otg_platform_data msm_otg_pdata;
800#else
801#define USB_5V_EN 42
802static void msm_hsusb_vbus_power(bool on)
803{
804 int rc;
805 static bool vbus_is_on;
806 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700807
808 if (vbus_is_on == on)
809 return;
810
811 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700812 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
813 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700814 if (IS_ERR(mvs_otg_switch)) {
815 pr_err("Unable to get mvs_otg_switch\n");
816 return;
817 }
818
819 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
820 "usb_5v_en");
821 if (rc < 0) {
822 pr_err("failed to request usb_5v_en gpio\n");
823 goto put_mvs_otg;
824 }
825
Anji jonnala2936fd92011-11-09 15:39:22 +0530826 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
827 if (rc) {
828 pr_err("%s: unable to set_direction for gpio [%d]\n",
829 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700830 goto free_usb_5v_en;
831 }
832
Anji jonnala2936fd92011-11-09 15:39:22 +0530833 if (regulator_enable(mvs_otg_switch)) {
834 pr_err("unable to enable mvs_otg_switch\n");
835 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700836 }
Anji jonnala2936fd92011-11-09 15:39:22 +0530837
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700838 vbus_is_on = true;
839 return;
840 }
Anji jonnala2936fd92011-11-09 15:39:22 +0530841 regulator_disable(mvs_otg_switch);
842err_ldo_gpio_set_dir:
Pavankumar Kondetic7a5e872011-12-09 14:50:16 +0530843 gpio_set_value_cansleep(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700844free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +0530845 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +0530847 regulator_put(mvs_otg_switch);
848 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700849}
850
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530851static int wr_phy_init_seq[] = {
852 0x44, 0x80, /* set VBUS valid threshold
853 and disconnect valid threshold */
854 0x38, 0x81, /* update DC voltage level */
855 0x14, 0x82, /* set preemphasis and rise/fall time */
856 0x13, 0x83, /* set source impedance adjusment */
857 -1};
858
859static int liquid_v1_phy_init_seq[] = {
860 0x44, 0x80,/* set VBUS valid threshold
861 and disconnect valid threshold */
862 0x3C, 0x81,/* update DC voltage level */
863 0x18, 0x82,/* set preemphasis and rise/fall time */
864 0x23, 0x83,/* set source impedance sdjusment */
865 -1};
866
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700867static struct msm_otg_platform_data msm_otg_pdata = {
868 .mode = USB_OTG,
869 .otg_control = OTG_PMIC_CONTROL,
870 .phy_type = SNPS_28NM_INTEGRATED_PHY,
871 .pclk_src_name = "dfab_usb_hs_clk",
872 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
873 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +0530874 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700875};
876#endif
877
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530878#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530879#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530880static struct msm_hsic_host_platform_data msm_hsic_pdata = {
881 .strobe = 150,
882 .data = 151,
883};
884#else
885static struct msm_hsic_host_platform_data msm_hsic_pdata;
886#endif
887
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700888#define PID_MAGIC_ID 0x71432909
889#define SERIAL_NUM_MAGIC_ID 0x61945374
890#define SERIAL_NUMBER_LENGTH 127
891#define DLOAD_USB_BASE_ADD 0x2A03F0C8
892
893struct magic_num_struct {
894 uint32_t pid;
895 uint32_t serial_num;
896};
897
898struct dload_struct {
899 uint32_t reserved1;
900 uint32_t reserved2;
901 uint32_t reserved3;
902 uint16_t reserved4;
903 uint16_t pid;
904 char serial_number[SERIAL_NUMBER_LENGTH];
905 uint16_t reserved5;
906 struct magic_num_struct magic_struct;
907};
908
909static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
910{
911 struct dload_struct __iomem *dload = 0;
912
913 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
914 if (!dload) {
915 pr_err("%s: cannot remap I/O memory region: %08x\n",
916 __func__, DLOAD_USB_BASE_ADD);
917 return -ENXIO;
918 }
919
920 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
921 __func__, dload, pid, snum);
922 /* update pid */
923 dload->magic_struct.pid = PID_MAGIC_ID;
924 dload->pid = pid;
925
926 /* update serial number */
927 dload->magic_struct.serial_num = 0;
928 if (!snum) {
929 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
930 goto out;
931 }
932
933 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -0700934 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700935out:
936 iounmap(dload);
937 return 0;
938}
939
940static struct android_usb_platform_data android_usb_pdata = {
941 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
942};
943
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700944static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700945 .name = "android_usb",
946 .id = -1,
947 .dev = {
948 .platform_data = &android_usb_pdata,
949 },
950};
951
952static uint8_t spm_wfi_cmd_sequence[] __initdata = {
953 0x03, 0x0f,
954};
955
956static uint8_t spm_power_collapse_without_rpm[] __initdata = {
957 0x00, 0x24, 0x54, 0x10,
958 0x09, 0x03, 0x01,
959 0x10, 0x54, 0x30, 0x0C,
960 0x24, 0x30, 0x0f,
961};
962
963static uint8_t spm_power_collapse_with_rpm[] __initdata = {
964 0x00, 0x24, 0x54, 0x10,
965 0x09, 0x07, 0x01, 0x0B,
966 0x10, 0x54, 0x30, 0x0C,
967 0x24, 0x30, 0x0f,
968};
969
970static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
971 [0] = {
972 .mode = MSM_SPM_MODE_CLOCK_GATING,
973 .notify_rpm = false,
974 .cmd = spm_wfi_cmd_sequence,
975 },
976 [1] = {
977 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
978 .notify_rpm = false,
979 .cmd = spm_power_collapse_without_rpm,
980 },
981 [2] = {
982 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
983 .notify_rpm = true,
984 .cmd = spm_power_collapse_with_rpm,
985 },
986};
987
988static struct msm_spm_platform_data msm_spm_data[] __initdata = {
989 [0] = {
990 .reg_base_addr = MSM_SAW0_BASE,
991 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
992 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -0800993 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700994#if defined(CONFIG_MSM_AVS_HW)
995 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
996 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
997#endif
998 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
999 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1000 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1001 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1002 .vctl_timeout_us = 50,
1003 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1004 .modes = msm_spm_seq_list,
1005 },
1006 [1] = {
1007 .reg_base_addr = MSM_SAW1_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};
1024
1025static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1026 0x00, 0x20, 0x03, 0x20,
1027 0x00, 0x0f,
1028};
1029
1030static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1031 0x00, 0x20, 0x34, 0x64,
1032 0x48, 0x07, 0x48, 0x20,
1033 0x50, 0x64, 0x04, 0x34,
1034 0x50, 0x0f,
1035};
1036static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1037 0x00, 0x10, 0x34, 0x64,
1038 0x48, 0x07, 0x48, 0x10,
1039 0x50, 0x64, 0x04, 0x34,
1040 0x50, 0x0F,
1041};
1042
1043static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1044 [0] = {
1045 .mode = MSM_SPM_L2_MODE_RETENTION,
1046 .notify_rpm = false,
1047 .cmd = l2_spm_wfi_cmd_sequence,
1048 },
1049 [1] = {
1050 .mode = MSM_SPM_L2_MODE_GDHS,
1051 .notify_rpm = true,
1052 .cmd = l2_spm_gdhs_cmd_sequence,
1053 },
1054 [2] = {
1055 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1056 .notify_rpm = true,
1057 .cmd = l2_spm_power_off_cmd_sequence,
1058 },
1059};
1060
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001061static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1062 [0] = {
1063 .reg_base_addr = MSM_SAW_L2_BASE,
1064 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1065 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1066 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1067 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1068 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1069 .modes = msm_spm_l2_seq_list,
1070 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1071 },
1072};
1073
Mohan Pallaka5e490392011-09-09 15:18:41 +05301074#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1075#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1076
1077static struct msm_xo_voter *xo_handle_d1;
1078
1079static int isa1200_power(int on)
1080{
1081 int rc = 0;
1082
1083 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1084
1085 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1086 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1087 if (rc < 0) {
1088 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1089 __func__, on ? "" : "de-", rc);
1090 goto err_xo_vote;
1091 }
1092
1093 return 0;
1094
1095err_xo_vote:
1096 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1097 return rc;
1098}
1099
1100static int isa1200_dev_setup(bool enable)
1101{
1102 int rc = 0;
1103
1104 struct pm_gpio hap_gpio_config = {
1105 .direction = PM_GPIO_DIR_OUT,
1106 .pull = PM_GPIO_PULL_NO,
1107 .out_strength = PM_GPIO_STRENGTH_HIGH,
1108 .function = PM_GPIO_FUNC_NORMAL,
1109 .inv_int_pol = 0,
1110 .vin_sel = 2,
1111 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1112 .output_value = 0,
1113 };
1114
1115 if (enable == true) {
1116 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1117 if (rc) {
1118 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1119 __func__, PM_HAP_EN_GPIO, rc);
1120 return rc;
1121 }
1122
1123 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1124 if (rc) {
1125 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1126 __func__, PM_HAP_LEN_GPIO, rc);
1127 return rc;
1128 }
1129
1130 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1131 if (rc) {
1132 pr_err("%s: unable to request gpio %d (%d)\n",
1133 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1134 return rc;
1135 }
1136
1137 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1138 if (rc) {
1139 pr_err("%s: Unable to set direction\n", __func__);
1140 goto free_gpio;
1141 }
1142
1143 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1144 if (IS_ERR(xo_handle_d1)) {
1145 rc = PTR_ERR(xo_handle_d1);
1146 pr_err("%s: failed to get the handle for D1(%d)\n",
1147 __func__, rc);
1148 goto gpio_set_dir;
1149 }
1150 } else {
1151 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1152
1153 msm_xo_put(xo_handle_d1);
1154 }
1155
1156 return 0;
1157
1158gpio_set_dir:
1159 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1160free_gpio:
1161 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1162 return rc;
1163}
1164
1165static struct isa1200_regulator isa1200_reg_data[] = {
1166 {
1167 .name = "vcc_i2c",
1168 .min_uV = ISA_I2C_VTG_MIN_UV,
1169 .max_uV = ISA_I2C_VTG_MAX_UV,
1170 .load_uA = ISA_I2C_CURR_UA,
1171 },
1172};
1173
1174static struct isa1200_platform_data isa1200_1_pdata = {
1175 .name = "vibrator",
1176 .dev_setup = isa1200_dev_setup,
1177 .power_on = isa1200_power,
1178 .hap_en_gpio = PM_HAP_EN_GPIO,
1179 .hap_len_gpio = PM_HAP_LEN_GPIO,
1180 .max_timeout = 15000,
1181 .mode_ctrl = PWM_GEN_MODE,
1182 .pwm_fd = {
1183 .pwm_div = 256,
1184 },
1185 .is_erm = false,
1186 .smart_en = true,
1187 .ext_clk_en = true,
1188 .chip_en = 1,
1189 .regulator_info = isa1200_reg_data,
1190 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1191};
1192
1193static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1194 {
1195 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301196 },
1197};
1198
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001199#define CYTTSP_TS_GPIO_IRQ 11
1200#define CYTTSP_TS_SLEEP_GPIO 50
1201#define CYTTSP_TS_RESOUT_N_GPIO 52
1202
1203/*virtual key support */
1204static ssize_t tma340_vkeys_show(struct kobject *kobj,
1205 struct kobj_attribute *attr, char *buf)
1206{
1207 return snprintf(buf, 200,
1208 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1209 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1210 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1211 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1212 "\n");
1213}
1214
1215static struct kobj_attribute tma340_vkeys_attr = {
1216 .attr = {
1217 .mode = S_IRUGO,
1218 },
1219 .show = &tma340_vkeys_show,
1220};
1221
1222static struct attribute *tma340_properties_attrs[] = {
1223 &tma340_vkeys_attr.attr,
1224 NULL
1225};
1226
1227static struct attribute_group tma340_properties_attr_group = {
1228 .attrs = tma340_properties_attrs,
1229};
1230
1231
1232static int cyttsp_platform_init(struct i2c_client *client)
1233{
1234 int rc = 0;
1235 static struct kobject *tma340_properties_kobj;
1236
1237 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1238 tma340_properties_kobj = kobject_create_and_add("board_properties",
1239 NULL);
1240 if (tma340_properties_kobj)
1241 rc = sysfs_create_group(tma340_properties_kobj,
1242 &tma340_properties_attr_group);
1243 if (!tma340_properties_kobj || rc)
1244 pr_err("%s: failed to create board_properties\n",
1245 __func__);
1246
1247 return 0;
1248}
1249
1250static struct cyttsp_regulator regulator_data[] = {
1251 {
1252 .name = "vdd",
1253 .min_uV = CY_TMA300_VTG_MIN_UV,
1254 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301255 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1256 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001257 },
1258 /* TODO: Remove after runtime PM is enabled in I2C driver */
1259 {
1260 .name = "vcc_i2c",
1261 .min_uV = CY_I2C_VTG_MIN_UV,
1262 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301263 .hpm_load_uA = CY_I2C_CURR_UA,
1264 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001265 },
1266};
1267
1268static struct cyttsp_platform_data cyttsp_pdata = {
1269 .panel_maxx = 634,
1270 .panel_maxy = 1166,
1271 .disp_maxx = 616,
1272 .disp_maxy = 1023,
1273 .disp_minx = 0,
1274 .disp_miny = 16,
1275 .flags = 0x01,
1276 .gen = CY_GEN3, /* or */
1277 .use_st = CY_USE_ST,
1278 .use_mt = CY_USE_MT,
1279 .use_hndshk = CY_SEND_HNDSHK,
1280 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301281 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282 .use_gestures = CY_USE_GESTURES,
1283 .fw_fname = "cyttsp_8960_cdp.hex",
1284 /* activate up to 4 groups
1285 * and set active distance
1286 */
1287 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1288 CY_GEST_GRP3 | CY_GEST_GRP4 |
1289 CY_ACT_DIST,
1290 /* change act_intrvl to customize the Active power state
1291 * scanning/processing refresh interval for Operating mode
1292 */
1293 .act_intrvl = CY_ACT_INTRVL_DFLT,
1294 /* change tch_tmout to customize the touch timeout for the
1295 * Active power state for Operating mode
1296 */
1297 .tch_tmout = CY_TCH_TMOUT_DFLT,
1298 /* change lp_intrvl to customize the Low Power power state
1299 * scanning/processing refresh interval for Operating mode
1300 */
1301 .lp_intrvl = CY_LP_INTRVL_DFLT,
1302 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1303 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1304 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1305 .regulator_info = regulator_data,
1306 .num_regulators = ARRAY_SIZE(regulator_data),
1307 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301308 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001309};
1310
1311static struct i2c_board_info cyttsp_info[] __initdata = {
1312 {
1313 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1314 .platform_data = &cyttsp_pdata,
1315#ifndef CY_USE_TIMER
1316 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1317#endif /* CY_USE_TIMER */
1318 },
1319};
1320
Mohan Pallaka50837382011-09-07 11:00:57 +05301321/* configuration data */
1322static const u8 mxt_config_data[] = {
1323 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001324 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301325 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001326 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001327 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1328 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1329 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1330 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1331 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1332 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301333 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001334 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301335 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001336 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301337 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001338 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1339 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1340 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1341 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301342 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1344 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301345 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001346 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1347 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301348 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001349 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1350 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301351 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001352 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1353 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301354 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001355 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301356 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001357 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301358 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001359 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301360 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001361 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301362 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001363 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301364};
1365
1366#define MXT_TS_GPIO_IRQ 11
1367#define MXT_TS_LDO_EN_GPIO 50
1368#define MXT_TS_RESET_GPIO 52
1369
1370static void mxt_init_hw_liquid(void)
1371{
1372 int rc;
1373
1374 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
1375 if (rc) {
1376 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
1377 __func__, MXT_TS_GPIO_IRQ);
1378 return;
1379 }
1380
1381 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
1382 if (rc) {
1383 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
1384 __func__, MXT_TS_GPIO_IRQ);
1385 goto err_irq_gpio_req;
1386 }
1387
1388 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1389 if (rc) {
1390 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
1391 __func__, MXT_TS_LDO_EN_GPIO);
1392 goto err_irq_gpio_req;
1393 }
1394
1395 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1396 if (rc) {
1397 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
1398 __func__, MXT_TS_LDO_EN_GPIO);
1399 goto err_ldo_gpio_req;
1400 }
1401
1402 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
1403 if (rc) {
1404 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
1405 __func__, MXT_TS_RESET_GPIO);
1406 goto err_ldo_gpio_set_dir;
1407 }
1408
1409 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
1410 if (rc) {
1411 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
1412 __func__, MXT_TS_RESET_GPIO);
1413 goto err_reset_gpio_req;
1414 }
1415
1416 return;
1417
1418err_reset_gpio_req:
1419 gpio_free(MXT_TS_RESET_GPIO);
1420err_ldo_gpio_set_dir:
1421 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
1422err_ldo_gpio_req:
1423 gpio_free(MXT_TS_LDO_EN_GPIO);
1424err_irq_gpio_req:
1425 gpio_free(MXT_TS_GPIO_IRQ);
1426}
1427
1428static struct mxt_platform_data mxt_platform_data = {
1429 .config = mxt_config_data,
1430 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001431 .x_size = 1365,
1432 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301433 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001434 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05301435};
1436
1437static struct i2c_board_info mxt_device_info[] __initdata = {
1438 {
1439 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1440 .platform_data = &mxt_platform_data,
1441 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1442 },
1443};
1444
Eugene Yasmand2316b82011-12-07 18:23:48 +02001445static struct i2c_board_info sii_device_info[] __initdata = {
1446 {
1447 I2C_BOARD_INFO("Sil-9244", 0x39),
1448 .flags = I2C_CLIENT_WAKE,
1449 .irq = MSM_GPIO_TO_INT(15),
1450 },
1451};
1452
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001453static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
1454{
1455}
1456
1457static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1458 .clk_freq = 100000,
1459 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001460 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1461};
1462
1463static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1464 .clk_freq = 100000,
1465 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001466 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1467};
1468
1469static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1470 .clk_freq = 100000,
1471 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001472 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1473};
1474
1475static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1476 .clk_freq = 100000,
1477 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001478 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1479};
1480
1481static struct msm_rpm_platform_data msm_rpm_data = {
1482 .reg_base_addrs = {
1483 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1484 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1485 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1486 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1487 },
1488
1489 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1490 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1491 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1492 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1493 .msm_apps_ipc_rpm_val = 4,
1494};
1495
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001496static struct ks8851_pdata spi_eth_pdata = {
1497 .irq_gpio = KS8851_IRQ_GPIO,
1498 .rst_gpio = KS8851_RST_GPIO,
1499};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001500
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001501static struct spi_board_info spi_board_info[] __initdata = {
1502 {
1503 .modalias = "ks8851",
1504 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1505 .max_speed_hz = 19200000,
1506 .bus_num = 0,
1507 .chip_select = 0,
1508 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001509 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001510 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001511 {
1512 .modalias = "dsi_novatek_3d_panel_spi",
1513 .max_speed_hz = 10800000,
1514 .bus_num = 0,
1515 .chip_select = 1,
1516 .mode = SPI_MODE_0,
1517 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001518};
1519
1520static struct platform_device msm_device_saw_core0 = {
1521 .name = "saw-regulator",
1522 .id = 0,
1523 .dev = {
1524 .platform_data = &msm_saw_regulator_pdata_s5,
1525 },
1526};
1527
1528static struct platform_device msm_device_saw_core1 = {
1529 .name = "saw-regulator",
1530 .id = 1,
1531 .dev = {
1532 .platform_data = &msm_saw_regulator_pdata_s6,
1533 },
1534};
1535
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001536static struct tsens_platform_data msm_tsens_pdata = {
1537 .slope = 910,
1538 .tsens_factor = 1000,
1539 .hw_type = MSM_8960,
1540 .tsens_num_sensor = 5,
1541};
1542
1543static struct platform_device msm_tsens_device = {
1544 .name = "tsens8960-tm",
1545 .id = -1,
1546 .dev = {
1547 .platform_data = &msm_tsens_pdata,
1548 },
1549};
1550
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001551#ifdef CONFIG_MSM_FAKE_BATTERY
1552static struct platform_device fish_battery_device = {
1553 .name = "fish_battery",
1554};
1555#endif
1556
David Collins26f05562011-06-20 09:56:28 -07001557static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558 .name = GPIO_REGULATOR_DEV_NAME,
1559 .id = PM8921_MPP_PM_TO_SYS(7),
1560 .dev = {
1561 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1562 },
1563};
1564
David Collins26f05562011-06-20 09:56:28 -07001565static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001566 .name = GPIO_REGULATOR_DEV_NAME,
1567 .id = 91,
1568 .dev = {
1569 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1570 },
1571};
1572
David Collinsb10be1d2011-09-02 10:29:31 -07001573static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1574 .name = GPIO_REGULATOR_DEV_NAME,
1575 .id = PM8921_GPIO_PM_TO_SYS(17),
1576 .dev = {
1577 .platform_data =
1578 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1579 },
1580};
1581
David Collins26f05562011-06-20 09:56:28 -07001582static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1583 .name = "rpm-regulator",
1584 .id = -1,
1585 .dev = {
1586 .platform_data = &msm_rpm_regulator_pdata,
1587 },
1588};
1589
David Collins4c31a872011-08-31 10:07:10 -07001590static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1591 .phys_addr_base = 0x0010C000,
1592 .reg_offsets = {
1593 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1594 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1595 },
1596 .phys_size = SZ_8K,
1597 .log_len = 4096, /* log's buffer length in bytes */
1598 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1599};
1600
1601static struct platform_device msm_rpm_log_device = {
1602 .name = "msm_rpm_log",
1603 .id = -1,
1604 .dev = {
1605 .platform_data = &msm_rpm_log_pdata,
1606 },
1607};
1608
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001609static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001610 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001611 &msm_device_smd,
1612 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301613 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001614 &msm_device_saw_core0,
1615 &msm_device_saw_core1,
1616 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001617 &msm8960_device_ssbi_pmic,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001618 &msm8960_device_qup_spi_gsbi1,
1619 &msm8960_device_qup_i2c_gsbi3,
1620 &msm8960_device_qup_i2c_gsbi4,
1621 &msm8960_device_qup_i2c_gsbi10,
1622#ifndef CONFIG_MSM_DSPS
1623 &msm8960_device_qup_i2c_gsbi12,
1624#endif
1625 &msm_slim_ctrl,
1626 &msm_device_wcnss_wlan,
1627#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1628 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1629 &qcrypto_device,
1630#endif
1631
1632#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1633 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1634 &qcedev_device,
1635#endif
1636#ifdef CONFIG_MSM_ROTATOR
1637 &msm_rotator_device,
1638#endif
1639 &msm_device_sps,
1640#ifdef CONFIG_MSM_FAKE_BATTERY
1641 &fish_battery_device,
1642#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001643 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001644#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001645#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001646 &android_pmem_device,
1647 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001648#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001649 &android_pmem_audio_device,
1650#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001651 &msm_device_vidc,
1652 &msm_device_bam_dmux,
1653 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001654
1655#ifdef CONFIG_HW_RANDOM_MSM
1656 &msm_device_rng,
1657#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001658 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07001659#ifdef CONFIG_ION_MSM
1660 &ion_dev,
1661#endif
David Collins4c31a872011-08-31 10:07:10 -07001662 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06001663 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001664 &msm_device_tz_log,
1665
Pratik Patel7831c082011-06-08 21:44:37 -07001666#ifdef CONFIG_MSM_QDSS
1667 &msm_etb_device,
1668 &msm_tpiu_device,
1669 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07001670 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07001671 &msm_ptm_device,
1672#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001673 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001674 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001675};
1676
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001677static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001678 &msm8960_device_otg,
1679 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001680 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301681 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001682 &android_usb_device,
1683 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001684 &msm_bus_apps_fabric,
1685 &msm_bus_sys_fabric,
1686 &msm_bus_mm_fabric,
1687 &msm_bus_sys_fpb,
1688 &msm_bus_cpss_fpb,
1689 &msm_pcm,
1690 &msm_pcm_routing,
1691 &msm_cpudai0,
1692 &msm_cpudai1,
1693 &msm_cpudai_hdmi_rx,
1694 &msm_cpudai_bt_rx,
1695 &msm_cpudai_bt_tx,
1696 &msm_cpudai_fm_rx,
1697 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001698 &msm_cpudai_auxpcm_rx,
1699 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700 &msm_cpu_fe,
1701 &msm_stub_codec,
1702 &msm_voice,
1703 &msm_voip,
1704 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301705 &msm_compr_dsp,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001706
1707#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1708 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1709 &qcrypto_device,
1710#endif
1711
1712#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1713 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1714 &qcedev_device,
1715#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001716};
1717
1718static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001719 &msm_kgsl_3d0,
1720 &msm_kgsl_2d0,
1721 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001722#ifdef CONFIG_MSM_GEMINI
1723 &msm8960_gemini_device,
1724#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001725};
1726
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001727static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001728 &msm_8960_q6_lpass,
1729 &msm_8960_q6_mss_fw,
1730 &msm_8960_q6_mss_sw,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001731 &msm8960_device_otg,
1732 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001733 &msm_device_hsusb_host,
1734 &android_usb_device,
1735 &msm_pcm,
1736 &msm_pcm_routing,
1737 &msm_cpudai0,
1738 &msm_cpudai1,
1739 &msm_cpudai_hdmi_rx,
1740 &msm_cpudai_bt_rx,
1741 &msm_cpudai_bt_tx,
1742 &msm_cpudai_fm_rx,
1743 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001744 &msm_cpudai_auxpcm_rx,
1745 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001746 &msm_cpu_fe,
1747 &msm_stub_codec,
1748 &msm_kgsl_3d0,
1749#ifdef CONFIG_MSM_KGSL_2D
1750 &msm_kgsl_2d0,
1751 &msm_kgsl_2d1,
1752#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001753#ifdef CONFIG_MSM_GEMINI
1754 &msm8960_gemini_device,
1755#endif
1756 &msm_voice,
1757 &msm_voip,
1758 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301759 &msm_cpudai_afe_01_rx,
1760 &msm_cpudai_afe_01_tx,
1761 &msm_cpudai_afe_02_rx,
1762 &msm_cpudai_afe_02_tx,
1763 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301764 &msm_compr_dsp,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001765 &msm_pcm_hostless,
1766 &msm_bus_apps_fabric,
1767 &msm_bus_sys_fabric,
1768 &msm_bus_mm_fabric,
1769 &msm_bus_sys_fpb,
1770 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001771 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001772};
1773
1774static void __init msm8960_i2c_init(void)
1775{
1776 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1777 &msm8960_i2c_qup_gsbi4_pdata;
1778
1779 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1780 &msm8960_i2c_qup_gsbi3_pdata;
1781
1782 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1783 &msm8960_i2c_qup_gsbi10_pdata;
1784
1785 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1786 &msm8960_i2c_qup_gsbi12_pdata;
1787}
1788
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001789static void __init msm8960_gfx_init(void)
1790{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001791 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001792 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1793 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1794 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001795 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1796 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001797 }
1798}
1799
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001800static struct msm_cpuidle_state msm_cstates[] __initdata = {
1801 {0, 0, "C0", "WFI",
1802 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1803
1804 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1805 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1806
1807 {0, 2, "C2", "POWER_COLLAPSE",
1808 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1809
1810 {1, 0, "C0", "WFI",
1811 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1812
1813 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1814 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1815};
1816
1817static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1818 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1819 .idle_supported = 1,
1820 .suspend_supported = 1,
1821 .idle_enabled = 0,
1822 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001823 },
1824
1825 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1826 .idle_supported = 1,
1827 .suspend_supported = 1,
1828 .idle_enabled = 0,
1829 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001830 },
1831
1832 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1833 .idle_supported = 1,
1834 .suspend_supported = 1,
1835 .idle_enabled = 1,
1836 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001837 },
1838
1839 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1840 .idle_supported = 0,
1841 .suspend_supported = 1,
1842 .idle_enabled = 0,
1843 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001844 },
1845
1846 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1847 .idle_supported = 1,
1848 .suspend_supported = 1,
1849 .idle_enabled = 0,
1850 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001851 },
1852
1853 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1854 .idle_supported = 1,
1855 .suspend_supported = 0,
1856 .idle_enabled = 1,
1857 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001858 },
1859};
1860
1861static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1862 {
1863 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1864 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1865 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001866 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001867 },
1868
1869 {
1870 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1871 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1872 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001873 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001874 },
1875
1876 {
1877 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1878 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1879 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001880 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001881 },
1882
1883 {
1884 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1885 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1886 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001887 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001888 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001889 {
1890 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1891 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1892 false,
1893 7000, 3500, 66600000, 5150,
1894 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001895
1896 {
1897 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1898 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1899 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001900 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001901 },
1902
1903 {
1904 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1905 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1906 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001907 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001908 },
1909
1910 {
1911 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1912 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1913 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001914 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001915 },
1916
1917 {
1918 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1919 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1920 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001921 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001922 },
1923};
1924
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001925static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1926 .mode = MSM_PM_BOOT_CONFIG_TZ,
1927};
1928
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001929#ifdef CONFIG_I2C
1930#define I2C_SURF 1
1931#define I2C_FFA (1 << 1)
1932#define I2C_RUMI (1 << 2)
1933#define I2C_SIM (1 << 3)
1934#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03001935#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001936
1937struct i2c_registry {
1938 u8 machs;
1939 int bus;
1940 struct i2c_board_info *info;
1941 int len;
1942};
1943
1944#ifdef CONFIG_MSM_CAMERA
1945static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
1946#ifdef CONFIG_IMX074
1947 {
1948 I2C_BOARD_INFO("imx074", 0x1A),
1949 },
1950#endif
1951#ifdef CONFIG_OV2720
1952 {
1953 I2C_BOARD_INFO("ov2720", 0x6C),
1954 },
1955#endif
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -08001956#ifdef CONFIG_MT9M114
1957 {
1958 I2C_BOARD_INFO("mt9m114", 0x48),
1959 },
1960#endif
Nishant Pandit474f2252011-07-23 23:17:56 +05301961#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
1962 {
1963 I2C_BOARD_INFO("sc628a", 0x6E),
1964 },
1965#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001966};
1967#endif
1968
1969/* Sensors DSPS platform data */
1970#ifdef CONFIG_MSM_DSPS
1971#define DSPS_PIL_GENERIC_NAME "dsps"
1972#endif /* CONFIG_MSM_DSPS */
1973
1974static void __init msm8960_init_dsps(void)
1975{
1976#ifdef CONFIG_MSM_DSPS
1977 struct msm_dsps_platform_data *pdata =
1978 msm_dsps_device.dev.platform_data;
1979 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
1980 pdata->gpios = NULL;
1981 pdata->gpios_num = 0;
1982
1983 platform_device_register(&msm_dsps_device);
1984#endif /* CONFIG_MSM_DSPS */
1985}
1986
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07001987static void __init msm8960_init_hsic(void)
1988{
1989#ifdef CONFIG_USB_EHCI_MSM_HSIC
1990 uint32_t version = socinfo_get_version();
1991
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08001992 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07001993 return;
1994
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001995 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08001996 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07001997#endif
1998}
1999
Amir Samuelov5137e392011-09-21 17:31:25 +03002000#ifdef CONFIG_ISL9519_CHARGER
2001static struct isl_platform_data isl_data __initdata = {
2002 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2003 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2004 .max_system_voltage = 4200,
2005 .min_system_voltage = 3200,
2006 .chgcurrent = 1000, /* 1900, */
2007 .term_current = 400, /* Need fine tuning */
2008 .input_current = 2048,
2009};
2010
2011static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2012 {
2013 I2C_BOARD_INFO("isl9519q", 0x9),
2014 .irq = 0, /* Not required when notify-by-pmic */
2015 .platform_data = &isl_data,
2016 },
2017};
2018#endif /* CONFIG_ISL9519_CHARGER */
2019
Amir Samuelov755616d2011-12-13 16:34:46 +02002020static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2021 {
2022 I2C_BOARD_INFO("sx1508q", 0x20),
2023 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2024 },
2025};
2026
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002027static struct i2c_registry msm8960_i2c_devices[] __initdata = {
2028#ifdef CONFIG_MSM_CAMERA
2029 {
Amir Samuelov05f87802011-08-27 18:30:12 +03002030 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002031 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2032 msm_camera_boardinfo,
2033 ARRAY_SIZE(msm_camera_boardinfo),
2034 },
2035#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03002036#ifdef CONFIG_ISL9519_CHARGER
2037 {
2038 I2C_LIQUID,
2039 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2040 isl_charger_i2c_info,
2041 ARRAY_SIZE(isl_charger_i2c_info),
2042 },
2043#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002044 {
2045 I2C_SURF | I2C_FFA | I2C_FLUID,
2046 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2047 cyttsp_info,
2048 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002049 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302050 {
2051 I2C_LIQUID,
2052 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2053 mxt_device_info,
2054 ARRAY_SIZE(mxt_device_info),
2055 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302056 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302057 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302058 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002059 sii_device_info,
2060 ARRAY_SIZE(sii_device_info),
2061 },
2062 {
2063 I2C_LIQUID,
2064 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302065 msm_isa1200_board_info,
2066 ARRAY_SIZE(msm_isa1200_board_info),
2067 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002068 {
2069 I2C_LIQUID,
2070 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2071 liquid_io_expander_i2c_info,
2072 ARRAY_SIZE(liquid_io_expander_i2c_info),
2073 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002074};
2075#endif /* CONFIG_I2C */
2076
2077static void __init register_i2c_devices(void)
2078{
2079#ifdef CONFIG_I2C
2080 u8 mach_mask = 0;
2081 int i;
2082
2083 /* Build the matching 'supported_machs' bitmask */
2084 if (machine_is_msm8960_cdp())
2085 mach_mask = I2C_SURF;
2086 else if (machine_is_msm8960_rumi3())
2087 mach_mask = I2C_RUMI;
2088 else if (machine_is_msm8960_sim())
2089 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002090 else if (machine_is_msm8960_fluid())
2091 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002092 else if (machine_is_msm8960_liquid())
2093 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002094 else if (machine_is_msm8960_mtp())
2095 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002096 else
2097 pr_err("unmatched machine ID in register_i2c_devices\n");
2098
2099 /* Run the array and install devices as appropriate */
2100 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2101 if (msm8960_i2c_devices[i].machs & mach_mask)
2102 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2103 msm8960_i2c_devices[i].info,
2104 msm8960_i2c_devices[i].len);
2105 }
2106#endif
2107}
2108
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002109static void __init msm8960_sim_init(void)
2110{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002111 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2112 &msm8960_device_watchdog.dev.platform_data;
2113
2114 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002115 BUG_ON(msm_rpm_init(&msm_rpm_data));
2116 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2117 ARRAY_SIZE(msm_rpmrs_levels)));
2118 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002119 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002120 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002121 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002122
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002123 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002124 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002125 msm8960_i2c_init();
2126 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2127 msm_spm_l2_init(msm_spm_l2_data);
2128 msm8960_init_buses();
2129 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002130 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002131 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002132 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002133
2134 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2135 &msm8960_qup_spi_gsbi1_pdata;
2136 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2137
2138 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002139 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002140 slim_register_board_info(msm_slim_devices,
2141 ARRAY_SIZE(msm_slim_devices));
2142 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2143 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2144 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2145 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002146 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002147}
2148
2149static void __init msm8960_rumi3_init(void)
2150{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002151 BUG_ON(msm_rpm_init(&msm_rpm_data));
2152 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2153 ARRAY_SIZE(msm_rpmrs_levels)));
2154 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002155 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002156 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002157 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002158 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002159 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2160 &msm8960_qup_spi_gsbi1_pdata;
2161 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2162 msm8960_i2c_init();
2163 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2164 msm_spm_l2_init(msm_spm_l2_data);
2165 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002166 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002167 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002168 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002169 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002170 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002171 slim_register_board_info(msm_slim_devices,
2172 ARRAY_SIZE(msm_slim_devices));
2173 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2174 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2175 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2176 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002177 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002178}
2179
2180static void __init msm8960_cdp_init(void)
2181{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002182 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2183 pr_err("meminfo_init() failed!\n");
2184
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002185 BUG_ON(msm_rpm_init(&msm_rpm_data));
2186 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2187 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002188
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002189 regulator_suppress_info_printing();
2190 if (msm_xo_init())
2191 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002192 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002193 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302194 if (machine_is_msm8960_liquid())
2195 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002196 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302197 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2198 machine_is_msm8960_cdp()) {
2199 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2200 } else if (machine_is_msm8960_liquid()) {
2201 msm_otg_pdata.phy_init_seq =
2202 liquid_v1_phy_init_seq;
2203 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302204 msm_otg_pdata.swfi_latency =
2205 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302206#ifdef CONFIG_USB_EHCI_MSM_HSIC
2207 if (machine_is_msm8960_liquid()) {
2208 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2209 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2210 }
2211#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302212 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002213 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002214 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2215 &msm8960_qup_spi_gsbi1_pdata;
2216 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002217
2218 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302219 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2220 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2221 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002222 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002223 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002224 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2225 msm_spm_l2_init(msm_spm_l2_data);
2226 msm8960_init_buses();
2227 platform_add_devices(msm_footswitch_devices,
2228 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002229 if (machine_is_msm8960_liquid())
2230 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002231 if (machine_is_msm8960_cdp())
2232 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002233 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002234 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002235 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002236 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002237 msm8960_init_cam();
2238 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002239 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302240 if (machine_is_msm8960_liquid())
2241 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002242 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002243 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002244 slim_register_board_info(msm_slim_devices,
2245 ARRAY_SIZE(msm_slim_devices));
2246 msm8960_init_dsps();
2247 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2248 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2249 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2250 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002251 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002252 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Joel Kingb8352a12011-11-15 18:46:24 -08002253 if (PLATFORM_IS_CHARM25())
2254 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002255}
2256
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002257MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2258 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002259 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002260 .init_irq = msm8960_init_irq,
2261 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002262 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002263 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002264 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002265MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002266
2267MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2268 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002269 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002270 .init_irq = msm8960_init_irq,
2271 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002272 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002273 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002274 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002275MACHINE_END
2276
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002277MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2278 .map_io = msm8960_map_io,
2279 .reserve = msm8960_reserve,
2280 .init_irq = msm8960_init_irq,
2281 .timer = &msm_timer,
2282 .init_machine = msm8960_cdp_init,
2283 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002284 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002285MACHINE_END
2286
2287MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2288 .map_io = msm8960_map_io,
2289 .reserve = msm8960_reserve,
2290 .init_irq = msm8960_init_irq,
2291 .timer = &msm_timer,
2292 .init_machine = msm8960_cdp_init,
2293 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002294 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002295MACHINE_END
2296
2297MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
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
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002306
2307MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
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,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002315MACHINE_END