blob: 135f6611dce5c1c801434b0e68652542ad1b9b51 [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"
David Collins4c31a872011-08-31 10:07:10 -070095#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070096#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060097#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070098#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080099
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700100static struct platform_device msm_fm_platform_init = {
101 .name = "iris_fm",
102 .id = -1,
103};
104
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700105#define KS8851_RST_GPIO 89
106#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530107#define HAP_SHIFT_LVL_OE_GPIO 47
108
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700109#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700110
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800111struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700112 [SX150X_CAM] = {
113 .gpio_base = GPIO_CAM_EXPANDER_BASE,
114 .oscio_is_gpo = false,
115 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530116 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700117 .io_open_drain_ena = 0x0,
118 .irq_summary = -1,
119 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200120 [SX150X_LIQUID] = {
121 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
122 .oscio_is_gpo = false,
123 .io_pullup_ena = 0x0c08,
124 .io_pulldn_ena = 0x4060,
125 .io_open_drain_ena = 0x000c,
126 .io_polarity = 0,
127 .irq_summary = -1,
128 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700129};
Nishant Pandit474f2252011-07-23 23:17:56 +0530130
131#endif
132
Haynes Mathew George9bc27652011-12-13 19:14:14 -0800133#define MSM_PMEM_ADSP_SIZE 0x4200000
Ben Romberger3ffcd812011-12-08 19:12:10 -0800134#define MSM_PMEM_AUDIO_SIZE 0x2B4000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700135#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
136#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
137#else
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800138#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700139#endif
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800140#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700141
142#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbott6db11c92011-11-04 10:31:43 -0700143#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
Naseer Ahmed7b7eb1d2012-01-13 12:01:46 +0530144#define MSM_ION_SF_SIZE 0x2800000 /* (40MB) */
Olav Haugan42ebe712012-01-10 16:30:58 -0800145#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800146#define MSM_ION_MM_SIZE 0x4000000 /* (64MB) */
Olav Haugan80854eb2012-01-12 12:00:23 -0800147#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800148#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan80854eb2012-01-12 12:00:23 -0800149#define MSM_ION_HEAP_NUM 7
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 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700389#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700390 }
391};
392
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800393static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700394 .name = "ion-msm",
395 .id = 1,
396 .dev = { .platform_data = &ion_pdata },
397};
398#endif
399
Larry Bassel41a055b2011-12-06 16:15:14 -0800400struct platform_device fmem_device = {
401 .name = "fmem",
402 .id = 1,
403 .dev = { .platform_data = &fmem_pdata },
404};
405
Laura Abbottd6183792011-08-19 13:42:24 -0700406static void reserve_ion_memory(void)
407{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700408#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800409 unsigned int i;
410
411 if (!pmem_param_set && machine_is_msm8960_liquid()) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800412 msm_ion_cp_mm_size = MSM_LIQUID_ION_MM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800413 for (i = 0; i < ion_pdata.nr; i++) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800414 if (ion_pdata.heaps[i].id == ION_CP_MM_HEAP_ID) {
415 ion_pdata.heaps[i].size = msm_ion_cp_mm_size;
416 pr_debug("msm_ion_cp_mm_size 0x%x\n",
417 msm_ion_cp_mm_size);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800418 break;
419 }
420 }
421 }
Olav Hauganb5be7992011-11-18 14:29:02 -0800422 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_ion_cp_mm_size;
Olav Haugan42ebe712012-01-10 16:30:58 -0800423 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Hauganb5be7992011-11-18 14:29:02 -0800424 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
425 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Olav Haugan80854eb2012-01-12 12:00:23 -0800426 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700427#endif
428}
Huaibin Yanga5419422011-12-08 23:52:10 -0800429
430static void __init reserve_mdp_memory(void)
431{
432 msm8960_mdp_writeback(msm8960_reserve_table);
433}
434
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700435static void __init msm8960_calculate_reserve_sizes(void)
436{
437 size_pmem_devices();
438 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700439 reserve_ion_memory();
Larry Bassel41a055b2011-12-06 16:15:14 -0800440 reserve_fmem_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800441 reserve_mdp_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700442}
443
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700444static struct reserve_info msm8960_reserve_info __initdata = {
445 .memtype_reserve_table = msm8960_reserve_table,
446 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
447 .paddr_to_memtype = msm8960_paddr_to_memtype,
448};
449
Larry Basselb4126da2011-07-18 14:31:33 -0700450static int msm8960_memory_bank_size(void)
451{
452 return 1<<29;
453}
454
455static void __init locate_unstable_memory(void)
456{
457 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
458 unsigned long bank_size;
459 unsigned long low, high;
460
461 bank_size = msm8960_memory_bank_size();
462 low = meminfo.bank[0].start;
463 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700464
465 /* Check if 32 bit overflow occured */
466 if (high < mb->start)
467 high = ~0UL;
468
Larry Basselb4126da2011-07-18 14:31:33 -0700469 low &= ~(bank_size - 1);
470
471 if (high - low <= bank_size)
472 return;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800473 msm8960_reserve_info.low_unstable_address = high -
474 MIN_MEMORY_BLOCK_SIZE;
475 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700476
Larry Basselb4126da2011-07-18 14:31:33 -0700477 msm8960_reserve_info.bank_size = bank_size;
478 pr_info("low unstable address %lx max size %lx bank size %lx\n",
479 msm8960_reserve_info.low_unstable_address,
480 msm8960_reserve_info.max_unstable_size,
481 msm8960_reserve_info.bank_size);
482}
483
Larry Basselb830e182011-10-14 10:46:55 -0700484static void __init place_movable_zone(void)
485{
486 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
487 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
488 pr_info("movable zone start %lx size %lx\n",
489 movable_reserved_start, movable_reserved_size);
490}
491
492static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700493{
494 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700495 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700496 place_movable_zone();
497}
498
499static void __init msm8960_reserve(void)
500{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700501 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800502 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700503}
504
Larry Bassela4414b12011-08-04 11:11:02 -0700505static int msm8960_change_memory_power(u64 start, u64 size,
506 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700507{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700508 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700509}
510
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700511static void __init msm8960_allocate_memory_regions(void)
512{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800513 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700514}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800515
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700516#ifdef CONFIG_WCD9310_CODEC
517
518#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
519
Patrick Lai3043fba2011-08-01 14:15:57 -0700520/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
521 * 4 micbiases are used to power various analog and digital
522 * microphones operating at 1800 mV. Technically, all micbiases
523 * can source from single cfilter since all microphones operate
524 * at the same voltage level. The arrangement below is to make
525 * sure all cfilters are exercised. LDO_H regulator ouput level
526 * does not need to be as high as 2.85V. It is choosen for
527 * microphone sensitivity purpose.
528 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700529static struct tabla_pdata tabla_platform_data = {
530 .slimbus_slave_device = {
531 .name = "tabla-slave",
532 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
533 },
534 .irq = MSM_GPIO_TO_INT(62),
535 .irq_base = TABLA_INTERRUPT_BASE,
536 .num_irqs = NR_TABLA_IRQS,
537 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700538 .micbias = {
539 .ldoh_v = TABLA_LDOH_2P85_V,
540 .cfilt1_mv = 1800,
541 .cfilt2_mv = 1800,
542 .cfilt3_mv = 1800,
543 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
544 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
545 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
546 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
547 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700548};
549
550static struct slim_device msm_slim_tabla = {
551 .name = "tabla-slim",
552 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
553 .dev = {
554 .platform_data = &tabla_platform_data,
555 },
556};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530557
558static struct tabla_pdata tabla20_platform_data = {
559 .slimbus_slave_device = {
560 .name = "tabla-slave",
561 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
562 },
563 .irq = MSM_GPIO_TO_INT(62),
564 .irq_base = TABLA_INTERRUPT_BASE,
565 .num_irqs = NR_TABLA_IRQS,
566 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
567 .micbias = {
568 .ldoh_v = TABLA_LDOH_2P85_V,
569 .cfilt1_mv = 1800,
570 .cfilt2_mv = 1800,
571 .cfilt3_mv = 1800,
572 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
573 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
574 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
575 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
576 }
577};
578
579static struct slim_device msm_slim_tabla20 = {
580 .name = "tabla2x-slim",
581 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
582 .dev = {
583 .platform_data = &tabla20_platform_data,
584 },
585};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700586#endif
587
588static struct slim_boardinfo msm_slim_devices[] = {
589#ifdef CONFIG_WCD9310_CODEC
590 {
591 .bus_num = 1,
592 .slim_slave = &msm_slim_tabla,
593 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530594 {
595 .bus_num = 1,
596 .slim_slave = &msm_slim_tabla20,
597 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598#endif
599 /* add more slimbus slaves as needed */
600};
601
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700602#define MSM_WCNSS_PHYS 0x03000000
603#define MSM_WCNSS_SIZE 0x280000
604
605static struct resource resources_wcnss_wlan[] = {
606 {
607 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
608 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
609 .name = "wcnss_wlanrx_irq",
610 .flags = IORESOURCE_IRQ,
611 },
612 {
613 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
614 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
615 .name = "wcnss_wlantx_irq",
616 .flags = IORESOURCE_IRQ,
617 },
618 {
619 .start = MSM_WCNSS_PHYS,
620 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
621 .name = "wcnss_mmio",
622 .flags = IORESOURCE_MEM,
623 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700624 {
625 .start = 84,
626 .end = 88,
627 .name = "wcnss_gpios_5wire",
628 .flags = IORESOURCE_IO,
629 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700630};
631
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700632static struct qcom_wcnss_opts qcom_wcnss_pdata = {
633 .has_48mhz_xo = 1,
634};
635
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700636static struct platform_device msm_device_wcnss_wlan = {
637 .name = "wcnss_wlan",
638 .id = 0,
639 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
640 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700641 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700642};
643
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700644#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
645 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
646 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
647 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
648
649#define QCE_SIZE 0x10000
650#define QCE_0_BASE 0x18500000
651
652#define QCE_HW_KEY_SUPPORT 0
653#define QCE_SHA_HMAC_SUPPORT 1
654#define QCE_SHARE_CE_RESOURCE 1
655#define QCE_CE_SHARED 0
656
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800657/* Begin Bus scaling definitions */
658static struct msm_bus_vectors crypto_hw_init_vectors[] = {
659 {
660 .src = MSM_BUS_MASTER_ADM_PORT0,
661 .dst = MSM_BUS_SLAVE_EBI_CH0,
662 .ab = 0,
663 .ib = 0,
664 },
665 {
666 .src = MSM_BUS_MASTER_ADM_PORT1,
667 .dst = MSM_BUS_SLAVE_GSBI1_UART,
668 .ab = 0,
669 .ib = 0,
670 },
671};
672
673static struct msm_bus_vectors crypto_hw_active_vectors[] = {
674 {
675 .src = MSM_BUS_MASTER_ADM_PORT0,
676 .dst = MSM_BUS_SLAVE_EBI_CH0,
677 .ab = 70000000UL,
678 .ib = 70000000UL,
679 },
680 {
681 .src = MSM_BUS_MASTER_ADM_PORT1,
682 .dst = MSM_BUS_SLAVE_GSBI1_UART,
683 .ab = 2480000000UL,
684 .ib = 2480000000UL,
685 },
686};
687
688static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
689 {
690 ARRAY_SIZE(crypto_hw_init_vectors),
691 crypto_hw_init_vectors,
692 },
693 {
694 ARRAY_SIZE(crypto_hw_active_vectors),
695 crypto_hw_active_vectors,
696 },
697};
698
699static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
700 crypto_hw_bus_scale_usecases,
701 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
702 .name = "cryptohw",
703};
704/* End Bus Scaling Definitions*/
705
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700706static struct resource qcrypto_resources[] = {
707 [0] = {
708 .start = QCE_0_BASE,
709 .end = QCE_0_BASE + QCE_SIZE - 1,
710 .flags = IORESOURCE_MEM,
711 },
712 [1] = {
713 .name = "crypto_channels",
714 .start = DMOV_CE_IN_CHAN,
715 .end = DMOV_CE_OUT_CHAN,
716 .flags = IORESOURCE_DMA,
717 },
718 [2] = {
719 .name = "crypto_crci_in",
720 .start = DMOV_CE_IN_CRCI,
721 .end = DMOV_CE_IN_CRCI,
722 .flags = IORESOURCE_DMA,
723 },
724 [3] = {
725 .name = "crypto_crci_out",
726 .start = DMOV_CE_OUT_CRCI,
727 .end = DMOV_CE_OUT_CRCI,
728 .flags = IORESOURCE_DMA,
729 },
730};
731
732static struct resource qcedev_resources[] = {
733 [0] = {
734 .start = QCE_0_BASE,
735 .end = QCE_0_BASE + QCE_SIZE - 1,
736 .flags = IORESOURCE_MEM,
737 },
738 [1] = {
739 .name = "crypto_channels",
740 .start = DMOV_CE_IN_CHAN,
741 .end = DMOV_CE_OUT_CHAN,
742 .flags = IORESOURCE_DMA,
743 },
744 [2] = {
745 .name = "crypto_crci_in",
746 .start = DMOV_CE_IN_CRCI,
747 .end = DMOV_CE_IN_CRCI,
748 .flags = IORESOURCE_DMA,
749 },
750 [3] = {
751 .name = "crypto_crci_out",
752 .start = DMOV_CE_OUT_CRCI,
753 .end = DMOV_CE_OUT_CRCI,
754 .flags = IORESOURCE_DMA,
755 },
756};
757
758#endif
759
760#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
761 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
762
763static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
764 .ce_shared = QCE_CE_SHARED,
765 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
766 .hw_key_support = QCE_HW_KEY_SUPPORT,
767 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800768 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700769};
770
771static struct platform_device qcrypto_device = {
772 .name = "qcrypto",
773 .id = 0,
774 .num_resources = ARRAY_SIZE(qcrypto_resources),
775 .resource = qcrypto_resources,
776 .dev = {
777 .coherent_dma_mask = DMA_BIT_MASK(32),
778 .platform_data = &qcrypto_ce_hw_suppport,
779 },
780};
781#endif
782
783#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
784 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
785
786static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
787 .ce_shared = QCE_CE_SHARED,
788 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
789 .hw_key_support = QCE_HW_KEY_SUPPORT,
790 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800791 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700792};
793
794static struct platform_device qcedev_device = {
795 .name = "qce",
796 .id = 0,
797 .num_resources = ARRAY_SIZE(qcedev_resources),
798 .resource = qcedev_resources,
799 .dev = {
800 .coherent_dma_mask = DMA_BIT_MASK(32),
801 .platform_data = &qcedev_ce_hw_suppport,
802 },
803};
804#endif
805
Joel Kingb8352a12011-11-15 18:46:24 -0800806#define MDM2AP_ERRFATAL 70
807#define AP2MDM_ERRFATAL 95
808#define MDM2AP_STATUS 69
809#define AP2MDM_STATUS 94
810#define AP2MDM_PMIC_RESET_N 80
811#define AP2MDM_KPDPWR_N 81
812
Joel Kingb8352a12011-11-15 18:46:24 -0800813static struct resource mdm_resources[] = {
814 {
815 .start = MDM2AP_ERRFATAL,
816 .end = MDM2AP_ERRFATAL,
817 .name = "MDM2AP_ERRFATAL",
818 .flags = IORESOURCE_IO,
819 },
820 {
821 .start = AP2MDM_ERRFATAL,
822 .end = AP2MDM_ERRFATAL,
823 .name = "AP2MDM_ERRFATAL",
824 .flags = IORESOURCE_IO,
825 },
826 {
827 .start = MDM2AP_STATUS,
828 .end = MDM2AP_STATUS,
829 .name = "MDM2AP_STATUS",
830 .flags = IORESOURCE_IO,
831 },
832 {
833 .start = AP2MDM_STATUS,
834 .end = AP2MDM_STATUS,
835 .name = "AP2MDM_STATUS",
836 .flags = IORESOURCE_IO,
837 },
838 {
839 .start = AP2MDM_PMIC_RESET_N,
840 .end = AP2MDM_PMIC_RESET_N,
841 .name = "AP2MDM_PMIC_RESET_N",
842 .flags = IORESOURCE_IO,
843 },
844 {
845 .start = AP2MDM_KPDPWR_N,
846 .end = AP2MDM_KPDPWR_N,
847 .name = "AP2MDM_KPDPWR_N",
848 .flags = IORESOURCE_IO,
849 },
850};
851
852static struct mdm_platform_data mdm_platform_data = {
853 .mdm_version = "2.5",
854};
855
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800856static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800857 .name = "mdm2_modem",
858 .id = -1,
859 .num_resources = ARRAY_SIZE(mdm_resources),
860 .resource = mdm_resources,
861 .dev = {
862 .platform_data = &mdm_platform_data,
863 },
864};
865
866static struct platform_device *mdm_devices[] __initdata = {
867 &mdm_device,
868};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700869
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870#define MSM_SHARED_RAM_PHYS 0x80000000
871
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800872static void __init msm8960_map_io(void)
873{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700874 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800875 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700876
877 if (socinfo_init() < 0)
878 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800879}
880
881static void __init msm8960_init_irq(void)
882{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700883 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800884 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700885 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800886
887 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700888 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800889
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700890 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
891 mb();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800892}
893
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700894static void __init msm8960_init_buses(void)
895{
896#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -0600897 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -0600898 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
899 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
900 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
901 msm_bus_apps_fabric.dev.platform_data =
902 &msm_bus_8960_apps_fabric_pdata;
903 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
904 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
905 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
906 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700907#endif
908}
909
910static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
911 .max_clock_speed = 15060000,
912};
913
914#ifdef CONFIG_USB_MSM_OTG_72K
915static struct msm_otg_platform_data msm_otg_pdata;
916#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530917static int wr_phy_init_seq[] = {
918 0x44, 0x80, /* set VBUS valid threshold
919 and disconnect valid threshold */
920 0x38, 0x81, /* update DC voltage level */
921 0x14, 0x82, /* set preemphasis and rise/fall time */
922 0x13, 0x83, /* set source impedance adjusment */
923 -1};
924
925static int liquid_v1_phy_init_seq[] = {
926 0x44, 0x80,/* set VBUS valid threshold
927 and disconnect valid threshold */
928 0x3C, 0x81,/* update DC voltage level */
929 0x18, 0x82,/* set preemphasis and rise/fall time */
930 0x23, 0x83,/* set source impedance sdjusment */
931 -1};
932
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700933static struct msm_otg_platform_data msm_otg_pdata = {
934 .mode = USB_OTG,
935 .otg_control = OTG_PMIC_CONTROL,
936 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700937 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +0530938 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700939};
940#endif
941
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530942#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530943#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530944static struct msm_hsic_host_platform_data msm_hsic_pdata = {
945 .strobe = 150,
946 .data = 151,
947};
948#else
949static struct msm_hsic_host_platform_data msm_hsic_pdata;
950#endif
951
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700952#define PID_MAGIC_ID 0x71432909
953#define SERIAL_NUM_MAGIC_ID 0x61945374
954#define SERIAL_NUMBER_LENGTH 127
955#define DLOAD_USB_BASE_ADD 0x2A03F0C8
956
957struct magic_num_struct {
958 uint32_t pid;
959 uint32_t serial_num;
960};
961
962struct dload_struct {
963 uint32_t reserved1;
964 uint32_t reserved2;
965 uint32_t reserved3;
966 uint16_t reserved4;
967 uint16_t pid;
968 char serial_number[SERIAL_NUMBER_LENGTH];
969 uint16_t reserved5;
970 struct magic_num_struct magic_struct;
971};
972
973static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
974{
975 struct dload_struct __iomem *dload = 0;
976
977 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
978 if (!dload) {
979 pr_err("%s: cannot remap I/O memory region: %08x\n",
980 __func__, DLOAD_USB_BASE_ADD);
981 return -ENXIO;
982 }
983
984 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
985 __func__, dload, pid, snum);
986 /* update pid */
987 dload->magic_struct.pid = PID_MAGIC_ID;
988 dload->pid = pid;
989
990 /* update serial number */
991 dload->magic_struct.serial_num = 0;
992 if (!snum) {
993 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
994 goto out;
995 }
996
997 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -0700998 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999out:
1000 iounmap(dload);
1001 return 0;
1002}
1003
1004static struct android_usb_platform_data android_usb_pdata = {
1005 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1006};
1007
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001008static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001009 .name = "android_usb",
1010 .id = -1,
1011 .dev = {
1012 .platform_data = &android_usb_pdata,
1013 },
1014};
1015
1016static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1017 0x03, 0x0f,
1018};
1019
1020static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1021 0x00, 0x24, 0x54, 0x10,
1022 0x09, 0x03, 0x01,
1023 0x10, 0x54, 0x30, 0x0C,
1024 0x24, 0x30, 0x0f,
1025};
1026
1027static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1028 0x00, 0x24, 0x54, 0x10,
1029 0x09, 0x07, 0x01, 0x0B,
1030 0x10, 0x54, 0x30, 0x0C,
1031 0x24, 0x30, 0x0f,
1032};
1033
1034static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1035 [0] = {
1036 .mode = MSM_SPM_MODE_CLOCK_GATING,
1037 .notify_rpm = false,
1038 .cmd = spm_wfi_cmd_sequence,
1039 },
1040 [1] = {
1041 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1042 .notify_rpm = false,
1043 .cmd = spm_power_collapse_without_rpm,
1044 },
1045 [2] = {
1046 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1047 .notify_rpm = true,
1048 .cmd = spm_power_collapse_with_rpm,
1049 },
1050};
1051
1052static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1053 [0] = {
1054 .reg_base_addr = MSM_SAW0_BASE,
1055 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1056 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001057 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001058#if defined(CONFIG_MSM_AVS_HW)
1059 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1060 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1061#endif
1062 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1063 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1064 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1065 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1066 .vctl_timeout_us = 50,
1067 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1068 .modes = msm_spm_seq_list,
1069 },
1070 [1] = {
1071 .reg_base_addr = MSM_SAW1_BASE,
1072 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1073 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001074 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001075#if defined(CONFIG_MSM_AVS_HW)
1076 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1077 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1078#endif
1079 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1080 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1081 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1082 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1083 .vctl_timeout_us = 50,
1084 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1085 .modes = msm_spm_seq_list,
1086 },
1087};
1088
1089static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1090 0x00, 0x20, 0x03, 0x20,
1091 0x00, 0x0f,
1092};
1093
1094static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1095 0x00, 0x20, 0x34, 0x64,
1096 0x48, 0x07, 0x48, 0x20,
1097 0x50, 0x64, 0x04, 0x34,
1098 0x50, 0x0f,
1099};
1100static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1101 0x00, 0x10, 0x34, 0x64,
1102 0x48, 0x07, 0x48, 0x10,
1103 0x50, 0x64, 0x04, 0x34,
1104 0x50, 0x0F,
1105};
1106
1107static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1108 [0] = {
1109 .mode = MSM_SPM_L2_MODE_RETENTION,
1110 .notify_rpm = false,
1111 .cmd = l2_spm_wfi_cmd_sequence,
1112 },
1113 [1] = {
1114 .mode = MSM_SPM_L2_MODE_GDHS,
1115 .notify_rpm = true,
1116 .cmd = l2_spm_gdhs_cmd_sequence,
1117 },
1118 [2] = {
1119 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1120 .notify_rpm = true,
1121 .cmd = l2_spm_power_off_cmd_sequence,
1122 },
1123};
1124
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001125static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1126 [0] = {
1127 .reg_base_addr = MSM_SAW_L2_BASE,
1128 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1129 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1130 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1131 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1132 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1133 .modes = msm_spm_l2_seq_list,
1134 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1135 },
1136};
1137
Mohan Pallaka5e490392011-09-09 15:18:41 +05301138#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1139#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1140
1141static struct msm_xo_voter *xo_handle_d1;
1142
1143static int isa1200_power(int on)
1144{
1145 int rc = 0;
1146
1147 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1148
1149 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1150 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1151 if (rc < 0) {
1152 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1153 __func__, on ? "" : "de-", rc);
1154 goto err_xo_vote;
1155 }
1156
1157 return 0;
1158
1159err_xo_vote:
1160 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1161 return rc;
1162}
1163
1164static int isa1200_dev_setup(bool enable)
1165{
1166 int rc = 0;
1167
1168 struct pm_gpio hap_gpio_config = {
1169 .direction = PM_GPIO_DIR_OUT,
1170 .pull = PM_GPIO_PULL_NO,
1171 .out_strength = PM_GPIO_STRENGTH_HIGH,
1172 .function = PM_GPIO_FUNC_NORMAL,
1173 .inv_int_pol = 0,
1174 .vin_sel = 2,
1175 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1176 .output_value = 0,
1177 };
1178
1179 if (enable == true) {
1180 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1181 if (rc) {
1182 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1183 __func__, PM_HAP_EN_GPIO, rc);
1184 return rc;
1185 }
1186
1187 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1188 if (rc) {
1189 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1190 __func__, PM_HAP_LEN_GPIO, rc);
1191 return rc;
1192 }
1193
1194 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1195 if (rc) {
1196 pr_err("%s: unable to request gpio %d (%d)\n",
1197 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1198 return rc;
1199 }
1200
1201 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1202 if (rc) {
1203 pr_err("%s: Unable to set direction\n", __func__);
1204 goto free_gpio;
1205 }
1206
1207 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1208 if (IS_ERR(xo_handle_d1)) {
1209 rc = PTR_ERR(xo_handle_d1);
1210 pr_err("%s: failed to get the handle for D1(%d)\n",
1211 __func__, rc);
1212 goto gpio_set_dir;
1213 }
1214 } else {
1215 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1216
1217 msm_xo_put(xo_handle_d1);
1218 }
1219
1220 return 0;
1221
1222gpio_set_dir:
1223 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1224free_gpio:
1225 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1226 return rc;
1227}
1228
1229static struct isa1200_regulator isa1200_reg_data[] = {
1230 {
1231 .name = "vcc_i2c",
1232 .min_uV = ISA_I2C_VTG_MIN_UV,
1233 .max_uV = ISA_I2C_VTG_MAX_UV,
1234 .load_uA = ISA_I2C_CURR_UA,
1235 },
1236};
1237
1238static struct isa1200_platform_data isa1200_1_pdata = {
1239 .name = "vibrator",
1240 .dev_setup = isa1200_dev_setup,
1241 .power_on = isa1200_power,
1242 .hap_en_gpio = PM_HAP_EN_GPIO,
1243 .hap_len_gpio = PM_HAP_LEN_GPIO,
1244 .max_timeout = 15000,
1245 .mode_ctrl = PWM_GEN_MODE,
1246 .pwm_fd = {
1247 .pwm_div = 256,
1248 },
1249 .is_erm = false,
1250 .smart_en = true,
1251 .ext_clk_en = true,
1252 .chip_en = 1,
1253 .regulator_info = isa1200_reg_data,
1254 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1255};
1256
1257static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1258 {
1259 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301260 },
1261};
1262
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001263#define CYTTSP_TS_GPIO_IRQ 11
1264#define CYTTSP_TS_SLEEP_GPIO 50
1265#define CYTTSP_TS_RESOUT_N_GPIO 52
1266
1267/*virtual key support */
1268static ssize_t tma340_vkeys_show(struct kobject *kobj,
1269 struct kobj_attribute *attr, char *buf)
1270{
1271 return snprintf(buf, 200,
1272 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1273 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1274 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1275 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1276 "\n");
1277}
1278
1279static struct kobj_attribute tma340_vkeys_attr = {
1280 .attr = {
1281 .mode = S_IRUGO,
1282 },
1283 .show = &tma340_vkeys_show,
1284};
1285
1286static struct attribute *tma340_properties_attrs[] = {
1287 &tma340_vkeys_attr.attr,
1288 NULL
1289};
1290
1291static struct attribute_group tma340_properties_attr_group = {
1292 .attrs = tma340_properties_attrs,
1293};
1294
1295
1296static int cyttsp_platform_init(struct i2c_client *client)
1297{
1298 int rc = 0;
1299 static struct kobject *tma340_properties_kobj;
1300
1301 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1302 tma340_properties_kobj = kobject_create_and_add("board_properties",
1303 NULL);
1304 if (tma340_properties_kobj)
1305 rc = sysfs_create_group(tma340_properties_kobj,
1306 &tma340_properties_attr_group);
1307 if (!tma340_properties_kobj || rc)
1308 pr_err("%s: failed to create board_properties\n",
1309 __func__);
1310
1311 return 0;
1312}
1313
1314static struct cyttsp_regulator regulator_data[] = {
1315 {
1316 .name = "vdd",
1317 .min_uV = CY_TMA300_VTG_MIN_UV,
1318 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301319 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1320 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321 },
1322 /* TODO: Remove after runtime PM is enabled in I2C driver */
1323 {
1324 .name = "vcc_i2c",
1325 .min_uV = CY_I2C_VTG_MIN_UV,
1326 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301327 .hpm_load_uA = CY_I2C_CURR_UA,
1328 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001329 },
1330};
1331
1332static struct cyttsp_platform_data cyttsp_pdata = {
1333 .panel_maxx = 634,
1334 .panel_maxy = 1166,
1335 .disp_maxx = 616,
1336 .disp_maxy = 1023,
1337 .disp_minx = 0,
1338 .disp_miny = 16,
1339 .flags = 0x01,
1340 .gen = CY_GEN3, /* or */
1341 .use_st = CY_USE_ST,
1342 .use_mt = CY_USE_MT,
1343 .use_hndshk = CY_SEND_HNDSHK,
1344 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301345 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001346 .use_gestures = CY_USE_GESTURES,
1347 .fw_fname = "cyttsp_8960_cdp.hex",
1348 /* activate up to 4 groups
1349 * and set active distance
1350 */
1351 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1352 CY_GEST_GRP3 | CY_GEST_GRP4 |
1353 CY_ACT_DIST,
1354 /* change act_intrvl to customize the Active power state
1355 * scanning/processing refresh interval for Operating mode
1356 */
1357 .act_intrvl = CY_ACT_INTRVL_DFLT,
1358 /* change tch_tmout to customize the touch timeout for the
1359 * Active power state for Operating mode
1360 */
1361 .tch_tmout = CY_TCH_TMOUT_DFLT,
1362 /* change lp_intrvl to customize the Low Power power state
1363 * scanning/processing refresh interval for Operating mode
1364 */
1365 .lp_intrvl = CY_LP_INTRVL_DFLT,
1366 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1367 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1368 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1369 .regulator_info = regulator_data,
1370 .num_regulators = ARRAY_SIZE(regulator_data),
1371 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301372 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001373};
1374
1375static struct i2c_board_info cyttsp_info[] __initdata = {
1376 {
1377 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1378 .platform_data = &cyttsp_pdata,
1379#ifndef CY_USE_TIMER
1380 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1381#endif /* CY_USE_TIMER */
1382 },
1383};
1384
Mohan Pallaka50837382011-09-07 11:00:57 +05301385/* configuration data */
1386static const u8 mxt_config_data[] = {
1387 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001388 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301389 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001390 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001391 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1393 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1394 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1395 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1396 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301397 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001398 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301399 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001400 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301401 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001402 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1403 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1404 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1405 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301406 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001407 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1408 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301409 /* T18 Object */
1410 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301411 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001412 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1413 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301414 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001415 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1416 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301417 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001418 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1419 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301420 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001421 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301422 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001423 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301424 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001425 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301426 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001427 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301428 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001429 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301430};
1431
Amy Maloche08266db2011-11-04 11:07:16 -07001432#define MXT_TS_GPIO_IRQ 11
1433#define MXT_TS_LDO_EN_GPIO 50
1434#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301435
1436static void mxt_init_hw_liquid(void)
1437{
1438 int rc;
1439
Mohan Pallaka50837382011-09-07 11:00:57 +05301440 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1441 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001442 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1443 __func__, MXT_TS_LDO_EN_GPIO);
1444 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301445 }
1446
1447 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1448 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001449 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1450 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301451 goto err_ldo_gpio_req;
1452 }
1453
Mohan Pallaka50837382011-09-07 11:00:57 +05301454 return;
1455
Mohan Pallaka50837382011-09-07 11:00:57 +05301456err_ldo_gpio_req:
1457 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301458}
1459
1460static struct mxt_platform_data mxt_platform_data = {
1461 .config = mxt_config_data,
1462 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001463 .x_size = 1365,
1464 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301465 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001466 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001467 .reset_gpio = MXT_TS_RESET_GPIO,
1468 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301469};
1470
1471static struct i2c_board_info mxt_device_info[] __initdata = {
1472 {
1473 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1474 .platform_data = &mxt_platform_data,
1475 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1476 },
1477};
1478
Eugene Yasmand2316b82011-12-07 18:23:48 +02001479static struct i2c_board_info sii_device_info[] __initdata = {
1480 {
1481 I2C_BOARD_INFO("Sil-9244", 0x39),
1482 .flags = I2C_CLIENT_WAKE,
1483 .irq = MSM_GPIO_TO_INT(15),
1484 },
1485};
1486
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001487static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1488 .clk_freq = 100000,
1489 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001490};
1491
1492static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1493 .clk_freq = 100000,
1494 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001495};
1496
1497static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1498 .clk_freq = 100000,
1499 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001500};
1501
1502static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1503 .clk_freq = 100000,
1504 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001505};
1506
1507static struct msm_rpm_platform_data msm_rpm_data = {
1508 .reg_base_addrs = {
1509 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1510 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1511 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1512 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1513 },
1514
1515 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1516 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1517 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1518 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1519 .msm_apps_ipc_rpm_val = 4,
1520};
1521
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06001522static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1523 .base_addr = MSM_ACC0_BASE + 0x08,
1524 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1525 .mask = 1UL << 13,
1526};
1527
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001528static struct ks8851_pdata spi_eth_pdata = {
1529 .irq_gpio = KS8851_IRQ_GPIO,
1530 .rst_gpio = KS8851_RST_GPIO,
1531};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001532
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001533static struct spi_board_info spi_board_info[] __initdata = {
1534 {
1535 .modalias = "ks8851",
1536 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1537 .max_speed_hz = 19200000,
1538 .bus_num = 0,
1539 .chip_select = 0,
1540 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001541 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001542 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001543 {
1544 .modalias = "dsi_novatek_3d_panel_spi",
1545 .max_speed_hz = 10800000,
1546 .bus_num = 0,
1547 .chip_select = 1,
1548 .mode = SPI_MODE_0,
1549 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001550};
1551
1552static struct platform_device msm_device_saw_core0 = {
1553 .name = "saw-regulator",
1554 .id = 0,
1555 .dev = {
1556 .platform_data = &msm_saw_regulator_pdata_s5,
1557 },
1558};
1559
1560static struct platform_device msm_device_saw_core1 = {
1561 .name = "saw-regulator",
1562 .id = 1,
1563 .dev = {
1564 .platform_data = &msm_saw_regulator_pdata_s6,
1565 },
1566};
1567
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001568static struct tsens_platform_data msm_tsens_pdata = {
1569 .slope = 910,
1570 .tsens_factor = 1000,
1571 .hw_type = MSM_8960,
1572 .tsens_num_sensor = 5,
1573};
1574
1575static struct platform_device msm_tsens_device = {
1576 .name = "tsens8960-tm",
1577 .id = -1,
1578 .dev = {
1579 .platform_data = &msm_tsens_pdata,
1580 },
1581};
1582
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001583#ifdef CONFIG_MSM_FAKE_BATTERY
1584static struct platform_device fish_battery_device = {
1585 .name = "fish_battery",
1586};
1587#endif
1588
David Collins26f05562011-06-20 09:56:28 -07001589static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001590 .name = GPIO_REGULATOR_DEV_NAME,
1591 .id = PM8921_MPP_PM_TO_SYS(7),
1592 .dev = {
1593 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1594 },
1595};
1596
David Collins26f05562011-06-20 09:56:28 -07001597static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001598 .name = GPIO_REGULATOR_DEV_NAME,
1599 .id = 91,
1600 .dev = {
1601 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1602 },
1603};
1604
David Collinsb10be1d2011-09-02 10:29:31 -07001605static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1606 .name = GPIO_REGULATOR_DEV_NAME,
1607 .id = PM8921_GPIO_PM_TO_SYS(17),
1608 .dev = {
1609 .platform_data =
1610 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1611 },
1612};
1613
David Collins35a78f52011-12-14 15:54:25 -08001614static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1615 .name = GPIO_REGULATOR_DEV_NAME,
1616 .id = PM8921_GPIO_PM_TO_SYS(42),
1617 .dev = {
1618 .platform_data =
1619 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1620 },
1621};
1622
David Collins26f05562011-06-20 09:56:28 -07001623static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1624 .name = "rpm-regulator",
1625 .id = -1,
1626 .dev = {
1627 .platform_data = &msm_rpm_regulator_pdata,
1628 },
1629};
1630
David Collins4c31a872011-08-31 10:07:10 -07001631static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1632 .phys_addr_base = 0x0010C000,
1633 .reg_offsets = {
1634 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1635 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1636 },
1637 .phys_size = SZ_8K,
1638 .log_len = 4096, /* log's buffer length in bytes */
1639 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1640};
1641
1642static struct platform_device msm_rpm_log_device = {
1643 .name = "msm_rpm_log",
1644 .id = -1,
1645 .dev = {
1646 .platform_data = &msm_rpm_log_pdata,
1647 },
1648};
1649
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001650static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001651 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001652 &msm_device_smd,
1653 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301654 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001655 &msm_device_saw_core0,
1656 &msm_device_saw_core1,
1657 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001658 &msm8960_device_ssbi_pmic,
David Collins35a78f52011-12-14 15:54:25 -08001659 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001660 &msm8960_device_qup_spi_gsbi1,
1661 &msm8960_device_qup_i2c_gsbi3,
1662 &msm8960_device_qup_i2c_gsbi4,
1663 &msm8960_device_qup_i2c_gsbi10,
1664#ifndef CONFIG_MSM_DSPS
1665 &msm8960_device_qup_i2c_gsbi12,
1666#endif
1667 &msm_slim_ctrl,
1668 &msm_device_wcnss_wlan,
1669#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1670 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1671 &qcrypto_device,
1672#endif
1673
1674#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1675 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1676 &qcedev_device,
1677#endif
1678#ifdef CONFIG_MSM_ROTATOR
1679 &msm_rotator_device,
1680#endif
1681 &msm_device_sps,
1682#ifdef CONFIG_MSM_FAKE_BATTERY
1683 &fish_battery_device,
1684#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001685 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001686#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001687#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001688 &android_pmem_device,
1689 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001690#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001691 &android_pmem_audio_device,
1692#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001693 &msm_device_vidc,
1694 &msm_device_bam_dmux,
1695 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001696
1697#ifdef CONFIG_HW_RANDOM_MSM
1698 &msm_device_rng,
1699#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001700 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07001701#ifdef CONFIG_ION_MSM
1702 &ion_dev,
1703#endif
David Collins4c31a872011-08-31 10:07:10 -07001704 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06001705 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001706 &msm_device_tz_log,
1707
Pratik Patel7831c082011-06-08 21:44:37 -07001708#ifdef CONFIG_MSM_QDSS
1709 &msm_etb_device,
1710 &msm_tpiu_device,
1711 &msm_funnel_device,
1712 &msm_ptm_device,
1713#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001714 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001715 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716};
1717
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001718static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001719 &msm8960_device_otg,
1720 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001721 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301722 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001723 &android_usb_device,
1724 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001725 &msm_bus_apps_fabric,
1726 &msm_bus_sys_fabric,
1727 &msm_bus_mm_fabric,
1728 &msm_bus_sys_fpb,
1729 &msm_bus_cpss_fpb,
1730 &msm_pcm,
1731 &msm_pcm_routing,
1732 &msm_cpudai0,
1733 &msm_cpudai1,
1734 &msm_cpudai_hdmi_rx,
1735 &msm_cpudai_bt_rx,
1736 &msm_cpudai_bt_tx,
1737 &msm_cpudai_fm_rx,
1738 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001739 &msm_cpudai_auxpcm_rx,
1740 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001741 &msm_cpu_fe,
1742 &msm_stub_codec,
1743 &msm_voice,
1744 &msm_voip,
1745 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301746 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001747 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001748 &msm_cpudai_incall_record_rx,
1749 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001750
1751#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1752 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1753 &qcrypto_device,
1754#endif
1755
1756#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1757 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1758 &qcedev_device,
1759#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001760};
1761
1762static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001763 &msm_kgsl_3d0,
1764 &msm_kgsl_2d0,
1765 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001766#ifdef CONFIG_MSM_GEMINI
1767 &msm8960_gemini_device,
1768#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001769};
1770
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001771static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001772 &msm_8960_q6_lpass,
1773 &msm_8960_q6_mss_fw,
1774 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001775 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001776 &msm_pil_tzapps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001777 &msm8960_device_otg,
1778 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001779 &msm_device_hsusb_host,
1780 &android_usb_device,
1781 &msm_pcm,
1782 &msm_pcm_routing,
1783 &msm_cpudai0,
1784 &msm_cpudai1,
1785 &msm_cpudai_hdmi_rx,
1786 &msm_cpudai_bt_rx,
1787 &msm_cpudai_bt_tx,
1788 &msm_cpudai_fm_rx,
1789 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001790 &msm_cpudai_auxpcm_rx,
1791 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001792 &msm_cpu_fe,
1793 &msm_stub_codec,
1794 &msm_kgsl_3d0,
1795#ifdef CONFIG_MSM_KGSL_2D
1796 &msm_kgsl_2d0,
1797 &msm_kgsl_2d1,
1798#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001799#ifdef CONFIG_MSM_GEMINI
1800 &msm8960_gemini_device,
1801#endif
1802 &msm_voice,
1803 &msm_voip,
1804 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301805 &msm_cpudai_afe_01_rx,
1806 &msm_cpudai_afe_01_tx,
1807 &msm_cpudai_afe_02_rx,
1808 &msm_cpudai_afe_02_tx,
1809 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301810 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001811 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001812 &msm_cpudai_incall_record_rx,
1813 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001814 &msm_pcm_hostless,
1815 &msm_bus_apps_fabric,
1816 &msm_bus_sys_fabric,
1817 &msm_bus_mm_fabric,
1818 &msm_bus_sys_fpb,
1819 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001820 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001821};
1822
1823static void __init msm8960_i2c_init(void)
1824{
1825 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1826 &msm8960_i2c_qup_gsbi4_pdata;
1827
1828 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1829 &msm8960_i2c_qup_gsbi3_pdata;
1830
1831 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1832 &msm8960_i2c_qup_gsbi10_pdata;
1833
1834 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1835 &msm8960_i2c_qup_gsbi12_pdata;
1836}
1837
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001838static void __init msm8960_gfx_init(void)
1839{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001840 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001841 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1842 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1843 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001844 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1845 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001846 }
1847}
1848
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001849static struct msm_cpuidle_state msm_cstates[] __initdata = {
1850 {0, 0, "C0", "WFI",
1851 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1852
1853 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1854 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1855
1856 {0, 2, "C2", "POWER_COLLAPSE",
1857 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1858
1859 {1, 0, "C0", "WFI",
1860 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1861
1862 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1863 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1864};
1865
1866static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1867 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1868 .idle_supported = 1,
1869 .suspend_supported = 1,
1870 .idle_enabled = 0,
1871 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001872 },
1873
1874 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1875 .idle_supported = 1,
1876 .suspend_supported = 1,
1877 .idle_enabled = 0,
1878 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001879 },
1880
1881 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1882 .idle_supported = 1,
1883 .suspend_supported = 1,
1884 .idle_enabled = 1,
1885 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001886 },
1887
1888 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1889 .idle_supported = 0,
1890 .suspend_supported = 1,
1891 .idle_enabled = 0,
1892 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001893 },
1894
1895 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1896 .idle_supported = 1,
1897 .suspend_supported = 1,
1898 .idle_enabled = 0,
1899 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001900 },
1901
1902 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1903 .idle_supported = 1,
1904 .suspend_supported = 0,
1905 .idle_enabled = 1,
1906 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907 },
1908};
1909
1910static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1911 {
1912 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1913 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1914 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001915 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001916 },
1917
1918 {
1919 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1920 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1921 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001922 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001923 },
1924
1925 {
1926 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1927 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1928 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001929 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001930 },
1931
1932 {
1933 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1934 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1935 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001936 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001937 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001938 {
1939 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1940 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1941 false,
1942 7000, 3500, 66600000, 5150,
1943 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001944
1945 {
1946 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1947 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1948 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001949 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950 },
1951
1952 {
1953 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1954 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1955 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001956 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001957 },
1958
1959 {
1960 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1961 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1962 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001963 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001964 },
1965
1966 {
1967 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1968 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1969 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001970 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001971 },
1972};
1973
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001974static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1975 .mode = MSM_PM_BOOT_CONFIG_TZ,
1976};
1977
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001978#ifdef CONFIG_I2C
1979#define I2C_SURF 1
1980#define I2C_FFA (1 << 1)
1981#define I2C_RUMI (1 << 2)
1982#define I2C_SIM (1 << 3)
1983#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03001984#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001985
1986struct i2c_registry {
1987 u8 machs;
1988 int bus;
1989 struct i2c_board_info *info;
1990 int len;
1991};
1992
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001993/* Sensors DSPS platform data */
1994#ifdef CONFIG_MSM_DSPS
1995#define DSPS_PIL_GENERIC_NAME "dsps"
1996#endif /* CONFIG_MSM_DSPS */
1997
1998static void __init msm8960_init_dsps(void)
1999{
2000#ifdef CONFIG_MSM_DSPS
2001 struct msm_dsps_platform_data *pdata =
2002 msm_dsps_device.dev.platform_data;
2003 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2004 pdata->gpios = NULL;
2005 pdata->gpios_num = 0;
2006
2007 platform_device_register(&msm_dsps_device);
2008#endif /* CONFIG_MSM_DSPS */
2009}
2010
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002011static int hsic_peripheral_status = 1;
2012static DEFINE_MUTEX(hsic_status_lock);
2013
2014void peripheral_connect()
2015{
2016 mutex_lock(&hsic_status_lock);
2017 if (hsic_peripheral_status)
2018 goto out;
2019 platform_device_add(&msm_device_hsic_host);
2020 hsic_peripheral_status = 1;
2021out:
2022 mutex_unlock(&hsic_status_lock);
2023}
2024EXPORT_SYMBOL(peripheral_connect);
2025
2026void peripheral_disconnect()
2027{
2028 mutex_lock(&hsic_status_lock);
2029 if (!hsic_peripheral_status)
2030 goto out;
2031 platform_device_del(&msm_device_hsic_host);
2032 hsic_peripheral_status = 0;
2033out:
2034 mutex_unlock(&hsic_status_lock);
2035}
2036EXPORT_SYMBOL(peripheral_disconnect);
2037
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002038static void __init msm8960_init_hsic(void)
2039{
2040#ifdef CONFIG_USB_EHCI_MSM_HSIC
2041 uint32_t version = socinfo_get_version();
2042
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002043 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002044 return;
2045
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002046 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002047 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002048#endif
2049}
2050
Amir Samuelov5137e392011-09-21 17:31:25 +03002051#ifdef CONFIG_ISL9519_CHARGER
2052static struct isl_platform_data isl_data __initdata = {
2053 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2054 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2055 .max_system_voltage = 4200,
2056 .min_system_voltage = 3200,
2057 .chgcurrent = 1000, /* 1900, */
2058 .term_current = 400, /* Need fine tuning */
2059 .input_current = 2048,
2060};
2061
2062static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2063 {
2064 I2C_BOARD_INFO("isl9519q", 0x9),
2065 .irq = 0, /* Not required when notify-by-pmic */
2066 .platform_data = &isl_data,
2067 },
2068};
2069#endif /* CONFIG_ISL9519_CHARGER */
2070
Amir Samuelov755616d2011-12-13 16:34:46 +02002071static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2072 {
2073 I2C_BOARD_INFO("sx1508q", 0x20),
2074 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2075 },
2076};
2077
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002078static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002079#ifdef CONFIG_ISL9519_CHARGER
2080 {
2081 I2C_LIQUID,
2082 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2083 isl_charger_i2c_info,
2084 ARRAY_SIZE(isl_charger_i2c_info),
2085 },
2086#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002087 {
2088 I2C_SURF | I2C_FFA | I2C_FLUID,
2089 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2090 cyttsp_info,
2091 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002092 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302093 {
2094 I2C_LIQUID,
2095 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2096 mxt_device_info,
2097 ARRAY_SIZE(mxt_device_info),
2098 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302099 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302100 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302101 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002102 sii_device_info,
2103 ARRAY_SIZE(sii_device_info),
2104 },
2105 {
2106 I2C_LIQUID,
2107 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302108 msm_isa1200_board_info,
2109 ARRAY_SIZE(msm_isa1200_board_info),
2110 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002111 {
2112 I2C_LIQUID,
2113 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2114 liquid_io_expander_i2c_info,
2115 ARRAY_SIZE(liquid_io_expander_i2c_info),
2116 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002117};
2118#endif /* CONFIG_I2C */
2119
2120static void __init register_i2c_devices(void)
2121{
2122#ifdef CONFIG_I2C
2123 u8 mach_mask = 0;
2124 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002125#ifdef CONFIG_MSM_CAMERA
2126 struct i2c_registry msm8960_camera_i2c_devices = {
2127 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2128 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2129 msm8960_camera_board_info.board_info,
2130 msm8960_camera_board_info.num_i2c_board_info,
2131 };
2132#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002133
2134 /* Build the matching 'supported_machs' bitmask */
2135 if (machine_is_msm8960_cdp())
2136 mach_mask = I2C_SURF;
2137 else if (machine_is_msm8960_rumi3())
2138 mach_mask = I2C_RUMI;
2139 else if (machine_is_msm8960_sim())
2140 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002141 else if (machine_is_msm8960_fluid())
2142 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002143 else if (machine_is_msm8960_liquid())
2144 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002145 else if (machine_is_msm8960_mtp())
2146 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002147 else
2148 pr_err("unmatched machine ID in register_i2c_devices\n");
2149
2150 /* Run the array and install devices as appropriate */
2151 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2152 if (msm8960_i2c_devices[i].machs & mach_mask)
2153 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2154 msm8960_i2c_devices[i].info,
2155 msm8960_i2c_devices[i].len);
2156 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002157#ifdef CONFIG_MSM_CAMERA
2158 if (msm8960_camera_i2c_devices.machs & mach_mask)
2159 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2160 msm8960_camera_i2c_devices.info,
2161 msm8960_camera_i2c_devices.len);
2162#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002163#endif
2164}
2165
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002166static void __init msm8960_sim_init(void)
2167{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002168 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2169 &msm8960_device_watchdog.dev.platform_data;
2170
2171 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002172 BUG_ON(msm_rpm_init(&msm_rpm_data));
2173 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2174 ARRAY_SIZE(msm_rpmrs_levels)));
2175 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002176 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002177 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002178 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002179
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002180 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002181 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002182 msm8960_i2c_init();
2183 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2184 msm_spm_l2_init(msm_spm_l2_data);
2185 msm8960_init_buses();
2186 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002187 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002188 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002189 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002190
2191 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2192 &msm8960_qup_spi_gsbi1_pdata;
2193 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2194
2195 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002196 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002197 slim_register_board_info(msm_slim_devices,
2198 ARRAY_SIZE(msm_slim_devices));
2199 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2200 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2201 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2202 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002203 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002204 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002205}
2206
2207static void __init msm8960_rumi3_init(void)
2208{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002209 BUG_ON(msm_rpm_init(&msm_rpm_data));
2210 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2211 ARRAY_SIZE(msm_rpmrs_levels)));
2212 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002213 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002214 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002215 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002216 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002217 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2218 &msm8960_qup_spi_gsbi1_pdata;
2219 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2220 msm8960_i2c_init();
2221 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2222 msm_spm_l2_init(msm_spm_l2_data);
2223 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002224 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002225 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002226 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002227 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002228 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002229 slim_register_board_info(msm_slim_devices,
2230 ARRAY_SIZE(msm_slim_devices));
2231 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2232 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2233 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2234 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002235 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002236 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002237}
2238
2239static void __init msm8960_cdp_init(void)
2240{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002241 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2242 pr_err("meminfo_init() failed!\n");
2243
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002244 BUG_ON(msm_rpm_init(&msm_rpm_data));
2245 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2246 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002247
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002248 regulator_suppress_info_printing();
2249 if (msm_xo_init())
2250 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002251 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002252 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302253 if (machine_is_msm8960_liquid())
2254 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002255 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302256 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2257 machine_is_msm8960_cdp()) {
2258 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2259 } else if (machine_is_msm8960_liquid()) {
2260 msm_otg_pdata.phy_init_seq =
2261 liquid_v1_phy_init_seq;
2262 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302263 msm_otg_pdata.swfi_latency =
2264 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302265#ifdef CONFIG_USB_EHCI_MSM_HSIC
2266 if (machine_is_msm8960_liquid()) {
2267 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2268 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2269 }
2270#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302271 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002272 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002273 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2274 &msm8960_qup_spi_gsbi1_pdata;
2275 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002276
2277 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302278 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2279 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2280 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002281 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002282 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002283 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2284 msm_spm_l2_init(msm_spm_l2_data);
2285 msm8960_init_buses();
2286 platform_add_devices(msm_footswitch_devices,
2287 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002288 if (machine_is_msm8960_liquid())
2289 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002290 if (machine_is_msm8960_cdp())
2291 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002292 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002293 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002294 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002295 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002296 msm8960_init_cam();
2297 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002298 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302299 if (machine_is_msm8960_liquid())
2300 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002301 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002302 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002303 slim_register_board_info(msm_slim_devices,
2304 ARRAY_SIZE(msm_slim_devices));
2305 msm8960_init_dsps();
2306 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2307 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2308 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2309 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002310 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002311 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002312 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08002313 if (PLATFORM_IS_CHARM25())
2314 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002315}
2316
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002317MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2318 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002319 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002320 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302321 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002322 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002323 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002324 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002325 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002326MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002327
2328MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2329 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002330 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002331 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302332 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002333 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002334 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002335 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002336 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002337MACHINE_END
2338
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002339MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2340 .map_io = msm8960_map_io,
2341 .reserve = msm8960_reserve,
2342 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302343 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002344 .timer = &msm_timer,
2345 .init_machine = msm8960_cdp_init,
2346 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002347 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002348MACHINE_END
2349
2350MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2351 .map_io = msm8960_map_io,
2352 .reserve = msm8960_reserve,
2353 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302354 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002355 .timer = &msm_timer,
2356 .init_machine = msm8960_cdp_init,
2357 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002358 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002359MACHINE_END
2360
2361MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2362 .map_io = msm8960_map_io,
2363 .reserve = msm8960_reserve,
2364 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302365 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002366 .timer = &msm_timer,
2367 .init_machine = msm8960_cdp_init,
2368 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002369 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002370MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002371
2372MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2373 .map_io = msm8960_map_io,
2374 .reserve = msm8960_reserve,
2375 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302376 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002377 .timer = &msm_timer,
2378 .init_machine = msm8960_cdp_init,
2379 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002380 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002381MACHINE_END