blob: 91bee0b04385c6ef21029c0d72f14f44e7116111 [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 Hauganb5be7992011-11-18 14:29:02 -0800145#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
Olav Haugan0703dbf2011-12-19 17:53:38 -0800312#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
313static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
314 .permission_type = IPT_TYPE_MM_CARVEOUT,
315};
316
317static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
318 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
319};
320
321static struct ion_co_heap_pdata co_ion_pdata = {
322};
323#endif
324
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800325static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700326 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700327 .heaps = {
328 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800329 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700330 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700331 .name = ION_VMALLOC_HEAP_NAME,
332 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700333#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700334 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800335 .id = ION_SF_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700336 .type = ION_HEAP_TYPE_CARVEOUT,
Olav Hauganb5be7992011-11-18 14:29:02 -0800337 .name = ION_SF_HEAP_NAME,
338 .size = MSM_ION_SF_SIZE,
Laura Abbottd6183792011-08-19 13:42:24 -0700339 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800340 .extra_data = &co_ion_pdata,
Laura Abbottd6183792011-08-19 13:42:24 -0700341 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700342 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800343 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800344 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800345 .name = ION_MM_HEAP_NAME,
346 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700347 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800348 .extra_data = (void *) &cp_mm_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700349 },
Laura Abbott8c017362011-09-22 20:59:12 -0700350 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800351 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800352 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800353 .name = ION_MFC_HEAP_NAME,
354 .size = MSM_ION_MFC_SIZE,
355 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800356 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800357 },
358 {
359 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700360 .type = ION_HEAP_TYPE_IOMMU,
361 .name = ION_IOMMU_HEAP_NAME,
362 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700363#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700364 }
365};
366
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800367static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700368 .name = "ion-msm",
369 .id = 1,
370 .dev = { .platform_data = &ion_pdata },
371};
372#endif
373
Larry Bassel41a055b2011-12-06 16:15:14 -0800374struct platform_device fmem_device = {
375 .name = "fmem",
376 .id = 1,
377 .dev = { .platform_data = &fmem_pdata },
378};
379
Laura Abbottd6183792011-08-19 13:42:24 -0700380static void reserve_ion_memory(void)
381{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700382#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800383 unsigned int i;
384
385 if (!pmem_param_set && machine_is_msm8960_liquid()) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800386 msm_ion_cp_mm_size = MSM_LIQUID_ION_MM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800387 for (i = 0; i < ion_pdata.nr; i++) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800388 if (ion_pdata.heaps[i].id == ION_CP_MM_HEAP_ID) {
389 ion_pdata.heaps[i].size = msm_ion_cp_mm_size;
390 pr_debug("msm_ion_cp_mm_size 0x%x\n",
391 msm_ion_cp_mm_size);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800392 break;
393 }
394 }
395 }
Olav Hauganb5be7992011-11-18 14:29:02 -0800396 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_ion_cp_mm_size;
397 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
398 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700399#endif
400}
Huaibin Yanga5419422011-12-08 23:52:10 -0800401
402static void __init reserve_mdp_memory(void)
403{
404 msm8960_mdp_writeback(msm8960_reserve_table);
405}
406
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700407static void __init msm8960_calculate_reserve_sizes(void)
408{
409 size_pmem_devices();
410 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700411 reserve_ion_memory();
Larry Bassel41a055b2011-12-06 16:15:14 -0800412 reserve_fmem_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800413 reserve_mdp_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700414}
415
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700416static struct reserve_info msm8960_reserve_info __initdata = {
417 .memtype_reserve_table = msm8960_reserve_table,
418 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
419 .paddr_to_memtype = msm8960_paddr_to_memtype,
420};
421
Larry Basselb4126da2011-07-18 14:31:33 -0700422static int msm8960_memory_bank_size(void)
423{
424 return 1<<29;
425}
426
427static void __init locate_unstable_memory(void)
428{
429 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
430 unsigned long bank_size;
431 unsigned long low, high;
432
433 bank_size = msm8960_memory_bank_size();
434 low = meminfo.bank[0].start;
435 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700436
437 /* Check if 32 bit overflow occured */
438 if (high < mb->start)
439 high = ~0UL;
440
Larry Basselb4126da2011-07-18 14:31:33 -0700441 low &= ~(bank_size - 1);
442
443 if (high - low <= bank_size)
444 return;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800445 msm8960_reserve_info.low_unstable_address = high -
446 MIN_MEMORY_BLOCK_SIZE;
447 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700448
Larry Basselb4126da2011-07-18 14:31:33 -0700449 msm8960_reserve_info.bank_size = bank_size;
450 pr_info("low unstable address %lx max size %lx bank size %lx\n",
451 msm8960_reserve_info.low_unstable_address,
452 msm8960_reserve_info.max_unstable_size,
453 msm8960_reserve_info.bank_size);
454}
455
Larry Basselb830e182011-10-14 10:46:55 -0700456static void __init place_movable_zone(void)
457{
458 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
459 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
460 pr_info("movable zone start %lx size %lx\n",
461 movable_reserved_start, movable_reserved_size);
462}
463
464static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700465{
466 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700467 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700468 place_movable_zone();
469}
470
471static void __init msm8960_reserve(void)
472{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700473 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800474 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700475}
476
Larry Bassela4414b12011-08-04 11:11:02 -0700477static int msm8960_change_memory_power(u64 start, u64 size,
478 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700479{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700480 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700481}
482
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700483static void __init msm8960_allocate_memory_regions(void)
484{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800485 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700486}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800487
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700488#ifdef CONFIG_WCD9310_CODEC
489
490#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
491
Patrick Lai3043fba2011-08-01 14:15:57 -0700492/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
493 * 4 micbiases are used to power various analog and digital
494 * microphones operating at 1800 mV. Technically, all micbiases
495 * can source from single cfilter since all microphones operate
496 * at the same voltage level. The arrangement below is to make
497 * sure all cfilters are exercised. LDO_H regulator ouput level
498 * does not need to be as high as 2.85V. It is choosen for
499 * microphone sensitivity purpose.
500 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700501static struct tabla_pdata tabla_platform_data = {
502 .slimbus_slave_device = {
503 .name = "tabla-slave",
504 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
505 },
506 .irq = MSM_GPIO_TO_INT(62),
507 .irq_base = TABLA_INTERRUPT_BASE,
508 .num_irqs = NR_TABLA_IRQS,
509 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700510 .micbias = {
511 .ldoh_v = TABLA_LDOH_2P85_V,
512 .cfilt1_mv = 1800,
513 .cfilt2_mv = 1800,
514 .cfilt3_mv = 1800,
515 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
516 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
517 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
518 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
519 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700520};
521
522static struct slim_device msm_slim_tabla = {
523 .name = "tabla-slim",
524 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
525 .dev = {
526 .platform_data = &tabla_platform_data,
527 },
528};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530529
530static struct tabla_pdata tabla20_platform_data = {
531 .slimbus_slave_device = {
532 .name = "tabla-slave",
533 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
534 },
535 .irq = MSM_GPIO_TO_INT(62),
536 .irq_base = TABLA_INTERRUPT_BASE,
537 .num_irqs = NR_TABLA_IRQS,
538 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
539 .micbias = {
540 .ldoh_v = TABLA_LDOH_2P85_V,
541 .cfilt1_mv = 1800,
542 .cfilt2_mv = 1800,
543 .cfilt3_mv = 1800,
544 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
545 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
546 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
547 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
548 }
549};
550
551static struct slim_device msm_slim_tabla20 = {
552 .name = "tabla2x-slim",
553 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
554 .dev = {
555 .platform_data = &tabla20_platform_data,
556 },
557};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700558#endif
559
560static struct slim_boardinfo msm_slim_devices[] = {
561#ifdef CONFIG_WCD9310_CODEC
562 {
563 .bus_num = 1,
564 .slim_slave = &msm_slim_tabla,
565 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530566 {
567 .bus_num = 1,
568 .slim_slave = &msm_slim_tabla20,
569 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700570#endif
571 /* add more slimbus slaves as needed */
572};
573
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700574#define MSM_WCNSS_PHYS 0x03000000
575#define MSM_WCNSS_SIZE 0x280000
576
577static struct resource resources_wcnss_wlan[] = {
578 {
579 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
580 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
581 .name = "wcnss_wlanrx_irq",
582 .flags = IORESOURCE_IRQ,
583 },
584 {
585 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
586 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
587 .name = "wcnss_wlantx_irq",
588 .flags = IORESOURCE_IRQ,
589 },
590 {
591 .start = MSM_WCNSS_PHYS,
592 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
593 .name = "wcnss_mmio",
594 .flags = IORESOURCE_MEM,
595 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700596 {
597 .start = 84,
598 .end = 88,
599 .name = "wcnss_gpios_5wire",
600 .flags = IORESOURCE_IO,
601 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700602};
603
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700604static struct qcom_wcnss_opts qcom_wcnss_pdata = {
605 .has_48mhz_xo = 1,
606};
607
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700608static struct platform_device msm_device_wcnss_wlan = {
609 .name = "wcnss_wlan",
610 .id = 0,
611 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
612 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700613 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700614};
615
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700616#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
617 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
618 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
619 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
620
621#define QCE_SIZE 0x10000
622#define QCE_0_BASE 0x18500000
623
624#define QCE_HW_KEY_SUPPORT 0
625#define QCE_SHA_HMAC_SUPPORT 1
626#define QCE_SHARE_CE_RESOURCE 1
627#define QCE_CE_SHARED 0
628
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800629/* Begin Bus scaling definitions */
630static struct msm_bus_vectors crypto_hw_init_vectors[] = {
631 {
632 .src = MSM_BUS_MASTER_ADM_PORT0,
633 .dst = MSM_BUS_SLAVE_EBI_CH0,
634 .ab = 0,
635 .ib = 0,
636 },
637 {
638 .src = MSM_BUS_MASTER_ADM_PORT1,
639 .dst = MSM_BUS_SLAVE_GSBI1_UART,
640 .ab = 0,
641 .ib = 0,
642 },
643};
644
645static struct msm_bus_vectors crypto_hw_active_vectors[] = {
646 {
647 .src = MSM_BUS_MASTER_ADM_PORT0,
648 .dst = MSM_BUS_SLAVE_EBI_CH0,
649 .ab = 70000000UL,
650 .ib = 70000000UL,
651 },
652 {
653 .src = MSM_BUS_MASTER_ADM_PORT1,
654 .dst = MSM_BUS_SLAVE_GSBI1_UART,
655 .ab = 2480000000UL,
656 .ib = 2480000000UL,
657 },
658};
659
660static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
661 {
662 ARRAY_SIZE(crypto_hw_init_vectors),
663 crypto_hw_init_vectors,
664 },
665 {
666 ARRAY_SIZE(crypto_hw_active_vectors),
667 crypto_hw_active_vectors,
668 },
669};
670
671static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
672 crypto_hw_bus_scale_usecases,
673 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
674 .name = "cryptohw",
675};
676/* End Bus Scaling Definitions*/
677
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700678static struct resource qcrypto_resources[] = {
679 [0] = {
680 .start = QCE_0_BASE,
681 .end = QCE_0_BASE + QCE_SIZE - 1,
682 .flags = IORESOURCE_MEM,
683 },
684 [1] = {
685 .name = "crypto_channels",
686 .start = DMOV_CE_IN_CHAN,
687 .end = DMOV_CE_OUT_CHAN,
688 .flags = IORESOURCE_DMA,
689 },
690 [2] = {
691 .name = "crypto_crci_in",
692 .start = DMOV_CE_IN_CRCI,
693 .end = DMOV_CE_IN_CRCI,
694 .flags = IORESOURCE_DMA,
695 },
696 [3] = {
697 .name = "crypto_crci_out",
698 .start = DMOV_CE_OUT_CRCI,
699 .end = DMOV_CE_OUT_CRCI,
700 .flags = IORESOURCE_DMA,
701 },
702};
703
704static struct resource qcedev_resources[] = {
705 [0] = {
706 .start = QCE_0_BASE,
707 .end = QCE_0_BASE + QCE_SIZE - 1,
708 .flags = IORESOURCE_MEM,
709 },
710 [1] = {
711 .name = "crypto_channels",
712 .start = DMOV_CE_IN_CHAN,
713 .end = DMOV_CE_OUT_CHAN,
714 .flags = IORESOURCE_DMA,
715 },
716 [2] = {
717 .name = "crypto_crci_in",
718 .start = DMOV_CE_IN_CRCI,
719 .end = DMOV_CE_IN_CRCI,
720 .flags = IORESOURCE_DMA,
721 },
722 [3] = {
723 .name = "crypto_crci_out",
724 .start = DMOV_CE_OUT_CRCI,
725 .end = DMOV_CE_OUT_CRCI,
726 .flags = IORESOURCE_DMA,
727 },
728};
729
730#endif
731
732#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
733 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
734
735static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
736 .ce_shared = QCE_CE_SHARED,
737 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
738 .hw_key_support = QCE_HW_KEY_SUPPORT,
739 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800740 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700741};
742
743static struct platform_device qcrypto_device = {
744 .name = "qcrypto",
745 .id = 0,
746 .num_resources = ARRAY_SIZE(qcrypto_resources),
747 .resource = qcrypto_resources,
748 .dev = {
749 .coherent_dma_mask = DMA_BIT_MASK(32),
750 .platform_data = &qcrypto_ce_hw_suppport,
751 },
752};
753#endif
754
755#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
756 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
757
758static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
759 .ce_shared = QCE_CE_SHARED,
760 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
761 .hw_key_support = QCE_HW_KEY_SUPPORT,
762 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800763 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700764};
765
766static struct platform_device qcedev_device = {
767 .name = "qce",
768 .id = 0,
769 .num_resources = ARRAY_SIZE(qcedev_resources),
770 .resource = qcedev_resources,
771 .dev = {
772 .coherent_dma_mask = DMA_BIT_MASK(32),
773 .platform_data = &qcedev_ce_hw_suppport,
774 },
775};
776#endif
777
Joel Kingb8352a12011-11-15 18:46:24 -0800778#define MDM2AP_ERRFATAL 70
779#define AP2MDM_ERRFATAL 95
780#define MDM2AP_STATUS 69
781#define AP2MDM_STATUS 94
782#define AP2MDM_PMIC_RESET_N 80
783#define AP2MDM_KPDPWR_N 81
784
Joel Kingb8352a12011-11-15 18:46:24 -0800785static struct resource mdm_resources[] = {
786 {
787 .start = MDM2AP_ERRFATAL,
788 .end = MDM2AP_ERRFATAL,
789 .name = "MDM2AP_ERRFATAL",
790 .flags = IORESOURCE_IO,
791 },
792 {
793 .start = AP2MDM_ERRFATAL,
794 .end = AP2MDM_ERRFATAL,
795 .name = "AP2MDM_ERRFATAL",
796 .flags = IORESOURCE_IO,
797 },
798 {
799 .start = MDM2AP_STATUS,
800 .end = MDM2AP_STATUS,
801 .name = "MDM2AP_STATUS",
802 .flags = IORESOURCE_IO,
803 },
804 {
805 .start = AP2MDM_STATUS,
806 .end = AP2MDM_STATUS,
807 .name = "AP2MDM_STATUS",
808 .flags = IORESOURCE_IO,
809 },
810 {
811 .start = AP2MDM_PMIC_RESET_N,
812 .end = AP2MDM_PMIC_RESET_N,
813 .name = "AP2MDM_PMIC_RESET_N",
814 .flags = IORESOURCE_IO,
815 },
816 {
817 .start = AP2MDM_KPDPWR_N,
818 .end = AP2MDM_KPDPWR_N,
819 .name = "AP2MDM_KPDPWR_N",
820 .flags = IORESOURCE_IO,
821 },
822};
823
824static struct mdm_platform_data mdm_platform_data = {
825 .mdm_version = "2.5",
826};
827
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800828static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800829 .name = "mdm2_modem",
830 .id = -1,
831 .num_resources = ARRAY_SIZE(mdm_resources),
832 .resource = mdm_resources,
833 .dev = {
834 .platform_data = &mdm_platform_data,
835 },
836};
837
838static struct platform_device *mdm_devices[] __initdata = {
839 &mdm_device,
840};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700841
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700842#define MSM_SHARED_RAM_PHYS 0x80000000
843
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800844static void __init msm8960_map_io(void)
845{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800847 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700848
849 if (socinfo_init() < 0)
850 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800851}
852
853static void __init msm8960_init_irq(void)
854{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700855 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800856 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700857 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800858
859 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700860 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800861
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700862 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
863 mb();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800864}
865
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700866static void __init msm8960_init_buses(void)
867{
868#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -0600869 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -0600870 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
871 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
872 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
873 msm_bus_apps_fabric.dev.platform_data =
874 &msm_bus_8960_apps_fabric_pdata;
875 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
876 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
877 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
878 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700879#endif
880}
881
882static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
883 .max_clock_speed = 15060000,
884};
885
886#ifdef CONFIG_USB_MSM_OTG_72K
887static struct msm_otg_platform_data msm_otg_pdata;
888#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530889static int wr_phy_init_seq[] = {
890 0x44, 0x80, /* set VBUS valid threshold
891 and disconnect valid threshold */
892 0x38, 0x81, /* update DC voltage level */
893 0x14, 0x82, /* set preemphasis and rise/fall time */
894 0x13, 0x83, /* set source impedance adjusment */
895 -1};
896
897static int liquid_v1_phy_init_seq[] = {
898 0x44, 0x80,/* set VBUS valid threshold
899 and disconnect valid threshold */
900 0x3C, 0x81,/* update DC voltage level */
901 0x18, 0x82,/* set preemphasis and rise/fall time */
902 0x23, 0x83,/* set source impedance sdjusment */
903 -1};
904
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905static struct msm_otg_platform_data msm_otg_pdata = {
906 .mode = USB_OTG,
907 .otg_control = OTG_PMIC_CONTROL,
908 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +0530910 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700911};
912#endif
913
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530914#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530915#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530916static struct msm_hsic_host_platform_data msm_hsic_pdata = {
917 .strobe = 150,
918 .data = 151,
919};
920#else
921static struct msm_hsic_host_platform_data msm_hsic_pdata;
922#endif
923
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700924#define PID_MAGIC_ID 0x71432909
925#define SERIAL_NUM_MAGIC_ID 0x61945374
926#define SERIAL_NUMBER_LENGTH 127
927#define DLOAD_USB_BASE_ADD 0x2A03F0C8
928
929struct magic_num_struct {
930 uint32_t pid;
931 uint32_t serial_num;
932};
933
934struct dload_struct {
935 uint32_t reserved1;
936 uint32_t reserved2;
937 uint32_t reserved3;
938 uint16_t reserved4;
939 uint16_t pid;
940 char serial_number[SERIAL_NUMBER_LENGTH];
941 uint16_t reserved5;
942 struct magic_num_struct magic_struct;
943};
944
945static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
946{
947 struct dload_struct __iomem *dload = 0;
948
949 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
950 if (!dload) {
951 pr_err("%s: cannot remap I/O memory region: %08x\n",
952 __func__, DLOAD_USB_BASE_ADD);
953 return -ENXIO;
954 }
955
956 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
957 __func__, dload, pid, snum);
958 /* update pid */
959 dload->magic_struct.pid = PID_MAGIC_ID;
960 dload->pid = pid;
961
962 /* update serial number */
963 dload->magic_struct.serial_num = 0;
964 if (!snum) {
965 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
966 goto out;
967 }
968
969 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -0700970 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700971out:
972 iounmap(dload);
973 return 0;
974}
975
976static struct android_usb_platform_data android_usb_pdata = {
977 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
978};
979
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700980static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700981 .name = "android_usb",
982 .id = -1,
983 .dev = {
984 .platform_data = &android_usb_pdata,
985 },
986};
987
988static uint8_t spm_wfi_cmd_sequence[] __initdata = {
989 0x03, 0x0f,
990};
991
992static uint8_t spm_power_collapse_without_rpm[] __initdata = {
993 0x00, 0x24, 0x54, 0x10,
994 0x09, 0x03, 0x01,
995 0x10, 0x54, 0x30, 0x0C,
996 0x24, 0x30, 0x0f,
997};
998
999static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1000 0x00, 0x24, 0x54, 0x10,
1001 0x09, 0x07, 0x01, 0x0B,
1002 0x10, 0x54, 0x30, 0x0C,
1003 0x24, 0x30, 0x0f,
1004};
1005
1006static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1007 [0] = {
1008 .mode = MSM_SPM_MODE_CLOCK_GATING,
1009 .notify_rpm = false,
1010 .cmd = spm_wfi_cmd_sequence,
1011 },
1012 [1] = {
1013 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1014 .notify_rpm = false,
1015 .cmd = spm_power_collapse_without_rpm,
1016 },
1017 [2] = {
1018 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1019 .notify_rpm = true,
1020 .cmd = spm_power_collapse_with_rpm,
1021 },
1022};
1023
1024static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1025 [0] = {
1026 .reg_base_addr = MSM_SAW0_BASE,
1027 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1028 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001029 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001030#if defined(CONFIG_MSM_AVS_HW)
1031 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1032 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1033#endif
1034 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1035 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1036 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1037 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1038 .vctl_timeout_us = 50,
1039 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1040 .modes = msm_spm_seq_list,
1041 },
1042 [1] = {
1043 .reg_base_addr = MSM_SAW1_BASE,
1044 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1045 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001046 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001047#if defined(CONFIG_MSM_AVS_HW)
1048 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1049 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1050#endif
1051 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1052 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1053 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1054 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1055 .vctl_timeout_us = 50,
1056 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1057 .modes = msm_spm_seq_list,
1058 },
1059};
1060
1061static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1062 0x00, 0x20, 0x03, 0x20,
1063 0x00, 0x0f,
1064};
1065
1066static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1067 0x00, 0x20, 0x34, 0x64,
1068 0x48, 0x07, 0x48, 0x20,
1069 0x50, 0x64, 0x04, 0x34,
1070 0x50, 0x0f,
1071};
1072static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1073 0x00, 0x10, 0x34, 0x64,
1074 0x48, 0x07, 0x48, 0x10,
1075 0x50, 0x64, 0x04, 0x34,
1076 0x50, 0x0F,
1077};
1078
1079static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1080 [0] = {
1081 .mode = MSM_SPM_L2_MODE_RETENTION,
1082 .notify_rpm = false,
1083 .cmd = l2_spm_wfi_cmd_sequence,
1084 },
1085 [1] = {
1086 .mode = MSM_SPM_L2_MODE_GDHS,
1087 .notify_rpm = true,
1088 .cmd = l2_spm_gdhs_cmd_sequence,
1089 },
1090 [2] = {
1091 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1092 .notify_rpm = true,
1093 .cmd = l2_spm_power_off_cmd_sequence,
1094 },
1095};
1096
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001097static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1098 [0] = {
1099 .reg_base_addr = MSM_SAW_L2_BASE,
1100 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1101 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1102 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1103 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1104 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1105 .modes = msm_spm_l2_seq_list,
1106 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1107 },
1108};
1109
Mohan Pallaka5e490392011-09-09 15:18:41 +05301110#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1111#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1112
1113static struct msm_xo_voter *xo_handle_d1;
1114
1115static int isa1200_power(int on)
1116{
1117 int rc = 0;
1118
1119 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1120
1121 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1122 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1123 if (rc < 0) {
1124 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1125 __func__, on ? "" : "de-", rc);
1126 goto err_xo_vote;
1127 }
1128
1129 return 0;
1130
1131err_xo_vote:
1132 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1133 return rc;
1134}
1135
1136static int isa1200_dev_setup(bool enable)
1137{
1138 int rc = 0;
1139
1140 struct pm_gpio hap_gpio_config = {
1141 .direction = PM_GPIO_DIR_OUT,
1142 .pull = PM_GPIO_PULL_NO,
1143 .out_strength = PM_GPIO_STRENGTH_HIGH,
1144 .function = PM_GPIO_FUNC_NORMAL,
1145 .inv_int_pol = 0,
1146 .vin_sel = 2,
1147 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1148 .output_value = 0,
1149 };
1150
1151 if (enable == true) {
1152 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1153 if (rc) {
1154 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1155 __func__, PM_HAP_EN_GPIO, rc);
1156 return rc;
1157 }
1158
1159 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1160 if (rc) {
1161 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1162 __func__, PM_HAP_LEN_GPIO, rc);
1163 return rc;
1164 }
1165
1166 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1167 if (rc) {
1168 pr_err("%s: unable to request gpio %d (%d)\n",
1169 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1170 return rc;
1171 }
1172
1173 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1174 if (rc) {
1175 pr_err("%s: Unable to set direction\n", __func__);
1176 goto free_gpio;
1177 }
1178
1179 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1180 if (IS_ERR(xo_handle_d1)) {
1181 rc = PTR_ERR(xo_handle_d1);
1182 pr_err("%s: failed to get the handle for D1(%d)\n",
1183 __func__, rc);
1184 goto gpio_set_dir;
1185 }
1186 } else {
1187 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1188
1189 msm_xo_put(xo_handle_d1);
1190 }
1191
1192 return 0;
1193
1194gpio_set_dir:
1195 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1196free_gpio:
1197 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1198 return rc;
1199}
1200
1201static struct isa1200_regulator isa1200_reg_data[] = {
1202 {
1203 .name = "vcc_i2c",
1204 .min_uV = ISA_I2C_VTG_MIN_UV,
1205 .max_uV = ISA_I2C_VTG_MAX_UV,
1206 .load_uA = ISA_I2C_CURR_UA,
1207 },
1208};
1209
1210static struct isa1200_platform_data isa1200_1_pdata = {
1211 .name = "vibrator",
1212 .dev_setup = isa1200_dev_setup,
1213 .power_on = isa1200_power,
1214 .hap_en_gpio = PM_HAP_EN_GPIO,
1215 .hap_len_gpio = PM_HAP_LEN_GPIO,
1216 .max_timeout = 15000,
1217 .mode_ctrl = PWM_GEN_MODE,
1218 .pwm_fd = {
1219 .pwm_div = 256,
1220 },
1221 .is_erm = false,
1222 .smart_en = true,
1223 .ext_clk_en = true,
1224 .chip_en = 1,
1225 .regulator_info = isa1200_reg_data,
1226 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1227};
1228
1229static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1230 {
1231 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301232 },
1233};
1234
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001235#define CYTTSP_TS_GPIO_IRQ 11
1236#define CYTTSP_TS_SLEEP_GPIO 50
1237#define CYTTSP_TS_RESOUT_N_GPIO 52
1238
1239/*virtual key support */
1240static ssize_t tma340_vkeys_show(struct kobject *kobj,
1241 struct kobj_attribute *attr, char *buf)
1242{
1243 return snprintf(buf, 200,
1244 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1245 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1246 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1247 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1248 "\n");
1249}
1250
1251static struct kobj_attribute tma340_vkeys_attr = {
1252 .attr = {
1253 .mode = S_IRUGO,
1254 },
1255 .show = &tma340_vkeys_show,
1256};
1257
1258static struct attribute *tma340_properties_attrs[] = {
1259 &tma340_vkeys_attr.attr,
1260 NULL
1261};
1262
1263static struct attribute_group tma340_properties_attr_group = {
1264 .attrs = tma340_properties_attrs,
1265};
1266
1267
1268static int cyttsp_platform_init(struct i2c_client *client)
1269{
1270 int rc = 0;
1271 static struct kobject *tma340_properties_kobj;
1272
1273 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1274 tma340_properties_kobj = kobject_create_and_add("board_properties",
1275 NULL);
1276 if (tma340_properties_kobj)
1277 rc = sysfs_create_group(tma340_properties_kobj,
1278 &tma340_properties_attr_group);
1279 if (!tma340_properties_kobj || rc)
1280 pr_err("%s: failed to create board_properties\n",
1281 __func__);
1282
1283 return 0;
1284}
1285
1286static struct cyttsp_regulator regulator_data[] = {
1287 {
1288 .name = "vdd",
1289 .min_uV = CY_TMA300_VTG_MIN_UV,
1290 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301291 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1292 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001293 },
1294 /* TODO: Remove after runtime PM is enabled in I2C driver */
1295 {
1296 .name = "vcc_i2c",
1297 .min_uV = CY_I2C_VTG_MIN_UV,
1298 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301299 .hpm_load_uA = CY_I2C_CURR_UA,
1300 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001301 },
1302};
1303
1304static struct cyttsp_platform_data cyttsp_pdata = {
1305 .panel_maxx = 634,
1306 .panel_maxy = 1166,
1307 .disp_maxx = 616,
1308 .disp_maxy = 1023,
1309 .disp_minx = 0,
1310 .disp_miny = 16,
1311 .flags = 0x01,
1312 .gen = CY_GEN3, /* or */
1313 .use_st = CY_USE_ST,
1314 .use_mt = CY_USE_MT,
1315 .use_hndshk = CY_SEND_HNDSHK,
1316 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301317 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001318 .use_gestures = CY_USE_GESTURES,
1319 .fw_fname = "cyttsp_8960_cdp.hex",
1320 /* activate up to 4 groups
1321 * and set active distance
1322 */
1323 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1324 CY_GEST_GRP3 | CY_GEST_GRP4 |
1325 CY_ACT_DIST,
1326 /* change act_intrvl to customize the Active power state
1327 * scanning/processing refresh interval for Operating mode
1328 */
1329 .act_intrvl = CY_ACT_INTRVL_DFLT,
1330 /* change tch_tmout to customize the touch timeout for the
1331 * Active power state for Operating mode
1332 */
1333 .tch_tmout = CY_TCH_TMOUT_DFLT,
1334 /* change lp_intrvl to customize the Low Power power state
1335 * scanning/processing refresh interval for Operating mode
1336 */
1337 .lp_intrvl = CY_LP_INTRVL_DFLT,
1338 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1339 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1340 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1341 .regulator_info = regulator_data,
1342 .num_regulators = ARRAY_SIZE(regulator_data),
1343 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301344 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001345};
1346
1347static struct i2c_board_info cyttsp_info[] __initdata = {
1348 {
1349 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1350 .platform_data = &cyttsp_pdata,
1351#ifndef CY_USE_TIMER
1352 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1353#endif /* CY_USE_TIMER */
1354 },
1355};
1356
Mohan Pallaka50837382011-09-07 11:00:57 +05301357/* configuration data */
1358static const u8 mxt_config_data[] = {
1359 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001360 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301361 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001362 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001363 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1365 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1366 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1367 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1368 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301369 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001370 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301371 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001372 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301373 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001374 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1375 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1376 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1377 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301378 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001379 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1380 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301381 /* T18 Object */
1382 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301383 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001384 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1385 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301386 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001387 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1388 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301389 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001390 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1391 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301392 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001393 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301394 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001395 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301396 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001397 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301398 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001399 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301400 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001401 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301402};
1403
Amy Maloche08266db2011-11-04 11:07:16 -07001404#define MXT_TS_GPIO_IRQ 11
1405#define MXT_TS_LDO_EN_GPIO 50
1406#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301407
1408static void mxt_init_hw_liquid(void)
1409{
1410 int rc;
1411
Mohan Pallaka50837382011-09-07 11:00:57 +05301412 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1413 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001414 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1415 __func__, MXT_TS_LDO_EN_GPIO);
1416 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301417 }
1418
1419 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1420 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001421 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1422 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301423 goto err_ldo_gpio_req;
1424 }
1425
Mohan Pallaka50837382011-09-07 11:00:57 +05301426 return;
1427
Mohan Pallaka50837382011-09-07 11:00:57 +05301428err_ldo_gpio_req:
1429 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301430}
1431
1432static struct mxt_platform_data mxt_platform_data = {
1433 .config = mxt_config_data,
1434 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001435 .x_size = 1365,
1436 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301437 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001438 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001439 .reset_gpio = MXT_TS_RESET_GPIO,
1440 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301441};
1442
1443static struct i2c_board_info mxt_device_info[] __initdata = {
1444 {
1445 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1446 .platform_data = &mxt_platform_data,
1447 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1448 },
1449};
1450
Eugene Yasmand2316b82011-12-07 18:23:48 +02001451static struct i2c_board_info sii_device_info[] __initdata = {
1452 {
1453 I2C_BOARD_INFO("Sil-9244", 0x39),
1454 .flags = I2C_CLIENT_WAKE,
1455 .irq = MSM_GPIO_TO_INT(15),
1456 },
1457};
1458
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001459static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1460 .clk_freq = 100000,
1461 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001462};
1463
1464static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1465 .clk_freq = 100000,
1466 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001467};
1468
1469static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1470 .clk_freq = 100000,
1471 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001472};
1473
1474static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1475 .clk_freq = 100000,
1476 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001477};
1478
1479static struct msm_rpm_platform_data msm_rpm_data = {
1480 .reg_base_addrs = {
1481 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1482 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1483 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1484 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1485 },
1486
1487 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1488 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1489 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1490 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1491 .msm_apps_ipc_rpm_val = 4,
1492};
1493
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001494static struct ks8851_pdata spi_eth_pdata = {
1495 .irq_gpio = KS8851_IRQ_GPIO,
1496 .rst_gpio = KS8851_RST_GPIO,
1497};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001498
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001499static struct spi_board_info spi_board_info[] __initdata = {
1500 {
1501 .modalias = "ks8851",
1502 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1503 .max_speed_hz = 19200000,
1504 .bus_num = 0,
1505 .chip_select = 0,
1506 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001507 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001508 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001509 {
1510 .modalias = "dsi_novatek_3d_panel_spi",
1511 .max_speed_hz = 10800000,
1512 .bus_num = 0,
1513 .chip_select = 1,
1514 .mode = SPI_MODE_0,
1515 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001516};
1517
1518static struct platform_device msm_device_saw_core0 = {
1519 .name = "saw-regulator",
1520 .id = 0,
1521 .dev = {
1522 .platform_data = &msm_saw_regulator_pdata_s5,
1523 },
1524};
1525
1526static struct platform_device msm_device_saw_core1 = {
1527 .name = "saw-regulator",
1528 .id = 1,
1529 .dev = {
1530 .platform_data = &msm_saw_regulator_pdata_s6,
1531 },
1532};
1533
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001534static struct tsens_platform_data msm_tsens_pdata = {
1535 .slope = 910,
1536 .tsens_factor = 1000,
1537 .hw_type = MSM_8960,
1538 .tsens_num_sensor = 5,
1539};
1540
1541static struct platform_device msm_tsens_device = {
1542 .name = "tsens8960-tm",
1543 .id = -1,
1544 .dev = {
1545 .platform_data = &msm_tsens_pdata,
1546 },
1547};
1548
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001549#ifdef CONFIG_MSM_FAKE_BATTERY
1550static struct platform_device fish_battery_device = {
1551 .name = "fish_battery",
1552};
1553#endif
1554
David Collins26f05562011-06-20 09:56:28 -07001555static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001556 .name = GPIO_REGULATOR_DEV_NAME,
1557 .id = PM8921_MPP_PM_TO_SYS(7),
1558 .dev = {
1559 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1560 },
1561};
1562
David Collins26f05562011-06-20 09:56:28 -07001563static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001564 .name = GPIO_REGULATOR_DEV_NAME,
1565 .id = 91,
1566 .dev = {
1567 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1568 },
1569};
1570
David Collinsb10be1d2011-09-02 10:29:31 -07001571static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1572 .name = GPIO_REGULATOR_DEV_NAME,
1573 .id = PM8921_GPIO_PM_TO_SYS(17),
1574 .dev = {
1575 .platform_data =
1576 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1577 },
1578};
1579
David Collins35a78f52011-12-14 15:54:25 -08001580static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1581 .name = GPIO_REGULATOR_DEV_NAME,
1582 .id = PM8921_GPIO_PM_TO_SYS(42),
1583 .dev = {
1584 .platform_data =
1585 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1586 },
1587};
1588
David Collins26f05562011-06-20 09:56:28 -07001589static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1590 .name = "rpm-regulator",
1591 .id = -1,
1592 .dev = {
1593 .platform_data = &msm_rpm_regulator_pdata,
1594 },
1595};
1596
David Collins4c31a872011-08-31 10:07:10 -07001597static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1598 .phys_addr_base = 0x0010C000,
1599 .reg_offsets = {
1600 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1601 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1602 },
1603 .phys_size = SZ_8K,
1604 .log_len = 4096, /* log's buffer length in bytes */
1605 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1606};
1607
1608static struct platform_device msm_rpm_log_device = {
1609 .name = "msm_rpm_log",
1610 .id = -1,
1611 .dev = {
1612 .platform_data = &msm_rpm_log_pdata,
1613 },
1614};
1615
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001616static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001617 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001618 &msm_device_smd,
1619 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301620 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001621 &msm_device_saw_core0,
1622 &msm_device_saw_core1,
1623 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001624 &msm8960_device_ssbi_pmic,
David Collins35a78f52011-12-14 15:54:25 -08001625 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001626 &msm8960_device_qup_spi_gsbi1,
1627 &msm8960_device_qup_i2c_gsbi3,
1628 &msm8960_device_qup_i2c_gsbi4,
1629 &msm8960_device_qup_i2c_gsbi10,
1630#ifndef CONFIG_MSM_DSPS
1631 &msm8960_device_qup_i2c_gsbi12,
1632#endif
1633 &msm_slim_ctrl,
1634 &msm_device_wcnss_wlan,
1635#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1636 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1637 &qcrypto_device,
1638#endif
1639
1640#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1641 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1642 &qcedev_device,
1643#endif
1644#ifdef CONFIG_MSM_ROTATOR
1645 &msm_rotator_device,
1646#endif
1647 &msm_device_sps,
1648#ifdef CONFIG_MSM_FAKE_BATTERY
1649 &fish_battery_device,
1650#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001651 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001652#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001653#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001654 &android_pmem_device,
1655 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001656#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001657 &android_pmem_audio_device,
1658#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001659 &msm_device_vidc,
1660 &msm_device_bam_dmux,
1661 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001662
1663#ifdef CONFIG_HW_RANDOM_MSM
1664 &msm_device_rng,
1665#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001666 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07001667#ifdef CONFIG_ION_MSM
1668 &ion_dev,
1669#endif
David Collins4c31a872011-08-31 10:07:10 -07001670 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06001671 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001672 &msm_device_tz_log,
1673
Pratik Patel7831c082011-06-08 21:44:37 -07001674#ifdef CONFIG_MSM_QDSS
1675 &msm_etb_device,
1676 &msm_tpiu_device,
1677 &msm_funnel_device,
1678 &msm_ptm_device,
1679#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001680 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001681 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001682};
1683
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001684static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001685 &msm8960_device_otg,
1686 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301688 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689 &android_usb_device,
1690 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001691 &msm_bus_apps_fabric,
1692 &msm_bus_sys_fabric,
1693 &msm_bus_mm_fabric,
1694 &msm_bus_sys_fpb,
1695 &msm_bus_cpss_fpb,
1696 &msm_pcm,
1697 &msm_pcm_routing,
1698 &msm_cpudai0,
1699 &msm_cpudai1,
1700 &msm_cpudai_hdmi_rx,
1701 &msm_cpudai_bt_rx,
1702 &msm_cpudai_bt_tx,
1703 &msm_cpudai_fm_rx,
1704 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001705 &msm_cpudai_auxpcm_rx,
1706 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001707 &msm_cpu_fe,
1708 &msm_stub_codec,
1709 &msm_voice,
1710 &msm_voip,
1711 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301712 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001713 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001714 &msm_cpudai_incall_record_rx,
1715 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716
1717#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1718 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1719 &qcrypto_device,
1720#endif
1721
1722#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1723 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1724 &qcedev_device,
1725#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001726};
1727
1728static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001729 &msm_kgsl_3d0,
1730 &msm_kgsl_2d0,
1731 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001732#ifdef CONFIG_MSM_GEMINI
1733 &msm8960_gemini_device,
1734#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001735};
1736
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001737static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001738 &msm_8960_q6_lpass,
1739 &msm_8960_q6_mss_fw,
1740 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001741 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001742 &msm_pil_tzapps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001743 &msm8960_device_otg,
1744 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001745 &msm_device_hsusb_host,
1746 &android_usb_device,
1747 &msm_pcm,
1748 &msm_pcm_routing,
1749 &msm_cpudai0,
1750 &msm_cpudai1,
1751 &msm_cpudai_hdmi_rx,
1752 &msm_cpudai_bt_rx,
1753 &msm_cpudai_bt_tx,
1754 &msm_cpudai_fm_rx,
1755 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001756 &msm_cpudai_auxpcm_rx,
1757 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001758 &msm_cpu_fe,
1759 &msm_stub_codec,
1760 &msm_kgsl_3d0,
1761#ifdef CONFIG_MSM_KGSL_2D
1762 &msm_kgsl_2d0,
1763 &msm_kgsl_2d1,
1764#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001765#ifdef CONFIG_MSM_GEMINI
1766 &msm8960_gemini_device,
1767#endif
1768 &msm_voice,
1769 &msm_voip,
1770 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301771 &msm_cpudai_afe_01_rx,
1772 &msm_cpudai_afe_01_tx,
1773 &msm_cpudai_afe_02_rx,
1774 &msm_cpudai_afe_02_tx,
1775 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301776 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001777 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001778 &msm_cpudai_incall_record_rx,
1779 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001780 &msm_pcm_hostless,
1781 &msm_bus_apps_fabric,
1782 &msm_bus_sys_fabric,
1783 &msm_bus_mm_fabric,
1784 &msm_bus_sys_fpb,
1785 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001786 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001787};
1788
1789static void __init msm8960_i2c_init(void)
1790{
1791 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1792 &msm8960_i2c_qup_gsbi4_pdata;
1793
1794 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1795 &msm8960_i2c_qup_gsbi3_pdata;
1796
1797 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1798 &msm8960_i2c_qup_gsbi10_pdata;
1799
1800 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1801 &msm8960_i2c_qup_gsbi12_pdata;
1802}
1803
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001804static void __init msm8960_gfx_init(void)
1805{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001806 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001807 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1808 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1809 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001810 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1811 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001812 }
1813}
1814
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001815static struct msm_cpuidle_state msm_cstates[] __initdata = {
1816 {0, 0, "C0", "WFI",
1817 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1818
1819 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1820 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1821
1822 {0, 2, "C2", "POWER_COLLAPSE",
1823 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1824
1825 {1, 0, "C0", "WFI",
1826 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1827
1828 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1829 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1830};
1831
1832static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1833 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1834 .idle_supported = 1,
1835 .suspend_supported = 1,
1836 .idle_enabled = 0,
1837 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001838 },
1839
1840 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1841 .idle_supported = 1,
1842 .suspend_supported = 1,
1843 .idle_enabled = 0,
1844 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001845 },
1846
1847 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1848 .idle_supported = 1,
1849 .suspend_supported = 1,
1850 .idle_enabled = 1,
1851 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001852 },
1853
1854 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1855 .idle_supported = 0,
1856 .suspend_supported = 1,
1857 .idle_enabled = 0,
1858 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001859 },
1860
1861 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1862 .idle_supported = 1,
1863 .suspend_supported = 1,
1864 .idle_enabled = 0,
1865 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001866 },
1867
1868 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1869 .idle_supported = 1,
1870 .suspend_supported = 0,
1871 .idle_enabled = 1,
1872 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001873 },
1874};
1875
1876static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1877 {
1878 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1879 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1880 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001881 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001882 },
1883
1884 {
1885 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1886 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1887 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001888 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001889 },
1890
1891 {
1892 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1893 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1894 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001895 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001896 },
1897
1898 {
1899 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1900 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1901 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001902 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001904 {
1905 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1906 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1907 false,
1908 7000, 3500, 66600000, 5150,
1909 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001910
1911 {
1912 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1913 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1914 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001915 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001916 },
1917
1918 {
1919 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1920 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1921 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001922 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001923 },
1924
1925 {
1926 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1927 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1928 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001929 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001930 },
1931
1932 {
1933 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1934 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1935 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001936 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001937 },
1938};
1939
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001940static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
1941 .mode = MSM_PM_BOOT_CONFIG_TZ,
1942};
1943
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001944#ifdef CONFIG_I2C
1945#define I2C_SURF 1
1946#define I2C_FFA (1 << 1)
1947#define I2C_RUMI (1 << 2)
1948#define I2C_SIM (1 << 3)
1949#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03001950#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001951
1952struct i2c_registry {
1953 u8 machs;
1954 int bus;
1955 struct i2c_board_info *info;
1956 int len;
1957};
1958
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001959/* Sensors DSPS platform data */
1960#ifdef CONFIG_MSM_DSPS
1961#define DSPS_PIL_GENERIC_NAME "dsps"
1962#endif /* CONFIG_MSM_DSPS */
1963
1964static void __init msm8960_init_dsps(void)
1965{
1966#ifdef CONFIG_MSM_DSPS
1967 struct msm_dsps_platform_data *pdata =
1968 msm_dsps_device.dev.platform_data;
1969 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
1970 pdata->gpios = NULL;
1971 pdata->gpios_num = 0;
1972
1973 platform_device_register(&msm_dsps_device);
1974#endif /* CONFIG_MSM_DSPS */
1975}
1976
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08001977static int hsic_peripheral_status = 1;
1978static DEFINE_MUTEX(hsic_status_lock);
1979
1980void peripheral_connect()
1981{
1982 mutex_lock(&hsic_status_lock);
1983 if (hsic_peripheral_status)
1984 goto out;
1985 platform_device_add(&msm_device_hsic_host);
1986 hsic_peripheral_status = 1;
1987out:
1988 mutex_unlock(&hsic_status_lock);
1989}
1990EXPORT_SYMBOL(peripheral_connect);
1991
1992void peripheral_disconnect()
1993{
1994 mutex_lock(&hsic_status_lock);
1995 if (!hsic_peripheral_status)
1996 goto out;
1997 platform_device_del(&msm_device_hsic_host);
1998 hsic_peripheral_status = 0;
1999out:
2000 mutex_unlock(&hsic_status_lock);
2001}
2002EXPORT_SYMBOL(peripheral_disconnect);
2003
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002004static void __init msm8960_init_hsic(void)
2005{
2006#ifdef CONFIG_USB_EHCI_MSM_HSIC
2007 uint32_t version = socinfo_get_version();
2008
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002009 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002010 return;
2011
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002012 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002013 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002014#endif
2015}
2016
Amir Samuelov5137e392011-09-21 17:31:25 +03002017#ifdef CONFIG_ISL9519_CHARGER
2018static struct isl_platform_data isl_data __initdata = {
2019 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2020 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2021 .max_system_voltage = 4200,
2022 .min_system_voltage = 3200,
2023 .chgcurrent = 1000, /* 1900, */
2024 .term_current = 400, /* Need fine tuning */
2025 .input_current = 2048,
2026};
2027
2028static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2029 {
2030 I2C_BOARD_INFO("isl9519q", 0x9),
2031 .irq = 0, /* Not required when notify-by-pmic */
2032 .platform_data = &isl_data,
2033 },
2034};
2035#endif /* CONFIG_ISL9519_CHARGER */
2036
Amir Samuelov755616d2011-12-13 16:34:46 +02002037static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2038 {
2039 I2C_BOARD_INFO("sx1508q", 0x20),
2040 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2041 },
2042};
2043
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002044static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002045#ifdef CONFIG_ISL9519_CHARGER
2046 {
2047 I2C_LIQUID,
2048 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2049 isl_charger_i2c_info,
2050 ARRAY_SIZE(isl_charger_i2c_info),
2051 },
2052#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002053 {
2054 I2C_SURF | I2C_FFA | I2C_FLUID,
2055 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2056 cyttsp_info,
2057 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002058 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302059 {
2060 I2C_LIQUID,
2061 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2062 mxt_device_info,
2063 ARRAY_SIZE(mxt_device_info),
2064 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302065 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302066 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302067 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002068 sii_device_info,
2069 ARRAY_SIZE(sii_device_info),
2070 },
2071 {
2072 I2C_LIQUID,
2073 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302074 msm_isa1200_board_info,
2075 ARRAY_SIZE(msm_isa1200_board_info),
2076 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002077 {
2078 I2C_LIQUID,
2079 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2080 liquid_io_expander_i2c_info,
2081 ARRAY_SIZE(liquid_io_expander_i2c_info),
2082 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002083};
2084#endif /* CONFIG_I2C */
2085
2086static void __init register_i2c_devices(void)
2087{
2088#ifdef CONFIG_I2C
2089 u8 mach_mask = 0;
2090 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002091#ifdef CONFIG_MSM_CAMERA
2092 struct i2c_registry msm8960_camera_i2c_devices = {
2093 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2094 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2095 msm8960_camera_board_info.board_info,
2096 msm8960_camera_board_info.num_i2c_board_info,
2097 };
2098#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002099
2100 /* Build the matching 'supported_machs' bitmask */
2101 if (machine_is_msm8960_cdp())
2102 mach_mask = I2C_SURF;
2103 else if (machine_is_msm8960_rumi3())
2104 mach_mask = I2C_RUMI;
2105 else if (machine_is_msm8960_sim())
2106 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002107 else if (machine_is_msm8960_fluid())
2108 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002109 else if (machine_is_msm8960_liquid())
2110 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002111 else if (machine_is_msm8960_mtp())
2112 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002113 else
2114 pr_err("unmatched machine ID in register_i2c_devices\n");
2115
2116 /* Run the array and install devices as appropriate */
2117 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2118 if (msm8960_i2c_devices[i].machs & mach_mask)
2119 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2120 msm8960_i2c_devices[i].info,
2121 msm8960_i2c_devices[i].len);
2122 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002123#ifdef CONFIG_MSM_CAMERA
2124 if (msm8960_camera_i2c_devices.machs & mach_mask)
2125 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2126 msm8960_camera_i2c_devices.info,
2127 msm8960_camera_i2c_devices.len);
2128#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002129#endif
2130}
2131
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002132static void __init msm8960_sim_init(void)
2133{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002134 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2135 &msm8960_device_watchdog.dev.platform_data;
2136
2137 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002138 BUG_ON(msm_rpm_init(&msm_rpm_data));
2139 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2140 ARRAY_SIZE(msm_rpmrs_levels)));
2141 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002142 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002143 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002144 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002145
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002146 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002147 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002148 msm8960_i2c_init();
2149 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2150 msm_spm_l2_init(msm_spm_l2_data);
2151 msm8960_init_buses();
2152 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002153 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002154 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002155 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002156
2157 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2158 &msm8960_qup_spi_gsbi1_pdata;
2159 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2160
2161 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002162 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002163 slim_register_board_info(msm_slim_devices,
2164 ARRAY_SIZE(msm_slim_devices));
2165 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2166 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2167 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2168 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002169 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002170}
2171
2172static void __init msm8960_rumi3_init(void)
2173{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002174 BUG_ON(msm_rpm_init(&msm_rpm_data));
2175 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2176 ARRAY_SIZE(msm_rpmrs_levels)));
2177 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002178 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002179 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002180 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002181 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002182 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2183 &msm8960_qup_spi_gsbi1_pdata;
2184 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2185 msm8960_i2c_init();
2186 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2187 msm_spm_l2_init(msm_spm_l2_data);
2188 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002189 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002190 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002191 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002192 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002193 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002194 slim_register_board_info(msm_slim_devices,
2195 ARRAY_SIZE(msm_slim_devices));
2196 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2197 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2198 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2199 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002200 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002201}
2202
2203static void __init msm8960_cdp_init(void)
2204{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002205 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2206 pr_err("meminfo_init() failed!\n");
2207
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002208 BUG_ON(msm_rpm_init(&msm_rpm_data));
2209 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2210 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002211
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002212 regulator_suppress_info_printing();
2213 if (msm_xo_init())
2214 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002215 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002216 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302217 if (machine_is_msm8960_liquid())
2218 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002219 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302220 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2221 machine_is_msm8960_cdp()) {
2222 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2223 } else if (machine_is_msm8960_liquid()) {
2224 msm_otg_pdata.phy_init_seq =
2225 liquid_v1_phy_init_seq;
2226 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302227 msm_otg_pdata.swfi_latency =
2228 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302229#ifdef CONFIG_USB_EHCI_MSM_HSIC
2230 if (machine_is_msm8960_liquid()) {
2231 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2232 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2233 }
2234#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302235 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002236 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002237 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2238 &msm8960_qup_spi_gsbi1_pdata;
2239 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002240
2241 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302242 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2243 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2244 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002245 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002246 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002247 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2248 msm_spm_l2_init(msm_spm_l2_data);
2249 msm8960_init_buses();
2250 platform_add_devices(msm_footswitch_devices,
2251 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002252 if (machine_is_msm8960_liquid())
2253 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002254 if (machine_is_msm8960_cdp())
2255 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002256 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002257 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002258 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002259 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002260 msm8960_init_cam();
2261 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002262 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302263 if (machine_is_msm8960_liquid())
2264 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002265 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002266 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002267 slim_register_board_info(msm_slim_devices,
2268 ARRAY_SIZE(msm_slim_devices));
2269 msm8960_init_dsps();
2270 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2271 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2272 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2273 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002274 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002275 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Joel Kingb8352a12011-11-15 18:46:24 -08002276 if (PLATFORM_IS_CHARM25())
2277 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002278}
2279
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002280MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2281 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002283 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302284 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002285 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002286 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002287 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002288 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002289MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002290
2291MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2292 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002293 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002294 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302295 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002296 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002297 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002298 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002299 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002300MACHINE_END
2301
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002302MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2303 .map_io = msm8960_map_io,
2304 .reserve = msm8960_reserve,
2305 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302306 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002307 .timer = &msm_timer,
2308 .init_machine = msm8960_cdp_init,
2309 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002310 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002311MACHINE_END
2312
2313MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2314 .map_io = msm8960_map_io,
2315 .reserve = msm8960_reserve,
2316 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302317 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002318 .timer = &msm_timer,
2319 .init_machine = msm8960_cdp_init,
2320 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002321 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002322MACHINE_END
2323
2324MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2325 .map_io = msm8960_map_io,
2326 .reserve = msm8960_reserve,
2327 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302328 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002329 .timer = &msm_timer,
2330 .init_machine = msm8960_cdp_init,
2331 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002332 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002333MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002334
2335MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2336 .map_io = msm8960_map_io,
2337 .reserve = msm8960_reserve,
2338 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302339 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002340 .timer = &msm_timer,
2341 .init_machine = msm8960_cdp_init,
2342 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002343 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002344MACHINE_END