blob: 109ab9c8d0f7edca51b4600e51548135c902a09f [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"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090#include "pm.h"
91#include "cpuidle.h"
92#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
Olav Hauganb5be7992011-11-18 14:29:02 -0800144#define MSM_ION_SF_SIZE 0x1800000 /* 24MB */
145#define MSM_ION_MM_SIZE 0x4000000 /* (64MB) */
146#define MSM_ION_MFC_SIZE SZ_8K
Laura Abbott8c017362011-09-22 20:59:12 -0700147#define MSM_ION_HEAP_NUM 5
Olav Hauganb5be7992011-11-18 14:29:02 -0800148#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
149static unsigned int msm_ion_cp_mm_size = MSM_ION_MM_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700150#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700151#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800152#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700153#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700154
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700155#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
156static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
157static int __init pmem_kernel_ebi1_size_setup(char *p)
158{
159 pmem_kernel_ebi1_size = memparse(p, NULL);
160 return 0;
161}
162early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
163#endif
164
165#ifdef CONFIG_ANDROID_PMEM
166static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800167static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700168static int __init pmem_size_setup(char *p)
169{
170 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800171 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700172 return 0;
173}
174early_param("pmem_size", pmem_size_setup);
175
176static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
177
178static int __init pmem_adsp_size_setup(char *p)
179{
180 pmem_adsp_size = memparse(p, NULL);
181 return 0;
182}
183early_param("pmem_adsp_size", pmem_adsp_size_setup);
184
185static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
186
187static int __init pmem_audio_size_setup(char *p)
188{
189 pmem_audio_size = memparse(p, NULL);
190 return 0;
191}
192early_param("pmem_audio_size", pmem_audio_size_setup);
193#endif
194
195#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700196#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700197static struct android_pmem_platform_data android_pmem_pdata = {
198 .name = "pmem",
199 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
200 .cached = 1,
201 .memory_type = MEMTYPE_EBI1,
202};
203
204static struct platform_device android_pmem_device = {
205 .name = "android_pmem",
206 .id = 0,
207 .dev = {.platform_data = &android_pmem_pdata},
208};
209
210static struct android_pmem_platform_data android_pmem_adsp_pdata = {
211 .name = "pmem_adsp",
212 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
213 .cached = 0,
214 .memory_type = MEMTYPE_EBI1,
215};
216static struct platform_device android_pmem_adsp_device = {
217 .name = "android_pmem",
218 .id = 2,
219 .dev = { .platform_data = &android_pmem_adsp_pdata },
220};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700221#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700222
223static struct android_pmem_platform_data android_pmem_audio_pdata = {
224 .name = "pmem_audio",
225 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
226 .cached = 0,
227 .memory_type = MEMTYPE_EBI1,
228};
229
230static struct platform_device android_pmem_audio_device = {
231 .name = "android_pmem",
232 .id = 4,
233 .dev = { .platform_data = &android_pmem_audio_pdata },
234};
235#endif
236
Larry Bassel41a055b2011-12-06 16:15:14 -0800237struct fmem_platform_data fmem_pdata = {
238};
239
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700240#define DSP_RAM_BASE_8960 0x8da00000
241#define DSP_RAM_SIZE_8960 0x1800000
242static int dspcrashd_pdata_8960 = 0xDEADDEAD;
243
244static struct resource resources_dspcrashd_8960[] = {
245 {
246 .name = "msm_dspcrashd",
247 .start = DSP_RAM_BASE_8960,
248 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
249 .flags = IORESOURCE_DMA,
250 },
251};
252
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800253static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700254 .name = "msm_dspcrashd",
255 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
256 .resource = resources_dspcrashd_8960,
257 .dev = { .platform_data = &dspcrashd_pdata_8960 },
258};
259
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700260static struct memtype_reserve msm8960_reserve_table[] __initdata = {
261 [MEMTYPE_SMI] = {
262 },
263 [MEMTYPE_EBI0] = {
264 .flags = MEMTYPE_FLAGS_1M_ALIGN,
265 },
266 [MEMTYPE_EBI1] = {
267 .flags = MEMTYPE_FLAGS_1M_ALIGN,
268 },
269};
270
271static void __init size_pmem_devices(void)
272{
273#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700274#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700275 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800276
277 if (!pmem_param_set && machine_is_msm8960_liquid())
278 pmem_size = MSM_LIQUID_PMEM_SIZE;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700280#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700281 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
282#endif
283}
284
285static void __init reserve_memory_for(struct android_pmem_platform_data *p)
286{
287 msm8960_reserve_table[p->memory_type].size += p->size;
288}
289
290static void __init reserve_pmem_memory(void)
291{
292#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700293#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700294 reserve_memory_for(&android_pmem_adsp_pdata);
295 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700296#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700297 reserve_memory_for(&android_pmem_audio_pdata);
298 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
299#endif
300}
301
Larry Bassel41a055b2011-12-06 16:15:14 -0800302static void __init reserve_fmem_memory(void)
303{
304}
305
Larry Basselb4126da2011-07-18 14:31:33 -0700306static int msm8960_paddr_to_memtype(unsigned int paddr)
307{
308 return MEMTYPE_EBI1;
309}
310
Laura Abbottd6183792011-08-19 13:42:24 -0700311#ifdef CONFIG_ION_MSM
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800312static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700313 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700314 .heaps = {
315 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800316 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700317 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700318 .name = ION_VMALLOC_HEAP_NAME,
319 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700320#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700321 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800322 .id = ION_SF_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700323 .type = ION_HEAP_TYPE_CARVEOUT,
Olav Hauganb5be7992011-11-18 14:29:02 -0800324 .name = ION_SF_HEAP_NAME,
325 .size = MSM_ION_SF_SIZE,
Laura Abbottd6183792011-08-19 13:42:24 -0700326 .memory_type = ION_EBI_TYPE,
327 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700328 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800329 .id = ION_CP_MM_HEAP_ID,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700330 .type = ION_HEAP_TYPE_CARVEOUT,
Olav Hauganb5be7992011-11-18 14:29:02 -0800331 .name = ION_MM_HEAP_NAME,
332 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700333 .memory_type = ION_EBI_TYPE,
334 },
Laura Abbott8c017362011-09-22 20:59:12 -0700335 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800336 .id = ION_CP_MFC_HEAP_ID,
337 .type = ION_HEAP_TYPE_CARVEOUT,
338 .name = ION_MFC_HEAP_NAME,
339 .size = MSM_ION_MFC_SIZE,
340 .memory_type = ION_EBI_TYPE,
341 },
342 {
343 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700344 .type = ION_HEAP_TYPE_IOMMU,
345 .name = ION_IOMMU_HEAP_NAME,
346 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700347#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700348 }
349};
350
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800351static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700352 .name = "ion-msm",
353 .id = 1,
354 .dev = { .platform_data = &ion_pdata },
355};
356#endif
357
Larry Bassel41a055b2011-12-06 16:15:14 -0800358struct platform_device fmem_device = {
359 .name = "fmem",
360 .id = 1,
361 .dev = { .platform_data = &fmem_pdata },
362};
363
Laura Abbottd6183792011-08-19 13:42:24 -0700364static void reserve_ion_memory(void)
365{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700366#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800367 unsigned int i;
368
369 if (!pmem_param_set && machine_is_msm8960_liquid()) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800370 msm_ion_cp_mm_size = MSM_LIQUID_ION_MM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800371 for (i = 0; i < ion_pdata.nr; i++) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800372 if (ion_pdata.heaps[i].id == ION_CP_MM_HEAP_ID) {
373 ion_pdata.heaps[i].size = msm_ion_cp_mm_size;
374 pr_debug("msm_ion_cp_mm_size 0x%x\n",
375 msm_ion_cp_mm_size);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800376 break;
377 }
378 }
379 }
Olav Hauganb5be7992011-11-18 14:29:02 -0800380 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_ion_cp_mm_size;
381 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
382 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700383#endif
384}
Huaibin Yanga5419422011-12-08 23:52:10 -0800385
386static void __init reserve_mdp_memory(void)
387{
388 msm8960_mdp_writeback(msm8960_reserve_table);
389}
390
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700391static void __init msm8960_calculate_reserve_sizes(void)
392{
393 size_pmem_devices();
394 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700395 reserve_ion_memory();
Larry Bassel41a055b2011-12-06 16:15:14 -0800396 reserve_fmem_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800397 reserve_mdp_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700398}
399
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700400static struct reserve_info msm8960_reserve_info __initdata = {
401 .memtype_reserve_table = msm8960_reserve_table,
402 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
403 .paddr_to_memtype = msm8960_paddr_to_memtype,
404};
405
Larry Basselb4126da2011-07-18 14:31:33 -0700406static int msm8960_memory_bank_size(void)
407{
408 return 1<<29;
409}
410
411static void __init locate_unstable_memory(void)
412{
413 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
414 unsigned long bank_size;
415 unsigned long low, high;
416
417 bank_size = msm8960_memory_bank_size();
418 low = meminfo.bank[0].start;
419 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700420
421 /* Check if 32 bit overflow occured */
422 if (high < mb->start)
423 high = ~0UL;
424
Larry Basselb4126da2011-07-18 14:31:33 -0700425 low &= ~(bank_size - 1);
426
427 if (high - low <= bank_size)
428 return;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800429 msm8960_reserve_info.low_unstable_address = high -
430 MIN_MEMORY_BLOCK_SIZE;
431 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700432
Larry Basselb4126da2011-07-18 14:31:33 -0700433 msm8960_reserve_info.bank_size = bank_size;
434 pr_info("low unstable address %lx max size %lx bank size %lx\n",
435 msm8960_reserve_info.low_unstable_address,
436 msm8960_reserve_info.max_unstable_size,
437 msm8960_reserve_info.bank_size);
438}
439
Larry Basselb830e182011-10-14 10:46:55 -0700440static void __init place_movable_zone(void)
441{
442 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
443 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
444 pr_info("movable zone start %lx size %lx\n",
445 movable_reserved_start, movable_reserved_size);
446}
447
448static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700449{
450 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700451 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700452 place_movable_zone();
453}
454
455static void __init msm8960_reserve(void)
456{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700457 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800458 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700459}
460
Larry Bassela4414b12011-08-04 11:11:02 -0700461static int msm8960_change_memory_power(u64 start, u64 size,
462 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700463{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700464 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700465}
466
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700467static void __init msm8960_allocate_memory_regions(void)
468{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800469 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700470}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800471
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700472#ifdef CONFIG_WCD9310_CODEC
473
474#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
475
Patrick Lai3043fba2011-08-01 14:15:57 -0700476/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
477 * 4 micbiases are used to power various analog and digital
478 * microphones operating at 1800 mV. Technically, all micbiases
479 * can source from single cfilter since all microphones operate
480 * at the same voltage level. The arrangement below is to make
481 * sure all cfilters are exercised. LDO_H regulator ouput level
482 * does not need to be as high as 2.85V. It is choosen for
483 * microphone sensitivity purpose.
484 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700485static struct tabla_pdata tabla_platform_data = {
486 .slimbus_slave_device = {
487 .name = "tabla-slave",
488 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
489 },
490 .irq = MSM_GPIO_TO_INT(62),
491 .irq_base = TABLA_INTERRUPT_BASE,
492 .num_irqs = NR_TABLA_IRQS,
493 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700494 .micbias = {
495 .ldoh_v = TABLA_LDOH_2P85_V,
496 .cfilt1_mv = 1800,
497 .cfilt2_mv = 1800,
498 .cfilt3_mv = 1800,
499 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
500 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
501 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
502 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
503 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700504};
505
506static struct slim_device msm_slim_tabla = {
507 .name = "tabla-slim",
508 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
509 .dev = {
510 .platform_data = &tabla_platform_data,
511 },
512};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530513
514static struct tabla_pdata tabla20_platform_data = {
515 .slimbus_slave_device = {
516 .name = "tabla-slave",
517 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
518 },
519 .irq = MSM_GPIO_TO_INT(62),
520 .irq_base = TABLA_INTERRUPT_BASE,
521 .num_irqs = NR_TABLA_IRQS,
522 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
523 .micbias = {
524 .ldoh_v = TABLA_LDOH_2P85_V,
525 .cfilt1_mv = 1800,
526 .cfilt2_mv = 1800,
527 .cfilt3_mv = 1800,
528 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
529 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
530 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
531 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
532 }
533};
534
535static struct slim_device msm_slim_tabla20 = {
536 .name = "tabla2x-slim",
537 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
538 .dev = {
539 .platform_data = &tabla20_platform_data,
540 },
541};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700542#endif
543
544static struct slim_boardinfo msm_slim_devices[] = {
545#ifdef CONFIG_WCD9310_CODEC
546 {
547 .bus_num = 1,
548 .slim_slave = &msm_slim_tabla,
549 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530550 {
551 .bus_num = 1,
552 .slim_slave = &msm_slim_tabla20,
553 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700554#endif
555 /* add more slimbus slaves as needed */
556};
557
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700558#define MSM_WCNSS_PHYS 0x03000000
559#define MSM_WCNSS_SIZE 0x280000
560
561static struct resource resources_wcnss_wlan[] = {
562 {
563 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
564 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
565 .name = "wcnss_wlanrx_irq",
566 .flags = IORESOURCE_IRQ,
567 },
568 {
569 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
570 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
571 .name = "wcnss_wlantx_irq",
572 .flags = IORESOURCE_IRQ,
573 },
574 {
575 .start = MSM_WCNSS_PHYS,
576 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
577 .name = "wcnss_mmio",
578 .flags = IORESOURCE_MEM,
579 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700580 {
581 .start = 84,
582 .end = 88,
583 .name = "wcnss_gpios_5wire",
584 .flags = IORESOURCE_IO,
585 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700586};
587
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700588static struct qcom_wcnss_opts qcom_wcnss_pdata = {
589 .has_48mhz_xo = 1,
590};
591
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700592static struct platform_device msm_device_wcnss_wlan = {
593 .name = "wcnss_wlan",
594 .id = 0,
595 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
596 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700597 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700598};
599
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700600#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
601 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
602 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
603 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
604
605#define QCE_SIZE 0x10000
606#define QCE_0_BASE 0x18500000
607
608#define QCE_HW_KEY_SUPPORT 0
609#define QCE_SHA_HMAC_SUPPORT 1
610#define QCE_SHARE_CE_RESOURCE 1
611#define QCE_CE_SHARED 0
612
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800613/* Begin Bus scaling definitions */
614static struct msm_bus_vectors crypto_hw_init_vectors[] = {
615 {
616 .src = MSM_BUS_MASTER_ADM_PORT0,
617 .dst = MSM_BUS_SLAVE_EBI_CH0,
618 .ab = 0,
619 .ib = 0,
620 },
621 {
622 .src = MSM_BUS_MASTER_ADM_PORT1,
623 .dst = MSM_BUS_SLAVE_GSBI1_UART,
624 .ab = 0,
625 .ib = 0,
626 },
627};
628
629static struct msm_bus_vectors crypto_hw_active_vectors[] = {
630 {
631 .src = MSM_BUS_MASTER_ADM_PORT0,
632 .dst = MSM_BUS_SLAVE_EBI_CH0,
633 .ab = 70000000UL,
634 .ib = 70000000UL,
635 },
636 {
637 .src = MSM_BUS_MASTER_ADM_PORT1,
638 .dst = MSM_BUS_SLAVE_GSBI1_UART,
639 .ab = 2480000000UL,
640 .ib = 2480000000UL,
641 },
642};
643
644static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
645 {
646 ARRAY_SIZE(crypto_hw_init_vectors),
647 crypto_hw_init_vectors,
648 },
649 {
650 ARRAY_SIZE(crypto_hw_active_vectors),
651 crypto_hw_active_vectors,
652 },
653};
654
655static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
656 crypto_hw_bus_scale_usecases,
657 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
658 .name = "cryptohw",
659};
660/* End Bus Scaling Definitions*/
661
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700662static struct resource qcrypto_resources[] = {
663 [0] = {
664 .start = QCE_0_BASE,
665 .end = QCE_0_BASE + QCE_SIZE - 1,
666 .flags = IORESOURCE_MEM,
667 },
668 [1] = {
669 .name = "crypto_channels",
670 .start = DMOV_CE_IN_CHAN,
671 .end = DMOV_CE_OUT_CHAN,
672 .flags = IORESOURCE_DMA,
673 },
674 [2] = {
675 .name = "crypto_crci_in",
676 .start = DMOV_CE_IN_CRCI,
677 .end = DMOV_CE_IN_CRCI,
678 .flags = IORESOURCE_DMA,
679 },
680 [3] = {
681 .name = "crypto_crci_out",
682 .start = DMOV_CE_OUT_CRCI,
683 .end = DMOV_CE_OUT_CRCI,
684 .flags = IORESOURCE_DMA,
685 },
686};
687
688static struct resource qcedev_resources[] = {
689 [0] = {
690 .start = QCE_0_BASE,
691 .end = QCE_0_BASE + QCE_SIZE - 1,
692 .flags = IORESOURCE_MEM,
693 },
694 [1] = {
695 .name = "crypto_channels",
696 .start = DMOV_CE_IN_CHAN,
697 .end = DMOV_CE_OUT_CHAN,
698 .flags = IORESOURCE_DMA,
699 },
700 [2] = {
701 .name = "crypto_crci_in",
702 .start = DMOV_CE_IN_CRCI,
703 .end = DMOV_CE_IN_CRCI,
704 .flags = IORESOURCE_DMA,
705 },
706 [3] = {
707 .name = "crypto_crci_out",
708 .start = DMOV_CE_OUT_CRCI,
709 .end = DMOV_CE_OUT_CRCI,
710 .flags = IORESOURCE_DMA,
711 },
712};
713
714#endif
715
716#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
717 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
718
719static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
720 .ce_shared = QCE_CE_SHARED,
721 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
722 .hw_key_support = QCE_HW_KEY_SUPPORT,
723 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800724 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700725};
726
727static struct platform_device qcrypto_device = {
728 .name = "qcrypto",
729 .id = 0,
730 .num_resources = ARRAY_SIZE(qcrypto_resources),
731 .resource = qcrypto_resources,
732 .dev = {
733 .coherent_dma_mask = DMA_BIT_MASK(32),
734 .platform_data = &qcrypto_ce_hw_suppport,
735 },
736};
737#endif
738
739#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
740 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
741
742static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
743 .ce_shared = QCE_CE_SHARED,
744 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
745 .hw_key_support = QCE_HW_KEY_SUPPORT,
746 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800747 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700748};
749
750static struct platform_device qcedev_device = {
751 .name = "qce",
752 .id = 0,
753 .num_resources = ARRAY_SIZE(qcedev_resources),
754 .resource = qcedev_resources,
755 .dev = {
756 .coherent_dma_mask = DMA_BIT_MASK(32),
757 .platform_data = &qcedev_ce_hw_suppport,
758 },
759};
760#endif
761
Joel Kingb8352a12011-11-15 18:46:24 -0800762#define MDM2AP_ERRFATAL 70
763#define AP2MDM_ERRFATAL 95
764#define MDM2AP_STATUS 69
765#define AP2MDM_STATUS 94
766#define AP2MDM_PMIC_RESET_N 80
767#define AP2MDM_KPDPWR_N 81
768
Joel Kingb8352a12011-11-15 18:46:24 -0800769static struct resource mdm_resources[] = {
770 {
771 .start = MDM2AP_ERRFATAL,
772 .end = MDM2AP_ERRFATAL,
773 .name = "MDM2AP_ERRFATAL",
774 .flags = IORESOURCE_IO,
775 },
776 {
777 .start = AP2MDM_ERRFATAL,
778 .end = AP2MDM_ERRFATAL,
779 .name = "AP2MDM_ERRFATAL",
780 .flags = IORESOURCE_IO,
781 },
782 {
783 .start = MDM2AP_STATUS,
784 .end = MDM2AP_STATUS,
785 .name = "MDM2AP_STATUS",
786 .flags = IORESOURCE_IO,
787 },
788 {
789 .start = AP2MDM_STATUS,
790 .end = AP2MDM_STATUS,
791 .name = "AP2MDM_STATUS",
792 .flags = IORESOURCE_IO,
793 },
794 {
795 .start = AP2MDM_PMIC_RESET_N,
796 .end = AP2MDM_PMIC_RESET_N,
797 .name = "AP2MDM_PMIC_RESET_N",
798 .flags = IORESOURCE_IO,
799 },
800 {
801 .start = AP2MDM_KPDPWR_N,
802 .end = AP2MDM_KPDPWR_N,
803 .name = "AP2MDM_KPDPWR_N",
804 .flags = IORESOURCE_IO,
805 },
806};
807
808static struct mdm_platform_data mdm_platform_data = {
809 .mdm_version = "2.5",
810};
811
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800812static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800813 .name = "mdm2_modem",
814 .id = -1,
815 .num_resources = ARRAY_SIZE(mdm_resources),
816 .resource = mdm_resources,
817 .dev = {
818 .platform_data = &mdm_platform_data,
819 },
820};
821
822static struct platform_device *mdm_devices[] __initdata = {
823 &mdm_device,
824};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700825
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700826#define MSM_SHARED_RAM_PHYS 0x80000000
827
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800828static void __init msm8960_map_io(void)
829{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700830 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800831 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700832
833 if (socinfo_init() < 0)
834 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800835}
836
837static void __init msm8960_init_irq(void)
838{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700839 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800840 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700841 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800842
843 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700844 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800845
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
847 mb();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800848}
849
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700850static void __init msm8960_init_buses(void)
851{
852#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -0600853 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -0600854 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
855 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
856 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
857 msm_bus_apps_fabric.dev.platform_data =
858 &msm_bus_8960_apps_fabric_pdata;
859 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
860 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
861 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
862 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700863#endif
864}
865
866static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
867 .max_clock_speed = 15060000,
868};
869
870#ifdef CONFIG_USB_MSM_OTG_72K
871static struct msm_otg_platform_data msm_otg_pdata;
872#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530873static int wr_phy_init_seq[] = {
874 0x44, 0x80, /* set VBUS valid threshold
875 and disconnect valid threshold */
876 0x38, 0x81, /* update DC voltage level */
877 0x14, 0x82, /* set preemphasis and rise/fall time */
878 0x13, 0x83, /* set source impedance adjusment */
879 -1};
880
881static int liquid_v1_phy_init_seq[] = {
882 0x44, 0x80,/* set VBUS valid threshold
883 and disconnect valid threshold */
884 0x3C, 0x81,/* update DC voltage level */
885 0x18, 0x82,/* set preemphasis and rise/fall time */
886 0x23, 0x83,/* set source impedance sdjusment */
887 -1};
888
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700889static struct msm_otg_platform_data msm_otg_pdata = {
890 .mode = USB_OTG,
891 .otg_control = OTG_PMIC_CONTROL,
892 .phy_type = SNPS_28NM_INTEGRATED_PHY,
893 .pclk_src_name = "dfab_usb_hs_clk",
894 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +0530895 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700896};
897#endif
898
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530899#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530900#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530901static struct msm_hsic_host_platform_data msm_hsic_pdata = {
902 .strobe = 150,
903 .data = 151,
904};
905#else
906static struct msm_hsic_host_platform_data msm_hsic_pdata;
907#endif
908
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909#define PID_MAGIC_ID 0x71432909
910#define SERIAL_NUM_MAGIC_ID 0x61945374
911#define SERIAL_NUMBER_LENGTH 127
912#define DLOAD_USB_BASE_ADD 0x2A03F0C8
913
914struct magic_num_struct {
915 uint32_t pid;
916 uint32_t serial_num;
917};
918
919struct dload_struct {
920 uint32_t reserved1;
921 uint32_t reserved2;
922 uint32_t reserved3;
923 uint16_t reserved4;
924 uint16_t pid;
925 char serial_number[SERIAL_NUMBER_LENGTH];
926 uint16_t reserved5;
927 struct magic_num_struct magic_struct;
928};
929
930static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
931{
932 struct dload_struct __iomem *dload = 0;
933
934 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
935 if (!dload) {
936 pr_err("%s: cannot remap I/O memory region: %08x\n",
937 __func__, DLOAD_USB_BASE_ADD);
938 return -ENXIO;
939 }
940
941 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
942 __func__, dload, pid, snum);
943 /* update pid */
944 dload->magic_struct.pid = PID_MAGIC_ID;
945 dload->pid = pid;
946
947 /* update serial number */
948 dload->magic_struct.serial_num = 0;
949 if (!snum) {
950 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
951 goto out;
952 }
953
954 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -0700955 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700956out:
957 iounmap(dload);
958 return 0;
959}
960
961static struct android_usb_platform_data android_usb_pdata = {
962 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
963};
964
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700965static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700966 .name = "android_usb",
967 .id = -1,
968 .dev = {
969 .platform_data = &android_usb_pdata,
970 },
971};
972
973static uint8_t spm_wfi_cmd_sequence[] __initdata = {
974 0x03, 0x0f,
975};
976
977static uint8_t spm_power_collapse_without_rpm[] __initdata = {
978 0x00, 0x24, 0x54, 0x10,
979 0x09, 0x03, 0x01,
980 0x10, 0x54, 0x30, 0x0C,
981 0x24, 0x30, 0x0f,
982};
983
984static uint8_t spm_power_collapse_with_rpm[] __initdata = {
985 0x00, 0x24, 0x54, 0x10,
986 0x09, 0x07, 0x01, 0x0B,
987 0x10, 0x54, 0x30, 0x0C,
988 0x24, 0x30, 0x0f,
989};
990
991static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
992 [0] = {
993 .mode = MSM_SPM_MODE_CLOCK_GATING,
994 .notify_rpm = false,
995 .cmd = spm_wfi_cmd_sequence,
996 },
997 [1] = {
998 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
999 .notify_rpm = false,
1000 .cmd = spm_power_collapse_without_rpm,
1001 },
1002 [2] = {
1003 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1004 .notify_rpm = true,
1005 .cmd = spm_power_collapse_with_rpm,
1006 },
1007};
1008
1009static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1010 [0] = {
1011 .reg_base_addr = MSM_SAW0_BASE,
1012 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1013 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001014 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001015#if defined(CONFIG_MSM_AVS_HW)
1016 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1017 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1018#endif
1019 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1020 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1021 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1022 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1023 .vctl_timeout_us = 50,
1024 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1025 .modes = msm_spm_seq_list,
1026 },
1027 [1] = {
1028 .reg_base_addr = MSM_SAW1_BASE,
1029 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1030 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001031 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001032#if defined(CONFIG_MSM_AVS_HW)
1033 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1034 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1035#endif
1036 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1037 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1038 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1039 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1040 .vctl_timeout_us = 50,
1041 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1042 .modes = msm_spm_seq_list,
1043 },
1044};
1045
1046static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1047 0x00, 0x20, 0x03, 0x20,
1048 0x00, 0x0f,
1049};
1050
1051static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1052 0x00, 0x20, 0x34, 0x64,
1053 0x48, 0x07, 0x48, 0x20,
1054 0x50, 0x64, 0x04, 0x34,
1055 0x50, 0x0f,
1056};
1057static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1058 0x00, 0x10, 0x34, 0x64,
1059 0x48, 0x07, 0x48, 0x10,
1060 0x50, 0x64, 0x04, 0x34,
1061 0x50, 0x0F,
1062};
1063
1064static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1065 [0] = {
1066 .mode = MSM_SPM_L2_MODE_RETENTION,
1067 .notify_rpm = false,
1068 .cmd = l2_spm_wfi_cmd_sequence,
1069 },
1070 [1] = {
1071 .mode = MSM_SPM_L2_MODE_GDHS,
1072 .notify_rpm = true,
1073 .cmd = l2_spm_gdhs_cmd_sequence,
1074 },
1075 [2] = {
1076 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1077 .notify_rpm = true,
1078 .cmd = l2_spm_power_off_cmd_sequence,
1079 },
1080};
1081
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001082static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1083 [0] = {
1084 .reg_base_addr = MSM_SAW_L2_BASE,
1085 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1086 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1087 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1088 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1089 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1090 .modes = msm_spm_l2_seq_list,
1091 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1092 },
1093};
1094
Mohan Pallaka5e490392011-09-09 15:18:41 +05301095#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1096#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1097
1098static struct msm_xo_voter *xo_handle_d1;
1099
1100static int isa1200_power(int on)
1101{
1102 int rc = 0;
1103
1104 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1105
1106 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1107 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1108 if (rc < 0) {
1109 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1110 __func__, on ? "" : "de-", rc);
1111 goto err_xo_vote;
1112 }
1113
1114 return 0;
1115
1116err_xo_vote:
1117 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1118 return rc;
1119}
1120
1121static int isa1200_dev_setup(bool enable)
1122{
1123 int rc = 0;
1124
1125 struct pm_gpio hap_gpio_config = {
1126 .direction = PM_GPIO_DIR_OUT,
1127 .pull = PM_GPIO_PULL_NO,
1128 .out_strength = PM_GPIO_STRENGTH_HIGH,
1129 .function = PM_GPIO_FUNC_NORMAL,
1130 .inv_int_pol = 0,
1131 .vin_sel = 2,
1132 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1133 .output_value = 0,
1134 };
1135
1136 if (enable == true) {
1137 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1138 if (rc) {
1139 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1140 __func__, PM_HAP_EN_GPIO, rc);
1141 return rc;
1142 }
1143
1144 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1145 if (rc) {
1146 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1147 __func__, PM_HAP_LEN_GPIO, rc);
1148 return rc;
1149 }
1150
1151 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1152 if (rc) {
1153 pr_err("%s: unable to request gpio %d (%d)\n",
1154 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1155 return rc;
1156 }
1157
1158 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1159 if (rc) {
1160 pr_err("%s: Unable to set direction\n", __func__);
1161 goto free_gpio;
1162 }
1163
1164 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1165 if (IS_ERR(xo_handle_d1)) {
1166 rc = PTR_ERR(xo_handle_d1);
1167 pr_err("%s: failed to get the handle for D1(%d)\n",
1168 __func__, rc);
1169 goto gpio_set_dir;
1170 }
1171 } else {
1172 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1173
1174 msm_xo_put(xo_handle_d1);
1175 }
1176
1177 return 0;
1178
1179gpio_set_dir:
1180 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1181free_gpio:
1182 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1183 return rc;
1184}
1185
1186static struct isa1200_regulator isa1200_reg_data[] = {
1187 {
1188 .name = "vcc_i2c",
1189 .min_uV = ISA_I2C_VTG_MIN_UV,
1190 .max_uV = ISA_I2C_VTG_MAX_UV,
1191 .load_uA = ISA_I2C_CURR_UA,
1192 },
1193};
1194
1195static struct isa1200_platform_data isa1200_1_pdata = {
1196 .name = "vibrator",
1197 .dev_setup = isa1200_dev_setup,
1198 .power_on = isa1200_power,
1199 .hap_en_gpio = PM_HAP_EN_GPIO,
1200 .hap_len_gpio = PM_HAP_LEN_GPIO,
1201 .max_timeout = 15000,
1202 .mode_ctrl = PWM_GEN_MODE,
1203 .pwm_fd = {
1204 .pwm_div = 256,
1205 },
1206 .is_erm = false,
1207 .smart_en = true,
1208 .ext_clk_en = true,
1209 .chip_en = 1,
1210 .regulator_info = isa1200_reg_data,
1211 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1212};
1213
1214static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1215 {
1216 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301217 },
1218};
1219
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001220#define CYTTSP_TS_GPIO_IRQ 11
1221#define CYTTSP_TS_SLEEP_GPIO 50
1222#define CYTTSP_TS_RESOUT_N_GPIO 52
1223
1224/*virtual key support */
1225static ssize_t tma340_vkeys_show(struct kobject *kobj,
1226 struct kobj_attribute *attr, char *buf)
1227{
1228 return snprintf(buf, 200,
1229 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1230 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1231 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1232 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1233 "\n");
1234}
1235
1236static struct kobj_attribute tma340_vkeys_attr = {
1237 .attr = {
1238 .mode = S_IRUGO,
1239 },
1240 .show = &tma340_vkeys_show,
1241};
1242
1243static struct attribute *tma340_properties_attrs[] = {
1244 &tma340_vkeys_attr.attr,
1245 NULL
1246};
1247
1248static struct attribute_group tma340_properties_attr_group = {
1249 .attrs = tma340_properties_attrs,
1250};
1251
1252
1253static int cyttsp_platform_init(struct i2c_client *client)
1254{
1255 int rc = 0;
1256 static struct kobject *tma340_properties_kobj;
1257
1258 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1259 tma340_properties_kobj = kobject_create_and_add("board_properties",
1260 NULL);
1261 if (tma340_properties_kobj)
1262 rc = sysfs_create_group(tma340_properties_kobj,
1263 &tma340_properties_attr_group);
1264 if (!tma340_properties_kobj || rc)
1265 pr_err("%s: failed to create board_properties\n",
1266 __func__);
1267
1268 return 0;
1269}
1270
1271static struct cyttsp_regulator regulator_data[] = {
1272 {
1273 .name = "vdd",
1274 .min_uV = CY_TMA300_VTG_MIN_UV,
1275 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301276 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1277 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001278 },
1279 /* TODO: Remove after runtime PM is enabled in I2C driver */
1280 {
1281 .name = "vcc_i2c",
1282 .min_uV = CY_I2C_VTG_MIN_UV,
1283 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301284 .hpm_load_uA = CY_I2C_CURR_UA,
1285 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001286 },
1287};
1288
1289static struct cyttsp_platform_data cyttsp_pdata = {
1290 .panel_maxx = 634,
1291 .panel_maxy = 1166,
1292 .disp_maxx = 616,
1293 .disp_maxy = 1023,
1294 .disp_minx = 0,
1295 .disp_miny = 16,
1296 .flags = 0x01,
1297 .gen = CY_GEN3, /* or */
1298 .use_st = CY_USE_ST,
1299 .use_mt = CY_USE_MT,
1300 .use_hndshk = CY_SEND_HNDSHK,
1301 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301302 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303 .use_gestures = CY_USE_GESTURES,
1304 .fw_fname = "cyttsp_8960_cdp.hex",
1305 /* activate up to 4 groups
1306 * and set active distance
1307 */
1308 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1309 CY_GEST_GRP3 | CY_GEST_GRP4 |
1310 CY_ACT_DIST,
1311 /* change act_intrvl to customize the Active power state
1312 * scanning/processing refresh interval for Operating mode
1313 */
1314 .act_intrvl = CY_ACT_INTRVL_DFLT,
1315 /* change tch_tmout to customize the touch timeout for the
1316 * Active power state for Operating mode
1317 */
1318 .tch_tmout = CY_TCH_TMOUT_DFLT,
1319 /* change lp_intrvl to customize the Low Power power state
1320 * scanning/processing refresh interval for Operating mode
1321 */
1322 .lp_intrvl = CY_LP_INTRVL_DFLT,
1323 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1324 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1325 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1326 .regulator_info = regulator_data,
1327 .num_regulators = ARRAY_SIZE(regulator_data),
1328 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301329 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001330};
1331
1332static struct i2c_board_info cyttsp_info[] __initdata = {
1333 {
1334 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1335 .platform_data = &cyttsp_pdata,
1336#ifndef CY_USE_TIMER
1337 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1338#endif /* CY_USE_TIMER */
1339 },
1340};
1341
Mohan Pallaka50837382011-09-07 11:00:57 +05301342/* configuration data */
1343static const u8 mxt_config_data[] = {
1344 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001345 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301346 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001347 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001348 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1349 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1350 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1351 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1352 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1353 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301354 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001355 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301356 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001357 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301358 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001359 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1360 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1361 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1362 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301363 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1365 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301366 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001367 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1368 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301369 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1371 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301372 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001373 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1374 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301375 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001376 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301377 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001378 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301379 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001380 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301381 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001382 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301383 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001384 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301385};
1386
Amy Maloche08266db2011-11-04 11:07:16 -07001387#define MXT_TS_GPIO_IRQ 11
1388#define MXT_TS_LDO_EN_GPIO 50
1389#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301390
1391static void mxt_init_hw_liquid(void)
1392{
1393 int rc;
1394
Mohan Pallaka50837382011-09-07 11:00:57 +05301395 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1396 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001397 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1398 __func__, MXT_TS_LDO_EN_GPIO);
1399 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301400 }
1401
1402 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1403 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001404 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1405 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301406 goto err_ldo_gpio_req;
1407 }
1408
Mohan Pallaka50837382011-09-07 11:00:57 +05301409 return;
1410
Mohan Pallaka50837382011-09-07 11:00:57 +05301411err_ldo_gpio_req:
1412 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301413}
1414
1415static struct mxt_platform_data mxt_platform_data = {
1416 .config = mxt_config_data,
1417 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001418 .x_size = 1365,
1419 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301420 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001421 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001422 .reset_gpio = MXT_TS_RESET_GPIO,
1423 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301424};
1425
1426static struct i2c_board_info mxt_device_info[] __initdata = {
1427 {
1428 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1429 .platform_data = &mxt_platform_data,
1430 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1431 },
1432};
1433
Eugene Yasmand2316b82011-12-07 18:23:48 +02001434static struct i2c_board_info sii_device_info[] __initdata = {
1435 {
1436 I2C_BOARD_INFO("Sil-9244", 0x39),
1437 .flags = I2C_CLIENT_WAKE,
1438 .irq = MSM_GPIO_TO_INT(15),
1439 },
1440};
1441
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001442static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1443 .clk_freq = 100000,
1444 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001445};
1446
1447static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1448 .clk_freq = 100000,
1449 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001450};
1451
1452static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1453 .clk_freq = 100000,
1454 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455};
1456
1457static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1458 .clk_freq = 100000,
1459 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001460};
1461
1462static struct msm_rpm_platform_data msm_rpm_data = {
1463 .reg_base_addrs = {
1464 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1465 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1466 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1467 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1468 },
1469
1470 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1471 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1472 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1473 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1474 .msm_apps_ipc_rpm_val = 4,
1475};
1476
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001477static struct ks8851_pdata spi_eth_pdata = {
1478 .irq_gpio = KS8851_IRQ_GPIO,
1479 .rst_gpio = KS8851_RST_GPIO,
1480};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001481
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001482static struct spi_board_info spi_board_info[] __initdata = {
1483 {
1484 .modalias = "ks8851",
1485 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1486 .max_speed_hz = 19200000,
1487 .bus_num = 0,
1488 .chip_select = 0,
1489 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001490 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001491 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001492 {
1493 .modalias = "dsi_novatek_3d_panel_spi",
1494 .max_speed_hz = 10800000,
1495 .bus_num = 0,
1496 .chip_select = 1,
1497 .mode = SPI_MODE_0,
1498 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001499};
1500
1501static struct platform_device msm_device_saw_core0 = {
1502 .name = "saw-regulator",
1503 .id = 0,
1504 .dev = {
1505 .platform_data = &msm_saw_regulator_pdata_s5,
1506 },
1507};
1508
1509static struct platform_device msm_device_saw_core1 = {
1510 .name = "saw-regulator",
1511 .id = 1,
1512 .dev = {
1513 .platform_data = &msm_saw_regulator_pdata_s6,
1514 },
1515};
1516
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001517static struct tsens_platform_data msm_tsens_pdata = {
1518 .slope = 910,
1519 .tsens_factor = 1000,
1520 .hw_type = MSM_8960,
1521 .tsens_num_sensor = 5,
1522};
1523
1524static struct platform_device msm_tsens_device = {
1525 .name = "tsens8960-tm",
1526 .id = -1,
1527 .dev = {
1528 .platform_data = &msm_tsens_pdata,
1529 },
1530};
1531
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001532#ifdef CONFIG_MSM_FAKE_BATTERY
1533static struct platform_device fish_battery_device = {
1534 .name = "fish_battery",
1535};
1536#endif
1537
David Collins26f05562011-06-20 09:56:28 -07001538static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001539 .name = GPIO_REGULATOR_DEV_NAME,
1540 .id = PM8921_MPP_PM_TO_SYS(7),
1541 .dev = {
1542 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1543 },
1544};
1545
David Collins26f05562011-06-20 09:56:28 -07001546static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001547 .name = GPIO_REGULATOR_DEV_NAME,
1548 .id = 91,
1549 .dev = {
1550 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1551 },
1552};
1553
David Collinsb10be1d2011-09-02 10:29:31 -07001554static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1555 .name = GPIO_REGULATOR_DEV_NAME,
1556 .id = PM8921_GPIO_PM_TO_SYS(17),
1557 .dev = {
1558 .platform_data =
1559 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1560 },
1561};
1562
David Collins35a78f52011-12-14 15:54:25 -08001563static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1564 .name = GPIO_REGULATOR_DEV_NAME,
1565 .id = PM8921_GPIO_PM_TO_SYS(42),
1566 .dev = {
1567 .platform_data =
1568 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1569 },
1570};
1571
David Collins26f05562011-06-20 09:56:28 -07001572static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1573 .name = "rpm-regulator",
1574 .id = -1,
1575 .dev = {
1576 .platform_data = &msm_rpm_regulator_pdata,
1577 },
1578};
1579
David Collins4c31a872011-08-31 10:07:10 -07001580static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1581 .phys_addr_base = 0x0010C000,
1582 .reg_offsets = {
1583 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1584 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1585 },
1586 .phys_size = SZ_8K,
1587 .log_len = 4096, /* log's buffer length in bytes */
1588 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1589};
1590
1591static struct platform_device msm_rpm_log_device = {
1592 .name = "msm_rpm_log",
1593 .id = -1,
1594 .dev = {
1595 .platform_data = &msm_rpm_log_pdata,
1596 },
1597};
1598
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001599static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001600 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001601 &msm_device_smd,
1602 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301603 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001604 &msm_device_saw_core0,
1605 &msm_device_saw_core1,
1606 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001607 &msm8960_device_ssbi_pmic,
David Collins35a78f52011-12-14 15:54:25 -08001608 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001609 &msm8960_device_qup_spi_gsbi1,
1610 &msm8960_device_qup_i2c_gsbi3,
1611 &msm8960_device_qup_i2c_gsbi4,
1612 &msm8960_device_qup_i2c_gsbi10,
1613#ifndef CONFIG_MSM_DSPS
1614 &msm8960_device_qup_i2c_gsbi12,
1615#endif
1616 &msm_slim_ctrl,
1617 &msm_device_wcnss_wlan,
1618#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1619 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1620 &qcrypto_device,
1621#endif
1622
1623#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1624 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1625 &qcedev_device,
1626#endif
1627#ifdef CONFIG_MSM_ROTATOR
1628 &msm_rotator_device,
1629#endif
1630 &msm_device_sps,
1631#ifdef CONFIG_MSM_FAKE_BATTERY
1632 &fish_battery_device,
1633#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001634 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001635#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001636#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001637 &android_pmem_device,
1638 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001639#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001640 &android_pmem_audio_device,
1641#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001642 &msm_device_vidc,
1643 &msm_device_bam_dmux,
1644 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001645
1646#ifdef CONFIG_HW_RANDOM_MSM
1647 &msm_device_rng,
1648#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001649 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07001650#ifdef CONFIG_ION_MSM
1651 &ion_dev,
1652#endif
David Collins4c31a872011-08-31 10:07:10 -07001653 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06001654 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001655 &msm_device_tz_log,
1656
Pratik Patel7831c082011-06-08 21:44:37 -07001657#ifdef CONFIG_MSM_QDSS
1658 &msm_etb_device,
1659 &msm_tpiu_device,
1660 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07001661 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07001662 &msm_ptm_device,
1663#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001664 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001665 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001666};
1667
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001668static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001669 &msm8960_device_otg,
1670 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001671 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301672 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001673 &android_usb_device,
1674 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001675 &msm_bus_apps_fabric,
1676 &msm_bus_sys_fabric,
1677 &msm_bus_mm_fabric,
1678 &msm_bus_sys_fpb,
1679 &msm_bus_cpss_fpb,
1680 &msm_pcm,
1681 &msm_pcm_routing,
1682 &msm_cpudai0,
1683 &msm_cpudai1,
1684 &msm_cpudai_hdmi_rx,
1685 &msm_cpudai_bt_rx,
1686 &msm_cpudai_bt_tx,
1687 &msm_cpudai_fm_rx,
1688 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001689 &msm_cpudai_auxpcm_rx,
1690 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001691 &msm_cpu_fe,
1692 &msm_stub_codec,
1693 &msm_voice,
1694 &msm_voip,
1695 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301696 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001697 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001698 &msm_cpudai_incall_record_rx,
1699 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700
1701#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1702 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1703 &qcrypto_device,
1704#endif
1705
1706#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1707 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1708 &qcedev_device,
1709#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001710};
1711
1712static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001713 &msm_kgsl_3d0,
1714 &msm_kgsl_2d0,
1715 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716#ifdef CONFIG_MSM_GEMINI
1717 &msm8960_gemini_device,
1718#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001719};
1720
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001721static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001722 &msm_8960_q6_lpass,
1723 &msm_8960_q6_mss_fw,
1724 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001725 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001726 &msm_pil_tzapps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001727 &msm8960_device_otg,
1728 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001729 &msm_device_hsusb_host,
1730 &android_usb_device,
1731 &msm_pcm,
1732 &msm_pcm_routing,
1733 &msm_cpudai0,
1734 &msm_cpudai1,
1735 &msm_cpudai_hdmi_rx,
1736 &msm_cpudai_bt_rx,
1737 &msm_cpudai_bt_tx,
1738 &msm_cpudai_fm_rx,
1739 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001740 &msm_cpudai_auxpcm_rx,
1741 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001742 &msm_cpu_fe,
1743 &msm_stub_codec,
1744 &msm_kgsl_3d0,
1745#ifdef CONFIG_MSM_KGSL_2D
1746 &msm_kgsl_2d0,
1747 &msm_kgsl_2d1,
1748#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001749#ifdef CONFIG_MSM_GEMINI
1750 &msm8960_gemini_device,
1751#endif
1752 &msm_voice,
1753 &msm_voip,
1754 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301755 &msm_cpudai_afe_01_rx,
1756 &msm_cpudai_afe_01_tx,
1757 &msm_cpudai_afe_02_rx,
1758 &msm_cpudai_afe_02_tx,
1759 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301760 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001761 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001762 &msm_cpudai_incall_record_rx,
1763 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764 &msm_pcm_hostless,
1765 &msm_bus_apps_fabric,
1766 &msm_bus_sys_fabric,
1767 &msm_bus_mm_fabric,
1768 &msm_bus_sys_fpb,
1769 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001770 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001771};
1772
1773static void __init msm8960_i2c_init(void)
1774{
1775 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1776 &msm8960_i2c_qup_gsbi4_pdata;
1777
1778 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1779 &msm8960_i2c_qup_gsbi3_pdata;
1780
1781 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1782 &msm8960_i2c_qup_gsbi10_pdata;
1783
1784 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1785 &msm8960_i2c_qup_gsbi12_pdata;
1786}
1787
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001788static void __init msm8960_gfx_init(void)
1789{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001790 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001791 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1792 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1793 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001794 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1795 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001796 }
1797}
1798
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001799static struct msm_cpuidle_state msm_cstates[] __initdata = {
1800 {0, 0, "C0", "WFI",
1801 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1802
1803 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1804 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1805
1806 {0, 2, "C2", "POWER_COLLAPSE",
1807 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1808
1809 {1, 0, "C0", "WFI",
1810 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1811
1812 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1813 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1814};
1815
1816static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1817 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1818 .idle_supported = 1,
1819 .suspend_supported = 1,
1820 .idle_enabled = 0,
1821 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001822 },
1823
1824 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1825 .idle_supported = 1,
1826 .suspend_supported = 1,
1827 .idle_enabled = 0,
1828 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001829 },
1830
1831 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1832 .idle_supported = 1,
1833 .suspend_supported = 1,
1834 .idle_enabled = 1,
1835 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001836 },
1837
1838 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1839 .idle_supported = 0,
1840 .suspend_supported = 1,
1841 .idle_enabled = 0,
1842 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001843 },
1844
1845 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1846 .idle_supported = 1,
1847 .suspend_supported = 1,
1848 .idle_enabled = 0,
1849 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001850 },
1851
1852 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1853 .idle_supported = 1,
1854 .suspend_supported = 0,
1855 .idle_enabled = 1,
1856 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001857 },
1858};
1859
1860static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1861 {
1862 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1863 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1864 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001865 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001866 },
1867
1868 {
1869 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1870 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1871 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001872 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001873 },
1874
1875 {
1876 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1877 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1878 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001879 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001880 },
1881
1882 {
1883 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1884 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1885 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001886 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001887 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001888 {
1889 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1890 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1891 false,
1892 7000, 3500, 66600000, 5150,
1893 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001894
1895 {
1896 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1897 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1898 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001899 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001900 },
1901
1902 {
1903 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1904 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1905 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001906 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907 },
1908
1909 {
1910 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1911 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1912 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001913 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001914 },
1915
1916 {
1917 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1918 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1919 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001920 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001921 },
1922};
1923
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001924static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1925 .mode = MSM_PM_BOOT_CONFIG_TZ,
1926};
1927
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001928#ifdef CONFIG_I2C
1929#define I2C_SURF 1
1930#define I2C_FFA (1 << 1)
1931#define I2C_RUMI (1 << 2)
1932#define I2C_SIM (1 << 3)
1933#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03001934#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001935
1936struct i2c_registry {
1937 u8 machs;
1938 int bus;
1939 struct i2c_board_info *info;
1940 int len;
1941};
1942
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001943/* Sensors DSPS platform data */
1944#ifdef CONFIG_MSM_DSPS
1945#define DSPS_PIL_GENERIC_NAME "dsps"
1946#endif /* CONFIG_MSM_DSPS */
1947
1948static void __init msm8960_init_dsps(void)
1949{
1950#ifdef CONFIG_MSM_DSPS
1951 struct msm_dsps_platform_data *pdata =
1952 msm_dsps_device.dev.platform_data;
1953 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
1954 pdata->gpios = NULL;
1955 pdata->gpios_num = 0;
1956
1957 platform_device_register(&msm_dsps_device);
1958#endif /* CONFIG_MSM_DSPS */
1959}
1960
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08001961static int hsic_peripheral_status = 1;
1962static DEFINE_MUTEX(hsic_status_lock);
1963
1964void peripheral_connect()
1965{
1966 mutex_lock(&hsic_status_lock);
1967 if (hsic_peripheral_status)
1968 goto out;
1969 platform_device_add(&msm_device_hsic_host);
1970 hsic_peripheral_status = 1;
1971out:
1972 mutex_unlock(&hsic_status_lock);
1973}
1974EXPORT_SYMBOL(peripheral_connect);
1975
1976void peripheral_disconnect()
1977{
1978 mutex_lock(&hsic_status_lock);
1979 if (!hsic_peripheral_status)
1980 goto out;
1981 platform_device_del(&msm_device_hsic_host);
1982 hsic_peripheral_status = 0;
1983out:
1984 mutex_unlock(&hsic_status_lock);
1985}
1986EXPORT_SYMBOL(peripheral_disconnect);
1987
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07001988static void __init msm8960_init_hsic(void)
1989{
1990#ifdef CONFIG_USB_EHCI_MSM_HSIC
1991 uint32_t version = socinfo_get_version();
1992
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08001993 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07001994 return;
1995
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08001996 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08001997 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07001998#endif
1999}
2000
Amir Samuelov5137e392011-09-21 17:31:25 +03002001#ifdef CONFIG_ISL9519_CHARGER
2002static struct isl_platform_data isl_data __initdata = {
2003 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2004 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2005 .max_system_voltage = 4200,
2006 .min_system_voltage = 3200,
2007 .chgcurrent = 1000, /* 1900, */
2008 .term_current = 400, /* Need fine tuning */
2009 .input_current = 2048,
2010};
2011
2012static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2013 {
2014 I2C_BOARD_INFO("isl9519q", 0x9),
2015 .irq = 0, /* Not required when notify-by-pmic */
2016 .platform_data = &isl_data,
2017 },
2018};
2019#endif /* CONFIG_ISL9519_CHARGER */
2020
Amir Samuelov755616d2011-12-13 16:34:46 +02002021static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2022 {
2023 I2C_BOARD_INFO("sx1508q", 0x20),
2024 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2025 },
2026};
2027
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002028static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002029#ifdef CONFIG_ISL9519_CHARGER
2030 {
2031 I2C_LIQUID,
2032 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2033 isl_charger_i2c_info,
2034 ARRAY_SIZE(isl_charger_i2c_info),
2035 },
2036#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002037 {
2038 I2C_SURF | I2C_FFA | I2C_FLUID,
2039 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2040 cyttsp_info,
2041 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002042 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302043 {
2044 I2C_LIQUID,
2045 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2046 mxt_device_info,
2047 ARRAY_SIZE(mxt_device_info),
2048 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302049 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302050 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302051 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002052 sii_device_info,
2053 ARRAY_SIZE(sii_device_info),
2054 },
2055 {
2056 I2C_LIQUID,
2057 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302058 msm_isa1200_board_info,
2059 ARRAY_SIZE(msm_isa1200_board_info),
2060 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002061 {
2062 I2C_LIQUID,
2063 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2064 liquid_io_expander_i2c_info,
2065 ARRAY_SIZE(liquid_io_expander_i2c_info),
2066 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002067};
2068#endif /* CONFIG_I2C */
2069
2070static void __init register_i2c_devices(void)
2071{
2072#ifdef CONFIG_I2C
2073 u8 mach_mask = 0;
2074 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002075#ifdef CONFIG_MSM_CAMERA
2076 struct i2c_registry msm8960_camera_i2c_devices = {
2077 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2078 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2079 msm8960_camera_board_info.board_info,
2080 msm8960_camera_board_info.num_i2c_board_info,
2081 };
2082#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002083
2084 /* Build the matching 'supported_machs' bitmask */
2085 if (machine_is_msm8960_cdp())
2086 mach_mask = I2C_SURF;
2087 else if (machine_is_msm8960_rumi3())
2088 mach_mask = I2C_RUMI;
2089 else if (machine_is_msm8960_sim())
2090 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002091 else if (machine_is_msm8960_fluid())
2092 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002093 else if (machine_is_msm8960_liquid())
2094 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002095 else if (machine_is_msm8960_mtp())
2096 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002097 else
2098 pr_err("unmatched machine ID in register_i2c_devices\n");
2099
2100 /* Run the array and install devices as appropriate */
2101 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2102 if (msm8960_i2c_devices[i].machs & mach_mask)
2103 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2104 msm8960_i2c_devices[i].info,
2105 msm8960_i2c_devices[i].len);
2106 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002107#ifdef CONFIG_MSM_CAMERA
2108 if (msm8960_camera_i2c_devices.machs & mach_mask)
2109 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2110 msm8960_camera_i2c_devices.info,
2111 msm8960_camera_i2c_devices.len);
2112#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002113#endif
2114}
2115
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002116static void __init msm8960_sim_init(void)
2117{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002118 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2119 &msm8960_device_watchdog.dev.platform_data;
2120
2121 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002122 BUG_ON(msm_rpm_init(&msm_rpm_data));
2123 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2124 ARRAY_SIZE(msm_rpmrs_levels)));
2125 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002126 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002127 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002128 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002129
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002130 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002131 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002132 msm8960_i2c_init();
2133 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2134 msm_spm_l2_init(msm_spm_l2_data);
2135 msm8960_init_buses();
2136 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002137 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002138 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002139 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002140
2141 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2142 &msm8960_qup_spi_gsbi1_pdata;
2143 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2144
2145 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002146 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002147 slim_register_board_info(msm_slim_devices,
2148 ARRAY_SIZE(msm_slim_devices));
2149 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2150 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2151 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2152 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002153 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002154}
2155
2156static void __init msm8960_rumi3_init(void)
2157{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002158 BUG_ON(msm_rpm_init(&msm_rpm_data));
2159 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2160 ARRAY_SIZE(msm_rpmrs_levels)));
2161 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002162 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002163 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002164 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002165 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002166 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2167 &msm8960_qup_spi_gsbi1_pdata;
2168 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2169 msm8960_i2c_init();
2170 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2171 msm_spm_l2_init(msm_spm_l2_data);
2172 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002173 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002174 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002175 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002176 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002177 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002178 slim_register_board_info(msm_slim_devices,
2179 ARRAY_SIZE(msm_slim_devices));
2180 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2181 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2182 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2183 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002184 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002185}
2186
2187static void __init msm8960_cdp_init(void)
2188{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002189 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2190 pr_err("meminfo_init() failed!\n");
2191
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002192 BUG_ON(msm_rpm_init(&msm_rpm_data));
2193 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2194 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002195
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002196 regulator_suppress_info_printing();
2197 if (msm_xo_init())
2198 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002199 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002200 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302201 if (machine_is_msm8960_liquid())
2202 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002203 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302204 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2205 machine_is_msm8960_cdp()) {
2206 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2207 } else if (machine_is_msm8960_liquid()) {
2208 msm_otg_pdata.phy_init_seq =
2209 liquid_v1_phy_init_seq;
2210 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302211 msm_otg_pdata.swfi_latency =
2212 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302213#ifdef CONFIG_USB_EHCI_MSM_HSIC
2214 if (machine_is_msm8960_liquid()) {
2215 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2216 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2217 }
2218#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302219 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002220 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002221 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2222 &msm8960_qup_spi_gsbi1_pdata;
2223 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002224
2225 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302226 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2227 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2228 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002229 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002230 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002231 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2232 msm_spm_l2_init(msm_spm_l2_data);
2233 msm8960_init_buses();
2234 platform_add_devices(msm_footswitch_devices,
2235 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002236 if (machine_is_msm8960_liquid())
2237 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002238 if (machine_is_msm8960_cdp())
2239 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002240 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002241 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002242 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002243 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002244 msm8960_init_cam();
2245 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002246 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302247 if (machine_is_msm8960_liquid())
2248 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002249 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002250 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002251 slim_register_board_info(msm_slim_devices,
2252 ARRAY_SIZE(msm_slim_devices));
2253 msm8960_init_dsps();
2254 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2255 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2256 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2257 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002258 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002259 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Joel Kingb8352a12011-11-15 18:46:24 -08002260 if (PLATFORM_IS_CHARM25())
2261 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002262}
2263
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002264MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2265 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002266 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002267 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302268 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002269 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002270 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002271 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002272 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002273MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002274
2275MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2276 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002277 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002278 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302279 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002280 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002281 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002283 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002284MACHINE_END
2285
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002286MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2287 .map_io = msm8960_map_io,
2288 .reserve = msm8960_reserve,
2289 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302290 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002291 .timer = &msm_timer,
2292 .init_machine = msm8960_cdp_init,
2293 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002294 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002295MACHINE_END
2296
2297MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2298 .map_io = msm8960_map_io,
2299 .reserve = msm8960_reserve,
2300 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302301 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002302 .timer = &msm_timer,
2303 .init_machine = msm8960_cdp_init,
2304 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002305 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002306MACHINE_END
2307
2308MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2309 .map_io = msm8960_map_io,
2310 .reserve = msm8960_reserve,
2311 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302312 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002313 .timer = &msm_timer,
2314 .init_machine = msm8960_cdp_init,
2315 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002316 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002317MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002318
2319MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2320 .map_io = msm8960_map_io,
2321 .reserve = msm8960_reserve,
2322 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302323 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002324 .timer = &msm_timer,
2325 .init_machine = msm8960_cdp_init,
2326 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002327 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002328MACHINE_END