blob: d628eebae60f6aff071b86d53c9f2774f85a8480 [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
Jing Lindc4413c2012-01-16 15:22:52 -08001400/* configuration data for mxt1386 */
1401static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301402 /* 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
Jing Lin33b007d2011-12-21 17:40:23 -08001447/* configuration data for mxt1386e using V1.0 firmware */
1448static const u8 mxt1386e_config_data_v1_0[] = {
1449 /* T6 Object */
1450 0, 0, 0, 0, 0, 0,
1451 /* T38 Object */
1452 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1453 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1454 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1455 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1456 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1457 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1458 0, 0, 0, 0,
1459 /* T7 Object */
1460 100, 16, 50,
1461 /* T8 Object */
1462 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1463 /* T9 Object */
1464 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1465 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1466 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1467 10, 5, 0, 0, 0,
1468 /* T18 Object */
1469 0, 0,
1470 /* T24 Object */
1471 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1472 0, 0, 0, 0, 0, 0, 0, 0, 0,
1473 /* T25 Object */
1474 3, 0, 60, 115, 156, 99,
1475 /* T27 Object */
1476 0, 0, 0, 0, 0, 0, 0,
1477 /* T40 Object */
1478 0, 0, 0, 0, 0,
1479 /* T42 Object */
1480 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1481 /* T43 Object */
1482 0, 0, 0, 0, 0, 0, 0,
1483 /* T46 Object */
1484 64, 0, 20, 20, 0, 0, 0, 0, 0,
1485 /* T47 Object */
1486 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1487 /* T48 Object */
1488 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1489 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1490 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1491 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1492 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1493 0, 0, 0, 0,
1494 /* T56 Object */
1495 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1496 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1497 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1498 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1499 2, 99, 33,
1500};
1501
1502/* configuration data for mxt1386e using V2.1 firmware */
1503static const u8 mxt1386e_config_data_v2_1[] = {
1504 /* T6 Object */
1505 0, 0, 0, 0, 0, 0,
1506 /* T38 Object */
1507 12, 2, 0, 17, 1, 12, 0, 0, 0, 0,
1508 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1509 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1510 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1511 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1512 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1513 0, 0, 0, 0,
1514 /* T7 Object */
1515 100, 16, 50,
1516 /* T8 Object */
1517 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1518 /* T9 Object */
1519 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1520 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1521 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1522 10, 5, 0, 0, 0,
1523 /* T18 Object */
1524 0, 0,
1525 /* T24 Object */
1526 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1527 0, 0, 0, 0, 0, 0, 0, 0, 0,
1528 /* T25 Object */
1529 3, 0, 60, 115, 156, 99,
1530 /* T27 Object */
1531 0, 0, 0, 0, 0, 0, 0,
1532 /* T40 Object */
1533 0, 0, 0, 0, 0,
1534 /* T42 Object */
1535 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1536 /* T43 Object */
1537 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1538 16,
1539 /* T46 Object */
1540 64, 0, 20, 20, 0, 0, 0, 0, 0,
1541 /* T47 Object */
1542 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1543 /* T48 Object */
1544 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1545 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1546 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1547 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1548 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1549 0, 0, 0, 0,
1550 /* T56 Object */
1551 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1552 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1553 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1554 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1555 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
1556 255,
1557};
1558
Amy Maloche08266db2011-11-04 11:07:16 -07001559#define MXT_TS_GPIO_IRQ 11
1560#define MXT_TS_LDO_EN_GPIO 50
1561#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301562
1563static void mxt_init_hw_liquid(void)
1564{
1565 int rc;
1566
Mohan Pallaka50837382011-09-07 11:00:57 +05301567 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1568 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001569 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1570 __func__, MXT_TS_LDO_EN_GPIO);
1571 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301572 }
1573
1574 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1575 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001576 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1577 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301578 goto err_ldo_gpio_req;
1579 }
1580
Mohan Pallaka50837382011-09-07 11:00:57 +05301581 return;
1582
Mohan Pallaka50837382011-09-07 11:00:57 +05301583err_ldo_gpio_req:
1584 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301585}
1586
Jing Lindc4413c2012-01-16 15:22:52 -08001587static struct mxt_config_info mxt_config_array[] = {
1588 {
1589 .config = mxt1386_config_data,
1590 .config_length = ARRAY_SIZE(mxt1386_config_data),
1591 .family_id = 0xA0,
1592 .variant_id = 0x0,
1593 .version = 0x10,
1594 .build = 0xAA,
1595 },
Jing Lin33b007d2011-12-21 17:40:23 -08001596 {
1597 .config = mxt1386e_config_data_v1_0,
1598 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
1599 .family_id = 0xA0,
1600 .variant_id = 0x2,
1601 .version = 0x10,
1602 .build = 0xAA,
1603 },
1604 {
1605 .config = mxt1386e_config_data_v2_1,
1606 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1607 .family_id = 0xA0,
1608 .variant_id = 0x7,
1609 .version = 0x21,
1610 .build = 0xAA,
1611 },
Jing Lindc4413c2012-01-16 15:22:52 -08001612};
1613
Mohan Pallaka50837382011-09-07 11:00:57 +05301614static struct mxt_platform_data mxt_platform_data = {
Jing Lindc4413c2012-01-16 15:22:52 -08001615 .config_array = mxt_config_array,
1616 .config_array_size = ARRAY_SIZE(mxt_config_array),
Jing Lin2f863172011-10-17 10:56:58 -07001617 .x_size = 1365,
1618 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301619 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001620 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001621 .reset_gpio = MXT_TS_RESET_GPIO,
1622 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301623};
1624
1625static struct i2c_board_info mxt_device_info[] __initdata = {
1626 {
1627 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1628 .platform_data = &mxt_platform_data,
1629 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1630 },
1631};
1632
Eugene Yasmand2316b82011-12-07 18:23:48 +02001633static struct i2c_board_info sii_device_info[] __initdata = {
1634 {
1635 I2C_BOARD_INFO("Sil-9244", 0x39),
1636 .flags = I2C_CLIENT_WAKE,
1637 .irq = MSM_GPIO_TO_INT(15),
1638 },
1639};
1640
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001641static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1642 .clk_freq = 100000,
1643 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001644};
1645
1646static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1647 .clk_freq = 100000,
1648 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001649};
1650
1651static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1652 .clk_freq = 100000,
1653 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001654};
1655
1656static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1657 .clk_freq = 100000,
1658 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001659};
1660
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06001661static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1662 .base_addr = MSM_ACC0_BASE + 0x08,
1663 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1664 .mask = 1UL << 13,
1665};
1666
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001667static struct ks8851_pdata spi_eth_pdata = {
1668 .irq_gpio = KS8851_IRQ_GPIO,
1669 .rst_gpio = KS8851_RST_GPIO,
1670};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001671
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001672static struct spi_board_info spi_board_info[] __initdata = {
1673 {
1674 .modalias = "ks8851",
1675 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1676 .max_speed_hz = 19200000,
1677 .bus_num = 0,
1678 .chip_select = 0,
1679 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001680 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001681 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001682 {
1683 .modalias = "dsi_novatek_3d_panel_spi",
1684 .max_speed_hz = 10800000,
1685 .bus_num = 0,
1686 .chip_select = 1,
1687 .mode = SPI_MODE_0,
1688 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689};
1690
1691static struct platform_device msm_device_saw_core0 = {
1692 .name = "saw-regulator",
1693 .id = 0,
1694 .dev = {
1695 .platform_data = &msm_saw_regulator_pdata_s5,
1696 },
1697};
1698
1699static struct platform_device msm_device_saw_core1 = {
1700 .name = "saw-regulator",
1701 .id = 1,
1702 .dev = {
1703 .platform_data = &msm_saw_regulator_pdata_s6,
1704 },
1705};
1706
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001707static struct tsens_platform_data msm_tsens_pdata = {
1708 .slope = 910,
1709 .tsens_factor = 1000,
1710 .hw_type = MSM_8960,
1711 .tsens_num_sensor = 5,
1712};
1713
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001714#ifdef CONFIG_MSM_FAKE_BATTERY
1715static struct platform_device fish_battery_device = {
1716 .name = "fish_battery",
1717};
1718#endif
1719
David Collins26f05562011-06-20 09:56:28 -07001720static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001721 .name = GPIO_REGULATOR_DEV_NAME,
1722 .id = PM8921_MPP_PM_TO_SYS(7),
1723 .dev = {
1724 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1725 },
1726};
1727
David Collins26f05562011-06-20 09:56:28 -07001728static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001729 .name = GPIO_REGULATOR_DEV_NAME,
1730 .id = 91,
1731 .dev = {
1732 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1733 },
1734};
1735
David Collinsb10be1d2011-09-02 10:29:31 -07001736static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1737 .name = GPIO_REGULATOR_DEV_NAME,
1738 .id = PM8921_GPIO_PM_TO_SYS(17),
1739 .dev = {
1740 .platform_data =
1741 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1742 },
1743};
1744
David Collins35a78f52011-12-14 15:54:25 -08001745static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1746 .name = GPIO_REGULATOR_DEV_NAME,
1747 .id = PM8921_GPIO_PM_TO_SYS(42),
1748 .dev = {
1749 .platform_data =
1750 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1751 },
1752};
1753
David Collins26f05562011-06-20 09:56:28 -07001754static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1755 .name = "rpm-regulator",
1756 .id = -1,
1757 .dev = {
1758 .platform_data = &msm_rpm_regulator_pdata,
1759 },
1760};
1761
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001762static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001763 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764 &msm_device_smd,
1765 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301766 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001767 &msm_device_saw_core0,
1768 &msm_device_saw_core1,
1769 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001770 &msm8960_device_ssbi_pmic,
David Collins35a78f52011-12-14 15:54:25 -08001771 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001772 &msm8960_device_qup_spi_gsbi1,
1773 &msm8960_device_qup_i2c_gsbi3,
1774 &msm8960_device_qup_i2c_gsbi4,
1775 &msm8960_device_qup_i2c_gsbi10,
1776#ifndef CONFIG_MSM_DSPS
1777 &msm8960_device_qup_i2c_gsbi12,
1778#endif
1779 &msm_slim_ctrl,
1780 &msm_device_wcnss_wlan,
1781#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1782 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1783 &qcrypto_device,
1784#endif
1785
1786#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1787 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1788 &qcedev_device,
1789#endif
1790#ifdef CONFIG_MSM_ROTATOR
1791 &msm_rotator_device,
1792#endif
1793 &msm_device_sps,
1794#ifdef CONFIG_MSM_FAKE_BATTERY
1795 &fish_battery_device,
1796#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001797 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001798#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001799#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001800 &android_pmem_device,
1801 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001802#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001803 &android_pmem_audio_device,
1804#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001805 &msm_device_vidc,
1806 &msm_device_bam_dmux,
1807 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001808
1809#ifdef CONFIG_HW_RANDOM_MSM
1810 &msm_device_rng,
1811#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001812#ifdef CONFIG_ION_MSM
1813 &ion_dev,
1814#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06001815 &msm8960_rpm_device,
1816 &msm8960_rpm_log_device,
1817 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001818 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07001819#ifdef CONFIG_MSM_QDSS
1820 &msm_etb_device,
1821 &msm_tpiu_device,
1822 &msm_funnel_device,
1823 &msm_ptm_device,
1824#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001825 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001826 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001827};
1828
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001829static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001830 &msm8960_device_otg,
1831 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001832 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301833 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001834 &android_usb_device,
1835 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001836 &msm_bus_apps_fabric,
1837 &msm_bus_sys_fabric,
1838 &msm_bus_mm_fabric,
1839 &msm_bus_sys_fpb,
1840 &msm_bus_cpss_fpb,
1841 &msm_pcm,
1842 &msm_pcm_routing,
1843 &msm_cpudai0,
1844 &msm_cpudai1,
1845 &msm_cpudai_hdmi_rx,
1846 &msm_cpudai_bt_rx,
1847 &msm_cpudai_bt_tx,
1848 &msm_cpudai_fm_rx,
1849 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001850 &msm_cpudai_auxpcm_rx,
1851 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001852 &msm_cpu_fe,
1853 &msm_stub_codec,
1854 &msm_voice,
1855 &msm_voip,
1856 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301857 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001858 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001859 &msm_cpudai_incall_record_rx,
1860 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001861
1862#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1863 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1864 &qcrypto_device,
1865#endif
1866
1867#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1868 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1869 &qcedev_device,
1870#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001871};
1872
1873static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001874 &msm_kgsl_3d0,
1875 &msm_kgsl_2d0,
1876 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001877#ifdef CONFIG_MSM_GEMINI
1878 &msm8960_gemini_device,
1879#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001880};
1881
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001882static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001883 &msm_8960_q6_lpass,
1884 &msm_8960_q6_mss_fw,
1885 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001886 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001887 &msm_pil_tzapps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001888 &msm8960_device_otg,
1889 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001890 &msm_device_hsusb_host,
1891 &android_usb_device,
1892 &msm_pcm,
1893 &msm_pcm_routing,
1894 &msm_cpudai0,
1895 &msm_cpudai1,
1896 &msm_cpudai_hdmi_rx,
1897 &msm_cpudai_bt_rx,
1898 &msm_cpudai_bt_tx,
1899 &msm_cpudai_fm_rx,
1900 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001901 &msm_cpudai_auxpcm_rx,
1902 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903 &msm_cpu_fe,
1904 &msm_stub_codec,
1905 &msm_kgsl_3d0,
1906#ifdef CONFIG_MSM_KGSL_2D
1907 &msm_kgsl_2d0,
1908 &msm_kgsl_2d1,
1909#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001910#ifdef CONFIG_MSM_GEMINI
1911 &msm8960_gemini_device,
1912#endif
1913 &msm_voice,
1914 &msm_voip,
1915 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301916 &msm_cpudai_afe_01_rx,
1917 &msm_cpudai_afe_01_tx,
1918 &msm_cpudai_afe_02_rx,
1919 &msm_cpudai_afe_02_tx,
1920 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301921 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001922 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001923 &msm_cpudai_incall_record_rx,
1924 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001925 &msm_pcm_hostless,
1926 &msm_bus_apps_fabric,
1927 &msm_bus_sys_fabric,
1928 &msm_bus_mm_fabric,
1929 &msm_bus_sys_fpb,
1930 &msm_bus_cpss_fpb,
1931};
1932
1933static void __init msm8960_i2c_init(void)
1934{
1935 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1936 &msm8960_i2c_qup_gsbi4_pdata;
1937
1938 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1939 &msm8960_i2c_qup_gsbi3_pdata;
1940
1941 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1942 &msm8960_i2c_qup_gsbi10_pdata;
1943
1944 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1945 &msm8960_i2c_qup_gsbi12_pdata;
1946}
1947
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001948static void __init msm8960_gfx_init(void)
1949{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001950 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001951 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1952 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1953 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001954 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1955 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001956 }
1957}
1958
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001959static struct msm_cpuidle_state msm_cstates[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001960
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961 {0, 0, "C0", "WFI",
1962 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1963
1964 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1965 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1966
1967 {0, 2, "C2", "POWER_COLLAPSE",
1968 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1969
1970 {1, 0, "C0", "WFI",
1971 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1972
1973 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1974 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1975};
1976
1977static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1978 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1979 .idle_supported = 1,
1980 .suspend_supported = 1,
1981 .idle_enabled = 0,
1982 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001983 },
1984
1985 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1986 .idle_supported = 1,
1987 .suspend_supported = 1,
1988 .idle_enabled = 0,
1989 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001990 },
1991
1992 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1993 .idle_supported = 1,
1994 .suspend_supported = 1,
1995 .idle_enabled = 1,
1996 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001997 },
1998
1999 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
2000 .idle_supported = 0,
2001 .suspend_supported = 1,
2002 .idle_enabled = 0,
2003 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002004 },
2005
2006 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
2007 .idle_supported = 1,
2008 .suspend_supported = 1,
2009 .idle_enabled = 0,
2010 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002011 },
2012
2013 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
2014 .idle_supported = 1,
2015 .suspend_supported = 0,
2016 .idle_enabled = 1,
2017 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002018 },
2019};
2020
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302021static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002022 {
2023 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2024 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2025 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002026 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002027 },
2028
2029 {
2030 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2031 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2032 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002033 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002034 },
2035
2036 {
2037 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2038 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2039 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002040 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002041 },
2042
2043 {
2044 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2045 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2046 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002047 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002048 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002049 {
2050 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2051 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2052 false,
2053 7000, 3500, 66600000, 5150,
2054 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002055
2056 {
2057 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2058 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2059 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002060 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002061 },
2062
2063 {
2064 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2065 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2066 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002067 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002068 },
2069
2070 {
2071 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2072 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2073 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002074 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002075 },
2076
2077 {
2078 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2079 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2080 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002081 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002082 },
2083};
2084
Praveen Chidambaram78499012011-11-01 17:15:17 -06002085static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2086 .levels = &msm_rpmrs_levels[0],
2087 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2088 .vdd_mem_levels = {
2089 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2090 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2091 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2092 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2093 },
2094 .vdd_dig_levels = {
2095 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2096 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2097 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2098 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2099 },
2100 .vdd_mask = 0x7FFFFF,
2101 .rpmrs_target_id = {
2102 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2103 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2104 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2105 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2106 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2107 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2108 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2109 },
2110};
2111
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002112static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2113 .mode = MSM_PM_BOOT_CONFIG_TZ,
2114};
2115
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302116uint32_t msm_rpm_get_swfi_latency(void)
2117{
2118 int i;
2119
2120 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
2121 if (msm_rpmrs_levels[i].sleep_mode ==
2122 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
2123 return msm_rpmrs_levels[i].latency_us;
2124 }
2125
2126 return 0;
2127}
2128
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002129#ifdef CONFIG_I2C
2130#define I2C_SURF 1
2131#define I2C_FFA (1 << 1)
2132#define I2C_RUMI (1 << 2)
2133#define I2C_SIM (1 << 3)
2134#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002135#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002136
2137struct i2c_registry {
2138 u8 machs;
2139 int bus;
2140 struct i2c_board_info *info;
2141 int len;
2142};
2143
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002144/* Sensors DSPS platform data */
2145#ifdef CONFIG_MSM_DSPS
2146#define DSPS_PIL_GENERIC_NAME "dsps"
2147#endif /* CONFIG_MSM_DSPS */
2148
2149static void __init msm8960_init_dsps(void)
2150{
2151#ifdef CONFIG_MSM_DSPS
2152 struct msm_dsps_platform_data *pdata =
2153 msm_dsps_device.dev.platform_data;
2154 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2155 pdata->gpios = NULL;
2156 pdata->gpios_num = 0;
2157
2158 platform_device_register(&msm_dsps_device);
2159#endif /* CONFIG_MSM_DSPS */
2160}
2161
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002162static int hsic_peripheral_status = 1;
2163static DEFINE_MUTEX(hsic_status_lock);
2164
2165void peripheral_connect()
2166{
2167 mutex_lock(&hsic_status_lock);
2168 if (hsic_peripheral_status)
2169 goto out;
2170 platform_device_add(&msm_device_hsic_host);
2171 hsic_peripheral_status = 1;
2172out:
2173 mutex_unlock(&hsic_status_lock);
2174}
2175EXPORT_SYMBOL(peripheral_connect);
2176
2177void peripheral_disconnect()
2178{
2179 mutex_lock(&hsic_status_lock);
2180 if (!hsic_peripheral_status)
2181 goto out;
2182 platform_device_del(&msm_device_hsic_host);
2183 hsic_peripheral_status = 0;
2184out:
2185 mutex_unlock(&hsic_status_lock);
2186}
2187EXPORT_SYMBOL(peripheral_disconnect);
2188
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002189static void __init msm8960_init_hsic(void)
2190{
2191#ifdef CONFIG_USB_EHCI_MSM_HSIC
2192 uint32_t version = socinfo_get_version();
2193
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002194 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002195 return;
2196
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002197 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002198 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002199#endif
2200}
2201
Amir Samuelov5137e392011-09-21 17:31:25 +03002202#ifdef CONFIG_ISL9519_CHARGER
2203static struct isl_platform_data isl_data __initdata = {
2204 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2205 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2206 .max_system_voltage = 4200,
2207 .min_system_voltage = 3200,
2208 .chgcurrent = 1000, /* 1900, */
2209 .term_current = 400, /* Need fine tuning */
2210 .input_current = 2048,
2211};
2212
2213static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2214 {
2215 I2C_BOARD_INFO("isl9519q", 0x9),
2216 .irq = 0, /* Not required when notify-by-pmic */
2217 .platform_data = &isl_data,
2218 },
2219};
2220#endif /* CONFIG_ISL9519_CHARGER */
2221
Amir Samuelov755616d2011-12-13 16:34:46 +02002222static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2223 {
2224 I2C_BOARD_INFO("sx1508q", 0x20),
2225 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2226 },
2227};
2228
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002229static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002230#ifdef CONFIG_ISL9519_CHARGER
2231 {
2232 I2C_LIQUID,
2233 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2234 isl_charger_i2c_info,
2235 ARRAY_SIZE(isl_charger_i2c_info),
2236 },
2237#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002238 {
2239 I2C_SURF | I2C_FFA | I2C_FLUID,
2240 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2241 cyttsp_info,
2242 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002243 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302244 {
2245 I2C_LIQUID,
2246 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2247 mxt_device_info,
2248 ARRAY_SIZE(mxt_device_info),
2249 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302250 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302251 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302252 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002253 sii_device_info,
2254 ARRAY_SIZE(sii_device_info),
2255 },
2256 {
2257 I2C_LIQUID,
2258 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302259 msm_isa1200_board_info,
2260 ARRAY_SIZE(msm_isa1200_board_info),
2261 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002262 {
2263 I2C_LIQUID,
2264 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2265 liquid_io_expander_i2c_info,
2266 ARRAY_SIZE(liquid_io_expander_i2c_info),
2267 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002268};
2269#endif /* CONFIG_I2C */
2270
2271static void __init register_i2c_devices(void)
2272{
2273#ifdef CONFIG_I2C
2274 u8 mach_mask = 0;
2275 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002276#ifdef CONFIG_MSM_CAMERA
2277 struct i2c_registry msm8960_camera_i2c_devices = {
2278 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2279 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2280 msm8960_camera_board_info.board_info,
2281 msm8960_camera_board_info.num_i2c_board_info,
2282 };
2283#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002284
2285 /* Build the matching 'supported_machs' bitmask */
2286 if (machine_is_msm8960_cdp())
2287 mach_mask = I2C_SURF;
2288 else if (machine_is_msm8960_rumi3())
2289 mach_mask = I2C_RUMI;
2290 else if (machine_is_msm8960_sim())
2291 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002292 else if (machine_is_msm8960_fluid())
2293 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002294 else if (machine_is_msm8960_liquid())
2295 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002296 else if (machine_is_msm8960_mtp())
2297 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002298 else
2299 pr_err("unmatched machine ID in register_i2c_devices\n");
2300
2301 /* Run the array and install devices as appropriate */
2302 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2303 if (msm8960_i2c_devices[i].machs & mach_mask)
2304 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2305 msm8960_i2c_devices[i].info,
2306 msm8960_i2c_devices[i].len);
2307 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002308#ifdef CONFIG_MSM_CAMERA
2309 if (msm8960_camera_i2c_devices.machs & mach_mask)
2310 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2311 msm8960_camera_i2c_devices.info,
2312 msm8960_camera_i2c_devices.len);
2313#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002314#endif
2315}
2316
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002317static void __init msm8960_sim_init(void)
2318{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002319 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2320 &msm8960_device_watchdog.dev.platform_data;
2321
2322 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002323 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002324 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2325 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002326 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002327 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002328 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002329 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002330
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002331 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002332 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002333 msm8960_i2c_init();
2334 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2335 msm_spm_l2_init(msm_spm_l2_data);
2336 msm8960_init_buses();
2337 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002338 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002339 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002340 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002341
2342 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2343 &msm8960_qup_spi_gsbi1_pdata;
2344 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2345
2346 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002347 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002348 slim_register_board_info(msm_slim_devices,
2349 ARRAY_SIZE(msm_slim_devices));
2350 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2351 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2352 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2353 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002354 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002355 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002356}
2357
2358static void __init msm8960_rumi3_init(void)
2359{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002360 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002361 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2362 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002363 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002364 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002365 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002366 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002367 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002368 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2369 &msm8960_qup_spi_gsbi1_pdata;
2370 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2371 msm8960_i2c_init();
2372 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2373 msm_spm_l2_init(msm_spm_l2_data);
2374 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002375 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002376 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002377 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002378 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002379 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002380 slim_register_board_info(msm_slim_devices,
2381 ARRAY_SIZE(msm_slim_devices));
2382 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2383 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2384 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2385 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002386 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002387 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002388}
2389
2390static void __init msm8960_cdp_init(void)
2391{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002392 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2393 pr_err("meminfo_init() failed!\n");
2394
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002395 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002396 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2397 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002398
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002399 regulator_suppress_info_printing();
2400 if (msm_xo_init())
2401 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002402 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002403 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302404 if (machine_is_msm8960_liquid())
2405 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002406 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302407 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2408 machine_is_msm8960_cdp()) {
2409 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2410 } else if (machine_is_msm8960_liquid()) {
2411 msm_otg_pdata.phy_init_seq =
2412 liquid_v1_phy_init_seq;
2413 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302414 msm_otg_pdata.swfi_latency =
2415 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302416#ifdef CONFIG_USB_EHCI_MSM_HSIC
2417 if (machine_is_msm8960_liquid()) {
2418 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2419 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2420 }
2421#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302422 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002423 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002424 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2425 &msm8960_qup_spi_gsbi1_pdata;
2426 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002427
2428 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302429 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2430 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2431 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002432 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002433 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002434 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2435 msm_spm_l2_init(msm_spm_l2_data);
2436 msm8960_init_buses();
2437 platform_add_devices(msm_footswitch_devices,
2438 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002439 if (machine_is_msm8960_liquid())
2440 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002441 if (machine_is_msm8960_cdp())
2442 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002443 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002444 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002445 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002446 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002447 msm8960_init_cam();
2448 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002449 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302450 if (machine_is_msm8960_liquid())
2451 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002452 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002453 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002454 slim_register_board_info(msm_slim_devices,
2455 ARRAY_SIZE(msm_slim_devices));
2456 msm8960_init_dsps();
2457 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2458 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2459 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2460 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002461 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002462 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002463 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08002464 if (PLATFORM_IS_CHARM25())
2465 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002466}
2467
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002468MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2469 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002470 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002471 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302472 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002473 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002474 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002475 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002476 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002477MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002478
2479MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2480 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002481 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002482 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302483 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002484 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002485 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002486 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002487 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002488MACHINE_END
2489
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002490MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2491 .map_io = msm8960_map_io,
2492 .reserve = msm8960_reserve,
2493 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302494 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002495 .timer = &msm_timer,
2496 .init_machine = msm8960_cdp_init,
2497 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002498 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002499MACHINE_END
2500
2501MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2502 .map_io = msm8960_map_io,
2503 .reserve = msm8960_reserve,
2504 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302505 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002506 .timer = &msm_timer,
2507 .init_machine = msm8960_cdp_init,
2508 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002509 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002510MACHINE_END
2511
2512MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2513 .map_io = msm8960_map_io,
2514 .reserve = msm8960_reserve,
2515 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302516 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002517 .timer = &msm_timer,
2518 .init_machine = msm8960_cdp_init,
2519 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002520 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002521MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002522
2523MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2524 .map_io = msm8960_map_io,
2525 .reserve = msm8960_reserve,
2526 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302527 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002528 .timer = &msm_timer,
2529 .init_machine = msm8960_cdp_init,
2530 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002531 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002532MACHINE_END