blob: 26dd04b6b8736e34a8c36d7d706e0f803fff1b00 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
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
Chetan Kalyana25d0762011-11-11 17:41:29 -0800138#define MSM_PMEM_SIZE 0x1C00000 /* 28 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
144#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
Laura Abbott2d1760b2011-09-29 21:31:24 -0700145#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
Laura Abbott8c017362011-09-22 20:59:12 -0700146#define MSM_ION_HEAP_NUM 5
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800147#define MSM_LIQUID_ION_EBI_SIZE (MSM_LIQUID_PMEM_SIZE + 0x600000)
148static unsigned msm_ion_ebi_size = MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700149#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700150#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700151#define MSM_ION_HEAP_NUM 2
152#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700153
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700154#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
155static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
156static int __init pmem_kernel_ebi1_size_setup(char *p)
157{
158 pmem_kernel_ebi1_size = memparse(p, NULL);
159 return 0;
160}
161early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
162#endif
163
164#ifdef CONFIG_ANDROID_PMEM
165static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800166static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700167static int __init pmem_size_setup(char *p)
168{
169 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800170 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700171 return 0;
172}
173early_param("pmem_size", pmem_size_setup);
174
175static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
176
177static int __init pmem_adsp_size_setup(char *p)
178{
179 pmem_adsp_size = memparse(p, NULL);
180 return 0;
181}
182early_param("pmem_adsp_size", pmem_adsp_size_setup);
183
184static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
185
186static int __init pmem_audio_size_setup(char *p)
187{
188 pmem_audio_size = memparse(p, NULL);
189 return 0;
190}
191early_param("pmem_audio_size", pmem_audio_size_setup);
192#endif
193
194#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700195#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196static struct android_pmem_platform_data android_pmem_pdata = {
197 .name = "pmem",
198 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
199 .cached = 1,
200 .memory_type = MEMTYPE_EBI1,
201};
202
203static struct platform_device android_pmem_device = {
204 .name = "android_pmem",
205 .id = 0,
206 .dev = {.platform_data = &android_pmem_pdata},
207};
208
209static struct android_pmem_platform_data android_pmem_adsp_pdata = {
210 .name = "pmem_adsp",
211 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
212 .cached = 0,
213 .memory_type = MEMTYPE_EBI1,
214};
215static struct platform_device android_pmem_adsp_device = {
216 .name = "android_pmem",
217 .id = 2,
218 .dev = { .platform_data = &android_pmem_adsp_pdata },
219};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700220#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700221
222static struct android_pmem_platform_data android_pmem_audio_pdata = {
223 .name = "pmem_audio",
224 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
225 .cached = 0,
226 .memory_type = MEMTYPE_EBI1,
227};
228
229static struct platform_device android_pmem_audio_device = {
230 .name = "android_pmem",
231 .id = 4,
232 .dev = { .platform_data = &android_pmem_audio_pdata },
233};
234#endif
235
Larry Bassel41a055b2011-12-06 16:15:14 -0800236struct fmem_platform_data fmem_pdata = {
237};
238
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700239#define DSP_RAM_BASE_8960 0x8da00000
240#define DSP_RAM_SIZE_8960 0x1800000
241static int dspcrashd_pdata_8960 = 0xDEADDEAD;
242
243static struct resource resources_dspcrashd_8960[] = {
244 {
245 .name = "msm_dspcrashd",
246 .start = DSP_RAM_BASE_8960,
247 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
248 .flags = IORESOURCE_DMA,
249 },
250};
251
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800252static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700253 .name = "msm_dspcrashd",
254 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
255 .resource = resources_dspcrashd_8960,
256 .dev = { .platform_data = &dspcrashd_pdata_8960 },
257};
258
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700259static struct memtype_reserve msm8960_reserve_table[] __initdata = {
260 [MEMTYPE_SMI] = {
261 },
262 [MEMTYPE_EBI0] = {
263 .flags = MEMTYPE_FLAGS_1M_ALIGN,
264 },
265 [MEMTYPE_EBI1] = {
266 .flags = MEMTYPE_FLAGS_1M_ALIGN,
267 },
268};
269
270static void __init size_pmem_devices(void)
271{
272#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700273#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700274 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800275
276 if (!pmem_param_set && machine_is_msm8960_liquid())
277 pmem_size = MSM_LIQUID_PMEM_SIZE;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700278 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700279#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700280 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
281#endif
282}
283
284static void __init reserve_memory_for(struct android_pmem_platform_data *p)
285{
286 msm8960_reserve_table[p->memory_type].size += p->size;
287}
288
289static void __init reserve_pmem_memory(void)
290{
291#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700292#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700293 reserve_memory_for(&android_pmem_adsp_pdata);
294 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700295#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700296 reserve_memory_for(&android_pmem_audio_pdata);
297 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
298#endif
299}
300
Larry Bassel41a055b2011-12-06 16:15:14 -0800301static void __init reserve_fmem_memory(void)
302{
303}
304
Larry Basselb4126da2011-07-18 14:31:33 -0700305static int msm8960_paddr_to_memtype(unsigned int paddr)
306{
307 return MEMTYPE_EBI1;
308}
309
Laura Abbottd6183792011-08-19 13:42:24 -0700310#ifdef CONFIG_ION_MSM
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800311static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700312 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700313 .heaps = {
314 {
315 .id = ION_HEAP_SYSTEM_ID,
316 .type = ION_HEAP_TYPE_SYSTEM,
317 .name = ION_KMALLOC_HEAP_NAME,
318 },
319 {
320 .id = ION_HEAP_SYSTEM_CONTIG_ID,
321 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
322 .name = ION_VMALLOC_HEAP_NAME,
323 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700324#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700325 {
326 .id = ION_HEAP_EBI_ID,
327 .type = ION_HEAP_TYPE_CARVEOUT,
328 .name = ION_EBI1_HEAP_NAME,
329 .size = MSM_ION_EBI_SIZE,
330 .memory_type = ION_EBI_TYPE,
331 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700332 {
333 .id = ION_HEAP_ADSP_ID,
334 .type = ION_HEAP_TYPE_CARVEOUT,
335 .name = ION_ADSP_HEAP_NAME,
336 .size = MSM_ION_ADSP_SIZE,
337 .memory_type = ION_EBI_TYPE,
338 },
Laura Abbott8c017362011-09-22 20:59:12 -0700339 {
340 .id = ION_HEAP_IOMMU_ID,
341 .type = ION_HEAP_TYPE_IOMMU,
342 .name = ION_IOMMU_HEAP_NAME,
343 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700344#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700345 }
346};
347
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800348static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700349 .name = "ion-msm",
350 .id = 1,
351 .dev = { .platform_data = &ion_pdata },
352};
353#endif
354
Larry Bassel41a055b2011-12-06 16:15:14 -0800355struct platform_device fmem_device = {
356 .name = "fmem",
357 .id = 1,
358 .dev = { .platform_data = &fmem_pdata },
359};
360
Laura Abbottd6183792011-08-19 13:42:24 -0700361static void reserve_ion_memory(void)
362{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700363#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800364 unsigned int i;
365
366 if (!pmem_param_set && machine_is_msm8960_liquid()) {
367 msm_ion_ebi_size = MSM_LIQUID_ION_EBI_SIZE;
368 for (i = 0; i < ion_pdata.nr; i++) {
369 if (ion_pdata.heaps[i].id == ION_HEAP_EBI_ID) {
370 ion_pdata.heaps[i].size = msm_ion_ebi_size;
371 pr_debug("msm_ion_ebi_size 0x%x\n",
372 msm_ion_ebi_size);
373 break;
374 }
375 }
376 }
377 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_ion_ebi_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700378 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700379#endif
380}
Huaibin Yanga5419422011-12-08 23:52:10 -0800381
382static void __init reserve_mdp_memory(void)
383{
384 msm8960_mdp_writeback(msm8960_reserve_table);
385}
386
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700387static void __init msm8960_calculate_reserve_sizes(void)
388{
389 size_pmem_devices();
390 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700391 reserve_ion_memory();
Larry Bassel41a055b2011-12-06 16:15:14 -0800392 reserve_fmem_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800393 reserve_mdp_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700394}
395
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700396static struct reserve_info msm8960_reserve_info __initdata = {
397 .memtype_reserve_table = msm8960_reserve_table,
398 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
399 .paddr_to_memtype = msm8960_paddr_to_memtype,
400};
401
Larry Basselb4126da2011-07-18 14:31:33 -0700402static int msm8960_memory_bank_size(void)
403{
404 return 1<<29;
405}
406
407static void __init locate_unstable_memory(void)
408{
409 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
410 unsigned long bank_size;
411 unsigned long low, high;
412
413 bank_size = msm8960_memory_bank_size();
414 low = meminfo.bank[0].start;
415 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700416
417 /* Check if 32 bit overflow occured */
418 if (high < mb->start)
419 high = ~0UL;
420
Larry Basselb4126da2011-07-18 14:31:33 -0700421 low &= ~(bank_size - 1);
422
423 if (high - low <= bank_size)
424 return;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800425 msm8960_reserve_info.low_unstable_address = high -
426 MIN_MEMORY_BLOCK_SIZE;
427 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700428
Larry Basselb4126da2011-07-18 14:31:33 -0700429 msm8960_reserve_info.bank_size = bank_size;
430 pr_info("low unstable address %lx max size %lx bank size %lx\n",
431 msm8960_reserve_info.low_unstable_address,
432 msm8960_reserve_info.max_unstable_size,
433 msm8960_reserve_info.bank_size);
434}
435
Larry Basselb830e182011-10-14 10:46:55 -0700436static void __init place_movable_zone(void)
437{
438 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
439 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
440 pr_info("movable zone start %lx size %lx\n",
441 movable_reserved_start, movable_reserved_size);
442}
443
444static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700445{
446 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700447 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700448 place_movable_zone();
449}
450
451static void __init msm8960_reserve(void)
452{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700453 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800454 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700455}
456
Larry Bassela4414b12011-08-04 11:11:02 -0700457static int msm8960_change_memory_power(u64 start, u64 size,
458 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700459{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700460 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700461}
462
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700463static void __init msm8960_allocate_memory_regions(void)
464{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800465 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700466}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800467
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700468#ifdef CONFIG_WCD9310_CODEC
469
470#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
471
Patrick Lai3043fba2011-08-01 14:15:57 -0700472/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
473 * 4 micbiases are used to power various analog and digital
474 * microphones operating at 1800 mV. Technically, all micbiases
475 * can source from single cfilter since all microphones operate
476 * at the same voltage level. The arrangement below is to make
477 * sure all cfilters are exercised. LDO_H regulator ouput level
478 * does not need to be as high as 2.85V. It is choosen for
479 * microphone sensitivity purpose.
480 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700481static struct tabla_pdata tabla_platform_data = {
482 .slimbus_slave_device = {
483 .name = "tabla-slave",
484 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
485 },
486 .irq = MSM_GPIO_TO_INT(62),
487 .irq_base = TABLA_INTERRUPT_BASE,
488 .num_irqs = NR_TABLA_IRQS,
489 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700490 .micbias = {
491 .ldoh_v = TABLA_LDOH_2P85_V,
492 .cfilt1_mv = 1800,
493 .cfilt2_mv = 1800,
494 .cfilt3_mv = 1800,
495 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
496 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
497 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
498 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
499 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700500};
501
502static struct slim_device msm_slim_tabla = {
503 .name = "tabla-slim",
504 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
505 .dev = {
506 .platform_data = &tabla_platform_data,
507 },
508};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530509
510static struct tabla_pdata tabla20_platform_data = {
511 .slimbus_slave_device = {
512 .name = "tabla-slave",
513 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
514 },
515 .irq = MSM_GPIO_TO_INT(62),
516 .irq_base = TABLA_INTERRUPT_BASE,
517 .num_irqs = NR_TABLA_IRQS,
518 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
519 .micbias = {
520 .ldoh_v = TABLA_LDOH_2P85_V,
521 .cfilt1_mv = 1800,
522 .cfilt2_mv = 1800,
523 .cfilt3_mv = 1800,
524 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
525 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
526 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
527 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
528 }
529};
530
531static struct slim_device msm_slim_tabla20 = {
532 .name = "tabla2x-slim",
533 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
534 .dev = {
535 .platform_data = &tabla20_platform_data,
536 },
537};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700538#endif
539
540static struct slim_boardinfo msm_slim_devices[] = {
541#ifdef CONFIG_WCD9310_CODEC
542 {
543 .bus_num = 1,
544 .slim_slave = &msm_slim_tabla,
545 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530546 {
547 .bus_num = 1,
548 .slim_slave = &msm_slim_tabla20,
549 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700550#endif
551 /* add more slimbus slaves as needed */
552};
553
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700554#define MSM_WCNSS_PHYS 0x03000000
555#define MSM_WCNSS_SIZE 0x280000
556
557static struct resource resources_wcnss_wlan[] = {
558 {
559 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
560 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
561 .name = "wcnss_wlanrx_irq",
562 .flags = IORESOURCE_IRQ,
563 },
564 {
565 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
566 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
567 .name = "wcnss_wlantx_irq",
568 .flags = IORESOURCE_IRQ,
569 },
570 {
571 .start = MSM_WCNSS_PHYS,
572 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
573 .name = "wcnss_mmio",
574 .flags = IORESOURCE_MEM,
575 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700576 {
577 .start = 84,
578 .end = 88,
579 .name = "wcnss_gpios_5wire",
580 .flags = IORESOURCE_IO,
581 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700582};
583
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700584static struct qcom_wcnss_opts qcom_wcnss_pdata = {
585 .has_48mhz_xo = 1,
586};
587
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700588static struct platform_device msm_device_wcnss_wlan = {
589 .name = "wcnss_wlan",
590 .id = 0,
591 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
592 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700593 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700594};
595
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700596#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
597 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
598 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
599 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
600
601#define QCE_SIZE 0x10000
602#define QCE_0_BASE 0x18500000
603
604#define QCE_HW_KEY_SUPPORT 0
605#define QCE_SHA_HMAC_SUPPORT 1
606#define QCE_SHARE_CE_RESOURCE 1
607#define QCE_CE_SHARED 0
608
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800609/* Begin Bus scaling definitions */
610static struct msm_bus_vectors crypto_hw_init_vectors[] = {
611 {
612 .src = MSM_BUS_MASTER_ADM_PORT0,
613 .dst = MSM_BUS_SLAVE_EBI_CH0,
614 .ab = 0,
615 .ib = 0,
616 },
617 {
618 .src = MSM_BUS_MASTER_ADM_PORT1,
619 .dst = MSM_BUS_SLAVE_GSBI1_UART,
620 .ab = 0,
621 .ib = 0,
622 },
623};
624
625static struct msm_bus_vectors crypto_hw_active_vectors[] = {
626 {
627 .src = MSM_BUS_MASTER_ADM_PORT0,
628 .dst = MSM_BUS_SLAVE_EBI_CH0,
629 .ab = 70000000UL,
630 .ib = 70000000UL,
631 },
632 {
633 .src = MSM_BUS_MASTER_ADM_PORT1,
634 .dst = MSM_BUS_SLAVE_GSBI1_UART,
635 .ab = 2480000000UL,
636 .ib = 2480000000UL,
637 },
638};
639
640static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
641 {
642 ARRAY_SIZE(crypto_hw_init_vectors),
643 crypto_hw_init_vectors,
644 },
645 {
646 ARRAY_SIZE(crypto_hw_active_vectors),
647 crypto_hw_active_vectors,
648 },
649};
650
651static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
652 crypto_hw_bus_scale_usecases,
653 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
654 .name = "cryptohw",
655};
656/* End Bus Scaling Definitions*/
657
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700658static struct resource qcrypto_resources[] = {
659 [0] = {
660 .start = QCE_0_BASE,
661 .end = QCE_0_BASE + QCE_SIZE - 1,
662 .flags = IORESOURCE_MEM,
663 },
664 [1] = {
665 .name = "crypto_channels",
666 .start = DMOV_CE_IN_CHAN,
667 .end = DMOV_CE_OUT_CHAN,
668 .flags = IORESOURCE_DMA,
669 },
670 [2] = {
671 .name = "crypto_crci_in",
672 .start = DMOV_CE_IN_CRCI,
673 .end = DMOV_CE_IN_CRCI,
674 .flags = IORESOURCE_DMA,
675 },
676 [3] = {
677 .name = "crypto_crci_out",
678 .start = DMOV_CE_OUT_CRCI,
679 .end = DMOV_CE_OUT_CRCI,
680 .flags = IORESOURCE_DMA,
681 },
682};
683
684static struct resource qcedev_resources[] = {
685 [0] = {
686 .start = QCE_0_BASE,
687 .end = QCE_0_BASE + QCE_SIZE - 1,
688 .flags = IORESOURCE_MEM,
689 },
690 [1] = {
691 .name = "crypto_channels",
692 .start = DMOV_CE_IN_CHAN,
693 .end = DMOV_CE_OUT_CHAN,
694 .flags = IORESOURCE_DMA,
695 },
696 [2] = {
697 .name = "crypto_crci_in",
698 .start = DMOV_CE_IN_CRCI,
699 .end = DMOV_CE_IN_CRCI,
700 .flags = IORESOURCE_DMA,
701 },
702 [3] = {
703 .name = "crypto_crci_out",
704 .start = DMOV_CE_OUT_CRCI,
705 .end = DMOV_CE_OUT_CRCI,
706 .flags = IORESOURCE_DMA,
707 },
708};
709
710#endif
711
712#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
713 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
714
715static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
716 .ce_shared = QCE_CE_SHARED,
717 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
718 .hw_key_support = QCE_HW_KEY_SUPPORT,
719 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800720 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700721};
722
723static struct platform_device qcrypto_device = {
724 .name = "qcrypto",
725 .id = 0,
726 .num_resources = ARRAY_SIZE(qcrypto_resources),
727 .resource = qcrypto_resources,
728 .dev = {
729 .coherent_dma_mask = DMA_BIT_MASK(32),
730 .platform_data = &qcrypto_ce_hw_suppport,
731 },
732};
733#endif
734
735#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
736 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
737
738static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
739 .ce_shared = QCE_CE_SHARED,
740 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
741 .hw_key_support = QCE_HW_KEY_SUPPORT,
742 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800743 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700744};
745
746static struct platform_device qcedev_device = {
747 .name = "qce",
748 .id = 0,
749 .num_resources = ARRAY_SIZE(qcedev_resources),
750 .resource = qcedev_resources,
751 .dev = {
752 .coherent_dma_mask = DMA_BIT_MASK(32),
753 .platform_data = &qcedev_ce_hw_suppport,
754 },
755};
756#endif
757
Joel Kingb8352a12011-11-15 18:46:24 -0800758#define MDM2AP_ERRFATAL 70
759#define AP2MDM_ERRFATAL 95
760#define MDM2AP_STATUS 69
761#define AP2MDM_STATUS 94
762#define AP2MDM_PMIC_RESET_N 80
763#define AP2MDM_KPDPWR_N 81
764
Joel Kingb8352a12011-11-15 18:46:24 -0800765static struct resource mdm_resources[] = {
766 {
767 .start = MDM2AP_ERRFATAL,
768 .end = MDM2AP_ERRFATAL,
769 .name = "MDM2AP_ERRFATAL",
770 .flags = IORESOURCE_IO,
771 },
772 {
773 .start = AP2MDM_ERRFATAL,
774 .end = AP2MDM_ERRFATAL,
775 .name = "AP2MDM_ERRFATAL",
776 .flags = IORESOURCE_IO,
777 },
778 {
779 .start = MDM2AP_STATUS,
780 .end = MDM2AP_STATUS,
781 .name = "MDM2AP_STATUS",
782 .flags = IORESOURCE_IO,
783 },
784 {
785 .start = AP2MDM_STATUS,
786 .end = AP2MDM_STATUS,
787 .name = "AP2MDM_STATUS",
788 .flags = IORESOURCE_IO,
789 },
790 {
791 .start = AP2MDM_PMIC_RESET_N,
792 .end = AP2MDM_PMIC_RESET_N,
793 .name = "AP2MDM_PMIC_RESET_N",
794 .flags = IORESOURCE_IO,
795 },
796 {
797 .start = AP2MDM_KPDPWR_N,
798 .end = AP2MDM_KPDPWR_N,
799 .name = "AP2MDM_KPDPWR_N",
800 .flags = IORESOURCE_IO,
801 },
802};
803
804static struct mdm_platform_data mdm_platform_data = {
805 .mdm_version = "2.5",
806};
807
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800808static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800809 .name = "mdm2_modem",
810 .id = -1,
811 .num_resources = ARRAY_SIZE(mdm_resources),
812 .resource = mdm_resources,
813 .dev = {
814 .platform_data = &mdm_platform_data,
815 },
816};
817
818static struct platform_device *mdm_devices[] __initdata = {
819 &mdm_device,
820};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700821
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700822#define MSM_SHARED_RAM_PHYS 0x80000000
823
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800824static void __init msm8960_map_io(void)
825{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700826 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800827 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700828
829 if (socinfo_init() < 0)
830 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800831}
832
833static void __init msm8960_init_irq(void)
834{
835 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700836
837 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800838 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700839 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800840
841 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700842 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800843
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700844 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
845 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -0800846
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800847 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
848 * as they are configured as level, which does not play nice with
849 * handle_percpu_irq.
850 */
851 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
852 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +0100853 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -0800854 }
855}
856
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700857static void __init msm8960_init_buses(void)
858{
859#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -0600860 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -0600861 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
862 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
863 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
864 msm_bus_apps_fabric.dev.platform_data =
865 &msm_bus_8960_apps_fabric_pdata;
866 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
867 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
868 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
869 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870#endif
871}
872
873static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
874 .max_clock_speed = 15060000,
875};
876
877#ifdef CONFIG_USB_MSM_OTG_72K
878static struct msm_otg_platform_data msm_otg_pdata;
879#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700880static void msm_hsusb_vbus_power(bool on)
881{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700882 static bool vbus_is_on;
883 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700884
885 if (vbus_is_on == on)
886 return;
887
888 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700889 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
890 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700891 if (IS_ERR(mvs_otg_switch)) {
892 pr_err("Unable to get mvs_otg_switch\n");
893 return;
894 }
895
Anji jonnala2936fd92011-11-09 15:39:22 +0530896 if (regulator_enable(mvs_otg_switch)) {
897 pr_err("unable to enable mvs_otg_switch\n");
David Collins57954fa2011-12-15 09:14:40 -0800898 goto put_mvs_otg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700899 }
Anji jonnala2936fd92011-11-09 15:39:22 +0530900
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700901 vbus_is_on = true;
902 return;
903 }
Anji jonnala2936fd92011-11-09 15:39:22 +0530904 regulator_disable(mvs_otg_switch);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +0530906 regulator_put(mvs_otg_switch);
907 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700908}
909
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530910static int wr_phy_init_seq[] = {
911 0x44, 0x80, /* set VBUS valid threshold
912 and disconnect valid threshold */
913 0x38, 0x81, /* update DC voltage level */
914 0x14, 0x82, /* set preemphasis and rise/fall time */
915 0x13, 0x83, /* set source impedance adjusment */
916 -1};
917
918static int liquid_v1_phy_init_seq[] = {
919 0x44, 0x80,/* set VBUS valid threshold
920 and disconnect valid threshold */
921 0x3C, 0x81,/* update DC voltage level */
922 0x18, 0x82,/* set preemphasis and rise/fall time */
923 0x23, 0x83,/* set source impedance sdjusment */
924 -1};
925
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700926static struct msm_otg_platform_data msm_otg_pdata = {
927 .mode = USB_OTG,
928 .otg_control = OTG_PMIC_CONTROL,
929 .phy_type = SNPS_28NM_INTEGRATED_PHY,
930 .pclk_src_name = "dfab_usb_hs_clk",
931 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
932 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +0530933 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700934};
935#endif
936
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530937#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530938#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530939static struct msm_hsic_host_platform_data msm_hsic_pdata = {
940 .strobe = 150,
941 .data = 151,
942};
943#else
944static struct msm_hsic_host_platform_data msm_hsic_pdata;
945#endif
946
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700947#define PID_MAGIC_ID 0x71432909
948#define SERIAL_NUM_MAGIC_ID 0x61945374
949#define SERIAL_NUMBER_LENGTH 127
950#define DLOAD_USB_BASE_ADD 0x2A03F0C8
951
952struct magic_num_struct {
953 uint32_t pid;
954 uint32_t serial_num;
955};
956
957struct dload_struct {
958 uint32_t reserved1;
959 uint32_t reserved2;
960 uint32_t reserved3;
961 uint16_t reserved4;
962 uint16_t pid;
963 char serial_number[SERIAL_NUMBER_LENGTH];
964 uint16_t reserved5;
965 struct magic_num_struct magic_struct;
966};
967
968static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
969{
970 struct dload_struct __iomem *dload = 0;
971
972 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
973 if (!dload) {
974 pr_err("%s: cannot remap I/O memory region: %08x\n",
975 __func__, DLOAD_USB_BASE_ADD);
976 return -ENXIO;
977 }
978
979 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
980 __func__, dload, pid, snum);
981 /* update pid */
982 dload->magic_struct.pid = PID_MAGIC_ID;
983 dload->pid = pid;
984
985 /* update serial number */
986 dload->magic_struct.serial_num = 0;
987 if (!snum) {
988 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
989 goto out;
990 }
991
992 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -0700993 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700994out:
995 iounmap(dload);
996 return 0;
997}
998
999static struct android_usb_platform_data android_usb_pdata = {
1000 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1001};
1002
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001003static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004 .name = "android_usb",
1005 .id = -1,
1006 .dev = {
1007 .platform_data = &android_usb_pdata,
1008 },
1009};
1010
1011static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1012 0x03, 0x0f,
1013};
1014
1015static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1016 0x00, 0x24, 0x54, 0x10,
1017 0x09, 0x03, 0x01,
1018 0x10, 0x54, 0x30, 0x0C,
1019 0x24, 0x30, 0x0f,
1020};
1021
1022static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1023 0x00, 0x24, 0x54, 0x10,
1024 0x09, 0x07, 0x01, 0x0B,
1025 0x10, 0x54, 0x30, 0x0C,
1026 0x24, 0x30, 0x0f,
1027};
1028
1029static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1030 [0] = {
1031 .mode = MSM_SPM_MODE_CLOCK_GATING,
1032 .notify_rpm = false,
1033 .cmd = spm_wfi_cmd_sequence,
1034 },
1035 [1] = {
1036 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1037 .notify_rpm = false,
1038 .cmd = spm_power_collapse_without_rpm,
1039 },
1040 [2] = {
1041 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1042 .notify_rpm = true,
1043 .cmd = spm_power_collapse_with_rpm,
1044 },
1045};
1046
1047static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1048 [0] = {
1049 .reg_base_addr = MSM_SAW0_BASE,
1050 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1051 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001052 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001053#if defined(CONFIG_MSM_AVS_HW)
1054 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1055 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1056#endif
1057 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1058 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1059 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1060 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1061 .vctl_timeout_us = 50,
1062 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1063 .modes = msm_spm_seq_list,
1064 },
1065 [1] = {
1066 .reg_base_addr = MSM_SAW1_BASE,
1067 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1068 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stephen Boyd9ac587a2011-12-09 22:55:10 -08001069 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001070#if defined(CONFIG_MSM_AVS_HW)
1071 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1072 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1073#endif
1074 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1075 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1076 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1077 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1078 .vctl_timeout_us = 50,
1079 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1080 .modes = msm_spm_seq_list,
1081 },
1082};
1083
1084static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1085 0x00, 0x20, 0x03, 0x20,
1086 0x00, 0x0f,
1087};
1088
1089static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1090 0x00, 0x20, 0x34, 0x64,
1091 0x48, 0x07, 0x48, 0x20,
1092 0x50, 0x64, 0x04, 0x34,
1093 0x50, 0x0f,
1094};
1095static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1096 0x00, 0x10, 0x34, 0x64,
1097 0x48, 0x07, 0x48, 0x10,
1098 0x50, 0x64, 0x04, 0x34,
1099 0x50, 0x0F,
1100};
1101
1102static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1103 [0] = {
1104 .mode = MSM_SPM_L2_MODE_RETENTION,
1105 .notify_rpm = false,
1106 .cmd = l2_spm_wfi_cmd_sequence,
1107 },
1108 [1] = {
1109 .mode = MSM_SPM_L2_MODE_GDHS,
1110 .notify_rpm = true,
1111 .cmd = l2_spm_gdhs_cmd_sequence,
1112 },
1113 [2] = {
1114 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1115 .notify_rpm = true,
1116 .cmd = l2_spm_power_off_cmd_sequence,
1117 },
1118};
1119
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001120static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1121 [0] = {
1122 .reg_base_addr = MSM_SAW_L2_BASE,
1123 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1124 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1125 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1126 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1127 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1128 .modes = msm_spm_l2_seq_list,
1129 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1130 },
1131};
1132
Mohan Pallaka5e490392011-09-09 15:18:41 +05301133#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1134#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1135
1136static struct msm_xo_voter *xo_handle_d1;
1137
1138static int isa1200_power(int on)
1139{
1140 int rc = 0;
1141
1142 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1143
1144 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1145 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1146 if (rc < 0) {
1147 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1148 __func__, on ? "" : "de-", rc);
1149 goto err_xo_vote;
1150 }
1151
1152 return 0;
1153
1154err_xo_vote:
1155 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1156 return rc;
1157}
1158
1159static int isa1200_dev_setup(bool enable)
1160{
1161 int rc = 0;
1162
1163 struct pm_gpio hap_gpio_config = {
1164 .direction = PM_GPIO_DIR_OUT,
1165 .pull = PM_GPIO_PULL_NO,
1166 .out_strength = PM_GPIO_STRENGTH_HIGH,
1167 .function = PM_GPIO_FUNC_NORMAL,
1168 .inv_int_pol = 0,
1169 .vin_sel = 2,
1170 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1171 .output_value = 0,
1172 };
1173
1174 if (enable == true) {
1175 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1176 if (rc) {
1177 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1178 __func__, PM_HAP_EN_GPIO, rc);
1179 return rc;
1180 }
1181
1182 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1183 if (rc) {
1184 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1185 __func__, PM_HAP_LEN_GPIO, rc);
1186 return rc;
1187 }
1188
1189 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1190 if (rc) {
1191 pr_err("%s: unable to request gpio %d (%d)\n",
1192 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1193 return rc;
1194 }
1195
1196 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1197 if (rc) {
1198 pr_err("%s: Unable to set direction\n", __func__);
1199 goto free_gpio;
1200 }
1201
1202 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1203 if (IS_ERR(xo_handle_d1)) {
1204 rc = PTR_ERR(xo_handle_d1);
1205 pr_err("%s: failed to get the handle for D1(%d)\n",
1206 __func__, rc);
1207 goto gpio_set_dir;
1208 }
1209 } else {
1210 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1211
1212 msm_xo_put(xo_handle_d1);
1213 }
1214
1215 return 0;
1216
1217gpio_set_dir:
1218 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1219free_gpio:
1220 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1221 return rc;
1222}
1223
1224static struct isa1200_regulator isa1200_reg_data[] = {
1225 {
1226 .name = "vcc_i2c",
1227 .min_uV = ISA_I2C_VTG_MIN_UV,
1228 .max_uV = ISA_I2C_VTG_MAX_UV,
1229 .load_uA = ISA_I2C_CURR_UA,
1230 },
1231};
1232
1233static struct isa1200_platform_data isa1200_1_pdata = {
1234 .name = "vibrator",
1235 .dev_setup = isa1200_dev_setup,
1236 .power_on = isa1200_power,
1237 .hap_en_gpio = PM_HAP_EN_GPIO,
1238 .hap_len_gpio = PM_HAP_LEN_GPIO,
1239 .max_timeout = 15000,
1240 .mode_ctrl = PWM_GEN_MODE,
1241 .pwm_fd = {
1242 .pwm_div = 256,
1243 },
1244 .is_erm = false,
1245 .smart_en = true,
1246 .ext_clk_en = true,
1247 .chip_en = 1,
1248 .regulator_info = isa1200_reg_data,
1249 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1250};
1251
1252static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1253 {
1254 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301255 },
1256};
1257
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001258#define CYTTSP_TS_GPIO_IRQ 11
1259#define CYTTSP_TS_SLEEP_GPIO 50
1260#define CYTTSP_TS_RESOUT_N_GPIO 52
1261
1262/*virtual key support */
1263static ssize_t tma340_vkeys_show(struct kobject *kobj,
1264 struct kobj_attribute *attr, char *buf)
1265{
1266 return snprintf(buf, 200,
1267 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1268 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1269 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1270 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1271 "\n");
1272}
1273
1274static struct kobj_attribute tma340_vkeys_attr = {
1275 .attr = {
1276 .mode = S_IRUGO,
1277 },
1278 .show = &tma340_vkeys_show,
1279};
1280
1281static struct attribute *tma340_properties_attrs[] = {
1282 &tma340_vkeys_attr.attr,
1283 NULL
1284};
1285
1286static struct attribute_group tma340_properties_attr_group = {
1287 .attrs = tma340_properties_attrs,
1288};
1289
1290
1291static int cyttsp_platform_init(struct i2c_client *client)
1292{
1293 int rc = 0;
1294 static struct kobject *tma340_properties_kobj;
1295
1296 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1297 tma340_properties_kobj = kobject_create_and_add("board_properties",
1298 NULL);
1299 if (tma340_properties_kobj)
1300 rc = sysfs_create_group(tma340_properties_kobj,
1301 &tma340_properties_attr_group);
1302 if (!tma340_properties_kobj || rc)
1303 pr_err("%s: failed to create board_properties\n",
1304 __func__);
1305
1306 return 0;
1307}
1308
1309static struct cyttsp_regulator regulator_data[] = {
1310 {
1311 .name = "vdd",
1312 .min_uV = CY_TMA300_VTG_MIN_UV,
1313 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301314 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1315 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001316 },
1317 /* TODO: Remove after runtime PM is enabled in I2C driver */
1318 {
1319 .name = "vcc_i2c",
1320 .min_uV = CY_I2C_VTG_MIN_UV,
1321 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301322 .hpm_load_uA = CY_I2C_CURR_UA,
1323 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001324 },
1325};
1326
1327static struct cyttsp_platform_data cyttsp_pdata = {
1328 .panel_maxx = 634,
1329 .panel_maxy = 1166,
1330 .disp_maxx = 616,
1331 .disp_maxy = 1023,
1332 .disp_minx = 0,
1333 .disp_miny = 16,
1334 .flags = 0x01,
1335 .gen = CY_GEN3, /* or */
1336 .use_st = CY_USE_ST,
1337 .use_mt = CY_USE_MT,
1338 .use_hndshk = CY_SEND_HNDSHK,
1339 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301340 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001341 .use_gestures = CY_USE_GESTURES,
1342 .fw_fname = "cyttsp_8960_cdp.hex",
1343 /* activate up to 4 groups
1344 * and set active distance
1345 */
1346 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1347 CY_GEST_GRP3 | CY_GEST_GRP4 |
1348 CY_ACT_DIST,
1349 /* change act_intrvl to customize the Active power state
1350 * scanning/processing refresh interval for Operating mode
1351 */
1352 .act_intrvl = CY_ACT_INTRVL_DFLT,
1353 /* change tch_tmout to customize the touch timeout for the
1354 * Active power state for Operating mode
1355 */
1356 .tch_tmout = CY_TCH_TMOUT_DFLT,
1357 /* change lp_intrvl to customize the Low Power power state
1358 * scanning/processing refresh interval for Operating mode
1359 */
1360 .lp_intrvl = CY_LP_INTRVL_DFLT,
1361 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1362 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1363 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1364 .regulator_info = regulator_data,
1365 .num_regulators = ARRAY_SIZE(regulator_data),
1366 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301367 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001368};
1369
1370static struct i2c_board_info cyttsp_info[] __initdata = {
1371 {
1372 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1373 .platform_data = &cyttsp_pdata,
1374#ifndef CY_USE_TIMER
1375 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1376#endif /* CY_USE_TIMER */
1377 },
1378};
1379
Mohan Pallaka50837382011-09-07 11:00:57 +05301380/* configuration data */
1381static const u8 mxt_config_data[] = {
1382 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001383 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301384 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001385 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1387 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1388 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1389 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1390 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1391 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301392 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001393 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301394 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001395 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301396 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001397 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1398 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1399 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1400 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301401 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001402 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1403 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301404 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001405 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1406 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301407 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001408 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1409 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301410 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001411 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1412 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301413 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001414 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301415 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001416 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301417 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001418 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301419 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001420 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301421 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001422 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301423};
1424
1425#define MXT_TS_GPIO_IRQ 11
1426#define MXT_TS_LDO_EN_GPIO 50
1427#define MXT_TS_RESET_GPIO 52
1428
1429static void mxt_init_hw_liquid(void)
1430{
1431 int rc;
1432
1433 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
1434 if (rc) {
1435 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
1436 __func__, MXT_TS_GPIO_IRQ);
1437 return;
1438 }
1439
1440 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
1441 if (rc) {
1442 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
1443 __func__, MXT_TS_GPIO_IRQ);
1444 goto err_irq_gpio_req;
1445 }
1446
1447 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1448 if (rc) {
1449 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
1450 __func__, MXT_TS_LDO_EN_GPIO);
1451 goto err_irq_gpio_req;
1452 }
1453
1454 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1455 if (rc) {
1456 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
1457 __func__, MXT_TS_LDO_EN_GPIO);
1458 goto err_ldo_gpio_req;
1459 }
1460
1461 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
1462 if (rc) {
1463 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
1464 __func__, MXT_TS_RESET_GPIO);
1465 goto err_ldo_gpio_set_dir;
1466 }
1467
1468 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
1469 if (rc) {
1470 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
1471 __func__, MXT_TS_RESET_GPIO);
1472 goto err_reset_gpio_req;
1473 }
1474
1475 return;
1476
1477err_reset_gpio_req:
1478 gpio_free(MXT_TS_RESET_GPIO);
1479err_ldo_gpio_set_dir:
1480 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
1481err_ldo_gpio_req:
1482 gpio_free(MXT_TS_LDO_EN_GPIO);
1483err_irq_gpio_req:
1484 gpio_free(MXT_TS_GPIO_IRQ);
1485}
1486
1487static struct mxt_platform_data mxt_platform_data = {
1488 .config = mxt_config_data,
1489 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07001490 .x_size = 1365,
1491 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301492 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001493 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05301494};
1495
1496static struct i2c_board_info mxt_device_info[] __initdata = {
1497 {
1498 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1499 .platform_data = &mxt_platform_data,
1500 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1501 },
1502};
1503
Eugene Yasmand2316b82011-12-07 18:23:48 +02001504static struct i2c_board_info sii_device_info[] __initdata = {
1505 {
1506 I2C_BOARD_INFO("Sil-9244", 0x39),
1507 .flags = I2C_CLIENT_WAKE,
1508 .irq = MSM_GPIO_TO_INT(15),
1509 },
1510};
1511
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001512static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
1513{
1514}
1515
1516static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1517 .clk_freq = 100000,
1518 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001519 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1520};
1521
1522static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1523 .clk_freq = 100000,
1524 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001525 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1526};
1527
1528static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1529 .clk_freq = 100000,
1530 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001531 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1532};
1533
1534static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1535 .clk_freq = 100000,
1536 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001537 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1538};
1539
1540static struct msm_rpm_platform_data msm_rpm_data = {
1541 .reg_base_addrs = {
1542 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
1543 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
1544 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
1545 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
1546 },
1547
1548 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
1549 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
1550 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1551 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
1552 .msm_apps_ipc_rpm_val = 4,
1553};
1554
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001555static struct ks8851_pdata spi_eth_pdata = {
1556 .irq_gpio = KS8851_IRQ_GPIO,
1557 .rst_gpio = KS8851_RST_GPIO,
1558};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001559
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001560static struct spi_board_info spi_board_info[] __initdata = {
1561 {
1562 .modalias = "ks8851",
1563 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1564 .max_speed_hz = 19200000,
1565 .bus_num = 0,
1566 .chip_select = 0,
1567 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001568 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001569 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001570 {
1571 .modalias = "dsi_novatek_3d_panel_spi",
1572 .max_speed_hz = 10800000,
1573 .bus_num = 0,
1574 .chip_select = 1,
1575 .mode = SPI_MODE_0,
1576 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001577};
1578
1579static struct platform_device msm_device_saw_core0 = {
1580 .name = "saw-regulator",
1581 .id = 0,
1582 .dev = {
1583 .platform_data = &msm_saw_regulator_pdata_s5,
1584 },
1585};
1586
1587static struct platform_device msm_device_saw_core1 = {
1588 .name = "saw-regulator",
1589 .id = 1,
1590 .dev = {
1591 .platform_data = &msm_saw_regulator_pdata_s6,
1592 },
1593};
1594
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001595static struct tsens_platform_data msm_tsens_pdata = {
1596 .slope = 910,
1597 .tsens_factor = 1000,
1598 .hw_type = MSM_8960,
1599 .tsens_num_sensor = 5,
1600};
1601
1602static struct platform_device msm_tsens_device = {
1603 .name = "tsens8960-tm",
1604 .id = -1,
1605 .dev = {
1606 .platform_data = &msm_tsens_pdata,
1607 },
1608};
1609
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001610#ifdef CONFIG_MSM_FAKE_BATTERY
1611static struct platform_device fish_battery_device = {
1612 .name = "fish_battery",
1613};
1614#endif
1615
David Collins26f05562011-06-20 09:56:28 -07001616static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001617 .name = GPIO_REGULATOR_DEV_NAME,
1618 .id = PM8921_MPP_PM_TO_SYS(7),
1619 .dev = {
1620 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1621 },
1622};
1623
David Collins26f05562011-06-20 09:56:28 -07001624static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001625 .name = GPIO_REGULATOR_DEV_NAME,
1626 .id = 91,
1627 .dev = {
1628 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1629 },
1630};
1631
David Collinsb10be1d2011-09-02 10:29:31 -07001632static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1633 .name = GPIO_REGULATOR_DEV_NAME,
1634 .id = PM8921_GPIO_PM_TO_SYS(17),
1635 .dev = {
1636 .platform_data =
1637 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1638 },
1639};
1640
David Collins35a78f52011-12-14 15:54:25 -08001641static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1642 .name = GPIO_REGULATOR_DEV_NAME,
1643 .id = PM8921_GPIO_PM_TO_SYS(42),
1644 .dev = {
1645 .platform_data =
1646 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1647 },
1648};
1649
David Collins26f05562011-06-20 09:56:28 -07001650static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1651 .name = "rpm-regulator",
1652 .id = -1,
1653 .dev = {
1654 .platform_data = &msm_rpm_regulator_pdata,
1655 },
1656};
1657
David Collins4c31a872011-08-31 10:07:10 -07001658static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1659 .phys_addr_base = 0x0010C000,
1660 .reg_offsets = {
1661 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1662 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1663 },
1664 .phys_size = SZ_8K,
1665 .log_len = 4096, /* log's buffer length in bytes */
1666 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1667};
1668
1669static struct platform_device msm_rpm_log_device = {
1670 .name = "msm_rpm_log",
1671 .id = -1,
1672 .dev = {
1673 .platform_data = &msm_rpm_log_pdata,
1674 },
1675};
1676
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001677static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001678 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001679 &msm_device_smd,
1680 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301681 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001682 &msm_device_saw_core0,
1683 &msm_device_saw_core1,
1684 &msm8960_device_ext_5v_vreg,
Jay Chokshi33c044a2011-12-07 13:05:40 -08001685 &msm8960_device_ssbi_pmic,
David Collins35a78f52011-12-14 15:54:25 -08001686 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687 &msm8960_device_qup_spi_gsbi1,
1688 &msm8960_device_qup_i2c_gsbi3,
1689 &msm8960_device_qup_i2c_gsbi4,
1690 &msm8960_device_qup_i2c_gsbi10,
1691#ifndef CONFIG_MSM_DSPS
1692 &msm8960_device_qup_i2c_gsbi12,
1693#endif
1694 &msm_slim_ctrl,
1695 &msm_device_wcnss_wlan,
1696#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1697 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1698 &qcrypto_device,
1699#endif
1700
1701#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1702 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1703 &qcedev_device,
1704#endif
1705#ifdef CONFIG_MSM_ROTATOR
1706 &msm_rotator_device,
1707#endif
1708 &msm_device_sps,
1709#ifdef CONFIG_MSM_FAKE_BATTERY
1710 &fish_battery_device,
1711#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001712 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001713#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001714#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001715 &android_pmem_device,
1716 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001717#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001718 &android_pmem_audio_device,
1719#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001720 &msm_device_vidc,
1721 &msm_device_bam_dmux,
1722 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001723
1724#ifdef CONFIG_HW_RANDOM_MSM
1725 &msm_device_rng,
1726#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001727 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07001728#ifdef CONFIG_ION_MSM
1729 &ion_dev,
1730#endif
David Collins4c31a872011-08-31 10:07:10 -07001731 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06001732 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001733 &msm_device_tz_log,
1734
Pratik Patel7831c082011-06-08 21:44:37 -07001735#ifdef CONFIG_MSM_QDSS
1736 &msm_etb_device,
1737 &msm_tpiu_device,
1738 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07001739 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07001740 &msm_ptm_device,
1741#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001742 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001743 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001744};
1745
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001746static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001747 &msm8960_device_otg,
1748 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001749 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301750 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001751 &android_usb_device,
1752 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001753 &msm_bus_apps_fabric,
1754 &msm_bus_sys_fabric,
1755 &msm_bus_mm_fabric,
1756 &msm_bus_sys_fpb,
1757 &msm_bus_cpss_fpb,
1758 &msm_pcm,
1759 &msm_pcm_routing,
1760 &msm_cpudai0,
1761 &msm_cpudai1,
1762 &msm_cpudai_hdmi_rx,
1763 &msm_cpudai_bt_rx,
1764 &msm_cpudai_bt_tx,
1765 &msm_cpudai_fm_rx,
1766 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001767 &msm_cpudai_auxpcm_rx,
1768 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001769 &msm_cpu_fe,
1770 &msm_stub_codec,
1771 &msm_voice,
1772 &msm_voip,
1773 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301774 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001775 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001776 &msm_cpudai_incall_record_rx,
1777 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001778
1779#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1780 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1781 &qcrypto_device,
1782#endif
1783
1784#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1785 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1786 &qcedev_device,
1787#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001788};
1789
1790static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001791 &msm_kgsl_3d0,
1792 &msm_kgsl_2d0,
1793 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001794#ifdef CONFIG_MSM_GEMINI
1795 &msm8960_gemini_device,
1796#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001797};
1798
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001799static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07001800 &msm_8960_q6_lpass,
1801 &msm_8960_q6_mss_fw,
1802 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001803 &msm_8960_riva,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001804 &msm8960_device_otg,
1805 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001806 &msm_device_hsusb_host,
1807 &android_usb_device,
1808 &msm_pcm,
1809 &msm_pcm_routing,
1810 &msm_cpudai0,
1811 &msm_cpudai1,
1812 &msm_cpudai_hdmi_rx,
1813 &msm_cpudai_bt_rx,
1814 &msm_cpudai_bt_tx,
1815 &msm_cpudai_fm_rx,
1816 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001817 &msm_cpudai_auxpcm_rx,
1818 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001819 &msm_cpu_fe,
1820 &msm_stub_codec,
1821 &msm_kgsl_3d0,
1822#ifdef CONFIG_MSM_KGSL_2D
1823 &msm_kgsl_2d0,
1824 &msm_kgsl_2d1,
1825#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001826#ifdef CONFIG_MSM_GEMINI
1827 &msm8960_gemini_device,
1828#endif
1829 &msm_voice,
1830 &msm_voip,
1831 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05301832 &msm_cpudai_afe_01_rx,
1833 &msm_cpudai_afe_01_tx,
1834 &msm_cpudai_afe_02_rx,
1835 &msm_cpudai_afe_02_tx,
1836 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05301837 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07001838 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07001839 &msm_cpudai_incall_record_rx,
1840 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001841 &msm_pcm_hostless,
1842 &msm_bus_apps_fabric,
1843 &msm_bus_sys_fabric,
1844 &msm_bus_mm_fabric,
1845 &msm_bus_sys_fpb,
1846 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001847 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001848};
1849
1850static void __init msm8960_i2c_init(void)
1851{
1852 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
1853 &msm8960_i2c_qup_gsbi4_pdata;
1854
1855 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
1856 &msm8960_i2c_qup_gsbi3_pdata;
1857
1858 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
1859 &msm8960_i2c_qup_gsbi10_pdata;
1860
1861 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
1862 &msm8960_i2c_qup_gsbi12_pdata;
1863}
1864
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001865static void __init msm8960_gfx_init(void)
1866{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06001867 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001868 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
1869 struct kgsl_device_platform_data *kgsl_3d0_pdata =
1870 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001871 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
1872 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06001873 }
1874}
1875
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001876static struct msm_cpuidle_state msm_cstates[] __initdata = {
1877 {0, 0, "C0", "WFI",
1878 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1879
1880 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1881 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1882
1883 {0, 2, "C2", "POWER_COLLAPSE",
1884 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
1885
1886 {1, 0, "C0", "WFI",
1887 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
1888
1889 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
1890 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
1891};
1892
1893static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
1894 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1895 .idle_supported = 1,
1896 .suspend_supported = 1,
1897 .idle_enabled = 0,
1898 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001899 },
1900
1901 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1902 .idle_supported = 1,
1903 .suspend_supported = 1,
1904 .idle_enabled = 0,
1905 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001906 },
1907
1908 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1909 .idle_supported = 1,
1910 .suspend_supported = 1,
1911 .idle_enabled = 1,
1912 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001913 },
1914
1915 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
1916 .idle_supported = 0,
1917 .suspend_supported = 1,
1918 .idle_enabled = 0,
1919 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001920 },
1921
1922 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
1923 .idle_supported = 1,
1924 .suspend_supported = 1,
1925 .idle_enabled = 0,
1926 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001927 },
1928
1929 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
1930 .idle_supported = 1,
1931 .suspend_supported = 0,
1932 .idle_enabled = 1,
1933 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001934 },
1935};
1936
1937static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1938 {
1939 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1940 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1941 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001942 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001943 },
1944
1945 {
1946 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1947 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1948 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001949 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950 },
1951
1952 {
1953 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1954 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
1955 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001956 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001957 },
1958
1959 {
1960 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1961 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
1962 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001963 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001964 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06001965 {
1966 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1967 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
1968 false,
1969 7000, 3500, 66600000, 5150,
1970 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001971
1972 {
1973 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1974 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
1975 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001976 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001977 },
1978
1979 {
1980 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1981 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1982 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001983 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001984 },
1985
1986 {
1987 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1988 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
1989 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001990 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001991 },
1992
1993 {
1994 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1995 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1996 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06001997 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001998 },
1999};
2000
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002001static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2002 .mode = MSM_PM_BOOT_CONFIG_TZ,
2003};
2004
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002005#ifdef CONFIG_I2C
2006#define I2C_SURF 1
2007#define I2C_FFA (1 << 1)
2008#define I2C_RUMI (1 << 2)
2009#define I2C_SIM (1 << 3)
2010#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002011#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002012
2013struct i2c_registry {
2014 u8 machs;
2015 int bus;
2016 struct i2c_board_info *info;
2017 int len;
2018};
2019
2020#ifdef CONFIG_MSM_CAMERA
2021static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
2022#ifdef CONFIG_IMX074
2023 {
2024 I2C_BOARD_INFO("imx074", 0x1A),
2025 },
2026#endif
2027#ifdef CONFIG_OV2720
2028 {
2029 I2C_BOARD_INFO("ov2720", 0x6C),
2030 },
2031#endif
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -08002032#ifdef CONFIG_MT9M114
2033 {
2034 I2C_BOARD_INFO("mt9m114", 0x48),
2035 },
2036#endif
Nishant Pandit474f2252011-07-23 23:17:56 +05302037#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
2038 {
2039 I2C_BOARD_INFO("sc628a", 0x6E),
2040 },
2041#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002042};
2043#endif
2044
2045/* Sensors DSPS platform data */
2046#ifdef CONFIG_MSM_DSPS
2047#define DSPS_PIL_GENERIC_NAME "dsps"
2048#endif /* CONFIG_MSM_DSPS */
2049
2050static void __init msm8960_init_dsps(void)
2051{
2052#ifdef CONFIG_MSM_DSPS
2053 struct msm_dsps_platform_data *pdata =
2054 msm_dsps_device.dev.platform_data;
2055 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2056 pdata->gpios = NULL;
2057 pdata->gpios_num = 0;
2058
2059 platform_device_register(&msm_dsps_device);
2060#endif /* CONFIG_MSM_DSPS */
2061}
2062
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002063static int hsic_peripheral_status = 1;
2064static DEFINE_MUTEX(hsic_status_lock);
2065
2066void peripheral_connect()
2067{
2068 mutex_lock(&hsic_status_lock);
2069 if (hsic_peripheral_status)
2070 goto out;
2071 platform_device_add(&msm_device_hsic_host);
2072 hsic_peripheral_status = 1;
2073out:
2074 mutex_unlock(&hsic_status_lock);
2075}
2076EXPORT_SYMBOL(peripheral_connect);
2077
2078void peripheral_disconnect()
2079{
2080 mutex_lock(&hsic_status_lock);
2081 if (!hsic_peripheral_status)
2082 goto out;
2083 platform_device_del(&msm_device_hsic_host);
2084 hsic_peripheral_status = 0;
2085out:
2086 mutex_unlock(&hsic_status_lock);
2087}
2088EXPORT_SYMBOL(peripheral_disconnect);
2089
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002090static void __init msm8960_init_hsic(void)
2091{
2092#ifdef CONFIG_USB_EHCI_MSM_HSIC
2093 uint32_t version = socinfo_get_version();
2094
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002095 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002096 return;
2097
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002098 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002099 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002100#endif
2101}
2102
Amir Samuelov5137e392011-09-21 17:31:25 +03002103#ifdef CONFIG_ISL9519_CHARGER
2104static struct isl_platform_data isl_data __initdata = {
2105 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2106 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2107 .max_system_voltage = 4200,
2108 .min_system_voltage = 3200,
2109 .chgcurrent = 1000, /* 1900, */
2110 .term_current = 400, /* Need fine tuning */
2111 .input_current = 2048,
2112};
2113
2114static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2115 {
2116 I2C_BOARD_INFO("isl9519q", 0x9),
2117 .irq = 0, /* Not required when notify-by-pmic */
2118 .platform_data = &isl_data,
2119 },
2120};
2121#endif /* CONFIG_ISL9519_CHARGER */
2122
Amir Samuelov755616d2011-12-13 16:34:46 +02002123static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2124 {
2125 I2C_BOARD_INFO("sx1508q", 0x20),
2126 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2127 },
2128};
2129
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002130static struct i2c_registry msm8960_i2c_devices[] __initdata = {
2131#ifdef CONFIG_MSM_CAMERA
2132 {
Amir Samuelov05f87802011-08-27 18:30:12 +03002133 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002134 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2135 msm_camera_boardinfo,
2136 ARRAY_SIZE(msm_camera_boardinfo),
2137 },
2138#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03002139#ifdef CONFIG_ISL9519_CHARGER
2140 {
2141 I2C_LIQUID,
2142 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2143 isl_charger_i2c_info,
2144 ARRAY_SIZE(isl_charger_i2c_info),
2145 },
2146#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002147 {
2148 I2C_SURF | I2C_FFA | I2C_FLUID,
2149 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2150 cyttsp_info,
2151 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002152 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302153 {
2154 I2C_LIQUID,
2155 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2156 mxt_device_info,
2157 ARRAY_SIZE(mxt_device_info),
2158 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302159 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302160 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302161 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002162 sii_device_info,
2163 ARRAY_SIZE(sii_device_info),
2164 },
2165 {
2166 I2C_LIQUID,
2167 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302168 msm_isa1200_board_info,
2169 ARRAY_SIZE(msm_isa1200_board_info),
2170 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002171 {
2172 I2C_LIQUID,
2173 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2174 liquid_io_expander_i2c_info,
2175 ARRAY_SIZE(liquid_io_expander_i2c_info),
2176 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002177};
2178#endif /* CONFIG_I2C */
2179
2180static void __init register_i2c_devices(void)
2181{
2182#ifdef CONFIG_I2C
2183 u8 mach_mask = 0;
2184 int i;
2185
2186 /* Build the matching 'supported_machs' bitmask */
2187 if (machine_is_msm8960_cdp())
2188 mach_mask = I2C_SURF;
2189 else if (machine_is_msm8960_rumi3())
2190 mach_mask = I2C_RUMI;
2191 else if (machine_is_msm8960_sim())
2192 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002193 else if (machine_is_msm8960_fluid())
2194 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002195 else if (machine_is_msm8960_liquid())
2196 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002197 else if (machine_is_msm8960_mtp())
2198 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002199 else
2200 pr_err("unmatched machine ID in register_i2c_devices\n");
2201
2202 /* Run the array and install devices as appropriate */
2203 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2204 if (msm8960_i2c_devices[i].machs & mach_mask)
2205 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2206 msm8960_i2c_devices[i].info,
2207 msm8960_i2c_devices[i].len);
2208 }
2209#endif
2210}
2211
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002212static void __init msm8960_sim_init(void)
2213{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002214 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2215 &msm8960_device_watchdog.dev.platform_data;
2216
2217 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002218 BUG_ON(msm_rpm_init(&msm_rpm_data));
2219 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2220 ARRAY_SIZE(msm_rpmrs_levels)));
2221 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002222 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002223 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002224 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002225
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002226 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002227 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002228 msm8960_i2c_init();
2229 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2230 msm_spm_l2_init(msm_spm_l2_data);
2231 msm8960_init_buses();
2232 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002233 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002234 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002235 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002236
2237 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));
2240
2241 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002242 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002243 slim_register_board_info(msm_slim_devices,
2244 ARRAY_SIZE(msm_slim_devices));
2245 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2246 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2247 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2248 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002249 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002250}
2251
2252static void __init msm8960_rumi3_init(void)
2253{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002254 BUG_ON(msm_rpm_init(&msm_rpm_data));
2255 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2256 ARRAY_SIZE(msm_rpmrs_levels)));
2257 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002258 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002259 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002260 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002261 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002262 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2263 &msm8960_qup_spi_gsbi1_pdata;
2264 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2265 msm8960_i2c_init();
2266 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2267 msm_spm_l2_init(msm_spm_l2_data);
2268 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002269 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002270 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002271 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002272 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002273 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002274 slim_register_board_info(msm_slim_devices,
2275 ARRAY_SIZE(msm_slim_devices));
2276 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2277 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2278 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2279 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002280 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002281}
2282
2283static void __init msm8960_cdp_init(void)
2284{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002285 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2286 pr_err("meminfo_init() failed!\n");
2287
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002288 BUG_ON(msm_rpm_init(&msm_rpm_data));
2289 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2290 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002291
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002292 regulator_suppress_info_printing();
2293 if (msm_xo_init())
2294 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002295 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002296 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302297 if (machine_is_msm8960_liquid())
2298 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002299 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302300 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2301 machine_is_msm8960_cdp()) {
2302 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2303 } else if (machine_is_msm8960_liquid()) {
2304 msm_otg_pdata.phy_init_seq =
2305 liquid_v1_phy_init_seq;
2306 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302307 msm_otg_pdata.swfi_latency =
2308 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302309#ifdef CONFIG_USB_EHCI_MSM_HSIC
2310 if (machine_is_msm8960_liquid()) {
2311 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2312 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2313 }
2314#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302315 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002316 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002317 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2318 &msm8960_qup_spi_gsbi1_pdata;
2319 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002320
2321 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302322 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2323 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2324 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002325 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002326 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002327 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2328 msm_spm_l2_init(msm_spm_l2_data);
2329 msm8960_init_buses();
2330 platform_add_devices(msm_footswitch_devices,
2331 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002332 if (machine_is_msm8960_liquid())
2333 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002334 if (machine_is_msm8960_cdp())
2335 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002336 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002337 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002338 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002339 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002340 msm8960_init_cam();
2341 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002342 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302343 if (machine_is_msm8960_liquid())
2344 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002345 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002346 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347 slim_register_board_info(msm_slim_devices,
2348 ARRAY_SIZE(msm_slim_devices));
2349 msm8960_init_dsps();
2350 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2351 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2352 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2353 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002354 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002355 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Joel Kingb8352a12011-11-15 18:46:24 -08002356 if (PLATFORM_IS_CHARM25())
2357 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002358}
2359
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002360MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2361 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002362 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002363 .init_irq = msm8960_init_irq,
2364 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002365 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002366 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002367 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002368MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002369
2370MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2371 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002372 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002373 .init_irq = msm8960_init_irq,
2374 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002375 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002376 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002377 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002378MACHINE_END
2379
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002380MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2381 .map_io = msm8960_map_io,
2382 .reserve = msm8960_reserve,
2383 .init_irq = msm8960_init_irq,
2384 .timer = &msm_timer,
2385 .init_machine = msm8960_cdp_init,
2386 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002387 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002388MACHINE_END
2389
2390MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2391 .map_io = msm8960_map_io,
2392 .reserve = msm8960_reserve,
2393 .init_irq = msm8960_init_irq,
2394 .timer = &msm_timer,
2395 .init_machine = msm8960_cdp_init,
2396 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002397 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002398MACHINE_END
2399
2400MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2401 .map_io = msm8960_map_io,
2402 .reserve = msm8960_reserve,
2403 .init_irq = msm8960_init_irq,
2404 .timer = &msm_timer,
2405 .init_machine = msm8960_cdp_init,
2406 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002407 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002408MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002409
2410MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2411 .map_io = msm8960_map_io,
2412 .reserve = msm8960_reserve,
2413 .init_irq = msm8960_init_irq,
2414 .timer = &msm_timer,
2415 .init_machine = msm8960_cdp_init,
2416 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002417 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002418MACHINE_END