blob: d38056699212768c310018b76794c39e465ade9a [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 Abbottf8c03b92012-02-16 14:57:58 -080082#include <mach/msm_rtb.h>
Laura Abbottd6183792011-08-19 13:42:24 -070083
Larry Bassel41a055b2011-12-06 16:15:14 -080084#include <linux/fmem.h>
85
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070086#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080087#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070088#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070089#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080090#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080091#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080092#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "rpm_resources.h"
94#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070095#include "acpuclock.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
Olav Haugana21169d2012-01-04 09:17:06 -0800133#define MSM_PMEM_ADSP_SIZE 0x7800000
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
Olav Hauganedcf6832012-01-24 08:35:41 -0800143#define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000
Olav Hauganb88eef12012-01-15 10:59:26 -0800144#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan42ebe712012-01-10 16:30:58 -0800145#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Olav Hauganb88eef12012-01-15 10:59:26 -0800146#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan80854eb2012-01-12 12:00:23 -0800147#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800148#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800149#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
150#define MSM_ION_HEAP_NUM 8
Olav Hauganb5be7992011-11-18 14:29:02 -0800151#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
152static unsigned int msm_ion_cp_mm_size = MSM_ION_MM_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700153#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700154#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800155#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700156#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700157
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700158#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
159static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
160static int __init pmem_kernel_ebi1_size_setup(char *p)
161{
162 pmem_kernel_ebi1_size = memparse(p, NULL);
163 return 0;
164}
165early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
166#endif
167
168#ifdef CONFIG_ANDROID_PMEM
169static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800170static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700171static int __init pmem_size_setup(char *p)
172{
173 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800174 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175 return 0;
176}
177early_param("pmem_size", pmem_size_setup);
178
179static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
180
181static int __init pmem_adsp_size_setup(char *p)
182{
183 pmem_adsp_size = memparse(p, NULL);
184 return 0;
185}
186early_param("pmem_adsp_size", pmem_adsp_size_setup);
187
188static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
189
190static int __init pmem_audio_size_setup(char *p)
191{
192 pmem_audio_size = memparse(p, NULL);
193 return 0;
194}
195early_param("pmem_audio_size", pmem_audio_size_setup);
196#endif
197
198#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700199#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700200static struct android_pmem_platform_data android_pmem_pdata = {
201 .name = "pmem",
202 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
203 .cached = 1,
204 .memory_type = MEMTYPE_EBI1,
205};
206
207static struct platform_device android_pmem_device = {
208 .name = "android_pmem",
209 .id = 0,
210 .dev = {.platform_data = &android_pmem_pdata},
211};
212
213static struct android_pmem_platform_data android_pmem_adsp_pdata = {
214 .name = "pmem_adsp",
215 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
216 .cached = 0,
217 .memory_type = MEMTYPE_EBI1,
218};
219static struct platform_device android_pmem_adsp_device = {
220 .name = "android_pmem",
221 .id = 2,
222 .dev = { .platform_data = &android_pmem_adsp_pdata },
223};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700224#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700225
226static struct android_pmem_platform_data android_pmem_audio_pdata = {
227 .name = "pmem_audio",
228 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
229 .cached = 0,
230 .memory_type = MEMTYPE_EBI1,
231};
232
233static struct platform_device android_pmem_audio_device = {
234 .name = "android_pmem",
235 .id = 4,
236 .dev = { .platform_data = &android_pmem_audio_pdata },
237};
238#endif
239
Larry Bassel41a055b2011-12-06 16:15:14 -0800240struct fmem_platform_data fmem_pdata = {
241};
242
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700243#define DSP_RAM_BASE_8960 0x8da00000
244#define DSP_RAM_SIZE_8960 0x1800000
245static int dspcrashd_pdata_8960 = 0xDEADDEAD;
246
247static struct resource resources_dspcrashd_8960[] = {
248 {
249 .name = "msm_dspcrashd",
250 .start = DSP_RAM_BASE_8960,
251 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
252 .flags = IORESOURCE_DMA,
253 },
254};
255
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800256static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700257 .name = "msm_dspcrashd",
258 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
259 .resource = resources_dspcrashd_8960,
260 .dev = { .platform_data = &dspcrashd_pdata_8960 },
261};
262
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700263static struct memtype_reserve msm8960_reserve_table[] __initdata = {
264 [MEMTYPE_SMI] = {
265 },
266 [MEMTYPE_EBI0] = {
267 .flags = MEMTYPE_FLAGS_1M_ALIGN,
268 },
269 [MEMTYPE_EBI1] = {
270 .flags = MEMTYPE_FLAGS_1M_ALIGN,
271 },
272};
273
Laura Abbottf8c03b92012-02-16 14:57:58 -0800274#if defined(CONFIG_MSM_RTB)
275static struct msm_rtb_platform_data msm_rtb_pdata = {
276 .size = SZ_1M,
277};
278
279static int __init msm_rtb_set_buffer_size(char *p)
280{
281 int s;
282
283 s = memparse(p, NULL);
284 msm_rtb_pdata.size = ALIGN(s, SZ_4K);
285 return 0;
286}
287early_param("msm_rtb_size", msm_rtb_set_buffer_size);
288
289
290static struct platform_device msm_rtb_device = {
291 .name = "msm_rtb",
292 .id = -1,
293 .dev = {
294 .platform_data = &msm_rtb_pdata,
295 },
296};
297#endif
298
299static void __init reserve_rtb_memory(void)
300{
301#if defined(CONFIG_MSM_RTB)
302 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
303#endif
304}
305
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306static void __init size_pmem_devices(void)
307{
308#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700309#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700310 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800311
312 if (!pmem_param_set && machine_is_msm8960_liquid())
313 pmem_size = MSM_LIQUID_PMEM_SIZE;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700315#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
317#endif
318}
319
320static void __init reserve_memory_for(struct android_pmem_platform_data *p)
321{
322 msm8960_reserve_table[p->memory_type].size += p->size;
323}
324
325static void __init reserve_pmem_memory(void)
326{
327#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700328#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329 reserve_memory_for(&android_pmem_adsp_pdata);
330 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700331#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700332 reserve_memory_for(&android_pmem_audio_pdata);
333 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
334#endif
335}
336
Larry Basselb4126da2011-07-18 14:31:33 -0700337static int msm8960_paddr_to_memtype(unsigned int paddr)
338{
339 return MEMTYPE_EBI1;
340}
341
Olav Hauganf6dc7742012-02-15 09:11:55 -0800342#define FMEM_ENABLED 1
343
Laura Abbottd6183792011-08-19 13:42:24 -0700344#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800345#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
346static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
347 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800348 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800349 .reusable = FMEM_ENABLED,
350 .mem_is_fmem = FMEM_ENABLED,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800351};
352
353static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
354 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800355 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800356 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800357 .mem_is_fmem = FMEM_ENABLED,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800358};
359
360static struct ion_co_heap_pdata co_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800361 .adjacent_mem_id = INVALID_HEAP_ID,
362 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800363 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800364};
365
366static struct ion_co_heap_pdata fw_co_ion_pdata = {
367 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
368 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800369 .mem_is_fmem = FMEM_ENABLED,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800370};
371#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800372
373/**
374 * These heaps are listed in the order they will be allocated. Due to
375 * video hardware restrictions and content protection the FW heap has to
376 * be allocated adjacent (below) the MM heap and the MFC heap has to be
377 * allocated after the MM heap to ensure MFC heap is not more than 256MB
378 * away from the base address of the FW heap.
379 * However, the order of FW heap and MM heap doesn't matter since these
380 * two heaps are taken care of by separate code to ensure they are adjacent
381 * to each other.
382 * Don't swap the order unless you know what you are doing!
383 */
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800384static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700385 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700386 .heaps = {
387 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800388 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700389 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700390 .name = ION_VMALLOC_HEAP_NAME,
391 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700392#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700393 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800394 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800395 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800396 .name = ION_MM_HEAP_NAME,
397 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700398 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800399 .extra_data = (void *) &cp_mm_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700400 },
Laura Abbott8c017362011-09-22 20:59:12 -0700401 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800402 .id = ION_MM_FIRMWARE_HEAP_ID,
403 .type = ION_HEAP_TYPE_CARVEOUT,
404 .name = ION_MM_FIRMWARE_HEAP_NAME,
405 .size = MSM_ION_MM_FW_SIZE,
406 .memory_type = ION_EBI_TYPE,
407 .extra_data = (void *) &fw_co_ion_pdata,
408 },
409 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800410 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800411 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800412 .name = ION_MFC_HEAP_NAME,
413 .size = MSM_ION_MFC_SIZE,
414 .memory_type = ION_EBI_TYPE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800415 .extra_data = (void *) &cp_mfc_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800416 },
417 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800418 .id = ION_SF_HEAP_ID,
419 .type = ION_HEAP_TYPE_CARVEOUT,
420 .name = ION_SF_HEAP_NAME,
421 .size = MSM_ION_SF_SIZE,
422 .memory_type = ION_EBI_TYPE,
423 .extra_data = (void *) &co_ion_pdata,
424 },
425 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800426 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700427 .type = ION_HEAP_TYPE_IOMMU,
428 .name = ION_IOMMU_HEAP_NAME,
429 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800430 {
431 .id = ION_QSECOM_HEAP_ID,
432 .type = ION_HEAP_TYPE_CARVEOUT,
433 .name = ION_QSECOM_HEAP_NAME,
434 .size = MSM_ION_QSECOM_SIZE,
435 .memory_type = ION_EBI_TYPE,
436 .extra_data = (void *) &co_ion_pdata,
437 },
Olav Haugan7355db02012-01-13 16:59:13 -0800438 {
439 .id = ION_AUDIO_HEAP_ID,
440 .type = ION_HEAP_TYPE_CARVEOUT,
441 .name = ION_AUDIO_HEAP_NAME,
442 .size = MSM_ION_AUDIO_SIZE,
443 .memory_type = ION_EBI_TYPE,
444 .extra_data = (void *) &co_ion_pdata,
445 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700446#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700447 }
448};
449
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800450static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700451 .name = "ion-msm",
452 .id = 1,
453 .dev = { .platform_data = &ion_pdata },
454};
455#endif
456
Larry Bassel41a055b2011-12-06 16:15:14 -0800457struct platform_device fmem_device = {
458 .name = "fmem",
459 .id = 1,
460 .dev = { .platform_data = &fmem_pdata },
461};
462
Olav Haugan65f4bd82011-12-13 11:50:08 -0800463static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700464{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800465 unsigned int i;
466
467 if (!pmem_param_set && machine_is_msm8960_liquid()) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800468 msm_ion_cp_mm_size = MSM_LIQUID_ION_MM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800469 for (i = 0; i < ion_pdata.nr; i++) {
Olav Hauganb5be7992011-11-18 14:29:02 -0800470 if (ion_pdata.heaps[i].id == ION_CP_MM_HEAP_ID) {
471 ion_pdata.heaps[i].size = msm_ion_cp_mm_size;
472 pr_debug("msm_ion_cp_mm_size 0x%x\n",
473 msm_ion_cp_mm_size);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800474 break;
475 }
476 }
477 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800478}
479
480static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
481 unsigned long size)
482{
483 msm8960_reserve_table[mem_type].size += size;
484}
485
Olav Haugan65f4bd82011-12-13 11:50:08 -0800486/**
487 * Reserve memory for ION and calculate amount of reusable memory for fmem.
488 * We only reserve memory for heaps that are not reusable. However, we only
489 * support one reusable heap at the moment so we ignore the reusable flag for
490 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800491 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
492 * at a higher address than FW in addition to not more than 256MB away from the
493 * base address of the firmware. This means that if MM is reusable the other
494 * two heaps must be allocated in the same region as FW. This is handled by the
495 * mem_is_fmem flag in the platform data. In addition the MM heap must be
496 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800497 */
498static void __init reserve_ion_memory(void)
499{
500#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
501 unsigned int i;
502 unsigned int reusable_count = 0;
503
504 adjust_mem_for_liquid();
505 fmem_pdata.size = 0;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800506 fmem_pdata.reserved_size_low = 0;
507 fmem_pdata.reserved_size_high = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800508
509 /* We only support 1 reusable heap. Check if more than one heap
510 * is specified as reusable and set as non-reusable if found.
511 */
512 for (i = 0; i < ion_pdata.nr; ++i) {
513 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
514
515 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
516 struct ion_cp_heap_pdata *data = heap->extra_data;
517
518 reusable_count += (data->reusable) ? 1 : 0;
519
520 if (data->reusable && reusable_count > 1) {
521 pr_err("%s: Too many heaps specified as "
522 "reusable. Heap %s was not configured "
523 "as reusable.\n", __func__, heap->name);
524 data->reusable = 0;
525 }
526 }
527 }
528
529 for (i = 0; i < ion_pdata.nr; ++i) {
530 int reusable = 0;
531 int adjacent_heap_id = INVALID_HEAP_ID;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800532 int mem_is_fmem = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800533 const struct ion_platform_heap *heap = &(ion_pdata.heaps[i]);
534
535 if (heap->extra_data) {
536 switch (heap->type) {
537 case ION_HEAP_TYPE_CP:
538 reusable = ((struct ion_cp_heap_pdata *)
539 heap->extra_data)->reusable;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800540 mem_is_fmem = ((struct ion_cp_heap_pdata *)
541 heap->extra_data)->mem_is_fmem;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800542 break;
543 case ION_HEAP_TYPE_CARVEOUT:
544 adjacent_heap_id = ((struct ion_co_heap_pdata *)
545 heap->extra_data)->adjacent_mem_id;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800546 mem_is_fmem = ((struct ion_co_heap_pdata *)
547 heap->extra_data)->mem_is_fmem;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800548 break;
549 default:
550 break;
551 }
552 }
553
Olav Hauganf6dc7742012-02-15 09:11:55 -0800554 if (mem_is_fmem && !reusable) {
555 if (adjacent_heap_id != INVALID_HEAP_ID)
556 fmem_pdata.reserved_size_low += heap->size;
557 else
558 fmem_pdata.reserved_size_high += heap->size;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800559 }
Olav Hauganf6dc7742012-02-15 09:11:55 -0800560 if (mem_is_fmem)
Olav Haugan65f4bd82011-12-13 11:50:08 -0800561 fmem_pdata.size += heap->size;
Olav Hauganf6dc7742012-02-15 09:11:55 -0800562 else
563 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800564 }
Laura Abbottd6183792011-08-19 13:42:24 -0700565#endif
566}
Huaibin Yanga5419422011-12-08 23:52:10 -0800567
568static void __init reserve_mdp_memory(void)
569{
570 msm8960_mdp_writeback(msm8960_reserve_table);
571}
572
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700573static void __init msm8960_calculate_reserve_sizes(void)
574{
575 size_pmem_devices();
576 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700577 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800578 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800579 reserve_rtb_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700580}
581
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582static struct reserve_info msm8960_reserve_info __initdata = {
583 .memtype_reserve_table = msm8960_reserve_table,
584 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
585 .paddr_to_memtype = msm8960_paddr_to_memtype,
586};
587
Larry Basselb4126da2011-07-18 14:31:33 -0700588static int msm8960_memory_bank_size(void)
589{
590 return 1<<29;
591}
592
593static void __init locate_unstable_memory(void)
594{
595 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
596 unsigned long bank_size;
597 unsigned long low, high;
598
599 bank_size = msm8960_memory_bank_size();
600 low = meminfo.bank[0].start;
601 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700602
603 /* Check if 32 bit overflow occured */
604 if (high < mb->start)
605 high = ~0UL;
606
Larry Basselb4126da2011-07-18 14:31:33 -0700607 low &= ~(bank_size - 1);
608
609 if (high - low <= bank_size)
610 return;
Jack Cheung60eaeab2012-01-09 16:40:26 -0800611 msm8960_reserve_info.low_unstable_address = mb->start -
612 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800613 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Olav Haugan62052e42011-10-28 14:28:32 -0700614
Larry Basselb4126da2011-07-18 14:31:33 -0700615 msm8960_reserve_info.bank_size = bank_size;
616 pr_info("low unstable address %lx max size %lx bank size %lx\n",
617 msm8960_reserve_info.low_unstable_address,
618 msm8960_reserve_info.max_unstable_size,
619 msm8960_reserve_info.bank_size);
620}
621
Larry Basselb830e182011-10-14 10:46:55 -0700622static void __init place_movable_zone(void)
623{
624 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
625 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
626 pr_info("movable zone start %lx size %lx\n",
627 movable_reserved_start, movable_reserved_size);
628}
629
630static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700631{
632 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700633 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700634 place_movable_zone();
635}
636
637static void __init msm8960_reserve(void)
638{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700639 msm_reserve();
Larry Bassel41a055b2011-12-06 16:15:14 -0800640 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700641}
642
Larry Bassela4414b12011-08-04 11:11:02 -0700643static int msm8960_change_memory_power(u64 start, u64 size,
644 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700645{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700646 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700647}
648
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700649static void __init msm8960_allocate_memory_regions(void)
650{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800651 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700652}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800653
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700654#ifdef CONFIG_WCD9310_CODEC
655
656#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
657
Patrick Lai3043fba2011-08-01 14:15:57 -0700658/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
659 * 4 micbiases are used to power various analog and digital
660 * microphones operating at 1800 mV. Technically, all micbiases
661 * can source from single cfilter since all microphones operate
662 * at the same voltage level. The arrangement below is to make
663 * sure all cfilters are exercised. LDO_H regulator ouput level
664 * does not need to be as high as 2.85V. It is choosen for
665 * microphone sensitivity purpose.
666 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700667static struct tabla_pdata tabla_platform_data = {
668 .slimbus_slave_device = {
669 .name = "tabla-slave",
670 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
671 },
672 .irq = MSM_GPIO_TO_INT(62),
673 .irq_base = TABLA_INTERRUPT_BASE,
674 .num_irqs = NR_TABLA_IRQS,
675 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700676 .micbias = {
677 .ldoh_v = TABLA_LDOH_2P85_V,
678 .cfilt1_mv = 1800,
679 .cfilt2_mv = 1800,
680 .cfilt3_mv = 1800,
681 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
682 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
683 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
684 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
685 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700686};
687
688static struct slim_device msm_slim_tabla = {
689 .name = "tabla-slim",
690 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
691 .dev = {
692 .platform_data = &tabla_platform_data,
693 },
694};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530695
696static struct tabla_pdata tabla20_platform_data = {
697 .slimbus_slave_device = {
698 .name = "tabla-slave",
699 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
700 },
701 .irq = MSM_GPIO_TO_INT(62),
702 .irq_base = TABLA_INTERRUPT_BASE,
703 .num_irqs = NR_TABLA_IRQS,
704 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
705 .micbias = {
706 .ldoh_v = TABLA_LDOH_2P85_V,
707 .cfilt1_mv = 1800,
708 .cfilt2_mv = 1800,
709 .cfilt3_mv = 1800,
710 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
711 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
712 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
713 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
714 }
715};
716
717static struct slim_device msm_slim_tabla20 = {
718 .name = "tabla2x-slim",
719 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
720 .dev = {
721 .platform_data = &tabla20_platform_data,
722 },
723};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700724#endif
725
726static struct slim_boardinfo msm_slim_devices[] = {
727#ifdef CONFIG_WCD9310_CODEC
728 {
729 .bus_num = 1,
730 .slim_slave = &msm_slim_tabla,
731 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530732 {
733 .bus_num = 1,
734 .slim_slave = &msm_slim_tabla20,
735 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700736#endif
737 /* add more slimbus slaves as needed */
738};
739
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700740#define MSM_WCNSS_PHYS 0x03000000
741#define MSM_WCNSS_SIZE 0x280000
742
743static struct resource resources_wcnss_wlan[] = {
744 {
745 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
746 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
747 .name = "wcnss_wlanrx_irq",
748 .flags = IORESOURCE_IRQ,
749 },
750 {
751 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
752 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
753 .name = "wcnss_wlantx_irq",
754 .flags = IORESOURCE_IRQ,
755 },
756 {
757 .start = MSM_WCNSS_PHYS,
758 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
759 .name = "wcnss_mmio",
760 .flags = IORESOURCE_MEM,
761 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700762 {
763 .start = 84,
764 .end = 88,
765 .name = "wcnss_gpios_5wire",
766 .flags = IORESOURCE_IO,
767 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700768};
769
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700770static struct qcom_wcnss_opts qcom_wcnss_pdata = {
771 .has_48mhz_xo = 1,
772};
773
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700774static struct platform_device msm_device_wcnss_wlan = {
775 .name = "wcnss_wlan",
776 .id = 0,
777 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
778 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700779 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700780};
781
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700782#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
783 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
784 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
785 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
786
787#define QCE_SIZE 0x10000
788#define QCE_0_BASE 0x18500000
789
790#define QCE_HW_KEY_SUPPORT 0
791#define QCE_SHA_HMAC_SUPPORT 1
792#define QCE_SHARE_CE_RESOURCE 1
793#define QCE_CE_SHARED 0
794
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800795/* Begin Bus scaling definitions */
796static struct msm_bus_vectors crypto_hw_init_vectors[] = {
797 {
798 .src = MSM_BUS_MASTER_ADM_PORT0,
799 .dst = MSM_BUS_SLAVE_EBI_CH0,
800 .ab = 0,
801 .ib = 0,
802 },
803 {
804 .src = MSM_BUS_MASTER_ADM_PORT1,
805 .dst = MSM_BUS_SLAVE_GSBI1_UART,
806 .ab = 0,
807 .ib = 0,
808 },
809};
810
811static struct msm_bus_vectors crypto_hw_active_vectors[] = {
812 {
813 .src = MSM_BUS_MASTER_ADM_PORT0,
814 .dst = MSM_BUS_SLAVE_EBI_CH0,
815 .ab = 70000000UL,
816 .ib = 70000000UL,
817 },
818 {
819 .src = MSM_BUS_MASTER_ADM_PORT1,
820 .dst = MSM_BUS_SLAVE_GSBI1_UART,
821 .ab = 2480000000UL,
822 .ib = 2480000000UL,
823 },
824};
825
826static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
827 {
828 ARRAY_SIZE(crypto_hw_init_vectors),
829 crypto_hw_init_vectors,
830 },
831 {
832 ARRAY_SIZE(crypto_hw_active_vectors),
833 crypto_hw_active_vectors,
834 },
835};
836
837static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
838 crypto_hw_bus_scale_usecases,
839 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
840 .name = "cryptohw",
841};
842/* End Bus Scaling Definitions*/
843
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700844static struct resource qcrypto_resources[] = {
845 [0] = {
846 .start = QCE_0_BASE,
847 .end = QCE_0_BASE + QCE_SIZE - 1,
848 .flags = IORESOURCE_MEM,
849 },
850 [1] = {
851 .name = "crypto_channels",
852 .start = DMOV_CE_IN_CHAN,
853 .end = DMOV_CE_OUT_CHAN,
854 .flags = IORESOURCE_DMA,
855 },
856 [2] = {
857 .name = "crypto_crci_in",
858 .start = DMOV_CE_IN_CRCI,
859 .end = DMOV_CE_IN_CRCI,
860 .flags = IORESOURCE_DMA,
861 },
862 [3] = {
863 .name = "crypto_crci_out",
864 .start = DMOV_CE_OUT_CRCI,
865 .end = DMOV_CE_OUT_CRCI,
866 .flags = IORESOURCE_DMA,
867 },
868};
869
870static struct resource qcedev_resources[] = {
871 [0] = {
872 .start = QCE_0_BASE,
873 .end = QCE_0_BASE + QCE_SIZE - 1,
874 .flags = IORESOURCE_MEM,
875 },
876 [1] = {
877 .name = "crypto_channels",
878 .start = DMOV_CE_IN_CHAN,
879 .end = DMOV_CE_OUT_CHAN,
880 .flags = IORESOURCE_DMA,
881 },
882 [2] = {
883 .name = "crypto_crci_in",
884 .start = DMOV_CE_IN_CRCI,
885 .end = DMOV_CE_IN_CRCI,
886 .flags = IORESOURCE_DMA,
887 },
888 [3] = {
889 .name = "crypto_crci_out",
890 .start = DMOV_CE_OUT_CRCI,
891 .end = DMOV_CE_OUT_CRCI,
892 .flags = IORESOURCE_DMA,
893 },
894};
895
896#endif
897
898#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
899 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
900
901static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
902 .ce_shared = QCE_CE_SHARED,
903 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
904 .hw_key_support = QCE_HW_KEY_SUPPORT,
905 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800906 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700907};
908
909static struct platform_device qcrypto_device = {
910 .name = "qcrypto",
911 .id = 0,
912 .num_resources = ARRAY_SIZE(qcrypto_resources),
913 .resource = qcrypto_resources,
914 .dev = {
915 .coherent_dma_mask = DMA_BIT_MASK(32),
916 .platform_data = &qcrypto_ce_hw_suppport,
917 },
918};
919#endif
920
921#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
922 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
923
924static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
925 .ce_shared = QCE_CE_SHARED,
926 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
927 .hw_key_support = QCE_HW_KEY_SUPPORT,
928 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800929 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700930};
931
932static struct platform_device qcedev_device = {
933 .name = "qce",
934 .id = 0,
935 .num_resources = ARRAY_SIZE(qcedev_resources),
936 .resource = qcedev_resources,
937 .dev = {
938 .coherent_dma_mask = DMA_BIT_MASK(32),
939 .platform_data = &qcedev_ce_hw_suppport,
940 },
941};
942#endif
943
Joel Kingb8352a12011-11-15 18:46:24 -0800944#define MDM2AP_ERRFATAL 70
945#define AP2MDM_ERRFATAL 95
946#define MDM2AP_STATUS 69
947#define AP2MDM_STATUS 94
948#define AP2MDM_PMIC_RESET_N 80
949#define AP2MDM_KPDPWR_N 81
950
Joel Kingb8352a12011-11-15 18:46:24 -0800951static struct resource mdm_resources[] = {
952 {
953 .start = MDM2AP_ERRFATAL,
954 .end = MDM2AP_ERRFATAL,
955 .name = "MDM2AP_ERRFATAL",
956 .flags = IORESOURCE_IO,
957 },
958 {
959 .start = AP2MDM_ERRFATAL,
960 .end = AP2MDM_ERRFATAL,
961 .name = "AP2MDM_ERRFATAL",
962 .flags = IORESOURCE_IO,
963 },
964 {
965 .start = MDM2AP_STATUS,
966 .end = MDM2AP_STATUS,
967 .name = "MDM2AP_STATUS",
968 .flags = IORESOURCE_IO,
969 },
970 {
971 .start = AP2MDM_STATUS,
972 .end = AP2MDM_STATUS,
973 .name = "AP2MDM_STATUS",
974 .flags = IORESOURCE_IO,
975 },
976 {
977 .start = AP2MDM_PMIC_RESET_N,
978 .end = AP2MDM_PMIC_RESET_N,
979 .name = "AP2MDM_PMIC_RESET_N",
980 .flags = IORESOURCE_IO,
981 },
982 {
983 .start = AP2MDM_KPDPWR_N,
984 .end = AP2MDM_KPDPWR_N,
985 .name = "AP2MDM_KPDPWR_N",
986 .flags = IORESOURCE_IO,
987 },
988};
989
990static struct mdm_platform_data mdm_platform_data = {
991 .mdm_version = "2.5",
992};
993
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800994static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -0800995 .name = "mdm2_modem",
996 .id = -1,
997 .num_resources = ARRAY_SIZE(mdm_resources),
998 .resource = mdm_resources,
999 .dev = {
1000 .platform_data = &mdm_platform_data,
1001 },
1002};
1003
1004static struct platform_device *mdm_devices[] __initdata = {
1005 &mdm_device,
1006};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001007
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001008#define MSM_SHARED_RAM_PHYS 0x80000000
1009
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001010static void __init msm8960_map_io(void)
1011{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001012 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001013 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001014
1015 if (socinfo_init() < 0)
1016 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001017}
1018
1019static void __init msm8960_init_irq(void)
1020{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001021 struct msm_mpm_device_data *data = NULL;
1022
1023#ifdef CONFIG_MSM_MPM
1024 data = &msm8960_mpm_dev_data;
1025#endif
1026
1027 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001028 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001029 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001030}
1031
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001032static void __init msm8960_init_buses(void)
1033{
1034#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001035 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001036 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1037 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1038 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1039 msm_bus_apps_fabric.dev.platform_data =
1040 &msm_bus_8960_apps_fabric_pdata;
1041 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1042 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1043 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1044 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001045#endif
1046}
1047
1048static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1049 .max_clock_speed = 15060000,
1050};
1051
1052#ifdef CONFIG_USB_MSM_OTG_72K
1053static struct msm_otg_platform_data msm_otg_pdata;
1054#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301055static int wr_phy_init_seq[] = {
1056 0x44, 0x80, /* set VBUS valid threshold
1057 and disconnect valid threshold */
1058 0x38, 0x81, /* update DC voltage level */
1059 0x14, 0x82, /* set preemphasis and rise/fall time */
1060 0x13, 0x83, /* set source impedance adjusment */
1061 -1};
1062
1063static int liquid_v1_phy_init_seq[] = {
1064 0x44, 0x80,/* set VBUS valid threshold
1065 and disconnect valid threshold */
1066 0x3C, 0x81,/* update DC voltage level */
1067 0x18, 0x82,/* set preemphasis and rise/fall time */
1068 0x23, 0x83,/* set source impedance sdjusment */
1069 -1};
1070
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301071#ifdef CONFIG_MSM_BUS_SCALING
1072/* Bandwidth requests (zero) if no vote placed */
1073static struct msm_bus_vectors usb_init_vectors[] = {
1074 {
1075 .src = MSM_BUS_MASTER_SPS,
1076 .dst = MSM_BUS_SLAVE_EBI_CH0,
1077 .ab = 0,
1078 .ib = 0,
1079 },
1080};
1081
1082/* Bus bandwidth requests in Bytes/sec */
1083static struct msm_bus_vectors usb_max_vectors[] = {
1084 {
1085 .src = MSM_BUS_MASTER_SPS,
1086 .dst = MSM_BUS_SLAVE_EBI_CH0,
1087 .ab = 60000000, /* At least 480Mbps on bus. */
1088 .ib = 960000000, /* MAX bursts rate */
1089 },
1090};
1091
1092static struct msm_bus_paths usb_bus_scale_usecases[] = {
1093 {
1094 ARRAY_SIZE(usb_init_vectors),
1095 usb_init_vectors,
1096 },
1097 {
1098 ARRAY_SIZE(usb_max_vectors),
1099 usb_max_vectors,
1100 },
1101};
1102
1103static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1104 usb_bus_scale_usecases,
1105 ARRAY_SIZE(usb_bus_scale_usecases),
1106 .name = "usb",
1107};
1108#endif
1109
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001110static struct msm_otg_platform_data msm_otg_pdata = {
1111 .mode = USB_OTG,
1112 .otg_control = OTG_PMIC_CONTROL,
1113 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001114 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301115 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301116#ifdef CONFIG_MSM_BUS_SCALING
1117 .bus_scale_table = &usb_bus_scale_pdata,
1118#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001119};
1120#endif
1121
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301122#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301123#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301124static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1125 .strobe = 150,
1126 .data = 151,
1127};
1128#else
1129static struct msm_hsic_host_platform_data msm_hsic_pdata;
1130#endif
1131
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001132#define PID_MAGIC_ID 0x71432909
1133#define SERIAL_NUM_MAGIC_ID 0x61945374
1134#define SERIAL_NUMBER_LENGTH 127
1135#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1136
1137struct magic_num_struct {
1138 uint32_t pid;
1139 uint32_t serial_num;
1140};
1141
1142struct dload_struct {
1143 uint32_t reserved1;
1144 uint32_t reserved2;
1145 uint32_t reserved3;
1146 uint16_t reserved4;
1147 uint16_t pid;
1148 char serial_number[SERIAL_NUMBER_LENGTH];
1149 uint16_t reserved5;
1150 struct magic_num_struct magic_struct;
1151};
1152
1153static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1154{
1155 struct dload_struct __iomem *dload = 0;
1156
1157 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1158 if (!dload) {
1159 pr_err("%s: cannot remap I/O memory region: %08x\n",
1160 __func__, DLOAD_USB_BASE_ADD);
1161 return -ENXIO;
1162 }
1163
1164 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1165 __func__, dload, pid, snum);
1166 /* update pid */
1167 dload->magic_struct.pid = PID_MAGIC_ID;
1168 dload->pid = pid;
1169
1170 /* update serial number */
1171 dload->magic_struct.serial_num = 0;
1172 if (!snum) {
1173 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1174 goto out;
1175 }
1176
1177 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001178 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001179out:
1180 iounmap(dload);
1181 return 0;
1182}
1183
1184static struct android_usb_platform_data android_usb_pdata = {
1185 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1186};
1187
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001188static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001189 .name = "android_usb",
1190 .id = -1,
1191 .dev = {
1192 .platform_data = &android_usb_pdata,
1193 },
1194};
1195
1196static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1197 0x03, 0x0f,
1198};
1199
1200static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1201 0x00, 0x24, 0x54, 0x10,
1202 0x09, 0x03, 0x01,
1203 0x10, 0x54, 0x30, 0x0C,
1204 0x24, 0x30, 0x0f,
1205};
1206
1207static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1208 0x00, 0x24, 0x54, 0x10,
1209 0x09, 0x07, 0x01, 0x0B,
1210 0x10, 0x54, 0x30, 0x0C,
1211 0x24, 0x30, 0x0f,
1212};
1213
1214static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1215 [0] = {
1216 .mode = MSM_SPM_MODE_CLOCK_GATING,
1217 .notify_rpm = false,
1218 .cmd = spm_wfi_cmd_sequence,
1219 },
1220 [1] = {
1221 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1222 .notify_rpm = false,
1223 .cmd = spm_power_collapse_without_rpm,
1224 },
1225 [2] = {
1226 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1227 .notify_rpm = true,
1228 .cmd = spm_power_collapse_with_rpm,
1229 },
1230};
1231
1232static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1233 [0] = {
1234 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001235 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001236#if defined(CONFIG_MSM_AVS_HW)
1237 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1238 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1239#endif
1240 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1241 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1242 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1243 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1244 .vctl_timeout_us = 50,
1245 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1246 .modes = msm_spm_seq_list,
1247 },
1248 [1] = {
1249 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001250 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001251#if defined(CONFIG_MSM_AVS_HW)
1252 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1253 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1254#endif
1255 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1256 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1257 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1258 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1259 .vctl_timeout_us = 50,
1260 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1261 .modes = msm_spm_seq_list,
1262 },
1263};
1264
1265static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1266 0x00, 0x20, 0x03, 0x20,
1267 0x00, 0x0f,
1268};
1269
1270static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1271 0x00, 0x20, 0x34, 0x64,
1272 0x48, 0x07, 0x48, 0x20,
1273 0x50, 0x64, 0x04, 0x34,
1274 0x50, 0x0f,
1275};
1276static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1277 0x00, 0x10, 0x34, 0x64,
1278 0x48, 0x07, 0x48, 0x10,
1279 0x50, 0x64, 0x04, 0x34,
1280 0x50, 0x0F,
1281};
1282
1283static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1284 [0] = {
1285 .mode = MSM_SPM_L2_MODE_RETENTION,
1286 .notify_rpm = false,
1287 .cmd = l2_spm_wfi_cmd_sequence,
1288 },
1289 [1] = {
1290 .mode = MSM_SPM_L2_MODE_GDHS,
1291 .notify_rpm = true,
1292 .cmd = l2_spm_gdhs_cmd_sequence,
1293 },
1294 [2] = {
1295 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1296 .notify_rpm = true,
1297 .cmd = l2_spm_power_off_cmd_sequence,
1298 },
1299};
1300
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001301static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1302 [0] = {
1303 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001304 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1305 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1306 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1307 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1308 .modes = msm_spm_l2_seq_list,
1309 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1310 },
1311};
1312
Mohan Pallaka5e490392011-09-09 15:18:41 +05301313#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1314#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1315
1316static struct msm_xo_voter *xo_handle_d1;
1317
1318static int isa1200_power(int on)
1319{
1320 int rc = 0;
1321
1322 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1323
1324 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1325 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1326 if (rc < 0) {
1327 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1328 __func__, on ? "" : "de-", rc);
1329 goto err_xo_vote;
1330 }
1331
1332 return 0;
1333
1334err_xo_vote:
1335 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1336 return rc;
1337}
1338
1339static int isa1200_dev_setup(bool enable)
1340{
1341 int rc = 0;
1342
1343 struct pm_gpio hap_gpio_config = {
1344 .direction = PM_GPIO_DIR_OUT,
1345 .pull = PM_GPIO_PULL_NO,
1346 .out_strength = PM_GPIO_STRENGTH_HIGH,
1347 .function = PM_GPIO_FUNC_NORMAL,
1348 .inv_int_pol = 0,
1349 .vin_sel = 2,
1350 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1351 .output_value = 0,
1352 };
1353
1354 if (enable == true) {
1355 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1356 if (rc) {
1357 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1358 __func__, PM_HAP_EN_GPIO, rc);
1359 return rc;
1360 }
1361
1362 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1363 if (rc) {
1364 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1365 __func__, PM_HAP_LEN_GPIO, rc);
1366 return rc;
1367 }
1368
1369 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1370 if (rc) {
1371 pr_err("%s: unable to request gpio %d (%d)\n",
1372 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1373 return rc;
1374 }
1375
1376 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1377 if (rc) {
1378 pr_err("%s: Unable to set direction\n", __func__);
1379 goto free_gpio;
1380 }
1381
1382 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1383 if (IS_ERR(xo_handle_d1)) {
1384 rc = PTR_ERR(xo_handle_d1);
1385 pr_err("%s: failed to get the handle for D1(%d)\n",
1386 __func__, rc);
1387 goto gpio_set_dir;
1388 }
1389 } else {
1390 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1391
1392 msm_xo_put(xo_handle_d1);
1393 }
1394
1395 return 0;
1396
1397gpio_set_dir:
1398 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1399free_gpio:
1400 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1401 return rc;
1402}
1403
1404static struct isa1200_regulator isa1200_reg_data[] = {
1405 {
1406 .name = "vcc_i2c",
1407 .min_uV = ISA_I2C_VTG_MIN_UV,
1408 .max_uV = ISA_I2C_VTG_MAX_UV,
1409 .load_uA = ISA_I2C_CURR_UA,
1410 },
1411};
1412
1413static struct isa1200_platform_data isa1200_1_pdata = {
1414 .name = "vibrator",
1415 .dev_setup = isa1200_dev_setup,
1416 .power_on = isa1200_power,
1417 .hap_en_gpio = PM_HAP_EN_GPIO,
1418 .hap_len_gpio = PM_HAP_LEN_GPIO,
1419 .max_timeout = 15000,
1420 .mode_ctrl = PWM_GEN_MODE,
1421 .pwm_fd = {
1422 .pwm_div = 256,
1423 },
1424 .is_erm = false,
1425 .smart_en = true,
1426 .ext_clk_en = true,
1427 .chip_en = 1,
1428 .regulator_info = isa1200_reg_data,
1429 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1430};
1431
1432static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1433 {
1434 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301435 },
1436};
1437
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001438#define CYTTSP_TS_GPIO_IRQ 11
1439#define CYTTSP_TS_SLEEP_GPIO 50
1440#define CYTTSP_TS_RESOUT_N_GPIO 52
1441
1442/*virtual key support */
1443static ssize_t tma340_vkeys_show(struct kobject *kobj,
1444 struct kobj_attribute *attr, char *buf)
1445{
1446 return snprintf(buf, 200,
1447 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1448 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1449 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1450 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1451 "\n");
1452}
1453
1454static struct kobj_attribute tma340_vkeys_attr = {
1455 .attr = {
1456 .mode = S_IRUGO,
1457 },
1458 .show = &tma340_vkeys_show,
1459};
1460
1461static struct attribute *tma340_properties_attrs[] = {
1462 &tma340_vkeys_attr.attr,
1463 NULL
1464};
1465
1466static struct attribute_group tma340_properties_attr_group = {
1467 .attrs = tma340_properties_attrs,
1468};
1469
1470
1471static int cyttsp_platform_init(struct i2c_client *client)
1472{
1473 int rc = 0;
1474 static struct kobject *tma340_properties_kobj;
1475
1476 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1477 tma340_properties_kobj = kobject_create_and_add("board_properties",
1478 NULL);
1479 if (tma340_properties_kobj)
1480 rc = sysfs_create_group(tma340_properties_kobj,
1481 &tma340_properties_attr_group);
1482 if (!tma340_properties_kobj || rc)
1483 pr_err("%s: failed to create board_properties\n",
1484 __func__);
1485
1486 return 0;
1487}
1488
1489static struct cyttsp_regulator regulator_data[] = {
1490 {
1491 .name = "vdd",
1492 .min_uV = CY_TMA300_VTG_MIN_UV,
1493 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301494 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1495 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001496 },
1497 /* TODO: Remove after runtime PM is enabled in I2C driver */
1498 {
1499 .name = "vcc_i2c",
1500 .min_uV = CY_I2C_VTG_MIN_UV,
1501 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301502 .hpm_load_uA = CY_I2C_CURR_UA,
1503 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001504 },
1505};
1506
1507static struct cyttsp_platform_data cyttsp_pdata = {
1508 .panel_maxx = 634,
1509 .panel_maxy = 1166,
1510 .disp_maxx = 616,
1511 .disp_maxy = 1023,
1512 .disp_minx = 0,
1513 .disp_miny = 16,
1514 .flags = 0x01,
1515 .gen = CY_GEN3, /* or */
1516 .use_st = CY_USE_ST,
1517 .use_mt = CY_USE_MT,
1518 .use_hndshk = CY_SEND_HNDSHK,
1519 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301520 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001521 .use_gestures = CY_USE_GESTURES,
1522 .fw_fname = "cyttsp_8960_cdp.hex",
1523 /* activate up to 4 groups
1524 * and set active distance
1525 */
1526 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1527 CY_GEST_GRP3 | CY_GEST_GRP4 |
1528 CY_ACT_DIST,
1529 /* change act_intrvl to customize the Active power state
1530 * scanning/processing refresh interval for Operating mode
1531 */
1532 .act_intrvl = CY_ACT_INTRVL_DFLT,
1533 /* change tch_tmout to customize the touch timeout for the
1534 * Active power state for Operating mode
1535 */
1536 .tch_tmout = CY_TCH_TMOUT_DFLT,
1537 /* change lp_intrvl to customize the Low Power power state
1538 * scanning/processing refresh interval for Operating mode
1539 */
1540 .lp_intrvl = CY_LP_INTRVL_DFLT,
1541 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1542 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1543 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1544 .regulator_info = regulator_data,
1545 .num_regulators = ARRAY_SIZE(regulator_data),
1546 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301547 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001548};
1549
1550static struct i2c_board_info cyttsp_info[] __initdata = {
1551 {
1552 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1553 .platform_data = &cyttsp_pdata,
1554#ifndef CY_USE_TIMER
1555 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1556#endif /* CY_USE_TIMER */
1557 },
1558};
1559
Jing Lindc4413c2012-01-16 15:22:52 -08001560/* configuration data for mxt1386 */
1561static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301562 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001563 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301564 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001565 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001566 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1567 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1568 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1569 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1570 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1571 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301572 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001573 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05301574 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001575 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05301576 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001577 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
1578 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
1579 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
1580 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05301581 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001582 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1583 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05301584 /* T18 Object */
1585 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301586 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001587 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
1588 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301589 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001590 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1591 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301592 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001593 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
1594 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301595 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001596 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301597 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001598 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05301599 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001600 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301601 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001602 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301603 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001604 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301605};
1606
Jing Lin33b007d2011-12-21 17:40:23 -08001607/* configuration data for mxt1386e using V1.0 firmware */
1608static const u8 mxt1386e_config_data_v1_0[] = {
1609 /* T6 Object */
1610 0, 0, 0, 0, 0, 0,
1611 /* T38 Object */
1612 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
1613 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1614 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1615 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1616 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1617 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1618 0, 0, 0, 0,
1619 /* T7 Object */
1620 100, 16, 50,
1621 /* T8 Object */
1622 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1623 /* T9 Object */
1624 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1625 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1626 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1627 10, 5, 0, 0, 0,
1628 /* T18 Object */
1629 0, 0,
1630 /* T24 Object */
1631 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1632 0, 0, 0, 0, 0, 0, 0, 0, 0,
1633 /* T25 Object */
1634 3, 0, 60, 115, 156, 99,
1635 /* T27 Object */
1636 0, 0, 0, 0, 0, 0, 0,
1637 /* T40 Object */
1638 0, 0, 0, 0, 0,
1639 /* T42 Object */
1640 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1641 /* T43 Object */
1642 0, 0, 0, 0, 0, 0, 0,
1643 /* T46 Object */
1644 64, 0, 20, 20, 0, 0, 0, 0, 0,
1645 /* T47 Object */
1646 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1647 /* T48 Object */
1648 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1649 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1650 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1651 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1652 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1653 0, 0, 0, 0,
1654 /* T56 Object */
1655 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1656 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1657 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1658 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1659 2, 99, 33,
1660};
1661
1662/* configuration data for mxt1386e using V2.1 firmware */
1663static const u8 mxt1386e_config_data_v2_1[] = {
1664 /* T6 Object */
1665 0, 0, 0, 0, 0, 0,
1666 /* T38 Object */
1667 12, 2, 0, 17, 1, 12, 0, 0, 0, 0,
1668 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1669 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1670 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1671 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1672 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1673 0, 0, 0, 0,
1674 /* T7 Object */
1675 100, 16, 50,
1676 /* T8 Object */
1677 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
1678 /* T9 Object */
1679 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1680 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
1681 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
1682 10, 5, 0, 0, 0,
1683 /* T18 Object */
1684 0, 0,
1685 /* T24 Object */
1686 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1687 0, 0, 0, 0, 0, 0, 0, 0, 0,
1688 /* T25 Object */
1689 3, 0, 60, 115, 156, 99,
1690 /* T27 Object */
1691 0, 0, 0, 0, 0, 0, 0,
1692 /* T40 Object */
1693 0, 0, 0, 0, 0,
1694 /* T42 Object */
1695 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
1696 /* T43 Object */
1697 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1698 16,
1699 /* T46 Object */
1700 64, 0, 20, 20, 0, 0, 0, 0, 0,
1701 /* T47 Object */
1702 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1703 /* T48 Object */
1704 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
1705 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
1706 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1707 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
1708 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1709 0, 0, 0, 0,
1710 /* T56 Object */
1711 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1712 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1713 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1714 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1715 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
1716 255,
1717};
1718
Amy Maloche08266db2011-11-04 11:07:16 -07001719#define MXT_TS_GPIO_IRQ 11
1720#define MXT_TS_LDO_EN_GPIO 50
1721#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05301722
1723static void mxt_init_hw_liquid(void)
1724{
1725 int rc;
1726
Mohan Pallaka50837382011-09-07 11:00:57 +05301727 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
1728 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001729 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
1730 __func__, MXT_TS_LDO_EN_GPIO);
1731 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05301732 }
1733
1734 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
1735 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07001736 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
1737 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301738 goto err_ldo_gpio_req;
1739 }
1740
Mohan Pallaka50837382011-09-07 11:00:57 +05301741 return;
1742
Mohan Pallaka50837382011-09-07 11:00:57 +05301743err_ldo_gpio_req:
1744 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05301745}
1746
Jing Lindc4413c2012-01-16 15:22:52 -08001747static struct mxt_config_info mxt_config_array[] = {
1748 {
1749 .config = mxt1386_config_data,
1750 .config_length = ARRAY_SIZE(mxt1386_config_data),
1751 .family_id = 0xA0,
1752 .variant_id = 0x0,
1753 .version = 0x10,
1754 .build = 0xAA,
1755 },
Jing Lin33b007d2011-12-21 17:40:23 -08001756 {
1757 .config = mxt1386e_config_data_v1_0,
1758 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
1759 .family_id = 0xA0,
1760 .variant_id = 0x2,
1761 .version = 0x10,
1762 .build = 0xAA,
1763 },
1764 {
1765 .config = mxt1386e_config_data_v2_1,
1766 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1767 .family_id = 0xA0,
1768 .variant_id = 0x7,
1769 .version = 0x21,
1770 .build = 0xAA,
1771 },
Jing Lindc4413c2012-01-16 15:22:52 -08001772};
1773
Mohan Pallaka50837382011-09-07 11:00:57 +05301774static struct mxt_platform_data mxt_platform_data = {
Jing Lindc4413c2012-01-16 15:22:52 -08001775 .config_array = mxt_config_array,
1776 .config_array_size = ARRAY_SIZE(mxt_config_array),
Jing Lin2f863172011-10-17 10:56:58 -07001777 .x_size = 1365,
1778 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05301779 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07001780 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07001781 .reset_gpio = MXT_TS_RESET_GPIO,
1782 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05301783};
1784
1785static struct i2c_board_info mxt_device_info[] __initdata = {
1786 {
1787 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1788 .platform_data = &mxt_platform_data,
1789 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1790 },
1791};
1792
Eugene Yasmand2316b82011-12-07 18:23:48 +02001793static struct i2c_board_info sii_device_info[] __initdata = {
1794 {
1795 I2C_BOARD_INFO("Sil-9244", 0x39),
1796 .flags = I2C_CLIENT_WAKE,
1797 .irq = MSM_GPIO_TO_INT(15),
1798 },
1799};
1800
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001801static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1802 .clk_freq = 100000,
1803 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001804};
1805
1806static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1807 .clk_freq = 100000,
1808 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001809};
1810
1811static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1812 .clk_freq = 100000,
1813 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001814};
1815
1816static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1817 .clk_freq = 100000,
1818 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001819};
1820
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06001821static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
1822 .base_addr = MSM_ACC0_BASE + 0x08,
1823 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
1824 .mask = 1UL << 13,
1825};
1826
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001827static struct ks8851_pdata spi_eth_pdata = {
1828 .irq_gpio = KS8851_IRQ_GPIO,
1829 .rst_gpio = KS8851_RST_GPIO,
1830};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06001831
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001832static struct spi_board_info spi_board_info[] __initdata = {
1833 {
1834 .modalias = "ks8851",
1835 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1836 .max_speed_hz = 19200000,
1837 .bus_num = 0,
1838 .chip_select = 0,
1839 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07001840 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001841 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001842 {
1843 .modalias = "dsi_novatek_3d_panel_spi",
1844 .max_speed_hz = 10800000,
1845 .bus_num = 0,
1846 .chip_select = 1,
1847 .mode = SPI_MODE_0,
1848 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001849};
1850
1851static struct platform_device msm_device_saw_core0 = {
1852 .name = "saw-regulator",
1853 .id = 0,
1854 .dev = {
1855 .platform_data = &msm_saw_regulator_pdata_s5,
1856 },
1857};
1858
1859static struct platform_device msm_device_saw_core1 = {
1860 .name = "saw-regulator",
1861 .id = 1,
1862 .dev = {
1863 .platform_data = &msm_saw_regulator_pdata_s6,
1864 },
1865};
1866
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001867static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001868 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07001869 .tsens_factor = 1000,
1870 .hw_type = MSM_8960,
1871 .tsens_num_sensor = 5,
1872};
1873
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001874#ifdef CONFIG_MSM_FAKE_BATTERY
1875static struct platform_device fish_battery_device = {
1876 .name = "fish_battery",
1877};
1878#endif
1879
David Collins26f05562011-06-20 09:56:28 -07001880static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001881 .name = GPIO_REGULATOR_DEV_NAME,
1882 .id = PM8921_MPP_PM_TO_SYS(7),
1883 .dev = {
1884 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1885 },
1886};
1887
David Collins26f05562011-06-20 09:56:28 -07001888static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001889 .name = GPIO_REGULATOR_DEV_NAME,
1890 .id = 91,
1891 .dev = {
1892 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1893 },
1894};
1895
David Collinsb10be1d2011-09-02 10:29:31 -07001896static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
1897 .name = GPIO_REGULATOR_DEV_NAME,
1898 .id = PM8921_GPIO_PM_TO_SYS(17),
1899 .dev = {
1900 .platform_data =
1901 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
1902 },
1903};
1904
David Collins35a78f52011-12-14 15:54:25 -08001905static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
1906 .name = GPIO_REGULATOR_DEV_NAME,
1907 .id = PM8921_GPIO_PM_TO_SYS(42),
1908 .dev = {
1909 .platform_data =
1910 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
1911 },
1912};
1913
David Collins26f05562011-06-20 09:56:28 -07001914static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
1915 .name = "rpm-regulator",
1916 .id = -1,
1917 .dev = {
1918 .platform_data = &msm_rpm_regulator_pdata,
1919 },
1920};
1921
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001922static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07001923 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001924 &msm_device_smd,
1925 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05301926 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001927 &msm_device_saw_core0,
1928 &msm_device_saw_core1,
1929 &msm8960_device_ext_5v_vreg,
David Collins35a78f52011-12-14 15:54:25 -08001930 &msm8960_device_ext_otg_sw_vreg,
David Collins87579612012-01-30 16:00:15 -08001931 &msm8960_device_ssbi_pmic,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001932 &msm8960_device_qup_spi_gsbi1,
1933 &msm8960_device_qup_i2c_gsbi3,
1934 &msm8960_device_qup_i2c_gsbi4,
1935 &msm8960_device_qup_i2c_gsbi10,
1936#ifndef CONFIG_MSM_DSPS
1937 &msm8960_device_qup_i2c_gsbi12,
1938#endif
1939 &msm_slim_ctrl,
1940 &msm_device_wcnss_wlan,
1941#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1942 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1943 &qcrypto_device,
1944#endif
1945
1946#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1947 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1948 &qcedev_device,
1949#endif
1950#ifdef CONFIG_MSM_ROTATOR
1951 &msm_rotator_device,
1952#endif
1953 &msm_device_sps,
1954#ifdef CONFIG_MSM_FAKE_BATTERY
1955 &fish_battery_device,
1956#endif
Larry Bassel41a055b2011-12-06 16:15:14 -08001957 &fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001958#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07001959#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001960 &android_pmem_device,
1961 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07001962#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001963 &android_pmem_audio_device,
1964#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001965 &msm_device_vidc,
1966 &msm_device_bam_dmux,
1967 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07001968
1969#ifdef CONFIG_HW_RANDOM_MSM
1970 &msm_device_rng,
1971#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001972#ifdef CONFIG_ION_MSM
1973 &ion_dev,
1974#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06001975 &msm8960_rpm_device,
1976 &msm8960_rpm_log_device,
1977 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07001978 &msm_device_tz_log,
Pratik Patel7831c082011-06-08 21:44:37 -07001979#ifdef CONFIG_MSM_QDSS
1980 &msm_etb_device,
1981 &msm_tpiu_device,
1982 &msm_funnel_device,
1983 &msm_ptm_device,
1984#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07001985 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07001986 &msm8960_device_watchdog,
Laura Abbottf8c03b92012-02-16 14:57:58 -08001987#ifdef CONFIG_MSM_RTB
1988 &msm_rtb_device,
1989#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001990};
1991
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001992static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001993 &msm8960_device_otg,
1994 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001995 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05301996 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001997 &android_usb_device,
1998 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001999 &msm_bus_apps_fabric,
2000 &msm_bus_sys_fabric,
2001 &msm_bus_mm_fabric,
2002 &msm_bus_sys_fpb,
2003 &msm_bus_cpss_fpb,
2004 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002005 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002006 &msm_pcm_routing,
2007 &msm_cpudai0,
2008 &msm_cpudai1,
2009 &msm_cpudai_hdmi_rx,
2010 &msm_cpudai_bt_rx,
2011 &msm_cpudai_bt_tx,
2012 &msm_cpudai_fm_rx,
2013 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002014 &msm_cpudai_auxpcm_rx,
2015 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002016 &msm_cpu_fe,
2017 &msm_stub_codec,
2018 &msm_voice,
2019 &msm_voip,
2020 &msm_lpa_pcm,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302021 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002022 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002023 &msm_cpudai_incall_record_rx,
2024 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002025
2026#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2027 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2028 &qcrypto_device,
2029#endif
2030
2031#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2032 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2033 &qcedev_device,
2034#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002035};
2036
2037static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002038 &msm_kgsl_3d0,
2039 &msm_kgsl_2d0,
2040 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002041#ifdef CONFIG_MSM_GEMINI
2042 &msm8960_gemini_device,
2043#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002044};
2045
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002046static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002047 &msm_8960_q6_lpass,
2048 &msm_8960_q6_mss_fw,
2049 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002050 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002051 &msm_pil_tzapps,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002052 &msm8960_device_otg,
2053 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002054 &msm_device_hsusb_host,
2055 &android_usb_device,
2056 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002057 &msm_multi_ch_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002058 &msm_pcm_routing,
2059 &msm_cpudai0,
2060 &msm_cpudai1,
2061 &msm_cpudai_hdmi_rx,
2062 &msm_cpudai_bt_rx,
2063 &msm_cpudai_bt_tx,
2064 &msm_cpudai_fm_rx,
2065 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002066 &msm_cpudai_auxpcm_rx,
2067 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002068 &msm_cpu_fe,
2069 &msm_stub_codec,
2070 &msm_kgsl_3d0,
2071#ifdef CONFIG_MSM_KGSL_2D
2072 &msm_kgsl_2d0,
2073 &msm_kgsl_2d1,
2074#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002075#ifdef CONFIG_MSM_GEMINI
2076 &msm8960_gemini_device,
2077#endif
2078 &msm_voice,
2079 &msm_voip,
2080 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302081 &msm_cpudai_afe_01_rx,
2082 &msm_cpudai_afe_01_tx,
2083 &msm_cpudai_afe_02_rx,
2084 &msm_cpudai_afe_02_tx,
2085 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302086 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002087 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002088 &msm_cpudai_incall_record_rx,
2089 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002090 &msm_pcm_hostless,
2091 &msm_bus_apps_fabric,
2092 &msm_bus_sys_fabric,
2093 &msm_bus_mm_fabric,
2094 &msm_bus_sys_fpb,
2095 &msm_bus_cpss_fpb,
2096};
2097
2098static void __init msm8960_i2c_init(void)
2099{
2100 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2101 &msm8960_i2c_qup_gsbi4_pdata;
2102
2103 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2104 &msm8960_i2c_qup_gsbi3_pdata;
2105
2106 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2107 &msm8960_i2c_qup_gsbi10_pdata;
2108
2109 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2110 &msm8960_i2c_qup_gsbi12_pdata;
2111}
2112
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002113static void __init msm8960_gfx_init(void)
2114{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002115 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002116 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2117 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2118 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002119 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2120 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002121 }
2122}
2123
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002124static struct msm_cpuidle_state msm_cstates[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002125
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002126 {0, 0, "C0", "WFI",
2127 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
2128
2129 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
2130 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
2131
2132 {0, 2, "C2", "POWER_COLLAPSE",
2133 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
2134
2135 {1, 0, "C0", "WFI",
2136 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
2137
2138 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
2139 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
2140};
2141
2142static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
2143 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
2144 .idle_supported = 1,
2145 .suspend_supported = 1,
2146 .idle_enabled = 0,
2147 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002148 },
2149
2150 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
2151 .idle_supported = 1,
2152 .suspend_supported = 1,
2153 .idle_enabled = 0,
2154 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002155 },
2156
2157 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
2158 .idle_supported = 1,
2159 .suspend_supported = 1,
2160 .idle_enabled = 1,
2161 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002162 },
2163
2164 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
2165 .idle_supported = 0,
2166 .suspend_supported = 1,
2167 .idle_enabled = 0,
2168 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002169 },
2170
2171 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
2172 .idle_supported = 1,
2173 .suspend_supported = 1,
2174 .idle_enabled = 0,
2175 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002176 },
2177
2178 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
2179 .idle_supported = 1,
2180 .suspend_supported = 0,
2181 .idle_enabled = 1,
2182 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002183 },
2184};
2185
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302186static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002187 {
2188 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2189 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2190 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002191 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002192 },
2193
2194 {
2195 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2196 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2197 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002198 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002199 },
2200
2201 {
2202 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2203 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2204 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002205 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002206 },
2207
2208 {
2209 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2210 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2211 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002212 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002213 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002214 {
2215 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2216 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2217 false,
2218 7000, 3500, 66600000, 5150,
2219 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002220
2221 {
2222 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2223 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2224 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002225 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002226 },
2227
2228 {
2229 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2230 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2231 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002232 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002233 },
2234
2235 {
2236 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2237 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2238 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002239 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002240 },
2241
2242 {
2243 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2244 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2245 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002246 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002247 },
2248};
2249
Praveen Chidambaram78499012011-11-01 17:15:17 -06002250static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2251 .levels = &msm_rpmrs_levels[0],
2252 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2253 .vdd_mem_levels = {
2254 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2255 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2256 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2257 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2258 },
2259 .vdd_dig_levels = {
2260 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2261 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2262 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2263 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2264 },
2265 .vdd_mask = 0x7FFFFF,
2266 .rpmrs_target_id = {
2267 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2268 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2269 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2270 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2271 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2272 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2273 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2274 },
2275};
2276
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002277static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2278 .mode = MSM_PM_BOOT_CONFIG_TZ,
2279};
2280
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302281uint32_t msm_rpm_get_swfi_latency(void)
2282{
2283 int i;
2284
2285 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
2286 if (msm_rpmrs_levels[i].sleep_mode ==
2287 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
2288 return msm_rpmrs_levels[i].latency_us;
2289 }
2290
2291 return 0;
2292}
2293
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002294#ifdef CONFIG_I2C
2295#define I2C_SURF 1
2296#define I2C_FFA (1 << 1)
2297#define I2C_RUMI (1 << 2)
2298#define I2C_SIM (1 << 3)
2299#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002300#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002301
2302struct i2c_registry {
2303 u8 machs;
2304 int bus;
2305 struct i2c_board_info *info;
2306 int len;
2307};
2308
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309/* Sensors DSPS platform data */
2310#ifdef CONFIG_MSM_DSPS
2311#define DSPS_PIL_GENERIC_NAME "dsps"
2312#endif /* CONFIG_MSM_DSPS */
2313
2314static void __init msm8960_init_dsps(void)
2315{
2316#ifdef CONFIG_MSM_DSPS
2317 struct msm_dsps_platform_data *pdata =
2318 msm_dsps_device.dev.platform_data;
2319 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2320 pdata->gpios = NULL;
2321 pdata->gpios_num = 0;
2322
2323 platform_device_register(&msm_dsps_device);
2324#endif /* CONFIG_MSM_DSPS */
2325}
2326
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002327static int hsic_peripheral_status = 1;
2328static DEFINE_MUTEX(hsic_status_lock);
2329
2330void peripheral_connect()
2331{
2332 mutex_lock(&hsic_status_lock);
2333 if (hsic_peripheral_status)
2334 goto out;
2335 platform_device_add(&msm_device_hsic_host);
2336 hsic_peripheral_status = 1;
2337out:
2338 mutex_unlock(&hsic_status_lock);
2339}
2340EXPORT_SYMBOL(peripheral_connect);
2341
2342void peripheral_disconnect()
2343{
2344 mutex_lock(&hsic_status_lock);
2345 if (!hsic_peripheral_status)
2346 goto out;
2347 platform_device_del(&msm_device_hsic_host);
2348 hsic_peripheral_status = 0;
2349out:
2350 mutex_unlock(&hsic_status_lock);
2351}
2352EXPORT_SYMBOL(peripheral_disconnect);
2353
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002354static void __init msm8960_init_hsic(void)
2355{
2356#ifdef CONFIG_USB_EHCI_MSM_HSIC
2357 uint32_t version = socinfo_get_version();
2358
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002359 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002360 return;
2361
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002362 if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08002363 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002364#endif
2365}
2366
Amir Samuelov5137e392011-09-21 17:31:25 +03002367#ifdef CONFIG_ISL9519_CHARGER
2368static struct isl_platform_data isl_data __initdata = {
2369 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2370 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2371 .max_system_voltage = 4200,
2372 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02002373 .chgcurrent = 1900,
2374 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03002375 .input_current = 2048,
2376};
2377
2378static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2379 {
2380 I2C_BOARD_INFO("isl9519q", 0x9),
2381 .irq = 0, /* Not required when notify-by-pmic */
2382 .platform_data = &isl_data,
2383 },
2384};
2385#endif /* CONFIG_ISL9519_CHARGER */
2386
Amir Samuelov755616d2011-12-13 16:34:46 +02002387static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
2388 {
2389 I2C_BOARD_INFO("sx1508q", 0x20),
2390 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
2391 },
2392};
2393
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002394static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03002395#ifdef CONFIG_ISL9519_CHARGER
2396 {
2397 I2C_LIQUID,
2398 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2399 isl_charger_i2c_info,
2400 ARRAY_SIZE(isl_charger_i2c_info),
2401 },
2402#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002403 {
2404 I2C_SURF | I2C_FFA | I2C_FLUID,
2405 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2406 cyttsp_info,
2407 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002408 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302409 {
2410 I2C_LIQUID,
2411 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2412 mxt_device_info,
2413 ARRAY_SIZE(mxt_device_info),
2414 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302415 {
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302416 I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302417 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002418 sii_device_info,
2419 ARRAY_SIZE(sii_device_info),
2420 },
2421 {
2422 I2C_LIQUID,
2423 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05302424 msm_isa1200_board_info,
2425 ARRAY_SIZE(msm_isa1200_board_info),
2426 },
Amir Samuelov755616d2011-12-13 16:34:46 +02002427 {
2428 I2C_LIQUID,
2429 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2430 liquid_io_expander_i2c_info,
2431 ARRAY_SIZE(liquid_io_expander_i2c_info),
2432 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002433};
2434#endif /* CONFIG_I2C */
2435
2436static void __init register_i2c_devices(void)
2437{
2438#ifdef CONFIG_I2C
2439 u8 mach_mask = 0;
2440 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002441#ifdef CONFIG_MSM_CAMERA
2442 struct i2c_registry msm8960_camera_i2c_devices = {
2443 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2444 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2445 msm8960_camera_board_info.board_info,
2446 msm8960_camera_board_info.num_i2c_board_info,
2447 };
2448#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002449
2450 /* Build the matching 'supported_machs' bitmask */
2451 if (machine_is_msm8960_cdp())
2452 mach_mask = I2C_SURF;
2453 else if (machine_is_msm8960_rumi3())
2454 mach_mask = I2C_RUMI;
2455 else if (machine_is_msm8960_sim())
2456 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002457 else if (machine_is_msm8960_fluid())
2458 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002459 else if (machine_is_msm8960_liquid())
2460 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002461 else if (machine_is_msm8960_mtp())
2462 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002463 else
2464 pr_err("unmatched machine ID in register_i2c_devices\n");
2465
2466 /* Run the array and install devices as appropriate */
2467 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2468 if (msm8960_i2c_devices[i].machs & mach_mask)
2469 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2470 msm8960_i2c_devices[i].info,
2471 msm8960_i2c_devices[i].len);
2472 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002473#ifdef CONFIG_MSM_CAMERA
2474 if (msm8960_camera_i2c_devices.machs & mach_mask)
2475 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
2476 msm8960_camera_i2c_devices.info,
2477 msm8960_camera_i2c_devices.len);
2478#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002479#endif
2480}
2481
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002482static void __init msm8960_sim_init(void)
2483{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002484 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2485 &msm8960_device_watchdog.dev.platform_data;
2486
2487 wdog_pdata->bark_time = 15000;
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002488 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002489 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2490 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002491 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002492 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002493 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002494 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002495
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002496 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002497 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002498 msm8960_i2c_init();
2499 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2500 msm_spm_l2_init(msm_spm_l2_data);
2501 msm8960_init_buses();
2502 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002503 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002504 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002505 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002506
2507 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2508 &msm8960_qup_spi_gsbi1_pdata;
2509 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2510
2511 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002512 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002513 slim_register_board_info(msm_slim_devices,
2514 ARRAY_SIZE(msm_slim_devices));
2515 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2516 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2517 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2518 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002519 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002520 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002521}
2522
2523static void __init msm8960_rumi3_init(void)
2524{
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002525 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002526 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2527 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002528 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002529 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002530 msm_clock_init(&msm8960_dummy_clock_init_data);
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002531 msm8960_init_gpiomux();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002532 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002533 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2534 &msm8960_qup_spi_gsbi1_pdata;
2535 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2536 msm8960_i2c_init();
2537 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2538 msm_spm_l2_init(msm_spm_l2_data);
2539 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002540 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002541 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002542 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002543 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002544 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002545 slim_register_board_info(msm_slim_devices,
2546 ARRAY_SIZE(msm_slim_devices));
2547 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2548 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2549 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2550 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002551 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002552 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002553}
2554
2555static void __init msm8960_cdp_init(void)
2556{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002557 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2558 pr_err("meminfo_init() failed!\n");
2559
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002560 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002561 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
2562 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002563
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002564 regulator_suppress_info_printing();
2565 if (msm_xo_init())
2566 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002567 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002568 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302569 if (machine_is_msm8960_liquid())
2570 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002571 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05302572 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2573 machine_is_msm8960_cdp()) {
2574 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
2575 } else if (machine_is_msm8960_liquid()) {
2576 msm_otg_pdata.phy_init_seq =
2577 liquid_v1_phy_init_seq;
2578 }
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05302579 msm_otg_pdata.swfi_latency =
2580 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302581#ifdef CONFIG_USB_EHCI_MSM_HSIC
2582 if (machine_is_msm8960_liquid()) {
2583 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2584 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2585 }
2586#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302587 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002588 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002589 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2590 &msm8960_qup_spi_gsbi1_pdata;
2591 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002592
2593 msm8960_init_pmic();
Mohan Pallakaf69f0492011-11-21 13:08:33 +05302594 if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
2595 (machine_is_msm8960_mtp())) || machine_is_msm8960_liquid())
2596 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002597 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002598 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002599 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2600 msm_spm_l2_init(msm_spm_l2_data);
2601 msm8960_init_buses();
2602 platform_add_devices(msm_footswitch_devices,
2603 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002604 if (machine_is_msm8960_liquid())
2605 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08002606 if (machine_is_msm8960_cdp())
2607 platform_device_register(&msm8960_device_ext_l2_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002608 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002609 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002610 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002611 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002612 msm8960_init_cam();
2613 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002614 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302615 if (machine_is_msm8960_liquid())
2616 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002617 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002618 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002619 slim_register_board_info(msm_slim_devices,
2620 ARRAY_SIZE(msm_slim_devices));
2621 msm8960_init_dsps();
2622 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2623 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2624 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2625 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002626 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002627 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Maheshkumar Sivasubramanian6866b1c2011-06-07 14:20:33 -06002628 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Joel Kingb8352a12011-11-15 18:46:24 -08002629 if (PLATFORM_IS_CHARM25())
2630 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002631}
2632
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002633MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2634 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002635 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002636 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302637 .handle_irq = gic_handle_irq,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002638 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002639 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002640 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002641 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002642MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002643
2644MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2645 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002646 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002647 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302648 .handle_irq = gic_handle_irq,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002649 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002650 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002651 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002652 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002653MACHINE_END
2654
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002655MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
2656 .map_io = msm8960_map_io,
2657 .reserve = msm8960_reserve,
2658 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302659 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002660 .timer = &msm_timer,
2661 .init_machine = msm8960_cdp_init,
2662 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002663 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002664MACHINE_END
2665
2666MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
2667 .map_io = msm8960_map_io,
2668 .reserve = msm8960_reserve,
2669 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302670 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002671 .timer = &msm_timer,
2672 .init_machine = msm8960_cdp_init,
2673 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002674 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002675MACHINE_END
2676
2677MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
2678 .map_io = msm8960_map_io,
2679 .reserve = msm8960_reserve,
2680 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302681 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002682 .timer = &msm_timer,
2683 .init_machine = msm8960_cdp_init,
2684 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002685 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002686MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002687
2688MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
2689 .map_io = msm8960_map_io,
2690 .reserve = msm8960_reserve,
2691 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302692 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002693 .timer = &msm_timer,
2694 .init_machine = msm8960_cdp_init,
2695 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002696 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03002697MACHINE_END