blob: b67fdd07c04c253e6bb63848b66c3b473f855b61 [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) */
147#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan42ebe712012-01-10 16:30:58 -0800148#define MSM_ION_HEAP_NUM 6
Olav Hauganb5be7992011-11-18 14:29:02 -0800149#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
150static unsigned int msm_ion_cp_mm_size = MSM_ION_MM_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700151#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700152#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800153#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700154#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700155
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700156#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
157static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
158static int __init pmem_kernel_ebi1_size_setup(char *p)
159{
160 pmem_kernel_ebi1_size = memparse(p, NULL);
161 return 0;
162}
163early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
164#endif
165
166#ifdef CONFIG_ANDROID_PMEM
167static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800168static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700169static int __init pmem_size_setup(char *p)
170{
171 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800172 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173 return 0;
174}
175early_param("pmem_size", pmem_size_setup);
176
177static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
178
179static int __init pmem_adsp_size_setup(char *p)
180{
181 pmem_adsp_size = memparse(p, NULL);
182 return 0;
183}
184early_param("pmem_adsp_size", pmem_adsp_size_setup);
185
186static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
187
188static int __init pmem_audio_size_setup(char *p)
189{
190 pmem_audio_size = memparse(p, NULL);
191 return 0;
192}
193early_param("pmem_audio_size", pmem_audio_size_setup);
194#endif
195
196#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700197#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700198static struct android_pmem_platform_data android_pmem_pdata = {
199 .name = "pmem",
200 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
201 .cached = 1,
202 .memory_type = MEMTYPE_EBI1,
203};
204
205static struct platform_device android_pmem_device = {
206 .name = "android_pmem",
207 .id = 0,
208 .dev = {.platform_data = &android_pmem_pdata},
209};
210
211static struct android_pmem_platform_data android_pmem_adsp_pdata = {
212 .name = "pmem_adsp",
213 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
214 .cached = 0,
215 .memory_type = MEMTYPE_EBI1,
216};
217static struct platform_device android_pmem_adsp_device = {
218 .name = "android_pmem",
219 .id = 2,
220 .dev = { .platform_data = &android_pmem_adsp_pdata },
221};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700222#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700223
224static struct android_pmem_platform_data android_pmem_audio_pdata = {
225 .name = "pmem_audio",
226 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
227 .cached = 0,
228 .memory_type = MEMTYPE_EBI1,
229};
230
231static struct platform_device android_pmem_audio_device = {
232 .name = "android_pmem",
233 .id = 4,
234 .dev = { .platform_data = &android_pmem_audio_pdata },
235};
236#endif
237
Larry Bassel41a055b2011-12-06 16:15:14 -0800238struct fmem_platform_data fmem_pdata = {
239};
240
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700241#define DSP_RAM_BASE_8960 0x8da00000
242#define DSP_RAM_SIZE_8960 0x1800000
243static int dspcrashd_pdata_8960 = 0xDEADDEAD;
244
245static struct resource resources_dspcrashd_8960[] = {
246 {
247 .name = "msm_dspcrashd",
248 .start = DSP_RAM_BASE_8960,
249 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
250 .flags = IORESOURCE_DMA,
251 },
252};
253
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800254static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700255 .name = "msm_dspcrashd",
256 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
257 .resource = resources_dspcrashd_8960,
258 .dev = { .platform_data = &dspcrashd_pdata_8960 },
259};
260
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700261static struct memtype_reserve msm8960_reserve_table[] __initdata = {
262 [MEMTYPE_SMI] = {
263 },
264 [MEMTYPE_EBI0] = {
265 .flags = MEMTYPE_FLAGS_1M_ALIGN,
266 },
267 [MEMTYPE_EBI1] = {
268 .flags = MEMTYPE_FLAGS_1M_ALIGN,
269 },
270};
271
272static void __init size_pmem_devices(void)
273{
274#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700275#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700276 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800277
278 if (!pmem_param_set && machine_is_msm8960_liquid())
279 pmem_size = MSM_LIQUID_PMEM_SIZE;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700280 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700281#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
283#endif
284}
285
286static void __init reserve_memory_for(struct android_pmem_platform_data *p)
287{
288 msm8960_reserve_table[p->memory_type].size += p->size;
289}
290
291static void __init reserve_pmem_memory(void)
292{
293#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700294#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295 reserve_memory_for(&android_pmem_adsp_pdata);
296 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700297#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700298 reserve_memory_for(&android_pmem_audio_pdata);
299 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
300#endif
301}
302
Larry Bassel41a055b2011-12-06 16:15:14 -0800303static void __init reserve_fmem_memory(void)
304{
305}
306
Larry Basselb4126da2011-07-18 14:31:33 -0700307static int msm8960_paddr_to_memtype(unsigned int paddr)
308{
309 return MEMTYPE_EBI1;
310}
311
Laura Abbottd6183792011-08-19 13:42:24 -0700312#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800313#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
314static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
315 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800316 .align = PAGE_SIZE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800317};
318
319static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
320 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800321 .align = PAGE_SIZE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800322};
323
324static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800325 .adjacent_mem_id = INVALID_HEAP_ID,
326 .align = PAGE_SIZE,
327};
328
329static struct ion_co_heap_pdata fw_co_ion_pdata = {
330 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
331 .align = SZ_128K,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800332};
333#endif
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800334static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700335 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700336 .heaps = {
337 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800338 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700339 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700340 .name = ION_VMALLOC_HEAP_NAME,
341 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700342#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700343 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800344 .id = ION_SF_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700345 .type = ION_HEAP_TYPE_CARVEOUT,
Olav Hauganb5be7992011-11-18 14:29:02 -0800346 .name = ION_SF_HEAP_NAME,
347 .size = MSM_ION_SF_SIZE,
Laura Abbottd6183792011-08-19 13:42:24 -0700348 .memory_type = ION_EBI_TYPE,
Olav Haugan42ebe712012-01-10 16:30:58 -0800349 .extra_data = (void *) &co_ion_pdata,
Laura Abbottd6183792011-08-19 13:42:24 -0700350 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700351 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800352 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800353 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800354 .name = ION_MM_HEAP_NAME,
355 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700356 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800357 .extra_data = (void *) &cp_mm_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700358 },
Laura Abbott8c017362011-09-22 20:59:12 -0700359 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800360 .id = ION_MM_FIRMWARE_HEAP_ID,
361 .type = ION_HEAP_TYPE_CARVEOUT,
362 .name = ION_MM_FIRMWARE_HEAP_NAME,
363 .size = MSM_ION_MM_FW_SIZE,
364 .memory_type = ION_EBI_TYPE,
365 .extra_data = (void *) &fw_co_ion_pdata,
366 },
367 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800368 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800369 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800370 .name = ION_MFC_HEAP_NAME,
371 .size = MSM_ION_MFC_SIZE,
372 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800373 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800374 },
375 {
376 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700377 .type = ION_HEAP_TYPE_IOMMU,
378 .name = ION_IOMMU_HEAP_NAME,
379 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700380#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700381 }
382};
383
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800384static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700385 .name = "ion-msm",
386 .id = 1,
387 .dev = { .platform_data = &ion_pdata },
388};
389#endif
390
Larry Bassel41a055b2011-12-06 16:15:14 -0800391struct platform_device fmem_device = {
392 .name = "fmem",
393 .id = 1,
394 .dev = { .platform_data = &fmem_pdata },
395};
396
Laura Abbottd6183792011-08-19 13:42:24 -0700397static void reserve_ion_memory(void)
398{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700399#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800400 unsigned int i;
401
402 if (!pmem_param_set && machine_is_msm8960_liquid()) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800403 msm_ion_cp_mm_size = MSM_LIQUID_ION_MM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800404 for (i = 0; i < ion_pdata.nr; i++) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800405 if (ion_pdata.heaps[i].id == ION_CP_MM_HEAP_ID) {
406 ion_pdata.heaps[i].size = msm_ion_cp_mm_size;
407 pr_debug("msm_ion_cp_mm_size 0x%x\n",
408 msm_ion_cp_mm_size);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800409 break;
410 }
411 }
412 }
Olav Hauganb5be7992011-11-18 14:29:02 -0800413 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_ion_cp_mm_size;
Olav Haugan42ebe712012-01-10 16:30:58 -0800414 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
Olav Hauganb5be7992011-11-18 14:29:02 -0800415 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
416 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700417#endif
418}
Huaibin Yanga5419422011-12-08 23:52:10 -0800419
420static void __init reserve_mdp_memory(void)
421{
422 msm8960_mdp_writeback(msm8960_reserve_table);
423}
424
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700425static void __init msm8960_calculate_reserve_sizes(void)
426{
427 size_pmem_devices();
428 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700429 reserve_ion_memory();
Larry Bassel41a055b2011-12-06 16:15:14 -0800430 reserve_fmem_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800431 reserve_mdp_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700432}
433
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700434static struct reserve_info msm8960_reserve_info __initdata = {
435 .memtype_reserve_table = msm8960_reserve_table,
436 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
437 .paddr_to_memtype = msm8960_paddr_to_memtype,
438};
439
Larry Basselb4126da2011-07-18 14:31:33 -0700440static int msm8960_memory_bank_size(void)
441{
442 return 1<<29;
443}
444
445static void __init locate_unstable_memory(void)
446{
447 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
448 unsigned long bank_size;
449 unsigned long low, high;
450
451 bank_size = msm8960_memory_bank_size();
452 low = meminfo.bank[0].start;
453 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700454
455 /* Check if 32 bit overflow occured */
456 if (high < mb->start)
457 high = ~0UL;
458
Larry Basselb4126da2011-07-18 14:31:33 -0700459 low &= ~(bank_size - 1);
460
461 if (high - low <= bank_size)
462 return;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800463 msm8960_reserve_info.low_unstable_address = high -
464 MIN_MEMORY_BLOCK_SIZE;
465 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700466
Larry Basselb4126da2011-07-18 14:31:33 -0700467 msm8960_reserve_info.bank_size = bank_size;
468 pr_info("low unstable address %lx max size %lx bank size %lx\n",
469 msm8960_reserve_info.low_unstable_address,
470 msm8960_reserve_info.max_unstable_size,
471 msm8960_reserve_info.bank_size);
472}
473
Larry Basselb830e182011-10-14 10:46:55 -0700474static void __init place_movable_zone(void)
475{
476 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
477 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
478 pr_info("movable zone start %lx size %lx\n",
479 movable_reserved_start, movable_reserved_size);
480}
481
482static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700483{
484 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700485 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700486 place_movable_zone();
487}
488
489static void __init msm8960_reserve(void)
490{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700491 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800492 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700493}
494
Larry Bassela4414b12011-08-04 11:11:02 -0700495static int msm8960_change_memory_power(u64 start, u64 size,
496 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700497{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700498 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700499}
500
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700501static void __init msm8960_allocate_memory_regions(void)
502{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800503 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700504}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800505
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700506#ifdef CONFIG_WCD9310_CODEC
507
508#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
509
Patrick Lai3043fba2011-08-01 14:15:57 -0700510/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
511 * 4 micbiases are used to power various analog and digital
512 * microphones operating at 1800 mV. Technically, all micbiases
513 * can source from single cfilter since all microphones operate
514 * at the same voltage level. The arrangement below is to make
515 * sure all cfilters are exercised. LDO_H regulator ouput level
516 * does not need to be as high as 2.85V. It is choosen for
517 * microphone sensitivity purpose.
518 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700519static struct tabla_pdata tabla_platform_data = {
520 .slimbus_slave_device = {
521 .name = "tabla-slave",
522 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
523 },
524 .irq = MSM_GPIO_TO_INT(62),
525 .irq_base = TABLA_INTERRUPT_BASE,
526 .num_irqs = NR_TABLA_IRQS,
527 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700528 .micbias = {
529 .ldoh_v = TABLA_LDOH_2P85_V,
530 .cfilt1_mv = 1800,
531 .cfilt2_mv = 1800,
532 .cfilt3_mv = 1800,
533 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
534 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
535 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
536 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
537 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700538};
539
540static struct slim_device msm_slim_tabla = {
541 .name = "tabla-slim",
542 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
543 .dev = {
544 .platform_data = &tabla_platform_data,
545 },
546};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530547
548static struct tabla_pdata tabla20_platform_data = {
549 .slimbus_slave_device = {
550 .name = "tabla-slave",
551 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
552 },
553 .irq = MSM_GPIO_TO_INT(62),
554 .irq_base = TABLA_INTERRUPT_BASE,
555 .num_irqs = NR_TABLA_IRQS,
556 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
557 .micbias = {
558 .ldoh_v = TABLA_LDOH_2P85_V,
559 .cfilt1_mv = 1800,
560 .cfilt2_mv = 1800,
561 .cfilt3_mv = 1800,
562 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
563 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
564 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
565 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
566 }
567};
568
569static struct slim_device msm_slim_tabla20 = {
570 .name = "tabla2x-slim",
571 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
572 .dev = {
573 .platform_data = &tabla20_platform_data,
574 },
575};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576#endif
577
578static struct slim_boardinfo msm_slim_devices[] = {
579#ifdef CONFIG_WCD9310_CODEC
580 {
581 .bus_num = 1,
582 .slim_slave = &msm_slim_tabla,
583 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530584 {
585 .bus_num = 1,
586 .slim_slave = &msm_slim_tabla20,
587 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700588#endif
589 /* add more slimbus slaves as needed */
590};
591
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700592#define MSM_WCNSS_PHYS 0x03000000
593#define MSM_WCNSS_SIZE 0x280000
594
595static struct resource resources_wcnss_wlan[] = {
596 {
597 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
598 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
599 .name = "wcnss_wlanrx_irq",
600 .flags = IORESOURCE_IRQ,
601 },
602 {
603 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
604 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
605 .name = "wcnss_wlantx_irq",
606 .flags = IORESOURCE_IRQ,
607 },
608 {
609 .start = MSM_WCNSS_PHYS,
610 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
611 .name = "wcnss_mmio",
612 .flags = IORESOURCE_MEM,
613 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700614 {
615 .start = 84,
616 .end = 88,
617 .name = "wcnss_gpios_5wire",
618 .flags = IORESOURCE_IO,
619 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700620};
621
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700622static struct qcom_wcnss_opts qcom_wcnss_pdata = {
623 .has_48mhz_xo = 1,
624};
625
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700626static struct platform_device msm_device_wcnss_wlan = {
627 .name = "wcnss_wlan",
628 .id = 0,
629 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
630 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700631 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700632};
633
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
635 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
636 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
637 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
638
639#define QCE_SIZE 0x10000
640#define QCE_0_BASE 0x18500000
641
642#define QCE_HW_KEY_SUPPORT 0
643#define QCE_SHA_HMAC_SUPPORT 1
644#define QCE_SHARE_CE_RESOURCE 1
645#define QCE_CE_SHARED 0
646
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800647/* Begin Bus scaling definitions */
648static struct msm_bus_vectors crypto_hw_init_vectors[] = {
649 {
650 .src = MSM_BUS_MASTER_ADM_PORT0,
651 .dst = MSM_BUS_SLAVE_EBI_CH0,
652 .ab = 0,
653 .ib = 0,
654 },
655 {
656 .src = MSM_BUS_MASTER_ADM_PORT1,
657 .dst = MSM_BUS_SLAVE_GSBI1_UART,
658 .ab = 0,
659 .ib = 0,
660 },
661};
662
663static struct msm_bus_vectors crypto_hw_active_vectors[] = {
664 {
665 .src = MSM_BUS_MASTER_ADM_PORT0,
666 .dst = MSM_BUS_SLAVE_EBI_CH0,
667 .ab = 70000000UL,
668 .ib = 70000000UL,
669 },
670 {
671 .src = MSM_BUS_MASTER_ADM_PORT1,
672 .dst = MSM_BUS_SLAVE_GSBI1_UART,
673 .ab = 2480000000UL,
674 .ib = 2480000000UL,
675 },
676};
677
678static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
679 {
680 ARRAY_SIZE(crypto_hw_init_vectors),
681 crypto_hw_init_vectors,
682 },
683 {
684 ARRAY_SIZE(crypto_hw_active_vectors),
685 crypto_hw_active_vectors,
686 },
687};
688
689static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
690 crypto_hw_bus_scale_usecases,
691 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
692 .name = "cryptohw",
693};
694/* End Bus Scaling Definitions*/
695
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700696static struct resource qcrypto_resources[] = {
697 [0] = {
698 .start = QCE_0_BASE,
699 .end = QCE_0_BASE + QCE_SIZE - 1,
700 .flags = IORESOURCE_MEM,
701 },
702 [1] = {
703 .name = "crypto_channels",
704 .start = DMOV_CE_IN_CHAN,
705 .end = DMOV_CE_OUT_CHAN,
706 .flags = IORESOURCE_DMA,
707 },
708 [2] = {
709 .name = "crypto_crci_in",
710 .start = DMOV_CE_IN_CRCI,
711 .end = DMOV_CE_IN_CRCI,
712 .flags = IORESOURCE_DMA,
713 },
714 [3] = {
715 .name = "crypto_crci_out",
716 .start = DMOV_CE_OUT_CRCI,
717 .end = DMOV_CE_OUT_CRCI,
718 .flags = IORESOURCE_DMA,
719 },
720};
721
722static struct resource qcedev_resources[] = {
723 [0] = {
724 .start = QCE_0_BASE,
725 .end = QCE_0_BASE + QCE_SIZE - 1,
726 .flags = IORESOURCE_MEM,
727 },
728 [1] = {
729 .name = "crypto_channels",
730 .start = DMOV_CE_IN_CHAN,
731 .end = DMOV_CE_OUT_CHAN,
732 .flags = IORESOURCE_DMA,
733 },
734 [2] = {
735 .name = "crypto_crci_in",
736 .start = DMOV_CE_IN_CRCI,
737 .end = DMOV_CE_IN_CRCI,
738 .flags = IORESOURCE_DMA,
739 },
740 [3] = {
741 .name = "crypto_crci_out",
742 .start = DMOV_CE_OUT_CRCI,
743 .end = DMOV_CE_OUT_CRCI,
744 .flags = IORESOURCE_DMA,
745 },
746};
747
748#endif
749
750#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
751 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
752
753static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
754 .ce_shared = QCE_CE_SHARED,
755 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
756 .hw_key_support = QCE_HW_KEY_SUPPORT,
757 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800758 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700759};
760
761static struct platform_device qcrypto_device = {
762 .name = "qcrypto",
763 .id = 0,
764 .num_resources = ARRAY_SIZE(qcrypto_resources),
765 .resource = qcrypto_resources,
766 .dev = {
767 .coherent_dma_mask = DMA_BIT_MASK(32),
768 .platform_data = &qcrypto_ce_hw_suppport,
769 },
770};
771#endif
772
773#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
774 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
775
776static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
777 .ce_shared = QCE_CE_SHARED,
778 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
779 .hw_key_support = QCE_HW_KEY_SUPPORT,
780 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800781 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700782};
783
784static struct platform_device qcedev_device = {
785 .name = "qce",
786 .id = 0,
787 .num_resources = ARRAY_SIZE(qcedev_resources),
788 .resource = qcedev_resources,
789 .dev = {
790 .coherent_dma_mask = DMA_BIT_MASK(32),
791 .platform_data = &qcedev_ce_hw_suppport,
792 },
793};
794#endif
795
Joel Kingb8352a12011-11-15 18:46:24 -0800796#define MDM2AP_ERRFATAL 70
797#define AP2MDM_ERRFATAL 95
798#define MDM2AP_STATUS 69
799#define AP2MDM_STATUS 94
800#define AP2MDM_PMIC_RESET_N 80
801#define AP2MDM_KPDPWR_N 81
802
Joel Kingb8352a12011-11-15 18:46:24 -0800803static struct resource mdm_resources[] = {
804 {
805 .start = MDM2AP_ERRFATAL,
806 .end = MDM2AP_ERRFATAL,
807 .name = "MDM2AP_ERRFATAL",
808 .flags = IORESOURCE_IO,
809 },
810 {
811 .start = AP2MDM_ERRFATAL,
812 .end = AP2MDM_ERRFATAL,
813 .name = "AP2MDM_ERRFATAL",
814 .flags = IORESOURCE_IO,
815 },
816 {
817 .start = MDM2AP_STATUS,
818 .end = MDM2AP_STATUS,
819 .name = "MDM2AP_STATUS",
820 .flags = IORESOURCE_IO,
821 },
822 {
823 .start = AP2MDM_STATUS,
824 .end = AP2MDM_STATUS,
825 .name = "AP2MDM_STATUS",
826 .flags = IORESOURCE_IO,
827 },
828 {
829 .start = AP2MDM_PMIC_RESET_N,
830 .end = AP2MDM_PMIC_RESET_N,
831 .name = "AP2MDM_PMIC_RESET_N",
832 .flags = IORESOURCE_IO,
833 },
834 {
835 .start = AP2MDM_KPDPWR_N,
836 .end = AP2MDM_KPDPWR_N,
837 .name = "AP2MDM_KPDPWR_N",
838 .flags = IORESOURCE_IO,
839 },
840};
841
842static struct mdm_platform_data mdm_platform_data = {
843 .mdm_version = "2.5",
844};
845
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800846static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800847 .name = "mdm2_modem",
848 .id = -1,
849 .num_resources = ARRAY_SIZE(mdm_resources),
850 .resource = mdm_resources,
851 .dev = {
852 .platform_data = &mdm_platform_data,
853 },
854};
855
856static struct platform_device *mdm_devices[] __initdata = {
857 &mdm_device,
858};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700859
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700860#define MSM_SHARED_RAM_PHYS 0x80000000
861
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800862static void __init msm8960_map_io(void)
863{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800865 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700866
867 if (socinfo_init() < 0)
868 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800869}
870
871static void __init msm8960_init_irq(void)
872{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700873 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800874 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700875 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800876
877 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700878 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800879
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700880 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
881 mb();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800882}
883
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700884static void __init msm8960_init_buses(void)
885{
886#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -0600887 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -0600888 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
889 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
890 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
891 msm_bus_apps_fabric.dev.platform_data =
892 &msm_bus_8960_apps_fabric_pdata;
893 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
894 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
895 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
896 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700897#endif
898}
899
900static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
901 .max_clock_speed = 15060000,
902};
903
904#ifdef CONFIG_USB_MSM_OTG_72K
905static struct msm_otg_platform_data msm_otg_pdata;
906#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530907static int wr_phy_init_seq[] = {
908 0x44, 0x80, /* set VBUS valid threshold
909 and disconnect valid threshold */
910 0x38, 0x81, /* update DC voltage level */
911 0x14, 0x82, /* set preemphasis and rise/fall time */
912 0x13, 0x83, /* set source impedance adjusment */
913 -1};
914
915static int liquid_v1_phy_init_seq[] = {
916 0x44, 0x80,/* set VBUS valid threshold
917 and disconnect valid threshold */
918 0x3C, 0x81,/* update DC voltage level */
919 0x18, 0x82,/* set preemphasis and rise/fall time */
920 0x23, 0x83,/* set source impedance sdjusment */
921 -1};
922
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700923static struct msm_otg_platform_data msm_otg_pdata = {
924 .mode = USB_OTG,
925 .otg_control = OTG_PMIC_CONTROL,
926 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700927 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +0530928 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700929};
930#endif
931
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530932#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530933#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530934static struct msm_hsic_host_platform_data msm_hsic_pdata = {
935 .strobe = 150,
936 .data = 151,
937};
938#else
939static struct msm_hsic_host_platform_data msm_hsic_pdata;
940#endif
941
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700942#define PID_MAGIC_ID 0x71432909
943#define SERIAL_NUM_MAGIC_ID 0x61945374
944#define SERIAL_NUMBER_LENGTH 127
945#define DLOAD_USB_BASE_ADD 0x2A03F0C8
946
947struct magic_num_struct {
948 uint32_t pid;
949 uint32_t serial_num;
950};
951
952struct dload_struct {
953 uint32_t reserved1;
954 uint32_t reserved2;
955 uint32_t reserved3;
956 uint16_t reserved4;
957 uint16_t pid;
958 char serial_number[SERIAL_NUMBER_LENGTH];
959 uint16_t reserved5;
960 struct magic_num_struct magic_struct;
961};
962
963static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
964{
965 struct dload_struct __iomem *dload = 0;
966
967 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
968 if (!dload) {
969 pr_err("%s: cannot remap I/O memory region: %08x\n",
970 __func__, DLOAD_USB_BASE_ADD);
971 return -ENXIO;
972 }
973
974 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
975 __func__, dload, pid, snum);
976 /* update pid */
977 dload->magic_struct.pid = PID_MAGIC_ID;
978 dload->pid = pid;
979
980 /* update serial number */
981 dload->magic_struct.serial_num = 0;
982 if (!snum) {
983 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
984 goto out;
985 }
986
987 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -0700988 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700989out:
990 iounmap(dload);
991 return 0;
992}
993
994static struct android_usb_platform_data android_usb_pdata = {
995 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
996};
997
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700998static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999 .name = "android_usb",
1000 .id = -1,
1001 .dev = {
1002 .platform_data = &android_usb_pdata,
1003 },
1004};
1005
1006static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1007 0x03, 0x0f,
1008};
1009
1010static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1011 0x00, 0x24, 0x54, 0x10,
1012 0x09, 0x03, 0x01,
1013 0x10, 0x54, 0x30, 0x0C,
1014 0x24, 0x30, 0x0f,
1015};
1016
1017static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1018 0x00, 0x24, 0x54, 0x10,
1019 0x09, 0x07, 0x01, 0x0B,
1020 0x10, 0x54, 0x30, 0x0C,
1021 0x24, 0x30, 0x0f,
1022};
1023
1024static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1025 [0] = {
1026 .mode = MSM_SPM_MODE_CLOCK_GATING,
1027 .notify_rpm = false,
1028 .cmd = spm_wfi_cmd_sequence,
1029 },
1030 [1] = {
1031 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1032 .notify_rpm = false,
1033 .cmd = spm_power_collapse_without_rpm,
1034 },
1035 [2] = {
1036 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1037 .notify_rpm = true,
1038 .cmd = spm_power_collapse_with_rpm,
1039 },
1040};
1041
1042static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1043 [0] = {
1044 .reg_base_addr = MSM_SAW0_BASE,
1045 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1046 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001047 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001048#if defined(CONFIG_MSM_AVS_HW)
1049 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1050 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1051#endif
1052 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1053 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1054 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1055 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1056 .vctl_timeout_us = 50,
1057 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1058 .modes = msm_spm_seq_list,
1059 },
1060 [1] = {
1061 .reg_base_addr = MSM_SAW1_BASE,
1062 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1063 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001064 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001065#if defined(CONFIG_MSM_AVS_HW)
1066 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1067 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1068#endif
1069 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1070 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1071 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1072 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1073 .vctl_timeout_us = 50,
1074 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1075 .modes = msm_spm_seq_list,
1076 },
1077};
1078
1079static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1080 0x00, 0x20, 0x03, 0x20,
1081 0x00, 0x0f,
1082};
1083
1084static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1085 0x00, 0x20, 0x34, 0x64,
1086 0x48, 0x07, 0x48, 0x20,
1087 0x50, 0x64, 0x04, 0x34,
1088 0x50, 0x0f,
1089};
1090static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1091 0x00, 0x10, 0x34, 0x64,
1092 0x48, 0x07, 0x48, 0x10,
1093 0x50, 0x64, 0x04, 0x34,
1094 0x50, 0x0F,
1095};
1096
1097static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1098 [0] = {
1099 .mode = MSM_SPM_L2_MODE_RETENTION,
1100 .notify_rpm = false,
1101 .cmd = l2_spm_wfi_cmd_sequence,
1102 },
1103 [1] = {
1104 .mode = MSM_SPM_L2_MODE_GDHS,
1105 .notify_rpm = true,
1106 .cmd = l2_spm_gdhs_cmd_sequence,
1107 },
1108 [2] = {
1109 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1110 .notify_rpm = true,
1111 .cmd = l2_spm_power_off_cmd_sequence,
1112 },
1113};
1114
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001115static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1116 [0] = {
1117 .reg_base_addr = MSM_SAW_L2_BASE,
1118 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1119 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1120 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1121 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1122 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1123 .modes = msm_spm_l2_seq_list,
1124 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1125 },
1126};
1127
Mohan Pallaka5e490392011-09-09 15:18:41 +05301128#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1129#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1130
1131static struct msm_xo_voter *xo_handle_d1;
1132
1133static int isa1200_power(int on)
1134{
1135 int rc = 0;
1136
1137 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1138
1139 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1140 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1141 if (rc < 0) {
1142 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1143 __func__, on ? "" : "de-", rc);
1144 goto err_xo_vote;
1145 }
1146
1147 return 0;
1148
1149err_xo_vote:
1150 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1151 return rc;
1152}
1153
1154static int isa1200_dev_setup(bool enable)
1155{
1156 int rc = 0;
1157
1158 struct pm_gpio hap_gpio_config = {
1159 .direction = PM_GPIO_DIR_OUT,
1160 .pull = PM_GPIO_PULL_NO,
1161 .out_strength = PM_GPIO_STRENGTH_HIGH,
1162 .function = PM_GPIO_FUNC_NORMAL,
1163 .inv_int_pol = 0,
1164 .vin_sel = 2,
1165 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1166 .output_value = 0,
1167 };
1168
1169 if (enable == true) {
1170 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1171 if (rc) {
1172 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1173 __func__, PM_HAP_EN_GPIO, rc);
1174 return rc;
1175 }
1176
1177 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1178 if (rc) {
1179 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1180 __func__, PM_HAP_LEN_GPIO, rc);
1181 return rc;
1182 }
1183
1184 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1185 if (rc) {
1186 pr_err("%s: unable to request gpio %d (%d)\n",
1187 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1188 return rc;
1189 }
1190
1191 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1192 if (rc) {
1193 pr_err("%s: Unable to set direction\n", __func__);
1194 goto free_gpio;
1195 }
1196
1197 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1198 if (IS_ERR(xo_handle_d1)) {
1199 rc = PTR_ERR(xo_handle_d1);
1200 pr_err("%s: failed to get the handle for D1(%d)\n",
1201 __func__, rc);
1202 goto gpio_set_dir;
1203 }
1204 } else {
1205 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1206
1207 msm_xo_put(xo_handle_d1);
1208 }
1209
1210 return 0;
1211
1212gpio_set_dir:
1213 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1214free_gpio:
1215 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1216 return rc;
1217}
1218
1219static struct isa1200_regulator isa1200_reg_data[] = {
1220 {
1221 .name = "vcc_i2c",
1222 .min_uV = ISA_I2C_VTG_MIN_UV,
1223 .max_uV = ISA_I2C_VTG_MAX_UV,
1224 .load_uA = ISA_I2C_CURR_UA,
1225 },
1226};
1227
1228static struct isa1200_platform_data isa1200_1_pdata = {
1229 .name = "vibrator",
1230 .dev_setup = isa1200_dev_setup,
1231 .power_on = isa1200_power,
1232 .hap_en_gpio = PM_HAP_EN_GPIO,
1233 .hap_len_gpio = PM_HAP_LEN_GPIO,
1234 .max_timeout = 15000,
1235 .mode_ctrl = PWM_GEN_MODE,
1236 .pwm_fd = {
1237 .pwm_div = 256,
1238 },
1239 .is_erm = false,
1240 .smart_en = true,
1241 .ext_clk_en = true,
1242 .chip_en = 1,
1243 .regulator_info = isa1200_reg_data,
1244 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1245};
1246
1247static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1248 {
1249 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301250 },
1251};
1252
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001253#define CYTTSP_TS_GPIO_IRQ 11
1254#define CYTTSP_TS_SLEEP_GPIO 50
1255#define CYTTSP_TS_RESOUT_N_GPIO 52
1256
1257/*virtual key support */
1258static ssize_t tma340_vkeys_show(struct kobject *kobj,
1259 struct kobj_attribute *attr, char *buf)
1260{
1261 return snprintf(buf, 200,
1262 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1263 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1264 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1265 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1266 "\n");
1267}
1268
1269static struct kobj_attribute tma340_vkeys_attr = {
1270 .attr = {
1271 .mode = S_IRUGO,
1272 },
1273 .show = &tma340_vkeys_show,
1274};
1275
1276static struct attribute *tma340_properties_attrs[] = {
1277 &tma340_vkeys_attr.attr,
1278 NULL
1279};
1280
1281static struct attribute_group tma340_properties_attr_group = {
1282 .attrs = tma340_properties_attrs,
1283};
1284
1285
1286static int cyttsp_platform_init(struct i2c_client *client)
1287{
1288 int rc = 0;
1289 static struct kobject *tma340_properties_kobj;
1290
1291 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1292 tma340_properties_kobj = kobject_create_and_add("board_properties",
1293 NULL);
1294 if (tma340_properties_kobj)
1295 rc = sysfs_create_group(tma340_properties_kobj,
1296 &tma340_properties_attr_group);
1297 if (!tma340_properties_kobj || rc)
1298 pr_err("%s: failed to create board_properties\n",
1299 __func__);
1300
1301 return 0;
1302}
1303
1304static struct cyttsp_regulator regulator_data[] = {
1305 {
1306 .name = "vdd",
1307 .min_uV = CY_TMA300_VTG_MIN_UV,
1308 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301309 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1310 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001311 },
1312 /* TODO: Remove after runtime PM is enabled in I2C driver */
1313 {
1314 .name = "vcc_i2c",
1315 .min_uV = CY_I2C_VTG_MIN_UV,
1316 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301317 .hpm_load_uA = CY_I2C_CURR_UA,
1318 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001319 },
1320};
1321
1322static struct cyttsp_platform_data cyttsp_pdata = {
1323 .panel_maxx = 634,
1324 .panel_maxy = 1166,
1325 .disp_maxx = 616,
1326 .disp_maxy = 1023,
1327 .disp_minx = 0,
1328 .disp_miny = 16,
1329 .flags = 0x01,
1330 .gen = CY_GEN3, /* or */
1331 .use_st = CY_USE_ST,
1332 .use_mt = CY_USE_MT,
1333 .use_hndshk = CY_SEND_HNDSHK,
1334 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301335 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001336 .use_gestures = CY_USE_GESTURES,
1337 .fw_fname = "cyttsp_8960_cdp.hex",
1338 /* activate up to 4 groups
1339 * and set active distance
1340 */
1341 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1342 CY_GEST_GRP3 | CY_GEST_GRP4 |
1343 CY_ACT_DIST,
1344 /* change act_intrvl to customize the Active power state
1345 * scanning/processing refresh interval for Operating mode
1346 */
1347 .act_intrvl = CY_ACT_INTRVL_DFLT,
1348 /* change tch_tmout to customize the touch timeout for the
1349 * Active power state for Operating mode
1350 */
1351 .tch_tmout = CY_TCH_TMOUT_DFLT,
1352 /* change lp_intrvl to customize the Low Power power state
1353 * scanning/processing refresh interval for Operating mode
1354 */
1355 .lp_intrvl = CY_LP_INTRVL_DFLT,
1356 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1357 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1358 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1359 .regulator_info = regulator_data,
1360 .num_regulators = ARRAY_SIZE(regulator_data),
1361 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301362 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001363};
1364
1365static struct i2c_board_info cyttsp_info[] __initdata = {
1366 {
1367 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1368 .platform_data = &cyttsp_pdata,
1369#ifndef CY_USE_TIMER
1370 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1371#endif /* CY_USE_TIMER */
1372 },
1373};
1374
Mohan Pallaka50837382011-09-07 11:00:57 +05301375/* configuration data */
1376static const u8 mxt_config_data[] = {
1377 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001378 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301379 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001380 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001381 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1382 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1383 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1384 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1385 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1386 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301387 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001388 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301389 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001390 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301391 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001392 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1393 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1394 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1395 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301396 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1398 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301399 /* T18 Object */
1400 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301401 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001402 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1403 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301404 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1406 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301407 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001408 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1409 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301410 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001411 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301412 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001413 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301414 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001415 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301416 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001417 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301418 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001419 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301420};
1421
Amy Maloche08266db2011-11-04 11:07:16 -07001422#define MXT_TS_GPIO_IRQ 11
1423#define MXT_TS_LDO_EN_GPIO 50
1424#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301425
1426static void mxt_init_hw_liquid(void)
1427{
1428 int rc;
1429
Mohan Pallaka50837382011-09-07 11:00:57 +05301430 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1431 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001432 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1433 __func__, MXT_TS_LDO_EN_GPIO);
1434 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301435 }
1436
1437 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1438 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001439 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1440 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301441 goto err_ldo_gpio_req;
1442 }
1443
Mohan Pallaka50837382011-09-07 11:00:57 +05301444 return;
1445
Mohan Pallaka50837382011-09-07 11:00:57 +05301446err_ldo_gpio_req:
1447 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301448}
1449
1450static struct mxt_platform_data mxt_platform_data = {
1451 .config = mxt_config_data,
1452 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001453 .x_size = 1365,
1454 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301455 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001456 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001457 .reset_gpio = MXT_TS_RESET_GPIO,
1458 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301459};
1460
1461static struct i2c_board_info mxt_device_info[] __initdata = {
1462 {
1463 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1464 .platform_data = &mxt_platform_data,
1465 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1466 },
1467};
1468
Eugene Yasmand2316b82011-12-07 18:23:48 +02001469static struct i2c_board_info sii_device_info[] __initdata = {
1470 {
1471 I2C_BOARD_INFO("Sil-9244", 0x39),
1472 .flags = I2C_CLIENT_WAKE,
1473 .irq = MSM_GPIO_TO_INT(15),
1474 },
1475};
1476
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001477static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1478 .clk_freq = 100000,
1479 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480};
1481
1482static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1483 .clk_freq = 100000,
1484 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001485};
1486
1487static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_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_gsbi12_pdata = {
1493 .clk_freq = 100000,
1494 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001495};
1496
1497static struct msm_rpm_platform_data msm_rpm_data = {
1498 .reg_base_addrs = {
1499 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1500 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1501 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1502 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1503 },
1504
1505 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1506 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1507 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1508 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1509 .msm_apps_ipc_rpm_val = 4,
1510};
1511
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06001512static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1513 .base_addr = MSM_ACC0_BASE + 0x08,
1514 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1515 .mask = 1UL << 13,
1516};
1517
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001518static struct ks8851_pdata spi_eth_pdata = {
1519 .irq_gpio = KS8851_IRQ_GPIO,
1520 .rst_gpio = KS8851_RST_GPIO,
1521};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001522
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001523static struct spi_board_info spi_board_info[] __initdata = {
1524 {
1525 .modalias = "ks8851",
1526 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1527 .max_speed_hz = 19200000,
1528 .bus_num = 0,
1529 .chip_select = 0,
1530 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001531 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001532 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001533 {
1534 .modalias = "dsi_novatek_3d_panel_spi",
1535 .max_speed_hz = 10800000,
1536 .bus_num = 0,
1537 .chip_select = 1,
1538 .mode = SPI_MODE_0,
1539 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001540};
1541
1542static struct platform_device msm_device_saw_core0 = {
1543 .name = "saw-regulator",
1544 .id = 0,
1545 .dev = {
1546 .platform_data = &msm_saw_regulator_pdata_s5,
1547 },
1548};
1549
1550static struct platform_device msm_device_saw_core1 = {
1551 .name = "saw-regulator",
1552 .id = 1,
1553 .dev = {
1554 .platform_data = &msm_saw_regulator_pdata_s6,
1555 },
1556};
1557
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001558static struct tsens_platform_data msm_tsens_pdata = {
1559 .slope = 910,
1560 .tsens_factor = 1000,
1561 .hw_type = MSM_8960,
1562 .tsens_num_sensor = 5,
1563};
1564
1565static struct platform_device msm_tsens_device = {
1566 .name = "tsens8960-tm",
1567 .id = -1,
1568 .dev = {
1569 .platform_data = &msm_tsens_pdata,
1570 },
1571};
1572
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001573#ifdef CONFIG_MSM_FAKE_BATTERY
1574static struct platform_device fish_battery_device = {
1575 .name = "fish_battery",
1576};
1577#endif
1578
David Collins26f05562011-06-20 09:56:28 -07001579static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001580 .name = GPIO_REGULATOR_DEV_NAME,
1581 .id = PM8921_MPP_PM_TO_SYS(7),
1582 .dev = {
1583 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1584 },
1585};
1586
David Collins26f05562011-06-20 09:56:28 -07001587static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001588 .name = GPIO_REGULATOR_DEV_NAME,
1589 .id = 91,
1590 .dev = {
1591 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1592 },
1593};
1594
David Collinsb10be1d2011-09-02 10:29:31 -07001595static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1596 .name = GPIO_REGULATOR_DEV_NAME,
1597 .id = PM8921_GPIO_PM_TO_SYS(17),
1598 .dev = {
1599 .platform_data =
1600 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1601 },
1602};
1603
David Collins35a78f52011-12-14 15:54:25 -08001604static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1605 .name = GPIO_REGULATOR_DEV_NAME,
1606 .id = PM8921_GPIO_PM_TO_SYS(42),
1607 .dev = {
1608 .platform_data =
1609 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1610 },
1611};
1612
David Collins26f05562011-06-20 09:56:28 -07001613static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1614 .name = "rpm-regulator",
1615 .id = -1,
1616 .dev = {
1617 .platform_data = &msm_rpm_regulator_pdata,
1618 },
1619};
1620
David Collins4c31a872011-08-31 10:07:10 -07001621static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1622 .phys_addr_base = 0x0010C000,
1623 .reg_offsets = {
1624 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1625 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1626 },
1627 .phys_size = SZ_8K,
1628 .log_len = 4096, /* log's buffer length in bytes */
1629 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1630};
1631
1632static struct platform_device msm_rpm_log_device = {
1633 .name = "msm_rpm_log",
1634 .id = -1,
1635 .dev = {
1636 .platform_data = &msm_rpm_log_pdata,
1637 },
1638};
1639
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001640static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001641 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001642 &msm_device_smd,
1643 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301644 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001645 &msm_device_saw_core0,
1646 &msm_device_saw_core1,
1647 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001648 &msm8960_device_ssbi_pmic,
David Collins35a78f52011-12-14 15:54:25 -08001649 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001650 &msm8960_device_qup_spi_gsbi1,
1651 &msm8960_device_qup_i2c_gsbi3,
1652 &msm8960_device_qup_i2c_gsbi4,
1653 &msm8960_device_qup_i2c_gsbi10,
1654#ifndef CONFIG_MSM_DSPS
1655 &msm8960_device_qup_i2c_gsbi12,
1656#endif
1657 &msm_slim_ctrl,
1658 &msm_device_wcnss_wlan,
1659#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1660 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1661 &qcrypto_device,
1662#endif
1663
1664#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1665 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1666 &qcedev_device,
1667#endif
1668#ifdef CONFIG_MSM_ROTATOR
1669 &msm_rotator_device,
1670#endif
1671 &msm_device_sps,
1672#ifdef CONFIG_MSM_FAKE_BATTERY
1673 &fish_battery_device,
1674#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001675 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001676#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001677#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001678 &android_pmem_device,
1679 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001680#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001681 &android_pmem_audio_device,
1682#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683 &msm_device_vidc,
1684 &msm_device_bam_dmux,
1685 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001686
1687#ifdef CONFIG_HW_RANDOM_MSM
1688 &msm_device_rng,
1689#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001690 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07001691#ifdef CONFIG_ION_MSM
1692 &ion_dev,
1693#endif
David Collins4c31a872011-08-31 10:07:10 -07001694 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06001695 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001696 &msm_device_tz_log,
1697
Pratik Patel7831c082011-06-08 21:44:37 -07001698#ifdef CONFIG_MSM_QDSS
1699 &msm_etb_device,
1700 &msm_tpiu_device,
1701 &msm_funnel_device,
1702 &msm_ptm_device,
1703#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001704 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001705 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001706};
1707
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001708static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001709 &msm8960_device_otg,
1710 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001711 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301712 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001713 &android_usb_device,
1714 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001715 &msm_bus_apps_fabric,
1716 &msm_bus_sys_fabric,
1717 &msm_bus_mm_fabric,
1718 &msm_bus_sys_fpb,
1719 &msm_bus_cpss_fpb,
1720 &msm_pcm,
1721 &msm_pcm_routing,
1722 &msm_cpudai0,
1723 &msm_cpudai1,
1724 &msm_cpudai_hdmi_rx,
1725 &msm_cpudai_bt_rx,
1726 &msm_cpudai_bt_tx,
1727 &msm_cpudai_fm_rx,
1728 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001729 &msm_cpudai_auxpcm_rx,
1730 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001731 &msm_cpu_fe,
1732 &msm_stub_codec,
1733 &msm_voice,
1734 &msm_voip,
1735 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301736 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001737 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001738 &msm_cpudai_incall_record_rx,
1739 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001740
1741#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1742 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1743 &qcrypto_device,
1744#endif
1745
1746#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1747 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1748 &qcedev_device,
1749#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001750};
1751
1752static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001753 &msm_kgsl_3d0,
1754 &msm_kgsl_2d0,
1755 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001756#ifdef CONFIG_MSM_GEMINI
1757 &msm8960_gemini_device,
1758#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001759};
1760
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001761static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001762 &msm_8960_q6_lpass,
1763 &msm_8960_q6_mss_fw,
1764 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001765 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001766 &msm_pil_tzapps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001767 &msm8960_device_otg,
1768 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001769 &msm_device_hsusb_host,
1770 &android_usb_device,
1771 &msm_pcm,
1772 &msm_pcm_routing,
1773 &msm_cpudai0,
1774 &msm_cpudai1,
1775 &msm_cpudai_hdmi_rx,
1776 &msm_cpudai_bt_rx,
1777 &msm_cpudai_bt_tx,
1778 &msm_cpudai_fm_rx,
1779 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001780 &msm_cpudai_auxpcm_rx,
1781 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001782 &msm_cpu_fe,
1783 &msm_stub_codec,
1784 &msm_kgsl_3d0,
1785#ifdef CONFIG_MSM_KGSL_2D
1786 &msm_kgsl_2d0,
1787 &msm_kgsl_2d1,
1788#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001789#ifdef CONFIG_MSM_GEMINI
1790 &msm8960_gemini_device,
1791#endif
1792 &msm_voice,
1793 &msm_voip,
1794 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301795 &msm_cpudai_afe_01_rx,
1796 &msm_cpudai_afe_01_tx,
1797 &msm_cpudai_afe_02_rx,
1798 &msm_cpudai_afe_02_tx,
1799 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301800 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001801 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001802 &msm_cpudai_incall_record_rx,
1803 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001804 &msm_pcm_hostless,
1805 &msm_bus_apps_fabric,
1806 &msm_bus_sys_fabric,
1807 &msm_bus_mm_fabric,
1808 &msm_bus_sys_fpb,
1809 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001810 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001811};
1812
1813static void __init msm8960_i2c_init(void)
1814{
1815 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1816 &msm8960_i2c_qup_gsbi4_pdata;
1817
1818 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1819 &msm8960_i2c_qup_gsbi3_pdata;
1820
1821 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1822 &msm8960_i2c_qup_gsbi10_pdata;
1823
1824 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1825 &msm8960_i2c_qup_gsbi12_pdata;
1826}
1827
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001828static void __init msm8960_gfx_init(void)
1829{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001830 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001831 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1832 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1833 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001834 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1835 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001836 }
1837}
1838
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001839static struct msm_cpuidle_state msm_cstates[] __initdata = {
1840 {0, 0, "C0", "WFI",
1841 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1842
1843 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1844 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1845
1846 {0, 2, "C2", "POWER_COLLAPSE",
1847 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1848
1849 {1, 0, "C0", "WFI",
1850 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1851
1852 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1853 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1854};
1855
1856static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1857 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1858 .idle_supported = 1,
1859 .suspend_supported = 1,
1860 .idle_enabled = 0,
1861 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001862 },
1863
1864 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1865 .idle_supported = 1,
1866 .suspend_supported = 1,
1867 .idle_enabled = 0,
1868 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001869 },
1870
1871 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1872 .idle_supported = 1,
1873 .suspend_supported = 1,
1874 .idle_enabled = 1,
1875 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001876 },
1877
1878 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1879 .idle_supported = 0,
1880 .suspend_supported = 1,
1881 .idle_enabled = 0,
1882 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001883 },
1884
1885 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1886 .idle_supported = 1,
1887 .suspend_supported = 1,
1888 .idle_enabled = 0,
1889 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001890 },
1891
1892 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1893 .idle_supported = 1,
1894 .suspend_supported = 0,
1895 .idle_enabled = 1,
1896 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001897 },
1898};
1899
1900static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1901 {
1902 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1903 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1904 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001905 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001906 },
1907
1908 {
1909 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1910 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1911 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001912 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001913 },
1914
1915 {
1916 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1917 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1918 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001919 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001920 },
1921
1922 {
1923 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1924 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1925 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001926 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001927 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001928 {
1929 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1930 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1931 false,
1932 7000, 3500, 66600000, 5150,
1933 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001934
1935 {
1936 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1937 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1938 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001939 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001940 },
1941
1942 {
1943 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1944 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1945 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001946 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001947 },
1948
1949 {
1950 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1951 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1952 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001953 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001954 },
1955
1956 {
1957 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1958 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1959 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001960 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961 },
1962};
1963
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001964static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1965 .mode = MSM_PM_BOOT_CONFIG_TZ,
1966};
1967
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001968#ifdef CONFIG_I2C
1969#define I2C_SURF 1
1970#define I2C_FFA (1 << 1)
1971#define I2C_RUMI (1 << 2)
1972#define I2C_SIM (1 << 3)
1973#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03001974#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001975
1976struct i2c_registry {
1977 u8 machs;
1978 int bus;
1979 struct i2c_board_info *info;
1980 int len;
1981};
1982
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001983/* Sensors DSPS platform data */
1984#ifdef CONFIG_MSM_DSPS
1985#define DSPS_PIL_GENERIC_NAME "dsps"
1986#endif /* CONFIG_MSM_DSPS */
1987
1988static void __init msm8960_init_dsps(void)
1989{
1990#ifdef CONFIG_MSM_DSPS
1991 struct msm_dsps_platform_data *pdata =
1992 msm_dsps_device.dev.platform_data;
1993 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
1994 pdata->gpios = NULL;
1995 pdata->gpios_num = 0;
1996
1997 platform_device_register(&msm_dsps_device);
1998#endif /* CONFIG_MSM_DSPS */
1999}
2000
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002001static int hsic_peripheral_status = 1;
2002static DEFINE_MUTEX(hsic_status_lock);
2003
2004void peripheral_connect()
2005{
2006 mutex_lock(&hsic_status_lock);
2007 if (hsic_peripheral_status)
2008 goto out;
2009 platform_device_add(&msm_device_hsic_host);
2010 hsic_peripheral_status = 1;
2011out:
2012 mutex_unlock(&hsic_status_lock);
2013}
2014EXPORT_SYMBOL(peripheral_connect);
2015
2016void peripheral_disconnect()
2017{
2018 mutex_lock(&hsic_status_lock);
2019 if (!hsic_peripheral_status)
2020 goto out;
2021 platform_device_del(&msm_device_hsic_host);
2022 hsic_peripheral_status = 0;
2023out:
2024 mutex_unlock(&hsic_status_lock);
2025}
2026EXPORT_SYMBOL(peripheral_disconnect);
2027
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002028static void __init msm8960_init_hsic(void)
2029{
2030#ifdef CONFIG_USB_EHCI_MSM_HSIC
2031 uint32_t version = socinfo_get_version();
2032
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002033 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002034 return;
2035
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002036 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002037 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002038#endif
2039}
2040
Amir Samuelov5137e392011-09-21 17:31:25 +03002041#ifdef CONFIG_ISL9519_CHARGER
2042static struct isl_platform_data isl_data __initdata = {
2043 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2044 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2045 .max_system_voltage = 4200,
2046 .min_system_voltage = 3200,
2047 .chgcurrent = 1000, /* 1900, */
2048 .term_current = 400, /* Need fine tuning */
2049 .input_current = 2048,
2050};
2051
2052static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2053 {
2054 I2C_BOARD_INFO("isl9519q", 0x9),
2055 .irq = 0, /* Not required when notify-by-pmic */
2056 .platform_data = &isl_data,
2057 },
2058};
2059#endif /* CONFIG_ISL9519_CHARGER */
2060
Amir Samuelov755616d2011-12-13 16:34:46 +02002061static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2062 {
2063 I2C_BOARD_INFO("sx1508q", 0x20),
2064 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2065 },
2066};
2067
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002068static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002069#ifdef CONFIG_ISL9519_CHARGER
2070 {
2071 I2C_LIQUID,
2072 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2073 isl_charger_i2c_info,
2074 ARRAY_SIZE(isl_charger_i2c_info),
2075 },
2076#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002077 {
2078 I2C_SURF | I2C_FFA | I2C_FLUID,
2079 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2080 cyttsp_info,
2081 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002082 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302083 {
2084 I2C_LIQUID,
2085 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2086 mxt_device_info,
2087 ARRAY_SIZE(mxt_device_info),
2088 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302089 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302090 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302091 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002092 sii_device_info,
2093 ARRAY_SIZE(sii_device_info),
2094 },
2095 {
2096 I2C_LIQUID,
2097 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302098 msm_isa1200_board_info,
2099 ARRAY_SIZE(msm_isa1200_board_info),
2100 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002101 {
2102 I2C_LIQUID,
2103 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2104 liquid_io_expander_i2c_info,
2105 ARRAY_SIZE(liquid_io_expander_i2c_info),
2106 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002107};
2108#endif /* CONFIG_I2C */
2109
2110static void __init register_i2c_devices(void)
2111{
2112#ifdef CONFIG_I2C
2113 u8 mach_mask = 0;
2114 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002115#ifdef CONFIG_MSM_CAMERA
2116 struct i2c_registry msm8960_camera_i2c_devices = {
2117 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2118 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2119 msm8960_camera_board_info.board_info,
2120 msm8960_camera_board_info.num_i2c_board_info,
2121 };
2122#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002123
2124 /* Build the matching 'supported_machs' bitmask */
2125 if (machine_is_msm8960_cdp())
2126 mach_mask = I2C_SURF;
2127 else if (machine_is_msm8960_rumi3())
2128 mach_mask = I2C_RUMI;
2129 else if (machine_is_msm8960_sim())
2130 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002131 else if (machine_is_msm8960_fluid())
2132 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002133 else if (machine_is_msm8960_liquid())
2134 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002135 else if (machine_is_msm8960_mtp())
2136 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002137 else
2138 pr_err("unmatched machine ID in register_i2c_devices\n");
2139
2140 /* Run the array and install devices as appropriate */
2141 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2142 if (msm8960_i2c_devices[i].machs & mach_mask)
2143 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2144 msm8960_i2c_devices[i].info,
2145 msm8960_i2c_devices[i].len);
2146 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002147#ifdef CONFIG_MSM_CAMERA
2148 if (msm8960_camera_i2c_devices.machs & mach_mask)
2149 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2150 msm8960_camera_i2c_devices.info,
2151 msm8960_camera_i2c_devices.len);
2152#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002153#endif
2154}
2155
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002156static void __init msm8960_sim_init(void)
2157{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002158 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2159 &msm8960_device_watchdog.dev.platform_data;
2160
2161 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002162 BUG_ON(msm_rpm_init(&msm_rpm_data));
2163 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2164 ARRAY_SIZE(msm_rpmrs_levels)));
2165 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002166 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002167 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002168 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002169
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002170 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002171 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002172 msm8960_i2c_init();
2173 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2174 msm_spm_l2_init(msm_spm_l2_data);
2175 msm8960_init_buses();
2176 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002177 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002178 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002179 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002180
2181 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2182 &msm8960_qup_spi_gsbi1_pdata;
2183 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2184
2185 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002186 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002187 slim_register_board_info(msm_slim_devices,
2188 ARRAY_SIZE(msm_slim_devices));
2189 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2190 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2191 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2192 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002193 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002194 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002195}
2196
2197static void __init msm8960_rumi3_init(void)
2198{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002199 BUG_ON(msm_rpm_init(&msm_rpm_data));
2200 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2201 ARRAY_SIZE(msm_rpmrs_levels)));
2202 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002203 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002204 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002205 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002206 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002207 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2208 &msm8960_qup_spi_gsbi1_pdata;
2209 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2210 msm8960_i2c_init();
2211 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2212 msm_spm_l2_init(msm_spm_l2_data);
2213 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002214 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002215 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002216 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002217 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002218 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002219 slim_register_board_info(msm_slim_devices,
2220 ARRAY_SIZE(msm_slim_devices));
2221 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2222 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2223 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2224 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002225 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002226 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002227}
2228
2229static void __init msm8960_cdp_init(void)
2230{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002231 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2232 pr_err("meminfo_init() failed!\n");
2233
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002234 BUG_ON(msm_rpm_init(&msm_rpm_data));
2235 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2236 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002237
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002238 regulator_suppress_info_printing();
2239 if (msm_xo_init())
2240 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002241 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002242 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302243 if (machine_is_msm8960_liquid())
2244 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002245 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302246 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2247 machine_is_msm8960_cdp()) {
2248 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2249 } else if (machine_is_msm8960_liquid()) {
2250 msm_otg_pdata.phy_init_seq =
2251 liquid_v1_phy_init_seq;
2252 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302253 msm_otg_pdata.swfi_latency =
2254 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302255#ifdef CONFIG_USB_EHCI_MSM_HSIC
2256 if (machine_is_msm8960_liquid()) {
2257 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2258 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2259 }
2260#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302261 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002262 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002263 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2264 &msm8960_qup_spi_gsbi1_pdata;
2265 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002266
2267 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302268 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2269 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2270 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002271 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002272 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002273 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2274 msm_spm_l2_init(msm_spm_l2_data);
2275 msm8960_init_buses();
2276 platform_add_devices(msm_footswitch_devices,
2277 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002278 if (machine_is_msm8960_liquid())
2279 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002280 if (machine_is_msm8960_cdp())
2281 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002283 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002284 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002285 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002286 msm8960_init_cam();
2287 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002288 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302289 if (machine_is_msm8960_liquid())
2290 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002291 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002292 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002293 slim_register_board_info(msm_slim_devices,
2294 ARRAY_SIZE(msm_slim_devices));
2295 msm8960_init_dsps();
2296 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2297 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2298 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2299 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002300 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002301 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002302 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08002303 if (PLATFORM_IS_CHARM25())
2304 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002305}
2306
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002307MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2308 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002310 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302311 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002312 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002313 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002314 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002315 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002316MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002317
2318MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2319 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002320 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002321 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302322 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002323 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002324 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002325 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002326 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002327MACHINE_END
2328
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002329MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2330 .map_io = msm8960_map_io,
2331 .reserve = msm8960_reserve,
2332 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302333 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002334 .timer = &msm_timer,
2335 .init_machine = msm8960_cdp_init,
2336 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002337 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002338MACHINE_END
2339
2340MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2341 .map_io = msm8960_map_io,
2342 .reserve = msm8960_reserve,
2343 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302344 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002345 .timer = &msm_timer,
2346 .init_machine = msm8960_cdp_init,
2347 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002348 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002349MACHINE_END
2350
2351MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2352 .map_io = msm8960_map_io,
2353 .reserve = msm8960_reserve,
2354 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302355 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002356 .timer = &msm_timer,
2357 .init_machine = msm8960_cdp_init,
2358 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002359 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002360MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002361
2362MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2363 .map_io = msm8960_map_io,
2364 .reserve = msm8960_reserve,
2365 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302366 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002367 .timer = &msm_timer,
2368 .init_machine = msm8960_cdp_init,
2369 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002370 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002371MACHINE_END