blob: d464375021cde26b3e75d9eea2c0973a830f3bdc [file] [log] [blame]
Harini Jayaramana9873ab2011-12-20 17:29:48 -07001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080043#include <linux/memory.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080044
45#include <asm/mach-types.h>
46#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070047#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080050
51#include <mach/board.h>
52#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053#include <mach/msm_spi.h>
54#ifdef CONFIG_USB_MSM_OTG_72K
55#include <mach/msm_hsusb.h>
56#else
57#include <linux/usb/msm_hsusb.h>
58#endif
59#include <linux/usb/android.h>
60#include <mach/usbdiag.h>
61#include <mach/socinfo.h>
62#include <mach/rpm.h>
63#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070064#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065#include <mach/msm_bus_board.h>
66#include <mach/msm_memtypes.h>
67#include <mach/dma.h>
68#include <mach/msm_dsps.h>
69#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070070#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080071
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072#ifdef CONFIG_WCD9310_CODEC
73#include <linux/slimbus/slimbus.h>
74#include <linux/mfd/wcd9310/core.h>
75#include <linux/mfd/wcd9310/pdata.h>
76#endif
77
Laura Abbottd6183792011-08-19 13:42:24 -070078#include <linux/ion.h>
79#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080080#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080081#include <mach/mdm-peripheral.h>
Laura Abbottd6183792011-08-19 13:42:24 -070082
Larry Bassel41a055b2011-12-06 16:15:14 -080083#include <linux/fmem.h>
84
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070085#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080086#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070087#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070088#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080089#include "board-8960.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080090#include <mach/pm.h>
91#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092#include "rpm_resources.h"
93#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070094#include "acpuclock.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
Olav Haugana21169d2012-01-04 09:17:06 -0800132#define MSM_PMEM_ADSP_SIZE 0x7800000
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
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800137#define MSM_PMEM_SIZE 0x2800000 /* 40 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
Olav Hauganedcf6832012-01-24 08:35:41 -0800142#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Hauganb88eef12012-01-15 10:59:26 -0800143#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan42ebe712012-01-10 16:30:58 -0800144#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Hauganb88eef12012-01-15 10:59:26 -0800145#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan80854eb2012-01-12 12:00:23 -0800146#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800147#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800148#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
149#define MSM_ION_HEAP_NUM 8
Olav Hauganb5be7992011-11-18 14:29:02 -0800150#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
151static unsigned int msm_ion_cp_mm_size = MSM_ION_MM_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700152#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700153#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800154#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700155#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700156
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700157#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
158static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
159static int __init pmem_kernel_ebi1_size_setup(char *p)
160{
161 pmem_kernel_ebi1_size = memparse(p, NULL);
162 return 0;
163}
164early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
165#endif
166
167#ifdef CONFIG_ANDROID_PMEM
168static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800169static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700170static int __init pmem_size_setup(char *p)
171{
172 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800173 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700174 return 0;
175}
176early_param("pmem_size", pmem_size_setup);
177
178static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
179
180static int __init pmem_adsp_size_setup(char *p)
181{
182 pmem_adsp_size = memparse(p, NULL);
183 return 0;
184}
185early_param("pmem_adsp_size", pmem_adsp_size_setup);
186
187static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
188
189static int __init pmem_audio_size_setup(char *p)
190{
191 pmem_audio_size = memparse(p, NULL);
192 return 0;
193}
194early_param("pmem_audio_size", pmem_audio_size_setup);
195#endif
196
197#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700198#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700199static struct android_pmem_platform_data android_pmem_pdata = {
200 .name = "pmem",
201 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
202 .cached = 1,
203 .memory_type = MEMTYPE_EBI1,
204};
205
206static struct platform_device android_pmem_device = {
207 .name = "android_pmem",
208 .id = 0,
209 .dev = {.platform_data = &android_pmem_pdata},
210};
211
212static struct android_pmem_platform_data android_pmem_adsp_pdata = {
213 .name = "pmem_adsp",
214 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
215 .cached = 0,
216 .memory_type = MEMTYPE_EBI1,
217};
218static struct platform_device android_pmem_adsp_device = {
219 .name = "android_pmem",
220 .id = 2,
221 .dev = { .platform_data = &android_pmem_adsp_pdata },
222};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700223#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700224
225static struct android_pmem_platform_data android_pmem_audio_pdata = {
226 .name = "pmem_audio",
227 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
228 .cached = 0,
229 .memory_type = MEMTYPE_EBI1,
230};
231
232static struct platform_device android_pmem_audio_device = {
233 .name = "android_pmem",
234 .id = 4,
235 .dev = { .platform_data = &android_pmem_audio_pdata },
236};
237#endif
238
Larry Bassel41a055b2011-12-06 16:15:14 -0800239struct fmem_platform_data fmem_pdata = {
240};
241
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700242#define DSP_RAM_BASE_8960 0x8da00000
243#define DSP_RAM_SIZE_8960 0x1800000
244static int dspcrashd_pdata_8960 = 0xDEADDEAD;
245
246static struct resource resources_dspcrashd_8960[] = {
247 {
248 .name = "msm_dspcrashd",
249 .start = DSP_RAM_BASE_8960,
250 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
251 .flags = IORESOURCE_DMA,
252 },
253};
254
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800255static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700256 .name = "msm_dspcrashd",
257 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
258 .resource = resources_dspcrashd_8960,
259 .dev = { .platform_data = &dspcrashd_pdata_8960 },
260};
261
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700262static struct memtype_reserve msm8960_reserve_table[] __initdata = {
263 [MEMTYPE_SMI] = {
264 },
265 [MEMTYPE_EBI0] = {
266 .flags = MEMTYPE_FLAGS_1M_ALIGN,
267 },
268 [MEMTYPE_EBI1] = {
269 .flags = MEMTYPE_FLAGS_1M_ALIGN,
270 },
271};
272
273static void __init size_pmem_devices(void)
274{
275#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700276#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700277 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800278
279 if (!pmem_param_set && machine_is_msm8960_liquid())
280 pmem_size = MSM_LIQUID_PMEM_SIZE;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700281 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700282#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700283 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
284#endif
285}
286
287static void __init reserve_memory_for(struct android_pmem_platform_data *p)
288{
289 msm8960_reserve_table[p->memory_type].size += p->size;
290}
291
292static void __init reserve_pmem_memory(void)
293{
294#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700295#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700296 reserve_memory_for(&android_pmem_adsp_pdata);
297 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700298#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700299 reserve_memory_for(&android_pmem_audio_pdata);
300 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
301#endif
302}
303
Larry Bassel41a055b2011-12-06 16:15:14 -0800304static void __init reserve_fmem_memory(void)
305{
306}
307
Larry Basselb4126da2011-07-18 14:31:33 -0700308static int msm8960_paddr_to_memtype(unsigned int paddr)
309{
310 return MEMTYPE_EBI1;
311}
312
Laura Abbottd6183792011-08-19 13:42:24 -0700313#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800314#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
315static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
316 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800317 .align = PAGE_SIZE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800318};
319
320static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
321 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800322 .align = PAGE_SIZE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800323};
324
325static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800326 .adjacent_mem_id = INVALID_HEAP_ID,
327 .align = PAGE_SIZE,
328};
329
330static struct ion_co_heap_pdata fw_co_ion_pdata = {
331 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
332 .align = SZ_128K,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800333};
334#endif
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800335static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700336 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700337 .heaps = {
338 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800339 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700340 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700341 .name = ION_VMALLOC_HEAP_NAME,
342 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700343#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700344 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800345 .id = ION_SF_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700346 .type = ION_HEAP_TYPE_CARVEOUT,
Olav Hauganb5be7992011-11-18 14:29:02 -0800347 .name = ION_SF_HEAP_NAME,
348 .size = MSM_ION_SF_SIZE,
Laura Abbottd6183792011-08-19 13:42:24 -0700349 .memory_type = ION_EBI_TYPE,
Olav Haugan42ebe712012-01-10 16:30:58 -0800350 .extra_data = (void *) &co_ion_pdata,
Laura Abbottd6183792011-08-19 13:42:24 -0700351 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700352 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800353 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800354 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800355 .name = ION_MM_HEAP_NAME,
356 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700357 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800358 .extra_data = (void *) &cp_mm_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700359 },
Laura Abbott8c017362011-09-22 20:59:12 -0700360 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800361 .id = ION_MM_FIRMWARE_HEAP_ID,
362 .type = ION_HEAP_TYPE_CARVEOUT,
363 .name = ION_MM_FIRMWARE_HEAP_NAME,
364 .size = MSM_ION_MM_FW_SIZE,
365 .memory_type = ION_EBI_TYPE,
366 .extra_data = (void *) &fw_co_ion_pdata,
367 },
368 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800369 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800370 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800371 .name = ION_MFC_HEAP_NAME,
372 .size = MSM_ION_MFC_SIZE,
373 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800374 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800375 },
376 {
377 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700378 .type = ION_HEAP_TYPE_IOMMU,
379 .name = ION_IOMMU_HEAP_NAME,
380 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800381 {
382 .id = ION_QSECOM_HEAP_ID,
383 .type = ION_HEAP_TYPE_CARVEOUT,
384 .name = ION_QSECOM_HEAP_NAME,
385 .size = MSM_ION_QSECOM_SIZE,
386 .memory_type = ION_EBI_TYPE,
387 .extra_data = (void *) &co_ion_pdata,
388 },
Olav Haugan7355db02012-01-13 16:59:13 -0800389 {
390 .id = ION_AUDIO_HEAP_ID,
391 .type = ION_HEAP_TYPE_CARVEOUT,
392 .name = ION_AUDIO_HEAP_NAME,
393 .size = MSM_ION_AUDIO_SIZE,
394 .memory_type = ION_EBI_TYPE,
395 .extra_data = (void *) &co_ion_pdata,
396 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700397#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700398 }
399};
400
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800401static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700402 .name = "ion-msm",
403 .id = 1,
404 .dev = { .platform_data = &ion_pdata },
405};
406#endif
407
Larry Bassel41a055b2011-12-06 16:15:14 -0800408struct platform_device fmem_device = {
409 .name = "fmem",
410 .id = 1,
411 .dev = { .platform_data = &fmem_pdata },
412};
413
Laura Abbottd6183792011-08-19 13:42:24 -0700414static void reserve_ion_memory(void)
415{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700416#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800417 unsigned int i;
418
419 if (!pmem_param_set && machine_is_msm8960_liquid()) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800420 msm_ion_cp_mm_size = MSM_LIQUID_ION_MM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800421 for (i = 0; i < ion_pdata.nr; i++) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800422 if (ion_pdata.heaps[i].id == ION_CP_MM_HEAP_ID) {
423 ion_pdata.heaps[i].size = msm_ion_cp_mm_size;
424 pr_debug("msm_ion_cp_mm_size 0x%x\n",
425 msm_ion_cp_mm_size);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800426 break;
427 }
428 }
429 }
Olav Hauganb5be7992011-11-18 14:29:02 -0800430 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_ion_cp_mm_size;
Olav Haugan42ebe712012-01-10 16:30:58 -0800431 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Hauganb5be7992011-11-18 14:29:02 -0800432 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
433 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Haugan80854eb2012-01-12 12:00:23 -0800434 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Olav Haugan7355db02012-01-13 16:59:13 -0800435 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700436#endif
437}
Huaibin Yanga5419422011-12-08 23:52:10 -0800438
439static void __init reserve_mdp_memory(void)
440{
441 msm8960_mdp_writeback(msm8960_reserve_table);
442}
443
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700444static void __init msm8960_calculate_reserve_sizes(void)
445{
446 size_pmem_devices();
447 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700448 reserve_ion_memory();
Larry Bassel41a055b2011-12-06 16:15:14 -0800449 reserve_fmem_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800450 reserve_mdp_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700451}
452
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700453static struct reserve_info msm8960_reserve_info __initdata = {
454 .memtype_reserve_table = msm8960_reserve_table,
455 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
456 .paddr_to_memtype = msm8960_paddr_to_memtype,
457};
458
Larry Basselb4126da2011-07-18 14:31:33 -0700459static int msm8960_memory_bank_size(void)
460{
461 return 1<<29;
462}
463
464static void __init locate_unstable_memory(void)
465{
466 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
467 unsigned long bank_size;
468 unsigned long low, high;
469
470 bank_size = msm8960_memory_bank_size();
471 low = meminfo.bank[0].start;
472 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700473
474 /* Check if 32 bit overflow occured */
475 if (high < mb->start)
476 high = ~0UL;
477
Larry Basselb4126da2011-07-18 14:31:33 -0700478 low &= ~(bank_size - 1);
479
480 if (high - low <= bank_size)
481 return;
Jack Cheung60eaeab2012-01-09 16:40:26 -0800482 msm8960_reserve_info.low_unstable_address = mb->start -
483 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800484 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700485
Larry Basselb4126da2011-07-18 14:31:33 -0700486 msm8960_reserve_info.bank_size = bank_size;
487 pr_info("low unstable address %lx max size %lx bank size %lx\n",
488 msm8960_reserve_info.low_unstable_address,
489 msm8960_reserve_info.max_unstable_size,
490 msm8960_reserve_info.bank_size);
491}
492
Larry Basselb830e182011-10-14 10:46:55 -0700493static void __init place_movable_zone(void)
494{
495 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
496 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
497 pr_info("movable zone start %lx size %lx\n",
498 movable_reserved_start, movable_reserved_size);
499}
500
501static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700502{
503 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700504 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700505 place_movable_zone();
506}
507
508static void __init msm8960_reserve(void)
509{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700510 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800511 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700512}
513
Larry Bassela4414b12011-08-04 11:11:02 -0700514static int msm8960_change_memory_power(u64 start, u64 size,
515 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700516{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700517 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700518}
519
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700520static void __init msm8960_allocate_memory_regions(void)
521{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800522 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700523}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800524
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700525#ifdef CONFIG_WCD9310_CODEC
526
527#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
528
Patrick Lai3043fba2011-08-01 14:15:57 -0700529/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
530 * 4 micbiases are used to power various analog and digital
531 * microphones operating at 1800 mV. Technically, all micbiases
532 * can source from single cfilter since all microphones operate
533 * at the same voltage level. The arrangement below is to make
534 * sure all cfilters are exercised. LDO_H regulator ouput level
535 * does not need to be as high as 2.85V. It is choosen for
536 * microphone sensitivity purpose.
537 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700538static struct tabla_pdata tabla_platform_data = {
539 .slimbus_slave_device = {
540 .name = "tabla-slave",
541 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
542 },
543 .irq = MSM_GPIO_TO_INT(62),
544 .irq_base = TABLA_INTERRUPT_BASE,
545 .num_irqs = NR_TABLA_IRQS,
546 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700547 .micbias = {
548 .ldoh_v = TABLA_LDOH_2P85_V,
549 .cfilt1_mv = 1800,
550 .cfilt2_mv = 1800,
551 .cfilt3_mv = 1800,
552 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
553 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
554 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
555 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
556 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700557};
558
559static struct slim_device msm_slim_tabla = {
560 .name = "tabla-slim",
561 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
562 .dev = {
563 .platform_data = &tabla_platform_data,
564 },
565};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530566
567static struct tabla_pdata tabla20_platform_data = {
568 .slimbus_slave_device = {
569 .name = "tabla-slave",
570 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
571 },
572 .irq = MSM_GPIO_TO_INT(62),
573 .irq_base = TABLA_INTERRUPT_BASE,
574 .num_irqs = NR_TABLA_IRQS,
575 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
576 .micbias = {
577 .ldoh_v = TABLA_LDOH_2P85_V,
578 .cfilt1_mv = 1800,
579 .cfilt2_mv = 1800,
580 .cfilt3_mv = 1800,
581 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
582 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
583 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
584 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
585 }
586};
587
588static struct slim_device msm_slim_tabla20 = {
589 .name = "tabla2x-slim",
590 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
591 .dev = {
592 .platform_data = &tabla20_platform_data,
593 },
594};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595#endif
596
597static struct slim_boardinfo msm_slim_devices[] = {
598#ifdef CONFIG_WCD9310_CODEC
599 {
600 .bus_num = 1,
601 .slim_slave = &msm_slim_tabla,
602 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530603 {
604 .bus_num = 1,
605 .slim_slave = &msm_slim_tabla20,
606 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700607#endif
608 /* add more slimbus slaves as needed */
609};
610
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700611#define MSM_WCNSS_PHYS 0x03000000
612#define MSM_WCNSS_SIZE 0x280000
613
614static struct resource resources_wcnss_wlan[] = {
615 {
616 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
617 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
618 .name = "wcnss_wlanrx_irq",
619 .flags = IORESOURCE_IRQ,
620 },
621 {
622 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
623 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
624 .name = "wcnss_wlantx_irq",
625 .flags = IORESOURCE_IRQ,
626 },
627 {
628 .start = MSM_WCNSS_PHYS,
629 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
630 .name = "wcnss_mmio",
631 .flags = IORESOURCE_MEM,
632 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700633 {
634 .start = 84,
635 .end = 88,
636 .name = "wcnss_gpios_5wire",
637 .flags = IORESOURCE_IO,
638 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700639};
640
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700641static struct qcom_wcnss_opts qcom_wcnss_pdata = {
642 .has_48mhz_xo = 1,
643};
644
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700645static struct platform_device msm_device_wcnss_wlan = {
646 .name = "wcnss_wlan",
647 .id = 0,
648 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
649 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700650 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700651};
652
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700653#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
654 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
655 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
656 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
657
658#define QCE_SIZE 0x10000
659#define QCE_0_BASE 0x18500000
660
661#define QCE_HW_KEY_SUPPORT 0
662#define QCE_SHA_HMAC_SUPPORT 1
663#define QCE_SHARE_CE_RESOURCE 1
664#define QCE_CE_SHARED 0
665
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800666/* Begin Bus scaling definitions */
667static struct msm_bus_vectors crypto_hw_init_vectors[] = {
668 {
669 .src = MSM_BUS_MASTER_ADM_PORT0,
670 .dst = MSM_BUS_SLAVE_EBI_CH0,
671 .ab = 0,
672 .ib = 0,
673 },
674 {
675 .src = MSM_BUS_MASTER_ADM_PORT1,
676 .dst = MSM_BUS_SLAVE_GSBI1_UART,
677 .ab = 0,
678 .ib = 0,
679 },
680};
681
682static struct msm_bus_vectors crypto_hw_active_vectors[] = {
683 {
684 .src = MSM_BUS_MASTER_ADM_PORT0,
685 .dst = MSM_BUS_SLAVE_EBI_CH0,
686 .ab = 70000000UL,
687 .ib = 70000000UL,
688 },
689 {
690 .src = MSM_BUS_MASTER_ADM_PORT1,
691 .dst = MSM_BUS_SLAVE_GSBI1_UART,
692 .ab = 2480000000UL,
693 .ib = 2480000000UL,
694 },
695};
696
697static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
698 {
699 ARRAY_SIZE(crypto_hw_init_vectors),
700 crypto_hw_init_vectors,
701 },
702 {
703 ARRAY_SIZE(crypto_hw_active_vectors),
704 crypto_hw_active_vectors,
705 },
706};
707
708static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
709 crypto_hw_bus_scale_usecases,
710 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
711 .name = "cryptohw",
712};
713/* End Bus Scaling Definitions*/
714
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700715static struct resource qcrypto_resources[] = {
716 [0] = {
717 .start = QCE_0_BASE,
718 .end = QCE_0_BASE + QCE_SIZE - 1,
719 .flags = IORESOURCE_MEM,
720 },
721 [1] = {
722 .name = "crypto_channels",
723 .start = DMOV_CE_IN_CHAN,
724 .end = DMOV_CE_OUT_CHAN,
725 .flags = IORESOURCE_DMA,
726 },
727 [2] = {
728 .name = "crypto_crci_in",
729 .start = DMOV_CE_IN_CRCI,
730 .end = DMOV_CE_IN_CRCI,
731 .flags = IORESOURCE_DMA,
732 },
733 [3] = {
734 .name = "crypto_crci_out",
735 .start = DMOV_CE_OUT_CRCI,
736 .end = DMOV_CE_OUT_CRCI,
737 .flags = IORESOURCE_DMA,
738 },
739};
740
741static struct resource qcedev_resources[] = {
742 [0] = {
743 .start = QCE_0_BASE,
744 .end = QCE_0_BASE + QCE_SIZE - 1,
745 .flags = IORESOURCE_MEM,
746 },
747 [1] = {
748 .name = "crypto_channels",
749 .start = DMOV_CE_IN_CHAN,
750 .end = DMOV_CE_OUT_CHAN,
751 .flags = IORESOURCE_DMA,
752 },
753 [2] = {
754 .name = "crypto_crci_in",
755 .start = DMOV_CE_IN_CRCI,
756 .end = DMOV_CE_IN_CRCI,
757 .flags = IORESOURCE_DMA,
758 },
759 [3] = {
760 .name = "crypto_crci_out",
761 .start = DMOV_CE_OUT_CRCI,
762 .end = DMOV_CE_OUT_CRCI,
763 .flags = IORESOURCE_DMA,
764 },
765};
766
767#endif
768
769#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
770 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
771
772static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
773 .ce_shared = QCE_CE_SHARED,
774 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
775 .hw_key_support = QCE_HW_KEY_SUPPORT,
776 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800777 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700778};
779
780static struct platform_device qcrypto_device = {
781 .name = "qcrypto",
782 .id = 0,
783 .num_resources = ARRAY_SIZE(qcrypto_resources),
784 .resource = qcrypto_resources,
785 .dev = {
786 .coherent_dma_mask = DMA_BIT_MASK(32),
787 .platform_data = &qcrypto_ce_hw_suppport,
788 },
789};
790#endif
791
792#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
793 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
794
795static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
796 .ce_shared = QCE_CE_SHARED,
797 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
798 .hw_key_support = QCE_HW_KEY_SUPPORT,
799 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800800 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700801};
802
803static struct platform_device qcedev_device = {
804 .name = "qce",
805 .id = 0,
806 .num_resources = ARRAY_SIZE(qcedev_resources),
807 .resource = qcedev_resources,
808 .dev = {
809 .coherent_dma_mask = DMA_BIT_MASK(32),
810 .platform_data = &qcedev_ce_hw_suppport,
811 },
812};
813#endif
814
Joel Kingb8352a12011-11-15 18:46:24 -0800815#define MDM2AP_ERRFATAL 70
816#define AP2MDM_ERRFATAL 95
817#define MDM2AP_STATUS 69
818#define AP2MDM_STATUS 94
819#define AP2MDM_PMIC_RESET_N 80
820#define AP2MDM_KPDPWR_N 81
821
Joel Kingb8352a12011-11-15 18:46:24 -0800822static struct resource mdm_resources[] = {
823 {
824 .start = MDM2AP_ERRFATAL,
825 .end = MDM2AP_ERRFATAL,
826 .name = "MDM2AP_ERRFATAL",
827 .flags = IORESOURCE_IO,
828 },
829 {
830 .start = AP2MDM_ERRFATAL,
831 .end = AP2MDM_ERRFATAL,
832 .name = "AP2MDM_ERRFATAL",
833 .flags = IORESOURCE_IO,
834 },
835 {
836 .start = MDM2AP_STATUS,
837 .end = MDM2AP_STATUS,
838 .name = "MDM2AP_STATUS",
839 .flags = IORESOURCE_IO,
840 },
841 {
842 .start = AP2MDM_STATUS,
843 .end = AP2MDM_STATUS,
844 .name = "AP2MDM_STATUS",
845 .flags = IORESOURCE_IO,
846 },
847 {
848 .start = AP2MDM_PMIC_RESET_N,
849 .end = AP2MDM_PMIC_RESET_N,
850 .name = "AP2MDM_PMIC_RESET_N",
851 .flags = IORESOURCE_IO,
852 },
853 {
854 .start = AP2MDM_KPDPWR_N,
855 .end = AP2MDM_KPDPWR_N,
856 .name = "AP2MDM_KPDPWR_N",
857 .flags = IORESOURCE_IO,
858 },
859};
860
861static struct mdm_platform_data mdm_platform_data = {
862 .mdm_version = "2.5",
863};
864
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800865static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800866 .name = "mdm2_modem",
867 .id = -1,
868 .num_resources = ARRAY_SIZE(mdm_resources),
869 .resource = mdm_resources,
870 .dev = {
871 .platform_data = &mdm_platform_data,
872 },
873};
874
875static struct platform_device *mdm_devices[] __initdata = {
876 &mdm_device,
877};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700878
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700879#define MSM_SHARED_RAM_PHYS 0x80000000
880
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800881static void __init msm8960_map_io(void)
882{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700883 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800884 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700885
886 if (socinfo_init() < 0)
887 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800888}
889
890static void __init msm8960_init_irq(void)
891{
Praveen Chidambaram78499012011-11-01 17:15:17 -0600892 struct msm_mpm_device_data *data = NULL;
893
894#ifdef CONFIG_MSM_MPM
895 data = &msm8960_mpm_dev_data;
896#endif
897
898 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800899 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700900 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800901
902 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800904
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
906 mb();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800907}
908
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909static void __init msm8960_init_buses(void)
910{
911#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -0600912 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -0600913 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
914 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
915 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
916 msm_bus_apps_fabric.dev.platform_data =
917 &msm_bus_8960_apps_fabric_pdata;
918 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
919 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
920 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
921 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700922#endif
923}
924
925static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
926 .max_clock_speed = 15060000,
927};
928
929#ifdef CONFIG_USB_MSM_OTG_72K
930static struct msm_otg_platform_data msm_otg_pdata;
931#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530932static int wr_phy_init_seq[] = {
933 0x44, 0x80, /* set VBUS valid threshold
934 and disconnect valid threshold */
935 0x38, 0x81, /* update DC voltage level */
936 0x14, 0x82, /* set preemphasis and rise/fall time */
937 0x13, 0x83, /* set source impedance adjusment */
938 -1};
939
940static int liquid_v1_phy_init_seq[] = {
941 0x44, 0x80,/* set VBUS valid threshold
942 and disconnect valid threshold */
943 0x3C, 0x81,/* update DC voltage level */
944 0x18, 0x82,/* set preemphasis and rise/fall time */
945 0x23, 0x83,/* set source impedance sdjusment */
946 -1};
947
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700948static struct msm_otg_platform_data msm_otg_pdata = {
949 .mode = USB_OTG,
950 .otg_control = OTG_PMIC_CONTROL,
951 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700952 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +0530953 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700954};
955#endif
956
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530957#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530958#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530959static struct msm_hsic_host_platform_data msm_hsic_pdata = {
960 .strobe = 150,
961 .data = 151,
962};
963#else
964static struct msm_hsic_host_platform_data msm_hsic_pdata;
965#endif
966
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700967#define PID_MAGIC_ID 0x71432909
968#define SERIAL_NUM_MAGIC_ID 0x61945374
969#define SERIAL_NUMBER_LENGTH 127
970#define DLOAD_USB_BASE_ADD 0x2A03F0C8
971
972struct magic_num_struct {
973 uint32_t pid;
974 uint32_t serial_num;
975};
976
977struct dload_struct {
978 uint32_t reserved1;
979 uint32_t reserved2;
980 uint32_t reserved3;
981 uint16_t reserved4;
982 uint16_t pid;
983 char serial_number[SERIAL_NUMBER_LENGTH];
984 uint16_t reserved5;
985 struct magic_num_struct magic_struct;
986};
987
988static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
989{
990 struct dload_struct __iomem *dload = 0;
991
992 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
993 if (!dload) {
994 pr_err("%s: cannot remap I/O memory region: %08x\n",
995 __func__, DLOAD_USB_BASE_ADD);
996 return -ENXIO;
997 }
998
999 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1000 __func__, dload, pid, snum);
1001 /* update pid */
1002 dload->magic_struct.pid = PID_MAGIC_ID;
1003 dload->pid = pid;
1004
1005 /* update serial number */
1006 dload->magic_struct.serial_num = 0;
1007 if (!snum) {
1008 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1009 goto out;
1010 }
1011
1012 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001013 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001014out:
1015 iounmap(dload);
1016 return 0;
1017}
1018
1019static struct android_usb_platform_data android_usb_pdata = {
1020 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1021};
1022
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001023static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001024 .name = "android_usb",
1025 .id = -1,
1026 .dev = {
1027 .platform_data = &android_usb_pdata,
1028 },
1029};
1030
1031static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1032 0x03, 0x0f,
1033};
1034
1035static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1036 0x00, 0x24, 0x54, 0x10,
1037 0x09, 0x03, 0x01,
1038 0x10, 0x54, 0x30, 0x0C,
1039 0x24, 0x30, 0x0f,
1040};
1041
1042static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1043 0x00, 0x24, 0x54, 0x10,
1044 0x09, 0x07, 0x01, 0x0B,
1045 0x10, 0x54, 0x30, 0x0C,
1046 0x24, 0x30, 0x0f,
1047};
1048
1049static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1050 [0] = {
1051 .mode = MSM_SPM_MODE_CLOCK_GATING,
1052 .notify_rpm = false,
1053 .cmd = spm_wfi_cmd_sequence,
1054 },
1055 [1] = {
1056 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1057 .notify_rpm = false,
1058 .cmd = spm_power_collapse_without_rpm,
1059 },
1060 [2] = {
1061 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1062 .notify_rpm = true,
1063 .cmd = spm_power_collapse_with_rpm,
1064 },
1065};
1066
1067static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1068 [0] = {
1069 .reg_base_addr = MSM_SAW0_BASE,
1070 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1071 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001072 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001073#if defined(CONFIG_MSM_AVS_HW)
1074 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1075 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1076#endif
1077 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1078 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1079 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1080 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1081 .vctl_timeout_us = 50,
1082 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1083 .modes = msm_spm_seq_list,
1084 },
1085 [1] = {
1086 .reg_base_addr = MSM_SAW1_BASE,
1087 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1088 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001089 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001090#if defined(CONFIG_MSM_AVS_HW)
1091 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1092 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1093#endif
1094 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1095 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1096 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1097 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1098 .vctl_timeout_us = 50,
1099 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1100 .modes = msm_spm_seq_list,
1101 },
1102};
1103
1104static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1105 0x00, 0x20, 0x03, 0x20,
1106 0x00, 0x0f,
1107};
1108
1109static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1110 0x00, 0x20, 0x34, 0x64,
1111 0x48, 0x07, 0x48, 0x20,
1112 0x50, 0x64, 0x04, 0x34,
1113 0x50, 0x0f,
1114};
1115static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1116 0x00, 0x10, 0x34, 0x64,
1117 0x48, 0x07, 0x48, 0x10,
1118 0x50, 0x64, 0x04, 0x34,
1119 0x50, 0x0F,
1120};
1121
1122static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1123 [0] = {
1124 .mode = MSM_SPM_L2_MODE_RETENTION,
1125 .notify_rpm = false,
1126 .cmd = l2_spm_wfi_cmd_sequence,
1127 },
1128 [1] = {
1129 .mode = MSM_SPM_L2_MODE_GDHS,
1130 .notify_rpm = true,
1131 .cmd = l2_spm_gdhs_cmd_sequence,
1132 },
1133 [2] = {
1134 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1135 .notify_rpm = true,
1136 .cmd = l2_spm_power_off_cmd_sequence,
1137 },
1138};
1139
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001140static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1141 [0] = {
1142 .reg_base_addr = MSM_SAW_L2_BASE,
1143 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1144 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1145 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1146 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1147 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1148 .modes = msm_spm_l2_seq_list,
1149 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1150 },
1151};
1152
Mohan Pallaka5e490392011-09-09 15:18:41 +05301153#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1154#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1155
1156static struct msm_xo_voter *xo_handle_d1;
1157
1158static int isa1200_power(int on)
1159{
1160 int rc = 0;
1161
1162 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1163
1164 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1165 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1166 if (rc < 0) {
1167 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1168 __func__, on ? "" : "de-", rc);
1169 goto err_xo_vote;
1170 }
1171
1172 return 0;
1173
1174err_xo_vote:
1175 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1176 return rc;
1177}
1178
1179static int isa1200_dev_setup(bool enable)
1180{
1181 int rc = 0;
1182
1183 struct pm_gpio hap_gpio_config = {
1184 .direction = PM_GPIO_DIR_OUT,
1185 .pull = PM_GPIO_PULL_NO,
1186 .out_strength = PM_GPIO_STRENGTH_HIGH,
1187 .function = PM_GPIO_FUNC_NORMAL,
1188 .inv_int_pol = 0,
1189 .vin_sel = 2,
1190 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1191 .output_value = 0,
1192 };
1193
1194 if (enable == true) {
1195 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1196 if (rc) {
1197 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1198 __func__, PM_HAP_EN_GPIO, rc);
1199 return rc;
1200 }
1201
1202 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1203 if (rc) {
1204 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1205 __func__, PM_HAP_LEN_GPIO, rc);
1206 return rc;
1207 }
1208
1209 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1210 if (rc) {
1211 pr_err("%s: unable to request gpio %d (%d)\n",
1212 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1213 return rc;
1214 }
1215
1216 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1217 if (rc) {
1218 pr_err("%s: Unable to set direction\n", __func__);
1219 goto free_gpio;
1220 }
1221
1222 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1223 if (IS_ERR(xo_handle_d1)) {
1224 rc = PTR_ERR(xo_handle_d1);
1225 pr_err("%s: failed to get the handle for D1(%d)\n",
1226 __func__, rc);
1227 goto gpio_set_dir;
1228 }
1229 } else {
1230 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1231
1232 msm_xo_put(xo_handle_d1);
1233 }
1234
1235 return 0;
1236
1237gpio_set_dir:
1238 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1239free_gpio:
1240 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1241 return rc;
1242}
1243
1244static struct isa1200_regulator isa1200_reg_data[] = {
1245 {
1246 .name = "vcc_i2c",
1247 .min_uV = ISA_I2C_VTG_MIN_UV,
1248 .max_uV = ISA_I2C_VTG_MAX_UV,
1249 .load_uA = ISA_I2C_CURR_UA,
1250 },
1251};
1252
1253static struct isa1200_platform_data isa1200_1_pdata = {
1254 .name = "vibrator",
1255 .dev_setup = isa1200_dev_setup,
1256 .power_on = isa1200_power,
1257 .hap_en_gpio = PM_HAP_EN_GPIO,
1258 .hap_len_gpio = PM_HAP_LEN_GPIO,
1259 .max_timeout = 15000,
1260 .mode_ctrl = PWM_GEN_MODE,
1261 .pwm_fd = {
1262 .pwm_div = 256,
1263 },
1264 .is_erm = false,
1265 .smart_en = true,
1266 .ext_clk_en = true,
1267 .chip_en = 1,
1268 .regulator_info = isa1200_reg_data,
1269 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1270};
1271
1272static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1273 {
1274 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301275 },
1276};
1277
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001278#define CYTTSP_TS_GPIO_IRQ 11
1279#define CYTTSP_TS_SLEEP_GPIO 50
1280#define CYTTSP_TS_RESOUT_N_GPIO 52
1281
1282/*virtual key support */
1283static ssize_t tma340_vkeys_show(struct kobject *kobj,
1284 struct kobj_attribute *attr, char *buf)
1285{
1286 return snprintf(buf, 200,
1287 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1288 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1289 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1290 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1291 "\n");
1292}
1293
1294static struct kobj_attribute tma340_vkeys_attr = {
1295 .attr = {
1296 .mode = S_IRUGO,
1297 },
1298 .show = &tma340_vkeys_show,
1299};
1300
1301static struct attribute *tma340_properties_attrs[] = {
1302 &tma340_vkeys_attr.attr,
1303 NULL
1304};
1305
1306static struct attribute_group tma340_properties_attr_group = {
1307 .attrs = tma340_properties_attrs,
1308};
1309
1310
1311static int cyttsp_platform_init(struct i2c_client *client)
1312{
1313 int rc = 0;
1314 static struct kobject *tma340_properties_kobj;
1315
1316 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1317 tma340_properties_kobj = kobject_create_and_add("board_properties",
1318 NULL);
1319 if (tma340_properties_kobj)
1320 rc = sysfs_create_group(tma340_properties_kobj,
1321 &tma340_properties_attr_group);
1322 if (!tma340_properties_kobj || rc)
1323 pr_err("%s: failed to create board_properties\n",
1324 __func__);
1325
1326 return 0;
1327}
1328
1329static struct cyttsp_regulator regulator_data[] = {
1330 {
1331 .name = "vdd",
1332 .min_uV = CY_TMA300_VTG_MIN_UV,
1333 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301334 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1335 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001336 },
1337 /* TODO: Remove after runtime PM is enabled in I2C driver */
1338 {
1339 .name = "vcc_i2c",
1340 .min_uV = CY_I2C_VTG_MIN_UV,
1341 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301342 .hpm_load_uA = CY_I2C_CURR_UA,
1343 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001344 },
1345};
1346
1347static struct cyttsp_platform_data cyttsp_pdata = {
1348 .panel_maxx = 634,
1349 .panel_maxy = 1166,
1350 .disp_maxx = 616,
1351 .disp_maxy = 1023,
1352 .disp_minx = 0,
1353 .disp_miny = 16,
1354 .flags = 0x01,
1355 .gen = CY_GEN3, /* or */
1356 .use_st = CY_USE_ST,
1357 .use_mt = CY_USE_MT,
1358 .use_hndshk = CY_SEND_HNDSHK,
1359 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301360 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361 .use_gestures = CY_USE_GESTURES,
1362 .fw_fname = "cyttsp_8960_cdp.hex",
1363 /* activate up to 4 groups
1364 * and set active distance
1365 */
1366 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1367 CY_GEST_GRP3 | CY_GEST_GRP4 |
1368 CY_ACT_DIST,
1369 /* change act_intrvl to customize the Active power state
1370 * scanning/processing refresh interval for Operating mode
1371 */
1372 .act_intrvl = CY_ACT_INTRVL_DFLT,
1373 /* change tch_tmout to customize the touch timeout for the
1374 * Active power state for Operating mode
1375 */
1376 .tch_tmout = CY_TCH_TMOUT_DFLT,
1377 /* change lp_intrvl to customize the Low Power power state
1378 * scanning/processing refresh interval for Operating mode
1379 */
1380 .lp_intrvl = CY_LP_INTRVL_DFLT,
1381 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1382 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1383 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1384 .regulator_info = regulator_data,
1385 .num_regulators = ARRAY_SIZE(regulator_data),
1386 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301387 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001388};
1389
1390static struct i2c_board_info cyttsp_info[] __initdata = {
1391 {
1392 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1393 .platform_data = &cyttsp_pdata,
1394#ifndef CY_USE_TIMER
1395 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1396#endif /* CY_USE_TIMER */
1397 },
1398};
1399
Mohan Pallaka50837382011-09-07 11:00:57 +05301400/* configuration data */
1401static const u8 mxt_config_data[] = {
1402 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001403 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301404 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001405 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001406 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1407 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1408 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1409 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1410 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1411 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301412 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001413 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301414 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001415 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301416 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001417 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1418 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1419 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1420 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301421 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001422 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1423 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301424 /* T18 Object */
1425 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301426 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001427 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1428 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301429 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001430 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1431 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301432 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001433 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1434 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301435 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001436 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301437 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001438 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301439 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001440 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301441 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001442 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301443 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001444 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301445};
1446
Amy Maloche08266db2011-11-04 11:07:16 -07001447#define MXT_TS_GPIO_IRQ 11
1448#define MXT_TS_LDO_EN_GPIO 50
1449#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301450
1451static void mxt_init_hw_liquid(void)
1452{
1453 int rc;
1454
Mohan Pallaka50837382011-09-07 11:00:57 +05301455 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1456 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001457 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1458 __func__, MXT_TS_LDO_EN_GPIO);
1459 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301460 }
1461
1462 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1463 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001464 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1465 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301466 goto err_ldo_gpio_req;
1467 }
1468
Mohan Pallaka50837382011-09-07 11:00:57 +05301469 return;
1470
Mohan Pallaka50837382011-09-07 11:00:57 +05301471err_ldo_gpio_req:
1472 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301473}
1474
1475static struct mxt_platform_data mxt_platform_data = {
1476 .config = mxt_config_data,
1477 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001478 .x_size = 1365,
1479 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301480 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001481 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001482 .reset_gpio = MXT_TS_RESET_GPIO,
1483 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301484};
1485
1486static struct i2c_board_info mxt_device_info[] __initdata = {
1487 {
1488 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1489 .platform_data = &mxt_platform_data,
1490 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1491 },
1492};
1493
Eugene Yasmand2316b82011-12-07 18:23:48 +02001494static struct i2c_board_info sii_device_info[] __initdata = {
1495 {
1496 I2C_BOARD_INFO("Sil-9244", 0x39),
1497 .flags = I2C_CLIENT_WAKE,
1498 .irq = MSM_GPIO_TO_INT(15),
1499 },
1500};
1501
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001502static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1503 .clk_freq = 100000,
1504 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001505};
1506
1507static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1508 .clk_freq = 100000,
1509 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001510};
1511
1512static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1513 .clk_freq = 100000,
1514 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001515};
1516
1517static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1518 .clk_freq = 100000,
1519 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001520};
1521
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06001522static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1523 .base_addr = MSM_ACC0_BASE + 0x08,
1524 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1525 .mask = 1UL << 13,
1526};
1527
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001528static struct ks8851_pdata spi_eth_pdata = {
1529 .irq_gpio = KS8851_IRQ_GPIO,
1530 .rst_gpio = KS8851_RST_GPIO,
1531};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001532
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001533static struct spi_board_info spi_board_info[] __initdata = {
1534 {
1535 .modalias = "ks8851",
1536 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1537 .max_speed_hz = 19200000,
1538 .bus_num = 0,
1539 .chip_select = 0,
1540 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001541 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001542 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001543 {
1544 .modalias = "dsi_novatek_3d_panel_spi",
1545 .max_speed_hz = 10800000,
1546 .bus_num = 0,
1547 .chip_select = 1,
1548 .mode = SPI_MODE_0,
1549 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001550};
1551
1552static struct platform_device msm_device_saw_core0 = {
1553 .name = "saw-regulator",
1554 .id = 0,
1555 .dev = {
1556 .platform_data = &msm_saw_regulator_pdata_s5,
1557 },
1558};
1559
1560static struct platform_device msm_device_saw_core1 = {
1561 .name = "saw-regulator",
1562 .id = 1,
1563 .dev = {
1564 .platform_data = &msm_saw_regulator_pdata_s6,
1565 },
1566};
1567
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001568static struct tsens_platform_data msm_tsens_pdata = {
1569 .slope = 910,
1570 .tsens_factor = 1000,
1571 .hw_type = MSM_8960,
1572 .tsens_num_sensor = 5,
1573};
1574
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001575#ifdef CONFIG_MSM_FAKE_BATTERY
1576static struct platform_device fish_battery_device = {
1577 .name = "fish_battery",
1578};
1579#endif
1580
David Collins26f05562011-06-20 09:56:28 -07001581static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001582 .name = GPIO_REGULATOR_DEV_NAME,
1583 .id = PM8921_MPP_PM_TO_SYS(7),
1584 .dev = {
1585 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1586 },
1587};
1588
David Collins26f05562011-06-20 09:56:28 -07001589static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001590 .name = GPIO_REGULATOR_DEV_NAME,
1591 .id = 91,
1592 .dev = {
1593 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1594 },
1595};
1596
David Collinsb10be1d2011-09-02 10:29:31 -07001597static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1598 .name = GPIO_REGULATOR_DEV_NAME,
1599 .id = PM8921_GPIO_PM_TO_SYS(17),
1600 .dev = {
1601 .platform_data =
1602 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1603 },
1604};
1605
David Collins35a78f52011-12-14 15:54:25 -08001606static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1607 .name = GPIO_REGULATOR_DEV_NAME,
1608 .id = PM8921_GPIO_PM_TO_SYS(42),
1609 .dev = {
1610 .platform_data =
1611 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1612 },
1613};
1614
David Collins26f05562011-06-20 09:56:28 -07001615static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1616 .name = "rpm-regulator",
1617 .id = -1,
1618 .dev = {
1619 .platform_data = &msm_rpm_regulator_pdata,
1620 },
1621};
1622
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001623static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001624 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001625 &msm_device_smd,
1626 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301627 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001628 &msm_device_saw_core0,
1629 &msm_device_saw_core1,
1630 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001631 &msm8960_device_ssbi_pmic,
David Collins35a78f52011-12-14 15:54:25 -08001632 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001633 &msm8960_device_qup_spi_gsbi1,
1634 &msm8960_device_qup_i2c_gsbi3,
1635 &msm8960_device_qup_i2c_gsbi4,
1636 &msm8960_device_qup_i2c_gsbi10,
1637#ifndef CONFIG_MSM_DSPS
1638 &msm8960_device_qup_i2c_gsbi12,
1639#endif
1640 &msm_slim_ctrl,
1641 &msm_device_wcnss_wlan,
1642#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1643 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1644 &qcrypto_device,
1645#endif
1646
1647#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1648 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1649 &qcedev_device,
1650#endif
1651#ifdef CONFIG_MSM_ROTATOR
1652 &msm_rotator_device,
1653#endif
1654 &msm_device_sps,
1655#ifdef CONFIG_MSM_FAKE_BATTERY
1656 &fish_battery_device,
1657#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001658 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001659#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001660#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001661 &android_pmem_device,
1662 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001663#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001664 &android_pmem_audio_device,
1665#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001666 &msm_device_vidc,
1667 &msm_device_bam_dmux,
1668 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001669
1670#ifdef CONFIG_HW_RANDOM_MSM
1671 &msm_device_rng,
1672#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001673#ifdef CONFIG_ION_MSM
1674 &ion_dev,
1675#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06001676 &msm8960_rpm_device,
1677 &msm8960_rpm_log_device,
1678 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001679 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07001680#ifdef CONFIG_MSM_QDSS
1681 &msm_etb_device,
1682 &msm_tpiu_device,
1683 &msm_funnel_device,
1684 &msm_ptm_device,
1685#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001686 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001687 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001688};
1689
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001690static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001691 &msm8960_device_otg,
1692 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001693 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301694 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001695 &android_usb_device,
1696 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001697 &msm_bus_apps_fabric,
1698 &msm_bus_sys_fabric,
1699 &msm_bus_mm_fabric,
1700 &msm_bus_sys_fpb,
1701 &msm_bus_cpss_fpb,
1702 &msm_pcm,
1703 &msm_pcm_routing,
1704 &msm_cpudai0,
1705 &msm_cpudai1,
1706 &msm_cpudai_hdmi_rx,
1707 &msm_cpudai_bt_rx,
1708 &msm_cpudai_bt_tx,
1709 &msm_cpudai_fm_rx,
1710 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001711 &msm_cpudai_auxpcm_rx,
1712 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001713 &msm_cpu_fe,
1714 &msm_stub_codec,
1715 &msm_voice,
1716 &msm_voip,
1717 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301718 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001719 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001720 &msm_cpudai_incall_record_rx,
1721 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001722
1723#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1724 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1725 &qcrypto_device,
1726#endif
1727
1728#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1729 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1730 &qcedev_device,
1731#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001732};
1733
1734static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001735 &msm_kgsl_3d0,
1736 &msm_kgsl_2d0,
1737 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001738#ifdef CONFIG_MSM_GEMINI
1739 &msm8960_gemini_device,
1740#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001741};
1742
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001743static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001744 &msm_8960_q6_lpass,
1745 &msm_8960_q6_mss_fw,
1746 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001747 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001748 &msm_pil_tzapps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001749 &msm8960_device_otg,
1750 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001751 &msm_device_hsusb_host,
1752 &android_usb_device,
1753 &msm_pcm,
1754 &msm_pcm_routing,
1755 &msm_cpudai0,
1756 &msm_cpudai1,
1757 &msm_cpudai_hdmi_rx,
1758 &msm_cpudai_bt_rx,
1759 &msm_cpudai_bt_tx,
1760 &msm_cpudai_fm_rx,
1761 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001762 &msm_cpudai_auxpcm_rx,
1763 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764 &msm_cpu_fe,
1765 &msm_stub_codec,
1766 &msm_kgsl_3d0,
1767#ifdef CONFIG_MSM_KGSL_2D
1768 &msm_kgsl_2d0,
1769 &msm_kgsl_2d1,
1770#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001771#ifdef CONFIG_MSM_GEMINI
1772 &msm8960_gemini_device,
1773#endif
1774 &msm_voice,
1775 &msm_voip,
1776 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301777 &msm_cpudai_afe_01_rx,
1778 &msm_cpudai_afe_01_tx,
1779 &msm_cpudai_afe_02_rx,
1780 &msm_cpudai_afe_02_tx,
1781 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301782 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001783 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001784 &msm_cpudai_incall_record_rx,
1785 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001786 &msm_pcm_hostless,
1787 &msm_bus_apps_fabric,
1788 &msm_bus_sys_fabric,
1789 &msm_bus_mm_fabric,
1790 &msm_bus_sys_fpb,
1791 &msm_bus_cpss_fpb,
1792};
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 = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001821
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001822 {0, 0, "C0", "WFI",
1823 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1824
1825 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1826 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1827
1828 {0, 2, "C2", "POWER_COLLAPSE",
1829 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1830
1831 {1, 0, "C0", "WFI",
1832 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1833
1834 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1835 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1836};
1837
1838static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1839 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1840 .idle_supported = 1,
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(0, 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(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1854 .idle_supported = 1,
1855 .suspend_supported = 1,
1856 .idle_enabled = 1,
1857 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001858 },
1859
1860 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1861 .idle_supported = 0,
1862 .suspend_supported = 1,
1863 .idle_enabled = 0,
1864 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001865 },
1866
1867 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1868 .idle_supported = 1,
1869 .suspend_supported = 1,
1870 .idle_enabled = 0,
1871 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001872 },
1873
1874 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1875 .idle_supported = 1,
1876 .suspend_supported = 0,
1877 .idle_enabled = 1,
1878 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001879 },
1880};
1881
1882static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1883 {
1884 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1885 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1886 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001887 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001888 },
1889
1890 {
1891 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1892 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1893 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001894 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001895 },
1896
1897 {
1898 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1899 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1900 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001901 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001902 },
1903
1904 {
1905 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1906 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1907 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001908 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001909 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001910 {
1911 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1912 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1913 false,
1914 7000, 3500, 66600000, 5150,
1915 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001916
1917 {
1918 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1919 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1920 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001921 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001922 },
1923
1924 {
1925 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1926 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1927 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001928 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001929 },
1930
1931 {
1932 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1933 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1934 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001935 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001936 },
1937
1938 {
1939 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1940 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1941 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001942 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001943 },
1944};
1945
Praveen Chidambaram78499012011-11-01 17:15:17 -06001946static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1947 .levels = &msm_rpmrs_levels[0],
1948 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1949 .vdd_mem_levels = {
1950 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1951 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1952 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1953 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1954 },
1955 .vdd_dig_levels = {
1956 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1957 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1958 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1959 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1960 },
1961 .vdd_mask = 0x7FFFFF,
1962 .rpmrs_target_id = {
1963 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
1964 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1965 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
1966 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
1967 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
1968 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
1969 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1970 },
1971};
1972
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001973static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1974 .mode = MSM_PM_BOOT_CONFIG_TZ,
1975};
1976
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001977#ifdef CONFIG_I2C
1978#define I2C_SURF 1
1979#define I2C_FFA (1 << 1)
1980#define I2C_RUMI (1 << 2)
1981#define I2C_SIM (1 << 3)
1982#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03001983#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001984
1985struct i2c_registry {
1986 u8 machs;
1987 int bus;
1988 struct i2c_board_info *info;
1989 int len;
1990};
1991
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001992/* Sensors DSPS platform data */
1993#ifdef CONFIG_MSM_DSPS
1994#define DSPS_PIL_GENERIC_NAME "dsps"
1995#endif /* CONFIG_MSM_DSPS */
1996
1997static void __init msm8960_init_dsps(void)
1998{
1999#ifdef CONFIG_MSM_DSPS
2000 struct msm_dsps_platform_data *pdata =
2001 msm_dsps_device.dev.platform_data;
2002 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2003 pdata->gpios = NULL;
2004 pdata->gpios_num = 0;
2005
2006 platform_device_register(&msm_dsps_device);
2007#endif /* CONFIG_MSM_DSPS */
2008}
2009
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002010static int hsic_peripheral_status = 1;
2011static DEFINE_MUTEX(hsic_status_lock);
2012
2013void peripheral_connect()
2014{
2015 mutex_lock(&hsic_status_lock);
2016 if (hsic_peripheral_status)
2017 goto out;
2018 platform_device_add(&msm_device_hsic_host);
2019 hsic_peripheral_status = 1;
2020out:
2021 mutex_unlock(&hsic_status_lock);
2022}
2023EXPORT_SYMBOL(peripheral_connect);
2024
2025void peripheral_disconnect()
2026{
2027 mutex_lock(&hsic_status_lock);
2028 if (!hsic_peripheral_status)
2029 goto out;
2030 platform_device_del(&msm_device_hsic_host);
2031 hsic_peripheral_status = 0;
2032out:
2033 mutex_unlock(&hsic_status_lock);
2034}
2035EXPORT_SYMBOL(peripheral_disconnect);
2036
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002037static void __init msm8960_init_hsic(void)
2038{
2039#ifdef CONFIG_USB_EHCI_MSM_HSIC
2040 uint32_t version = socinfo_get_version();
2041
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002042 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002043 return;
2044
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002045 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002046 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002047#endif
2048}
2049
Amir Samuelov5137e392011-09-21 17:31:25 +03002050#ifdef CONFIG_ISL9519_CHARGER
2051static struct isl_platform_data isl_data __initdata = {
2052 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2053 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2054 .max_system_voltage = 4200,
2055 .min_system_voltage = 3200,
2056 .chgcurrent = 1000, /* 1900, */
2057 .term_current = 400, /* Need fine tuning */
2058 .input_current = 2048,
2059};
2060
2061static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2062 {
2063 I2C_BOARD_INFO("isl9519q", 0x9),
2064 .irq = 0, /* Not required when notify-by-pmic */
2065 .platform_data = &isl_data,
2066 },
2067};
2068#endif /* CONFIG_ISL9519_CHARGER */
2069
Amir Samuelov755616d2011-12-13 16:34:46 +02002070static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2071 {
2072 I2C_BOARD_INFO("sx1508q", 0x20),
2073 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2074 },
2075};
2076
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002077static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002078#ifdef CONFIG_ISL9519_CHARGER
2079 {
2080 I2C_LIQUID,
2081 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2082 isl_charger_i2c_info,
2083 ARRAY_SIZE(isl_charger_i2c_info),
2084 },
2085#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002086 {
2087 I2C_SURF | I2C_FFA | I2C_FLUID,
2088 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2089 cyttsp_info,
2090 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002091 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302092 {
2093 I2C_LIQUID,
2094 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2095 mxt_device_info,
2096 ARRAY_SIZE(mxt_device_info),
2097 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302098 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302099 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302100 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002101 sii_device_info,
2102 ARRAY_SIZE(sii_device_info),
2103 },
2104 {
2105 I2C_LIQUID,
2106 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302107 msm_isa1200_board_info,
2108 ARRAY_SIZE(msm_isa1200_board_info),
2109 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002110 {
2111 I2C_LIQUID,
2112 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2113 liquid_io_expander_i2c_info,
2114 ARRAY_SIZE(liquid_io_expander_i2c_info),
2115 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002116};
2117#endif /* CONFIG_I2C */
2118
2119static void __init register_i2c_devices(void)
2120{
2121#ifdef CONFIG_I2C
2122 u8 mach_mask = 0;
2123 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002124#ifdef CONFIG_MSM_CAMERA
2125 struct i2c_registry msm8960_camera_i2c_devices = {
2126 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2127 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2128 msm8960_camera_board_info.board_info,
2129 msm8960_camera_board_info.num_i2c_board_info,
2130 };
2131#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002132
2133 /* Build the matching 'supported_machs' bitmask */
2134 if (machine_is_msm8960_cdp())
2135 mach_mask = I2C_SURF;
2136 else if (machine_is_msm8960_rumi3())
2137 mach_mask = I2C_RUMI;
2138 else if (machine_is_msm8960_sim())
2139 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002140 else if (machine_is_msm8960_fluid())
2141 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002142 else if (machine_is_msm8960_liquid())
2143 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002144 else if (machine_is_msm8960_mtp())
2145 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002146 else
2147 pr_err("unmatched machine ID in register_i2c_devices\n");
2148
2149 /* Run the array and install devices as appropriate */
2150 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2151 if (msm8960_i2c_devices[i].machs & mach_mask)
2152 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2153 msm8960_i2c_devices[i].info,
2154 msm8960_i2c_devices[i].len);
2155 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002156#ifdef CONFIG_MSM_CAMERA
2157 if (msm8960_camera_i2c_devices.machs & mach_mask)
2158 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2159 msm8960_camera_i2c_devices.info,
2160 msm8960_camera_i2c_devices.len);
2161#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002162#endif
2163}
2164
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002165static void __init msm8960_sim_init(void)
2166{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002167 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2168 &msm8960_device_watchdog.dev.platform_data;
2169
2170 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002171 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002172 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2173 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002174 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_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002177 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002178
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002179 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002180 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002181 msm8960_i2c_init();
2182 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2183 msm_spm_l2_init(msm_spm_l2_data);
2184 msm8960_init_buses();
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(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002188 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002189
2190 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2191 &msm8960_qup_spi_gsbi1_pdata;
2192 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2193
2194 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002195 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002196 slim_register_board_info(msm_slim_devices,
2197 ARRAY_SIZE(msm_slim_devices));
2198 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2199 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2200 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2201 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002202 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002203 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002204}
2205
2206static void __init msm8960_rumi3_init(void)
2207{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002208 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002209 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2210 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002211 regulator_suppress_info_printing();
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_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002214 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002215 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002216 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2217 &msm8960_qup_spi_gsbi1_pdata;
2218 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2219 msm8960_i2c_init();
2220 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2221 msm_spm_l2_init(msm_spm_l2_data);
2222 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002223 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002224 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002225 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002226 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002227 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002228 slim_register_board_info(msm_slim_devices,
2229 ARRAY_SIZE(msm_slim_devices));
2230 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2231 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2232 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2233 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002234 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002235 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002236}
2237
2238static void __init msm8960_cdp_init(void)
2239{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002240 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2241 pr_err("meminfo_init() failed!\n");
2242
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002243 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002244 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2245 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002246
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002247 regulator_suppress_info_printing();
2248 if (msm_xo_init())
2249 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002250 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002251 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302252 if (machine_is_msm8960_liquid())
2253 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002254 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302255 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2256 machine_is_msm8960_cdp()) {
2257 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2258 } else if (machine_is_msm8960_liquid()) {
2259 msm_otg_pdata.phy_init_seq =
2260 liquid_v1_phy_init_seq;
2261 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302262 msm_otg_pdata.swfi_latency =
2263 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302264#ifdef CONFIG_USB_EHCI_MSM_HSIC
2265 if (machine_is_msm8960_liquid()) {
2266 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2267 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2268 }
2269#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302270 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002271 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002272 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2273 &msm8960_qup_spi_gsbi1_pdata;
2274 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002275
2276 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302277 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2278 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2279 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002280 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002281 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2283 msm_spm_l2_init(msm_spm_l2_data);
2284 msm8960_init_buses();
2285 platform_add_devices(msm_footswitch_devices,
2286 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002287 if (machine_is_msm8960_liquid())
2288 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002289 if (machine_is_msm8960_cdp())
2290 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002291 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002292 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002293 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002294 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002295 msm8960_init_cam();
2296 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002297 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302298 if (machine_is_msm8960_liquid())
2299 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002300 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002301 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002302 slim_register_board_info(msm_slim_devices,
2303 ARRAY_SIZE(msm_slim_devices));
2304 msm8960_init_dsps();
2305 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2306 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2307 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2308 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002309 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002310 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002311 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08002312 if (PLATFORM_IS_CHARM25())
2313 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002314}
2315
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002316MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2317 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002318 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002319 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302320 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002321 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002322 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002323 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002324 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002325MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002326
2327MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2328 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002329 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002330 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302331 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002332 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002333 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002334 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002335 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002336MACHINE_END
2337
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002338MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2339 .map_io = msm8960_map_io,
2340 .reserve = msm8960_reserve,
2341 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302342 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002343 .timer = &msm_timer,
2344 .init_machine = msm8960_cdp_init,
2345 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002346 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347MACHINE_END
2348
2349MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2350 .map_io = msm8960_map_io,
2351 .reserve = msm8960_reserve,
2352 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302353 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002354 .timer = &msm_timer,
2355 .init_machine = msm8960_cdp_init,
2356 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002357 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002358MACHINE_END
2359
2360MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2361 .map_io = msm8960_map_io,
2362 .reserve = msm8960_reserve,
2363 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302364 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002365 .timer = &msm_timer,
2366 .init_machine = msm8960_cdp_init,
2367 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002368 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002369MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002370
2371MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2372 .map_io = msm8960_map_io,
2373 .reserve = msm8960_reserve,
2374 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302375 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002376 .timer = &msm_timer,
2377 .init_machine = msm8960_cdp_init,
2378 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002379 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002380MACHINE_END