blob: fbcc6f1b1665b8099268d54f6ae67ef9512b544a [file] [log] [blame]
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
Stepan Moskovchenko39236d72011-11-30 17:42:23 -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 *
12 */
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -080013#include <linux/err.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080014#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/irq.h>
18#include <linux/i2c.h>
19#include <linux/i2c/sx150x.h>
20#include <linux/i2c/isl9519.h>
21#include <linux/gpio.h>
22#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070023#include <linux/regulator/msm-gpio-regulator.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080024#include <linux/mfd/pm8xxx/pm8921.h>
25#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
26#include <linux/regulator/consumer.h>
27#include <linux/spi/spi.h>
28#include <linux/slimbus/slimbus.h>
29#include <linux/bootmem.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
Laura Abbottfd1ad202012-09-18 11:45:43 -070033#include <linux/dma-contiguous.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080034#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
36#include <linux/platform_data/qcom_wcnss_device.h>
37#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
39#include <linux/i2c/atmel_mxt_ts.h>
40#include <linux/msm_tsens.h>
41#include <linux/ks8851.h>
42#include <linux/i2c/isa1200.h>
Anirudh Ghayaleb3af972011-12-13 17:29:06 +053043#include <linux/gpio_keys.h>
Jack Cheung6ce8f682012-01-17 10:35:42 -080044#include <linux/memory.h>
Hanumant Singheea62562012-05-14 11:32:45 -070045#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060046#include <linux/msm_thermal.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080047
Asish Bhattacharyab86c3472012-02-15 08:31:52 +053048#include <linux/slimbus/slimbus.h>
49#include <linux/mfd/wcd9xxx/core.h>
50#include <linux/mfd/wcd9xxx/pdata.h>
51
Wentao Xu114c0152012-06-12 11:40:38 -040052#ifdef CONFIG_STM_LIS3DH
53#include <linux/input/lis3dh.h>
54#endif
55
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080056#include <asm/mach-types.h>
57#include <asm/mach/arch.h>
58#include <asm/setup.h>
59#include <asm/hardware/gic.h>
60#include <asm/mach/mmc.h>
61
62#include <mach/board.h>
63#include <mach/msm_iomap.h>
64#include <mach/msm_spi.h>
65#ifdef CONFIG_USB_MSM_OTG_72K
66#include <mach/msm_hsusb.h>
67#else
68#include <linux/usb/msm_hsusb.h>
69#endif
70#include <linux/usb/android.h>
71#include <mach/usbdiag.h>
72#include <mach/socinfo.h>
73#include <mach/rpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080074#include <mach/gpiomux.h>
75#include <mach/msm_bus_board.h>
76#include <mach/msm_memtypes.h>
77#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080078#include <mach/msm_xo.h>
79#include <mach/restart.h>
80
Mitchel Humpherysb8055522012-09-06 11:33:28 -070081#include <linux/msm_ion.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080082#include <mach/ion.h>
83#include <mach/mdm2.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080084#include <mach/msm_rtb.h>
Hanumant Singheea62562012-05-14 11:32:45 -070085#include <linux/fmem.h>
Laura Abbottf3173042012-05-29 15:23:18 -070086#include <mach/msm_cache_dump.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080087
Jordan Crouse914de9b2012-07-09 13:49:46 -060088#include <mach/kgsl.h>
Wentao Xuf59ce4e2012-05-22 17:30:13 -040089#ifdef CONFIG_INPUT_MPU3050
90#include <linux/input/mpu3050.h>
91#endif
92
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080093#include "timer.h"
94#include "devices.h"
95#include "devices-msm8x60.h"
96#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080097#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080098#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080099#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530100#include <mach/mpm.h>
Matt Wagantall33d01f52012-02-23 23:27:44 -0800101#include "clock.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800102#include "smd_private.h"
103#include "pm-boot.h"
104#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -0800105#include "board-8930.h"
Patrick Dalyc1227cb2012-08-28 13:39:17 -0700106#include "acpuclock-krait.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800107#include "platsmp.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800108
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800109static struct platform_device msm_fm_platform_init = {
110 .name = "iris_fm",
111 .id = -1,
112};
113
114#define KS8851_RST_GPIO 89
115#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800116#define HAP_SHIFT_LVL_OE_GPIO 47
117
Manoj Raoc6d904c2012-06-22 00:32:14 -0700118#define MHL_GPIO_INT 72
119#define MHL_GPIO_RESET 71
120#define MHL_GPIO_PWR_EN 5
121
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800122#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
123
124struct sx150x_platform_data msm8930_sx150x_data[] = {
125 [SX150X_CAM] = {
126 .gpio_base = GPIO_CAM_EXPANDER_BASE,
127 .oscio_is_gpo = false,
128 .io_pullup_ena = 0x0,
129 .io_pulldn_ena = 0xc0,
130 .io_open_drain_ena = 0x0,
131 .irq_summary = -1,
132 },
133};
134
135#endif
136
Olav Haugana21169d2012-01-04 09:17:06 -0800137#define MSM_PMEM_ADSP_SIZE 0x7800000
Vicky Sehrawat074f5432012-11-07 14:32:17 -0800138#define MSM_PMEM_AUDIO_SIZE 0x408000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800139#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
140#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
141#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800142#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800143#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700144#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800145
146#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur9830bf02012-06-01 15:04:29 -0700147#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700148#define MSM_CONTIG_MEM_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700149#ifdef CONFIG_MSM_IOMMU
150#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
151#define MSM_ION_SF_SIZE 0x0
Olav Haugan494e4dc2012-05-15 15:14:31 -0700152#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Hanumant Singhedfb0462012-05-15 14:49:32 -0700153#define MSM_ION_HEAP_NUM 7
154#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800155#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800156#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan494e4dc2012-05-15 15:14:31 -0700157#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Hanumant Singheea62562012-05-14 11:32:45 -0700158#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700159#endif
Deepak Kotur9830bf02012-06-01 15:04:29 -0700160#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800161#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800162#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700163
164#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
165#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
166#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
167
Deepak Kotur9830bf02012-06-01 15:04:29 -0700168#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */
169#define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
170 HOLE_SIZE))
Hanumant Singheea62562012-05-14 11:32:45 -0700171#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur9830bf02012-06-01 15:04:29 -0700172#define MSM8930_FW_START MSM8930_FIXED_AREA_START
Hanumant Singheea62562012-05-14 11:32:45 -0700173
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800174#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700175#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800176#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800177#endif
178
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700179#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
180static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
181static int __init msm_contig_mem_size_setup(char *p)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800182{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700183 msm_contig_mem_size = memparse(p, NULL);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800184 return 0;
185}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700186early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800187#endif
188
189#ifdef CONFIG_ANDROID_PMEM
190static unsigned pmem_size = MSM_PMEM_SIZE;
191static int __init pmem_size_setup(char *p)
192{
193 pmem_size = memparse(p, NULL);
194 return 0;
195}
196early_param("pmem_size", pmem_size_setup);
197
198static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
199
200static int __init pmem_adsp_size_setup(char *p)
201{
202 pmem_adsp_size = memparse(p, NULL);
203 return 0;
204}
205early_param("pmem_adsp_size", pmem_adsp_size_setup);
206
207static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
208
209static int __init pmem_audio_size_setup(char *p)
210{
211 pmem_audio_size = memparse(p, NULL);
212 return 0;
213}
214early_param("pmem_audio_size", pmem_audio_size_setup);
215#endif
216
217#ifdef CONFIG_ANDROID_PMEM
218#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
219static struct android_pmem_platform_data android_pmem_pdata = {
220 .name = "pmem",
221 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
222 .cached = 1,
223 .memory_type = MEMTYPE_EBI1,
224};
225
Laura Abbottb93525f2012-04-12 09:57:19 -0700226static struct platform_device msm8930_android_pmem_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800227 .name = "android_pmem",
228 .id = 0,
229 .dev = {.platform_data = &android_pmem_pdata},
230};
231
232static struct android_pmem_platform_data android_pmem_adsp_pdata = {
233 .name = "pmem_adsp",
234 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
235 .cached = 0,
236 .memory_type = MEMTYPE_EBI1,
237};
Laura Abbottb93525f2012-04-12 09:57:19 -0700238static struct platform_device msm8930_android_pmem_adsp_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800239 .name = "android_pmem",
240 .id = 2,
241 .dev = { .platform_data = &android_pmem_adsp_pdata },
242};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800243
244static struct android_pmem_platform_data android_pmem_audio_pdata = {
245 .name = "pmem_audio",
246 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
247 .cached = 0,
248 .memory_type = MEMTYPE_EBI1,
249};
250
Laura Abbottb93525f2012-04-12 09:57:19 -0700251static struct platform_device msm8930_android_pmem_audio_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800252 .name = "android_pmem",
253 .id = 4,
254 .dev = { .platform_data = &android_pmem_audio_pdata },
255};
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530256#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
257#endif /* CONFIG_ANDROID_PMEM */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800258
Hanumant Singheea62562012-05-14 11:32:45 -0700259struct fmem_platform_data msm8930_fmem_pdata = {
260};
261
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800262#define DSP_RAM_BASE_8960 0x8da00000
263#define DSP_RAM_SIZE_8960 0x1800000
264static int dspcrashd_pdata_8960 = 0xDEADDEAD;
265
266static struct resource resources_dspcrashd_8960[] = {
267 {
268 .name = "msm_dspcrashd",
269 .start = DSP_RAM_BASE_8960,
270 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
271 .flags = IORESOURCE_DMA,
272 },
273};
274
275static struct platform_device msm_device_dspcrashd_8960 = {
276 .name = "msm_dspcrashd",
277 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
278 .resource = resources_dspcrashd_8960,
279 .dev = { .platform_data = &dspcrashd_pdata_8960 },
280};
281
282static struct memtype_reserve msm8930_reserve_table[] __initdata = {
283 [MEMTYPE_SMI] = {
284 },
285 [MEMTYPE_EBI0] = {
286 .flags = MEMTYPE_FLAGS_1M_ALIGN,
287 },
288 [MEMTYPE_EBI1] = {
289 .flags = MEMTYPE_FLAGS_1M_ALIGN,
290 },
291};
292
Laura Abbottf8c03b92012-02-16 14:57:58 -0800293
294static void __init reserve_rtb_memory(void)
295{
296#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700297 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800298#endif
299}
300
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800301static void __init size_pmem_devices(void)
302{
303#ifdef CONFIG_ANDROID_PMEM
304#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
305 android_pmem_adsp_pdata.size = pmem_adsp_size;
306 android_pmem_pdata.size = pmem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800307 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530308#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
309#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800310}
311
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530312#ifdef CONFIG_ANDROID_PMEM
313#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800314static void __init reserve_memory_for(struct android_pmem_platform_data *p)
315{
316 msm8930_reserve_table[p->memory_type].size += p->size;
317}
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530318#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
319#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800320
321static void __init reserve_pmem_memory(void)
322{
323#ifdef CONFIG_ANDROID_PMEM
324#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
325 reserve_memory_for(&android_pmem_adsp_pdata);
326 reserve_memory_for(&android_pmem_pdata);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800327 reserve_memory_for(&android_pmem_audio_pdata);
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530328#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700329 msm8930_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530330#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800331}
332
333static int msm8930_paddr_to_memtype(unsigned int paddr)
334{
335 return MEMTYPE_EBI1;
336}
337
Steve Mucklef132c6c2012-06-06 18:30:57 -0700338#define FMEM_ENABLED 0
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800339#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800340#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700341static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800342 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800343 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700344 .reusable = FMEM_ENABLED,
345 .mem_is_fmem = FMEM_ENABLED,
346 .fixed_position = FIXED_MIDDLE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800347};
348
Laura Abbottb93525f2012-04-12 09:57:19 -0700349static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800350 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800351 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700352 .reusable = 0,
353 .mem_is_fmem = FMEM_ENABLED,
354 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800355};
Hanumant Singheea62562012-05-14 11:32:45 -0700356
Laura Abbottb93525f2012-04-12 09:57:19 -0700357static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800358 .adjacent_mem_id = INVALID_HEAP_ID,
359 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700360 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800361};
Hanumant Singheea62562012-05-14 11:32:45 -0700362
Laura Abbottb93525f2012-04-12 09:57:19 -0700363static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800364 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
365 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700366 .mem_is_fmem = FMEM_ENABLED,
367 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800368};
369#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800370
Laura Abbottfd1ad202012-09-18 11:45:43 -0700371
372static u64 msm_dmamask = DMA_BIT_MASK(32);
373
374static struct platform_device ion_mm_heap_device = {
375 .name = "ion-mm-heap-device",
376 .id = -1,
377 .dev = {
378 .dma_mask = &msm_dmamask,
379 .coherent_dma_mask = DMA_BIT_MASK(32),
380 }
381};
382
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800383/**
384 * These heaps are listed in the order they will be allocated. Due to
385 * video hardware restrictions and content protection the FW heap has to
386 * be allocated adjacent (below) the MM heap and the MFC heap has to be
387 * allocated after the MM heap to ensure MFC heap is not more than 256MB
388 * away from the base address of the FW heap.
389 * However, the order of FW heap and MM heap doesn't matter since these
390 * two heaps are taken care of by separate code to ensure they are adjacent
391 * to each other.
392 * Don't swap the order unless you know what you are doing!
393 */
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700394struct ion_platform_heap msm8930_heaps[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800395 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800396 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800397 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800398 .name = ION_VMALLOC_HEAP_NAME,
399 },
400#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
401 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800402 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800403 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800404 .name = ION_MM_HEAP_NAME,
405 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800406 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700407 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Laura Abbottfd1ad202012-09-18 11:45:43 -0700408 .priv = &ion_mm_heap_device.dev
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800409 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800410 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800411 .id = ION_MM_FIRMWARE_HEAP_ID,
412 .type = ION_HEAP_TYPE_CARVEOUT,
413 .name = ION_MM_FIRMWARE_HEAP_NAME,
414 .size = MSM_ION_MM_FW_SIZE,
415 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700416 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800417 },
418 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800419 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800420 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800421 .name = ION_MFC_HEAP_NAME,
422 .size = MSM_ION_MFC_SIZE,
423 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700424 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800425 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700426#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800427 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800428 .id = ION_SF_HEAP_ID,
429 .type = ION_HEAP_TYPE_CARVEOUT,
430 .name = ION_SF_HEAP_NAME,
431 .size = MSM_ION_SF_SIZE,
432 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700433 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800434 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700435#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800436 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800437 .id = ION_IOMMU_HEAP_ID,
438 .type = ION_HEAP_TYPE_IOMMU,
439 .name = ION_IOMMU_HEAP_NAME,
440 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800441 {
442 .id = ION_QSECOM_HEAP_ID,
443 .type = ION_HEAP_TYPE_CARVEOUT,
444 .name = ION_QSECOM_HEAP_NAME,
445 .size = MSM_ION_QSECOM_SIZE,
446 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700447 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800448 },
Olav Haugan7355db02012-01-13 16:59:13 -0800449 {
450 .id = ION_AUDIO_HEAP_ID,
451 .type = ION_HEAP_TYPE_CARVEOUT,
452 .name = ION_AUDIO_HEAP_NAME,
453 .size = MSM_ION_AUDIO_SIZE,
454 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700455 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800456 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800457#endif
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700458};
459
460static struct ion_platform_data msm8930_ion_pdata = {
461 .nr = MSM_ION_HEAP_NUM,
462 .heaps = msm8930_heaps,
463
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800464};
465
Laura Abbottb93525f2012-04-12 09:57:19 -0700466static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800467 .name = "ion-msm",
468 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700469 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800470};
471#endif
472
Hanumant Singheea62562012-05-14 11:32:45 -0700473struct platform_device msm8930_fmem_device = {
474 .name = "fmem",
475 .id = 1,
476 .dev = { .platform_data = &msm8930_fmem_pdata },
477};
478
479static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
480 unsigned long size)
481{
482 msm8930_reserve_table[mem_type].size += size;
483}
484
485static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
486{
487#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
488 int ret;
489
490 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
491 panic("fixed area size is larger than %dM\n",
492 MAX_FIXED_AREA_SIZE >> 20);
493
494 reserve_info->fixed_area_size = fixed_area_size;
495 reserve_info->fixed_area_start = MSM8930_FW_START;
496
497 ret = memblock_remove(reserve_info->fixed_area_start,
498 reserve_info->fixed_area_size);
499 BUG_ON(ret);
500#endif
501}
502
503/**
504 * Reserve memory for ION and calculate amount of reusable memory for fmem.
505 * We only reserve memory for heaps that are not reusable. However, we only
506 * support one reusable heap at the moment so we ignore the reusable flag for
507 * other than the first heap with reusable flag set. Also handle special case
508 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
509 * at a higher address than FW in addition to not more than 256MB away from the
510 * base address of the firmware. This means that if MM is reusable the other
511 * two heaps must be allocated in the same region as FW. This is handled by the
512 * mem_is_fmem flag in the platform data. In addition the MM heap must be
513 * adjacent to the FW heap for content protection purposes.
514 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700515static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800516{
517#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700518 unsigned int i;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700519 int ret;
Hanumant Singheea62562012-05-14 11:32:45 -0700520 unsigned int fixed_size = 0;
521 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
522 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700523 unsigned long cma_alignment;
524 unsigned int low_use_cma = 0;
525 unsigned int middle_use_cma = 0;
526 unsigned int high_use_cma = 0;
Hanumant Singheea62562012-05-14 11:32:45 -0700527
Hanumant Singheea62562012-05-14 11:32:45 -0700528 fixed_low_size = 0;
529 fixed_middle_size = 0;
530 fixed_high_size = 0;
531
Laura Abbottfd1ad202012-09-18 11:45:43 -0700532 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
533
Hanumant Singheea62562012-05-14 11:32:45 -0700534 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
Laura Abbottfd1ad202012-09-18 11:45:43 -0700535 struct ion_platform_heap *heap =
Hanumant Singheea62562012-05-14 11:32:45 -0700536 &(msm8930_ion_pdata.heaps[i]);
537
Laura Abbottfd1ad202012-09-18 11:45:43 -0700538 int use_cma = 0;
539
Hanumant Singheea62562012-05-14 11:32:45 -0700540 if (heap->extra_data) {
541 int fixed_position = NOT_FIXED;
Hanumant Singheea62562012-05-14 11:32:45 -0700542
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700543 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700544 case ION_HEAP_TYPE_CP:
Laura Abbottfd1ad202012-09-18 11:45:43 -0700545 if (((struct ion_cp_heap_pdata *)
546 heap->extra_data)->is_cma) {
547 heap->size = ALIGN(heap->size,
548 cma_alignment);
549 use_cma = 1;
550 }
Hanumant Singheea62562012-05-14 11:32:45 -0700551 fixed_position = ((struct ion_cp_heap_pdata *)
552 heap->extra_data)->fixed_position;
553 break;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700554 case ION_HEAP_TYPE_DMA:
555 use_cma = 1;
556 /* Purposely fall through here */
Hanumant Singheea62562012-05-14 11:32:45 -0700557 case ION_HEAP_TYPE_CARVEOUT:
Hanumant Singheea62562012-05-14 11:32:45 -0700558 fixed_position = ((struct ion_co_heap_pdata *)
559 heap->extra_data)->fixed_position;
560 break;
561 default:
562 break;
563 }
564
565 if (fixed_position != NOT_FIXED)
566 fixed_size += heap->size;
567 else
568 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
569
Laura Abbottfd1ad202012-09-18 11:45:43 -0700570 if (fixed_position == FIXED_LOW) {
Hanumant Singheea62562012-05-14 11:32:45 -0700571 fixed_low_size += heap->size;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700572 low_use_cma = use_cma;
573 } else if (fixed_position == FIXED_MIDDLE) {
Hanumant Singheea62562012-05-14 11:32:45 -0700574 fixed_middle_size += heap->size;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700575 middle_use_cma = use_cma;
576 } else if (fixed_position == FIXED_HIGH) {
Hanumant Singheea62562012-05-14 11:32:45 -0700577 fixed_high_size += heap->size;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700578 high_use_cma = use_cma;
579 } else if (use_cma) {
580 /*
581 * Heaps that use CMA but are not part of the
582 * fixed set. Create wherever.
583 */
584 dma_declare_contiguous(
585 heap->priv,
586 heap->size,
587 0,
588 0xb0000000);
589 }
Hanumant Singheea62562012-05-14 11:32:45 -0700590 }
591 }
592
593 if (!fixed_size)
594 return;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700595 /*
596 * Given the setup for the fixed area, we can't round up all sizes.
597 * Some sizes must be set up exactly and aligned correctly. Incorrect
598 * alignments are considered a configuration issue
Hanumant Singheea62562012-05-14 11:32:45 -0700599 */
Hanumant Singheea62562012-05-14 11:32:45 -0700600
601 fixed_low_start = MSM8930_FIXED_AREA_START;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700602 if (low_use_cma) {
603 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
604 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
605 } else {
606 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
607 ret = memblock_remove(fixed_low_start,
608 fixed_low_size + HOLE_SIZE);
609 BUG_ON(ret);
610 }
611
Deepak Kotur9830bf02012-06-01 15:04:29 -0700612 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700613 if (middle_use_cma) {
614 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
615 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
616 } else {
617 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
618 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
619 BUG_ON(ret);
620 }
621
Hanumant Singheea62562012-05-14 11:32:45 -0700622 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700623 if (high_use_cma) {
624 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
625 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
626 } else {
627 /* This is the end of the fixed area so it's okay to round up */
628 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
629 ret = memblock_remove(fixed_high_start, fixed_high_size);
630 BUG_ON(ret);
631 }
Hanumant Singheea62562012-05-14 11:32:45 -0700632
633 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
634 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
635
636 if (heap->extra_data) {
637 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700638 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700639
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700640 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700641 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700642 pdata =
643 (struct ion_cp_heap_pdata *)heap->extra_data;
644 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700645 break;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700646 case ION_HEAP_TYPE_DMA:
Hanumant Singheea62562012-05-14 11:32:45 -0700647 case ION_HEAP_TYPE_CARVEOUT:
648 fixed_position = ((struct ion_co_heap_pdata *)
649 heap->extra_data)->fixed_position;
650 break;
651 default:
652 break;
653 }
654
655 switch (fixed_position) {
656 case FIXED_LOW:
657 heap->base = fixed_low_start;
658 break;
659 case FIXED_MIDDLE:
660 heap->base = fixed_middle_start;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700661 if (middle_use_cma)
662 dma_declare_contiguous(
663 &ion_mm_heap_device.dev,
664 heap->size,
665 fixed_middle_start,
666 0xa0000000);
Deepak Kotur9830bf02012-06-01 15:04:29 -0700667 pdata->secure_base = fixed_middle_start
668 - HOLE_SIZE;
669 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700670 break;
671 case FIXED_HIGH:
672 heap->base = fixed_high_start;
673 break;
674 default:
675 break;
676 }
677 }
678 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800679#endif
680}
Huaibin Yanga5419422011-12-08 23:52:10 -0800681
682static void __init reserve_mdp_memory(void)
683{
684 msm8930_mdp_writeback(msm8930_reserve_table);
685}
686
Laura Abbottf3173042012-05-29 15:23:18 -0700687#ifdef CONFIG_MSM_CACHE_DUMP
688static void __init reserve_cache_dump_memory(void)
689{
690 unsigned int total;
691
692 total = msm8930_cache_dump_pdata.l1_size +
693 msm8930_cache_dump_pdata.l2_size;
694 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
695}
696#else
697static void __init reserve_cache_dump_memory(void) { }
698#endif
699
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800700static void __init msm8930_calculate_reserve_sizes(void)
701{
702 size_pmem_devices();
703 reserve_pmem_memory();
704 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800705 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800706 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700707 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800708}
709
710static struct reserve_info msm8930_reserve_info __initdata = {
711 .memtype_reserve_table = msm8930_reserve_table,
712 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700713 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800714 .paddr_to_memtype = msm8930_paddr_to_memtype,
715};
716
717static int msm8930_memory_bank_size(void)
718{
719 return 1<<29;
720}
721
722static void __init locate_unstable_memory(void)
723{
724 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
725 unsigned long bank_size;
726 unsigned long low, high;
727
728 bank_size = msm8930_memory_bank_size();
729 low = meminfo.bank[0].start;
730 high = mb->start + mb->size;
731
732 /* Check if 32 bit overflow occured */
733 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700734 high -= PAGE_SIZE;
735
736 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
737 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800738
739 low &= ~(bank_size - 1);
740
741 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700742 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800743
744 msm8930_reserve_info.bank_size = bank_size;
745#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800746 msm8930_reserve_info.low_unstable_address = mb->start -
747 MIN_MEMORY_BLOCK_SIZE + mb->size;
748 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800749 pr_info("low unstable address %lx max size %lx bank size %lx\n",
750 msm8930_reserve_info.low_unstable_address,
751 msm8930_reserve_info.max_unstable_size,
752 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700753 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800754#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700755no_dmm:
756 msm8930_reserve_info.low_unstable_address = high;
757 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800758}
759
760static void __init place_movable_zone(void)
761{
Larry Basselb8d61022012-02-24 10:49:45 -0800762#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800763 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
764 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
765 pr_info("movable zone start %lx size %lx\n",
766 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800767#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800768}
769
770static void __init msm8930_early_memory(void)
771{
772 reserve_info = &msm8930_reserve_info;
773 locate_unstable_memory();
774 place_movable_zone();
775}
776
Aravind Venkateswaran06a46352012-08-16 14:52:39 -0700777static char prim_panel_name[PANEL_NAME_MAX_LEN];
778static char ext_panel_name[PANEL_NAME_MAX_LEN];
779
780static int __init prim_display_setup(char *param)
781{
782 if (strnlen(param, PANEL_NAME_MAX_LEN))
783 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
784 return 0;
785}
786early_param("prim_display", prim_display_setup);
787
788static int __init ext_display_setup(char *param)
789{
790 if (strnlen(param, PANEL_NAME_MAX_LEN))
791 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
792 return 0;
793}
794early_param("ext_display", ext_display_setup);
795
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800796static void __init msm8930_reserve(void)
797{
Aravind Venkateswaran06a46352012-08-16 14:52:39 -0700798 msm8930_set_display_params(prim_panel_name, ext_panel_name);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800799 msm_reserve();
800}
801
802static int msm8930_change_memory_power(u64 start, u64 size,
803 int change_type)
804{
805 return soc_change_memory_power(start, size, change_type);
806}
807
808static void __init msm8930_allocate_memory_regions(void)
809{
810 msm8930_allocate_fb_region();
811}
812
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530813#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800814
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530815#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800816
817/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
818 * 4 micbiases are used to power various analog and digital
819 * microphones operating at 1800 mV. Technically, all micbiases
820 * can source from single cfilter since all microphones operate
821 * at the same voltage level. The arrangement below is to make
822 * sure all cfilters are exercised. LDO_H regulator ouput level
823 * does not need to be as high as 2.85V. It is choosen for
824 * microphone sensitivity purpose.
825 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530826static struct wcd9xxx_pdata sitar_platform_data = {
827 .slimbus_slave_device = {
828 .name = "sitar-slave",
829 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800830 },
831 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530832 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530833 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530834 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800835 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530836 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800837 .cfilt1_mv = 1800,
838 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530839 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
840 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700841 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
842 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530843 },
844 .regulator = {
845 {
846 .name = "CDC_VDD_CP",
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -0700847 .min_uV = 2200000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530848 .max_uV = 2200000,
849 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
850 },
851 {
852 .name = "CDC_VDDA_RX",
853 .min_uV = 1800000,
854 .max_uV = 1800000,
855 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
856 },
857 {
858 .name = "CDC_VDDA_TX",
859 .min_uV = 1800000,
860 .max_uV = 1800000,
861 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
862 },
863 {
864 .name = "VDDIO_CDC",
865 .min_uV = 1800000,
866 .max_uV = 1800000,
867 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
868 },
869 {
870 .name = "VDDD_CDC_D",
871 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700872 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530873 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
874 },
875 {
876 .name = "CDC_VDDA_A_1P2V",
877 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700878 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530879 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
880 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800881 },
882};
883
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530884static struct slim_device msm_slim_sitar = {
885 .name = "sitar-slim",
886 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800887 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530888 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800889 },
890};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700891
892static struct wcd9xxx_pdata sitar1p1_platform_data = {
893 .slimbus_slave_device = {
894 .name = "sitar-slave",
895 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
896 },
897 .irq = MSM_GPIO_TO_INT(62),
898 .irq_base = SITAR_INTERRUPT_BASE,
899 .num_irqs = NR_WCD9XXX_IRQS,
900 .reset_gpio = 42,
901 .micbias = {
902 .ldoh_v = SITAR_LDOH_2P85_V,
903 .cfilt1_mv = 1800,
904 .cfilt2_mv = 1800,
905 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
906 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700907 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
908 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700909 },
910 .regulator = {
911 {
912 .name = "CDC_VDD_CP",
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -0700913 .min_uV = 2200000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700914 .max_uV = 2200000,
915 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
916 },
917 {
918 .name = "CDC_VDDA_RX",
919 .min_uV = 1800000,
920 .max_uV = 1800000,
921 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
922 },
923 {
924 .name = "CDC_VDDA_TX",
925 .min_uV = 1800000,
926 .max_uV = 1800000,
927 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
928 },
929 {
930 .name = "VDDIO_CDC",
931 .min_uV = 1800000,
932 .max_uV = 1800000,
933 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
934 },
935 {
936 .name = "VDDD_CDC_D",
937 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700938 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700939 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
940 },
941 {
942 .name = "CDC_VDDA_A_1P2V",
943 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700944 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700945 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
946 },
947 },
948};
949
950static struct slim_device msm_slim_sitar1p1 = {
951 .name = "sitar1p1-slim",
952 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
953 .dev = {
954 .platform_data = &sitar1p1_platform_data,
955 },
956};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800957#endif
958
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530959
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800960static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530961#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800962 {
963 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530964 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800965 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700966 {
967 .bus_num = 1,
968 .slim_slave = &msm_slim_sitar1p1,
969 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800970#endif
971 /* add more slimbus slaves as needed */
972};
973
974#define MSM_WCNSS_PHYS 0x03000000
975#define MSM_WCNSS_SIZE 0x280000
976
977static struct resource resources_wcnss_wlan[] = {
978 {
979 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
980 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
981 .name = "wcnss_wlanrx_irq",
982 .flags = IORESOURCE_IRQ,
983 },
984 {
985 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
986 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
987 .name = "wcnss_wlantx_irq",
988 .flags = IORESOURCE_IRQ,
989 },
990 {
991 .start = MSM_WCNSS_PHYS,
992 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
993 .name = "wcnss_mmio",
994 .flags = IORESOURCE_MEM,
995 },
996 {
997 .start = 84,
998 .end = 88,
999 .name = "wcnss_gpios_5wire",
1000 .flags = IORESOURCE_IO,
1001 },
1002};
1003
1004static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1005 .has_48mhz_xo = 1,
1006};
1007
1008static struct platform_device msm_device_wcnss_wlan = {
1009 .name = "wcnss_wlan",
1010 .id = 0,
1011 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1012 .resource = resources_wcnss_wlan,
1013 .dev = {.platform_data = &qcom_wcnss_pdata},
1014};
1015
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001016#ifdef CONFIG_QSEECOM
1017/* qseecom bus scaling */
1018static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1019 {
1020 .src = MSM_BUS_MASTER_SPS,
1021 .dst = MSM_BUS_SLAVE_EBI_CH0,
1022 .ib = 0,
1023 .ab = 0,
1024 },
1025 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001026 .src = MSM_BUS_MASTER_SPS,
1027 .dst = MSM_BUS_SLAVE_SPS,
1028 .ib = 0,
1029 .ab = 0,
1030 },
1031 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001032 .src = MSM_BUS_MASTER_SPDM,
1033 .dst = MSM_BUS_SLAVE_SPDM,
1034 .ib = 0,
1035 .ab = 0,
1036 },
1037};
1038
1039static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1040 {
1041 .src = MSM_BUS_MASTER_SPS,
1042 .dst = MSM_BUS_SLAVE_EBI_CH0,
1043 .ib = (492 * 8) * 1000000UL,
1044 .ab = (492 * 8) * 100000UL,
1045 },
1046 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001047 .src = MSM_BUS_MASTER_SPS,
1048 .dst = MSM_BUS_SLAVE_SPS,
1049 .ib = (492 * 8) * 1000000UL,
1050 .ab = (492 * 8) * 100000UL,
1051 },
1052 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001053 .src = MSM_BUS_MASTER_SPDM,
1054 .dst = MSM_BUS_SLAVE_SPDM,
1055 .ib = 0,
1056 .ab = 0,
1057 },
1058};
1059
1060static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1061 {
1062 .src = MSM_BUS_MASTER_SPS,
1063 .dst = MSM_BUS_SLAVE_EBI_CH0,
1064 .ib = 0,
1065 .ab = 0,
1066 },
1067 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001068 .src = MSM_BUS_MASTER_SPS,
1069 .dst = MSM_BUS_SLAVE_SPS,
1070 .ib = 0,
1071 .ab = 0,
1072 },
1073 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001074 .src = MSM_BUS_MASTER_SPDM,
1075 .dst = MSM_BUS_SLAVE_SPDM,
1076 .ib = (64 * 8) * 1000000UL,
1077 .ab = (64 * 8) * 100000UL,
1078 },
1079};
1080
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001081static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1082 {
1083 .src = MSM_BUS_MASTER_SPS,
1084 .dst = MSM_BUS_SLAVE_EBI_CH0,
1085 .ib = (492 * 8) * 1000000UL,
1086 .ab = (492 * 8) * 100000UL,
1087 },
1088 {
1089 .src = MSM_BUS_MASTER_SPS,
1090 .dst = MSM_BUS_SLAVE_SPS,
1091 .ib = (492 * 8) * 1000000UL,
1092 .ab = (492 * 8) * 100000UL,
1093 },
1094 {
1095 .src = MSM_BUS_MASTER_SPDM,
1096 .dst = MSM_BUS_SLAVE_SPDM,
1097 .ib = (64 * 8) * 1000000UL,
1098 .ab = (64 * 8) * 100000UL,
1099 },
1100};
1101
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001102static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1103 {
1104 ARRAY_SIZE(qseecom_clks_init_vectors),
1105 qseecom_clks_init_vectors,
1106 },
1107 {
1108 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1109 qseecom_enable_sfpb_vectors,
1110 },
1111 {
1112 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1113 qseecom_enable_sfpb_vectors,
1114 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001115 {
1116 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1117 qseecom_enable_dfab_sfpb_vectors,
1118 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001119};
1120
1121static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1122 qseecom_hw_bus_scale_usecases,
1123 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1124 .name = "qsee",
1125};
1126
1127static struct platform_device qseecom_device = {
1128 .name = "qseecom",
1129 .id = 0,
1130 .dev = {
1131 .platform_data = &qseecom_bus_pdata,
1132 },
1133};
1134#endif
1135
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001136#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1137 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1138 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1139 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1140
1141#define QCE_SIZE 0x10000
1142#define QCE_0_BASE 0x18500000
1143
1144#define QCE_HW_KEY_SUPPORT 0
1145#define QCE_SHA_HMAC_SUPPORT 1
1146#define QCE_SHARE_CE_RESOURCE 1
1147#define QCE_CE_SHARED 0
1148
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001149/* Begin Bus scaling definitions */
1150static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1151 {
1152 .src = MSM_BUS_MASTER_ADM_PORT0,
1153 .dst = MSM_BUS_SLAVE_EBI_CH0,
1154 .ab = 0,
1155 .ib = 0,
1156 },
1157 {
1158 .src = MSM_BUS_MASTER_ADM_PORT1,
1159 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1160 .ab = 0,
1161 .ib = 0,
1162 },
1163};
1164
1165static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1166 {
1167 .src = MSM_BUS_MASTER_ADM_PORT0,
1168 .dst = MSM_BUS_SLAVE_EBI_CH0,
1169 .ab = 70000000UL,
1170 .ib = 70000000UL,
1171 },
1172 {
1173 .src = MSM_BUS_MASTER_ADM_PORT1,
1174 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1175 .ab = 2480000000UL,
1176 .ib = 2480000000UL,
1177 },
1178};
1179
1180static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1181 {
1182 ARRAY_SIZE(crypto_hw_init_vectors),
1183 crypto_hw_init_vectors,
1184 },
1185 {
1186 ARRAY_SIZE(crypto_hw_active_vectors),
1187 crypto_hw_active_vectors,
1188 },
1189};
1190
1191static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1192 crypto_hw_bus_scale_usecases,
1193 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1194 .name = "cryptohw",
1195};
1196/* End Bus Scaling Definitions*/
1197
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001198static struct resource qcrypto_resources[] = {
1199 [0] = {
1200 .start = QCE_0_BASE,
1201 .end = QCE_0_BASE + QCE_SIZE - 1,
1202 .flags = IORESOURCE_MEM,
1203 },
1204 [1] = {
1205 .name = "crypto_channels",
1206 .start = DMOV_CE_IN_CHAN,
1207 .end = DMOV_CE_OUT_CHAN,
1208 .flags = IORESOURCE_DMA,
1209 },
1210 [2] = {
1211 .name = "crypto_crci_in",
1212 .start = DMOV_CE_IN_CRCI,
1213 .end = DMOV_CE_IN_CRCI,
1214 .flags = IORESOURCE_DMA,
1215 },
1216 [3] = {
1217 .name = "crypto_crci_out",
1218 .start = DMOV_CE_OUT_CRCI,
1219 .end = DMOV_CE_OUT_CRCI,
1220 .flags = IORESOURCE_DMA,
1221 },
1222};
1223
1224static struct resource qcedev_resources[] = {
1225 [0] = {
1226 .start = QCE_0_BASE,
1227 .end = QCE_0_BASE + QCE_SIZE - 1,
1228 .flags = IORESOURCE_MEM,
1229 },
1230 [1] = {
1231 .name = "crypto_channels",
1232 .start = DMOV_CE_IN_CHAN,
1233 .end = DMOV_CE_OUT_CHAN,
1234 .flags = IORESOURCE_DMA,
1235 },
1236 [2] = {
1237 .name = "crypto_crci_in",
1238 .start = DMOV_CE_IN_CRCI,
1239 .end = DMOV_CE_IN_CRCI,
1240 .flags = IORESOURCE_DMA,
1241 },
1242 [3] = {
1243 .name = "crypto_crci_out",
1244 .start = DMOV_CE_OUT_CRCI,
1245 .end = DMOV_CE_OUT_CRCI,
1246 .flags = IORESOURCE_DMA,
1247 },
1248};
1249
1250#endif
1251
1252#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1253 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1254
1255static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1256 .ce_shared = QCE_CE_SHARED,
1257 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1258 .hw_key_support = QCE_HW_KEY_SUPPORT,
1259 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001260 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001261};
1262
1263static struct platform_device qcrypto_device = {
1264 .name = "qcrypto",
1265 .id = 0,
1266 .num_resources = ARRAY_SIZE(qcrypto_resources),
1267 .resource = qcrypto_resources,
1268 .dev = {
1269 .coherent_dma_mask = DMA_BIT_MASK(32),
1270 .platform_data = &qcrypto_ce_hw_suppport,
1271 },
1272};
1273#endif
1274
1275#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1276 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1277
1278static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1279 .ce_shared = QCE_CE_SHARED,
1280 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1281 .hw_key_support = QCE_HW_KEY_SUPPORT,
1282 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001283 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001284};
1285
1286static struct platform_device qcedev_device = {
1287 .name = "qce",
1288 .id = 0,
1289 .num_resources = ARRAY_SIZE(qcedev_resources),
1290 .resource = qcedev_resources,
1291 .dev = {
1292 .coherent_dma_mask = DMA_BIT_MASK(32),
1293 .platform_data = &qcedev_ce_hw_suppport,
1294 },
1295};
1296#endif
1297
1298#define MDM2AP_ERRFATAL 70
1299#define AP2MDM_ERRFATAL 95
1300#define MDM2AP_STATUS 69
1301#define AP2MDM_STATUS 94
1302#define AP2MDM_PMIC_RESET_N 80
1303#define AP2MDM_KPDPWR_N 81
1304
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001305static struct resource mdm_resources[] = {
1306 {
1307 .start = MDM2AP_ERRFATAL,
1308 .end = MDM2AP_ERRFATAL,
1309 .name = "MDM2AP_ERRFATAL",
1310 .flags = IORESOURCE_IO,
1311 },
1312 {
1313 .start = AP2MDM_ERRFATAL,
1314 .end = AP2MDM_ERRFATAL,
1315 .name = "AP2MDM_ERRFATAL",
1316 .flags = IORESOURCE_IO,
1317 },
1318 {
1319 .start = MDM2AP_STATUS,
1320 .end = MDM2AP_STATUS,
1321 .name = "MDM2AP_STATUS",
1322 .flags = IORESOURCE_IO,
1323 },
1324 {
1325 .start = AP2MDM_STATUS,
1326 .end = AP2MDM_STATUS,
1327 .name = "AP2MDM_STATUS",
1328 .flags = IORESOURCE_IO,
1329 },
1330 {
1331 .start = AP2MDM_PMIC_RESET_N,
1332 .end = AP2MDM_PMIC_RESET_N,
1333 .name = "AP2MDM_PMIC_RESET_N",
1334 .flags = IORESOURCE_IO,
1335 },
1336 {
1337 .start = AP2MDM_KPDPWR_N,
1338 .end = AP2MDM_KPDPWR_N,
1339 .name = "AP2MDM_KPDPWR_N",
1340 .flags = IORESOURCE_IO,
1341 },
1342};
1343
1344static struct mdm_platform_data mdm_platform_data = {
1345 .mdm_version = "2.5",
1346};
1347
1348static struct platform_device mdm_device = {
1349 .name = "mdm2_modem",
1350 .id = -1,
1351 .num_resources = ARRAY_SIZE(mdm_resources),
1352 .resource = mdm_resources,
1353 .dev = {
1354 .platform_data = &mdm_platform_data,
1355 },
1356};
1357
1358static struct platform_device *mdm_devices[] __initdata = {
1359 &mdm_device,
1360};
1361
Praveen Chidambaram78499012011-11-01 17:15:17 -06001362#ifdef CONFIG_MSM_MPM
1363static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1364 [1] = MSM_GPIO_TO_INT(46),
1365 [2] = MSM_GPIO_TO_INT(150),
1366 [4] = MSM_GPIO_TO_INT(103),
1367 [5] = MSM_GPIO_TO_INT(104),
1368 [6] = MSM_GPIO_TO_INT(105),
1369 [7] = MSM_GPIO_TO_INT(106),
1370 [8] = MSM_GPIO_TO_INT(107),
1371 [9] = MSM_GPIO_TO_INT(7),
1372 [10] = MSM_GPIO_TO_INT(11),
1373 [11] = MSM_GPIO_TO_INT(15),
1374 [12] = MSM_GPIO_TO_INT(19),
1375 [13] = MSM_GPIO_TO_INT(23),
1376 [14] = MSM_GPIO_TO_INT(27),
1377 [15] = MSM_GPIO_TO_INT(31),
1378 [16] = MSM_GPIO_TO_INT(35),
1379 [19] = MSM_GPIO_TO_INT(90),
1380 [20] = MSM_GPIO_TO_INT(92),
1381 [23] = MSM_GPIO_TO_INT(85),
1382 [24] = MSM_GPIO_TO_INT(83),
1383 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001384 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001385 [27] = HDMI_IRQ,
1386 [29] = MSM_GPIO_TO_INT(10),
1387 [30] = MSM_GPIO_TO_INT(102),
1388 [31] = MSM_GPIO_TO_INT(81),
1389 [32] = MSM_GPIO_TO_INT(78),
1390 [33] = MSM_GPIO_TO_INT(94),
1391 [34] = MSM_GPIO_TO_INT(72),
1392 [35] = MSM_GPIO_TO_INT(39),
1393 [36] = MSM_GPIO_TO_INT(43),
1394 [37] = MSM_GPIO_TO_INT(61),
1395 [38] = MSM_GPIO_TO_INT(50),
1396 [39] = MSM_GPIO_TO_INT(42),
1397 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001398 [42] = MSM_GPIO_TO_INT(8),
1399 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001400 [44] = MSM_GPIO_TO_INT(70),
1401 [45] = MSM_GPIO_TO_INT(69),
1402 [46] = MSM_GPIO_TO_INT(67),
1403 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001404 [48] = MSM_GPIO_TO_INT(55),
1405 [49] = MSM_GPIO_TO_INT(74),
1406 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001407 [51] = MSM_GPIO_TO_INT(49),
1408 [52] = MSM_GPIO_TO_INT(40),
1409 [53] = MSM_GPIO_TO_INT(37),
1410 [54] = MSM_GPIO_TO_INT(24),
1411 [55] = MSM_GPIO_TO_INT(14),
1412};
1413
1414static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1415 TLMM_MSM_SUMMARY_IRQ,
1416 RPM_APCC_CPU0_GP_HIGH_IRQ,
1417 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1418 RPM_APCC_CPU0_GP_LOW_IRQ,
1419 RPM_APCC_CPU0_WAKE_UP_IRQ,
1420 RPM_APCC_CPU1_GP_HIGH_IRQ,
1421 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1422 RPM_APCC_CPU1_GP_LOW_IRQ,
1423 RPM_APCC_CPU1_WAKE_UP_IRQ,
1424 MSS_TO_APPS_IRQ_0,
1425 MSS_TO_APPS_IRQ_1,
1426 MSS_TO_APPS_IRQ_2,
1427 MSS_TO_APPS_IRQ_3,
1428 MSS_TO_APPS_IRQ_4,
1429 MSS_TO_APPS_IRQ_5,
1430 MSS_TO_APPS_IRQ_6,
1431 MSS_TO_APPS_IRQ_7,
1432 MSS_TO_APPS_IRQ_8,
1433 MSS_TO_APPS_IRQ_9,
1434 LPASS_SCSS_GP_LOW_IRQ,
1435 LPASS_SCSS_GP_MEDIUM_IRQ,
1436 LPASS_SCSS_GP_HIGH_IRQ,
1437 SPS_MTI_30,
1438 SPS_MTI_31,
1439 RIVA_APSS_SPARE_IRQ,
1440 RIVA_APPS_WLAN_SMSM_IRQ,
1441 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1442 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1443};
1444
1445struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1446 .irqs_m2a = msm_mpm_irqs_m2a,
1447 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1448 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1449 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1450 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1451 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1452 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1453 .mpm_apps_ipc_val = BIT(1),
1454 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1455
1456};
1457#endif
1458
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001459#define MSM_SHARED_RAM_PHYS 0x80000000
1460
1461static void __init msm8930_map_io(void)
1462{
1463 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1464 msm_map_msm8930_io();
1465
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -08001466 if (socinfo_init() < 0)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001467 pr_err("socinfo_init() failed!\n");
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001468
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001469}
1470
1471static void __init msm8930_init_irq(void)
1472{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001473 struct msm_mpm_device_data *data = NULL;
1474#ifdef CONFIG_MSM_MPM
1475 data = &msm8930_mpm_dev_data;
1476#endif
1477
1478 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001479 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1480 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001481}
1482
1483static void __init msm8930_init_buses(void)
1484{
1485#ifdef CONFIG_MSM_BUS_SCALING
1486 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001487 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1488 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1489 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1490 msm_bus_8930_apps_fabric.dev.platform_data =
1491 &msm_bus_8930_apps_fabric_pdata;
1492 msm_bus_8930_sys_fabric.dev.platform_data =
1493 &msm_bus_8930_sys_fabric_pdata;
1494 msm_bus_8930_mm_fabric.dev.platform_data =
1495 &msm_bus_8930_mm_fabric_pdata;
1496 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1497 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001498#endif
1499}
1500
1501static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1502 .max_clock_speed = 15060000,
1503};
1504
1505#ifdef CONFIG_USB_MSM_OTG_72K
1506static struct msm_otg_platform_data msm_otg_pdata;
1507#else
Mayank Rana7e574162013-01-08 15:10:51 +05301508static int enable_usb_host_mode;
1509static int __init usb_host_mode_with_pm8917(char *param)
1510{
1511 int ret;
1512
1513 ret = kstrtoint(param, 10, &enable_usb_host_mode);
1514 return ret;
1515}
1516early_param("usb_host_mode_pm8917", usb_host_mode_with_pm8917);
1517
Manu Gautam32ab9462012-02-20 12:33:01 +05301518#ifdef CONFIG_MSM_BUS_SCALING
1519/* Bandwidth requests (zero) if no vote placed */
1520static struct msm_bus_vectors usb_init_vectors[] = {
1521 {
1522 .src = MSM_BUS_MASTER_SPS,
1523 .dst = MSM_BUS_SLAVE_EBI_CH0,
1524 .ab = 0,
1525 .ib = 0,
1526 },
1527};
1528
1529/* Bus bandwidth requests in Bytes/sec */
1530static struct msm_bus_vectors usb_max_vectors[] = {
1531 {
1532 .src = MSM_BUS_MASTER_SPS,
1533 .dst = MSM_BUS_SLAVE_EBI_CH0,
1534 .ab = 60000000, /* At least 480Mbps on bus. */
1535 .ib = 960000000, /* MAX bursts rate */
1536 },
1537};
1538
1539static struct msm_bus_paths usb_bus_scale_usecases[] = {
1540 {
1541 ARRAY_SIZE(usb_init_vectors),
1542 usb_init_vectors,
1543 },
1544 {
1545 ARRAY_SIZE(usb_max_vectors),
1546 usb_max_vectors,
1547 },
1548};
1549
1550static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1551 usb_bus_scale_usecases,
1552 ARRAY_SIZE(usb_bus_scale_usecases),
1553 .name = "usb",
1554};
1555#endif
1556
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301557static int hsusb_phy_init_seq[] = {
1558 0x44, 0x80, /* set VBUS valid threshold
1559 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301560 0x68, 0x81, /* update DC voltage level */
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301561 0x24, 0x82, /* set preemphasis and rise/fall time */
1562 0x13, 0x83, /* set source impedance adjusment */
1563 -1};
1564
Jack Pham87f202f2012-08-06 00:24:22 -07001565#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1566
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001567static struct msm_otg_platform_data msm_otg_pdata = {
1568 .mode = USB_OTG,
1569 .otg_control = OTG_PMIC_CONTROL,
1570 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001571 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301572#ifdef CONFIG_MSM_BUS_SCALING
1573 .bus_scale_table = &usb_bus_scale_pdata,
1574#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301575#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1576 .mhl_dev_name = "sii8334",
1577#endif
Jack Pham87f202f2012-08-06 00:24:22 -07001578 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001579};
1580#endif
1581
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001582#define PID_MAGIC_ID 0x71432909
1583#define SERIAL_NUM_MAGIC_ID 0x61945374
1584#define SERIAL_NUMBER_LENGTH 127
1585#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1586
1587struct magic_num_struct {
1588 uint32_t pid;
1589 uint32_t serial_num;
1590};
1591
1592struct dload_struct {
1593 uint32_t reserved1;
1594 uint32_t reserved2;
1595 uint32_t reserved3;
1596 uint16_t reserved4;
1597 uint16_t pid;
1598 char serial_number[SERIAL_NUMBER_LENGTH];
1599 uint16_t reserved5;
1600 struct magic_num_struct magic_struct;
1601};
1602
1603static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1604{
1605 struct dload_struct __iomem *dload = 0;
1606
1607 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1608 if (!dload) {
1609 pr_err("%s: cannot remap I/O memory region: %08x\n",
1610 __func__, DLOAD_USB_BASE_ADD);
1611 return -ENXIO;
1612 }
1613
1614 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1615 __func__, dload, pid, snum);
1616 /* update pid */
1617 dload->magic_struct.pid = PID_MAGIC_ID;
1618 dload->pid = pid;
1619
1620 /* update serial number */
1621 dload->magic_struct.serial_num = 0;
1622 if (!snum) {
1623 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1624 goto out;
1625 }
1626
1627 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1628 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1629out:
1630 iounmap(dload);
1631 return 0;
1632}
1633
1634static struct android_usb_platform_data android_usb_pdata = {
1635 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1636};
1637
1638static struct platform_device android_usb_device = {
1639 .name = "android_usb",
1640 .id = -1,
1641 .dev = {
1642 .platform_data = &android_usb_pdata,
1643 },
1644};
1645
1646static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001647 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001648};
1649
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301650
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001651static uint8_t spm_retention_cmd_sequence[] __initdata = {
1652 0x00, 0x05, 0x03, 0x0D,
1653 0x0B, 0x00, 0x0f,
1654};
1655
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301656static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
1657 0x42, 0x1B, 0x00,
1658 0x05, 0x03, 0x01, 0x0B,
1659 0x00, 0x42, 0x1B,
1660 0x0f,
1661};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001662static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001663 0x00, 0x24, 0x54, 0x10,
1664 0x09, 0x03, 0x01,
1665 0x10, 0x54, 0x30, 0x0C,
1666 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001667};
1668
1669static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001670 0x00, 0x24, 0x54, 0x10,
1671 0x09, 0x07, 0x01, 0x0B,
1672 0x10, 0x54, 0x30, 0x0C,
1673 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001674};
1675
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001676static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1677 [0] = {
1678 .mode = MSM_SPM_MODE_CLOCK_GATING,
1679 .notify_rpm = false,
1680 .cmd = spm_wfi_cmd_sequence,
1681 },
1682 [1] = {
1683 .mode = MSM_SPM_MODE_POWER_RETENTION,
1684 .notify_rpm = false,
1685 .cmd = spm_retention_cmd_sequence,
1686 },
1687 [2] = {
1688 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1689 .notify_rpm = false,
1690 .cmd = spm_power_collapse_without_rpm,
1691 },
1692 [3] = {
1693 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1694 .notify_rpm = true,
1695 .cmd = spm_power_collapse_with_rpm,
1696 },
1697};
1698
1699static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001700 [0] = {
1701 .mode = MSM_SPM_MODE_CLOCK_GATING,
1702 .notify_rpm = false,
1703 .cmd = spm_wfi_cmd_sequence,
1704 },
1705 [1] = {
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301706 .mode = MSM_SPM_MODE_POWER_RETENTION,
1707 .notify_rpm = false,
1708 .cmd = spm_retention_cmd_sequence,
1709 },
1710 [2] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001711 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1712 .notify_rpm = false,
1713 .cmd = spm_power_collapse_without_rpm,
1714 },
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301715 [3] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001716 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1717 .notify_rpm = true,
1718 .cmd = spm_power_collapse_with_rpm,
1719 },
1720};
1721
1722static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1723 [0] = {
1724 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001725 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001726#if defined(CONFIG_MSM_AVS_HW)
1727 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1728 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1729#endif
1730 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001731 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1732 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1733 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001734 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001735 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1736 .modes = msm_spm_boot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001737 },
1738 [1] = {
1739 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001740 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001741#if defined(CONFIG_MSM_AVS_HW)
1742 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1743 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1744#endif
1745 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001746 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001747 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1748 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1749 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001750 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1751 .modes = msm_spm_nonboot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001752 },
1753};
1754
1755static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001756 0x00, 0x20, 0x03, 0x20,
1757 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001758};
1759
1760static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001761 0x00, 0x20, 0x34, 0x64,
1762 0x48, 0x07, 0x48, 0x20,
1763 0x50, 0x64, 0x04, 0x34,
1764 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001765};
1766static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001767 0x00, 0x10, 0x34, 0x64,
1768 0x48, 0x07, 0x48, 0x10,
1769 0x50, 0x64, 0x04, 0x34,
1770 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001771};
1772
1773static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1774 [0] = {
1775 .mode = MSM_SPM_L2_MODE_RETENTION,
1776 .notify_rpm = false,
1777 .cmd = l2_spm_wfi_cmd_sequence,
1778 },
1779 [1] = {
1780 .mode = MSM_SPM_L2_MODE_GDHS,
1781 .notify_rpm = true,
1782 .cmd = l2_spm_gdhs_cmd_sequence,
1783 },
1784 [2] = {
1785 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1786 .notify_rpm = true,
1787 .cmd = l2_spm_power_off_cmd_sequence,
1788 },
1789};
1790
1791static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1792 [0] = {
1793 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001794 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001795 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001796 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1797 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1798 .modes = msm_spm_l2_seq_list,
1799 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1800 },
1801};
1802
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301803#define ISA1200_HAP_EN_GPIO 77
1804#define ISA1200_HAP_LEN_GPIO 78
David Collinsfd344aa2012-08-06 15:02:03 -07001805#define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7)
1806#define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001807
1808static int isa1200_power(int on)
1809{
David Collinsfd344aa2012-08-06 15:02:03 -07001810 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
1811 enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1;
Amy Malocheb20c1052012-04-11 10:36:13 -07001812 int rc = 0;
1813
David Collinsfd344aa2012-08-06 15:02:03 -07001814 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
1815 gpio = ISA1200_HAP_CLK_PM8917;
1816 clk_id = CLK_MP3_2;
1817 }
1818
1819 gpio_set_value_cansleep(gpio, !!on);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301820
Amy Malocheb20c1052012-04-11 10:36:13 -07001821 if (on)
David Collinsfd344aa2012-08-06 15:02:03 -07001822 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001823 else
David Collinsfd344aa2012-08-06 15:02:03 -07001824 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001825
1826 if (rc) {
1827 pr_err("%s: unable to write aux clock register(%d)\n",
1828 __func__, rc);
1829 }
1830
1831 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001832}
1833
1834static int isa1200_dev_setup(bool enable)
1835{
David Collinsfd344aa2012-08-06 15:02:03 -07001836 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001837 int rc = 0;
1838
David Collinsfd344aa2012-08-06 15:02:03 -07001839 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1840 gpio = ISA1200_HAP_CLK_PM8917;
1841
Amy Malocheb20c1052012-04-11 10:36:13 -07001842 if (!enable)
1843 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301844
David Collinsfd344aa2012-08-06 15:02:03 -07001845 rc = gpio_request(gpio, "haptics_clk");
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301846 if (rc) {
1847 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
David Collinsfd344aa2012-08-06 15:02:03 -07001848 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301849 goto fail_gpio_req;
1850 }
1851
David Collinsfd344aa2012-08-06 15:02:03 -07001852 rc = gpio_direction_output(gpio, 0);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301853 if (rc) {
1854 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
David Collinsfd344aa2012-08-06 15:02:03 -07001855 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301856 goto fail_gpio_dir;
1857 }
1858
1859 return 0;
1860
1861fail_gpio_dir:
David Collinsfd344aa2012-08-06 15:02:03 -07001862 gpio_free(gpio);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301863fail_gpio_req:
1864 return rc;
1865
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001866}
1867
1868static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301869 {
1870 .name = "vddp",
1871 .min_uV = ISA_I2C_VTG_MIN_UV,
1872 .max_uV = ISA_I2C_VTG_MAX_UV,
1873 .load_uA = ISA_I2C_CURR_UA,
1874 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001875 {
1876 .name = "vcc_i2c",
1877 .min_uV = ISA_I2C_VTG_MIN_UV,
1878 .max_uV = ISA_I2C_VTG_MAX_UV,
1879 .load_uA = ISA_I2C_CURR_UA,
1880 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001881};
1882
1883static struct isa1200_platform_data isa1200_1_pdata = {
1884 .name = "vibrator",
1885 .dev_setup = isa1200_dev_setup,
1886 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301887 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1888 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001889 .max_timeout = 15000,
1890 .mode_ctrl = PWM_GEN_MODE,
1891 .pwm_fd = {
1892 .pwm_div = 256,
1893 },
1894 .is_erm = false,
1895 .smart_en = true,
1896 .ext_clk_en = true,
1897 .chip_en = 1,
1898 .regulator_info = isa1200_reg_data,
1899 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1900};
1901
1902static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1903 {
1904 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1905 .platform_data = &isa1200_1_pdata,
1906 },
1907};
1908
Amy Malochef3c9db42011-12-08 15:17:35 -08001909#define MXT_TS_GPIO_IRQ 11
1910#define MXT_TS_RESET_GPIO 52
1911
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301912static const u8 mxt_config_data_8930_v1[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001913 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001914 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001915 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301916 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001917 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301918 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001919 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301920 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001921 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301922 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1923 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1924 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1925 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001926 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001927 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1928 0,
1929 /* T18 Object */
1930 0, 0,
1931 /* T19 Object */
1932 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1933 0, 0, 0, 0, 0, 0,
1934 /* T23 Object */
1935 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1936 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001937 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001938 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1939 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001940 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001941 0, 0, 0, 0, 0,
1942 /* T42 Object */
1943 0, 0, 0, 0, 0, 0, 0, 0,
1944 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301945 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001946 /* T47 Object */
1947 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1948 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301949 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1950 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1951 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001952 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1953 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1954 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001955};
1956
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301957static const u8 mxt_config_data_8930_v2[] = {
1958 /* T6 Object */
1959 0, 0, 0, 0, 0, 0,
1960 /* T38 Object */
1961 15, 4, 0, 9, 7, 12, 0, 0,
1962 /* T7 Object */
1963 32, 16, 50,
1964 /* T8 Object */
1965 30, 0, 5, 10, 0, 0, 10, 10, 0, 0,
1966 /* T9 Object */
1967 131, 0, 0, 19, 11, 0, 16, 50, 1, 3,
1968 12, 7, 2, 0, 4, 5, 2, 10, 43, 4,
1969 54, 2, -25, 29, 38, 18, 143, 40, 207, 80,
1970 17, 5, 50, 50, 0,
1971 /* T18 Object */
1972 0, 0,
1973 /* T19 Object */
1974 0, 0, 0, 0, 0, 0,
1975 /* T25 Object */
1976 0, 0, 0, 0, 0, 0,
1977 /* T42 Object */
1978 3, 60, 20, 20, 150, 0, 0, 0,
1979 /* T46 Object */
1980 0, 3, 28, 28, 0, 0, 1, 0, 0,
1981 /* T47 Object */
1982 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1983 /* T48 Object */
1984 1, 3, 82, 0, 0, 0, 0, 0, 0, 0,
1985 16, 30, 0, 6, 6, 0, 0, 124, 4, 100,
1986 0, 0, 0, 5, 0, 42, 0, 1, 0, 40,
1987 52, 20, 0, 0, 0, 50, 1, 5, 2, 1,
1988 4, 5, 3, -25, 29, 38, 18, 143, 40, 207,
1989 80, 10, 5, 2,
1990 /* T55 Object */
1991 0, 0, 0, 0,
1992};
1993
Amy Malochef3c9db42011-12-08 15:17:35 -08001994static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1995 struct kobj_attribute *attr, char *buf)
1996{
1997 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301998 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1999 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
2000 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
2001 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08002002 "\n");
2003}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002004
Amy Malochef3c9db42011-12-08 15:17:35 -08002005static struct kobj_attribute mxt224e_vkeys_attr = {
2006 .attr = {
2007 .mode = S_IRUGO,
2008 },
2009 .show = &mxt224e_vkeys_show,
2010};
2011
2012static struct attribute *mxt224e_properties_attrs[] = {
2013 &mxt224e_vkeys_attr.attr,
2014 NULL
2015};
2016
2017static struct attribute_group mxt224e_properties_attr_group = {
2018 .attrs = mxt224e_properties_attrs,
2019};
2020
2021static void mxt_init_vkeys_8930(void)
2022{
Steve Mucklef132c6c2012-06-06 18:30:57 -07002023 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08002024 static struct kobject *mxt224e_properties_kobj;
2025
2026 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
2027 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
2028 NULL);
2029 if (mxt224e_properties_kobj)
2030 rc = sysfs_create_group(mxt224e_properties_kobj,
2031 &mxt224e_properties_attr_group);
2032 if (!mxt224e_properties_kobj || rc)
2033 pr_err("%s: failed to create board_properties\n",
2034 __func__);
2035
2036 return;
2037}
2038
Jing Lindc4413c2012-01-16 15:22:52 -08002039static struct mxt_config_info mxt_config_array[] = {
2040 {
Mohan Pallaka204b6f72012-07-09 14:44:10 +05302041 .config = mxt_config_data_8930_v1,
2042 .config_length = ARRAY_SIZE(mxt_config_data_8930_v1),
Jing Lindc4413c2012-01-16 15:22:52 -08002043 .family_id = 0x81,
2044 .variant_id = 0x01,
2045 .version = 0x10,
2046 .build = 0xAA,
Mohan Pallaka204b6f72012-07-09 14:44:10 +05302047 .bootldr_id = MXT_BOOTLOADER_ID_224E,
2048 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
2049 },
2050 {
2051 .config = mxt_config_data_8930_v2,
2052 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
2053 .family_id = 0x81,
2054 .variant_id = 0x15,
2055 .version = 0x11,
2056 .build = 0xAA,
2057 .bootldr_id = MXT_BOOTLOADER_ID_224E,
2058 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
2059 },
2060 {
2061 .config = mxt_config_data_8930_v2,
2062 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
2063 .family_id = 0x81,
2064 .variant_id = 0x01,
2065 .version = 0x20,
2066 .build = 0xAB,
2067 .bootldr_id = MXT_BOOTLOADER_ID_224E,
Jing Lindc4413c2012-01-16 15:22:52 -08002068 },
2069};
2070
Amy Malochef3c9db42011-12-08 15:17:35 -08002071static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08002072 .config_array = mxt_config_array,
2073 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002074 .panel_minx = 0,
2075 .panel_maxx = 566,
2076 .panel_miny = 0,
2077 .panel_maxy = 1067,
2078 .disp_minx = 0,
2079 .disp_maxx = 540,
2080 .disp_miny = 0,
2081 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002082 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05302083#ifdef MSM8930_PHASE_2
2084 .digital_pwr_regulator = true,
2085#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002086 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08002087 .reset_gpio = MXT_TS_RESET_GPIO,
2088 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002089};
2090
Amy Malochef3c9db42011-12-08 15:17:35 -08002091static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002092 {
Amy Malochef3c9db42011-12-08 15:17:35 -08002093 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
2094 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002095 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2096 },
2097};
2098
David Collinsfd344aa2012-08-06 15:02:03 -07002099#define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
2100#define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25)
Manoj Raoc6d904c2012-06-22 00:32:14 -07002101static struct msm_mhl_platform_data mhl_platform_data = {
2102 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
2103 .gpio_mhl_int = MHL_GPIO_INT,
2104 .gpio_mhl_reset = MHL_GPIO_RESET,
David Collinsfd344aa2012-08-06 15:02:03 -07002105 .gpio_mhl_power = MHL_POWER_GPIO_PM8038,
Manoj Raoc6d904c2012-06-22 00:32:14 -07002106 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
2107};
2108
2109static struct i2c_board_info sii_device_info[] __initdata = {
2110 {
2111 /*
2112 * keeps SI 8334 as the default
2113 * MHL TX
2114 */
2115 I2C_BOARD_INFO("sii8334", 0x39),
2116 .platform_data = &mhl_platform_data,
2117 .flags = I2C_CLIENT_WAKE,
2118 },
2119};
2120
2121
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302122#ifdef MSM8930_PHASE_2
2123
David Collinsfd344aa2012-08-06 15:02:03 -07002124#define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3)
2125#define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8)
2126#define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10)
2127#define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11)
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302128
David Collinsfd344aa2012-08-06 15:02:03 -07002129#define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27)
2130#define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28)
2131#define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36)
2132#define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37)
2133
2134static struct gpio_keys_button keys_8930_pm8038[] = {
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302135 {
2136 .code = KEY_VOLUMEUP,
2137 .type = EV_KEY,
2138 .desc = "volume_up",
David Collinsfd344aa2012-08-06 15:02:03 -07002139 .gpio = GPIO_VOLUME_UP_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302140 .wakeup = 1,
2141 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002142 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302143 },
2144 {
2145 .code = KEY_VOLUMEDOWN,
2146 .type = EV_KEY,
2147 .desc = "volume_down",
David Collinsfd344aa2012-08-06 15:02:03 -07002148 .gpio = GPIO_VOLUME_DOWN_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302149 .wakeup = 1,
2150 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002151 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302152 },
2153 {
2154 .code = KEY_CAMERA_FOCUS,
2155 .type = EV_KEY,
2156 .desc = "camera_focus",
David Collinsfd344aa2012-08-06 15:02:03 -07002157 .gpio = GPIO_CAMERA_FOCUS_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302158 .wakeup = 1,
2159 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002160 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302161 },
2162 {
2163 .code = KEY_CAMERA_SNAPSHOT,
2164 .type = EV_KEY,
2165 .desc = "camera_snapshot",
David Collinsfd344aa2012-08-06 15:02:03 -07002166 .gpio = GPIO_CAMERA_SNAPSHOT_PM8038,
2167 .wakeup = 1,
2168 .active_low = 1,
2169 .debounce_interval = 15,
2170 },
2171};
2172
2173static struct gpio_keys_button keys_8930_pm8917[] = {
2174 {
2175 .code = KEY_VOLUMEUP,
2176 .type = EV_KEY,
2177 .desc = "volume_up",
2178 .gpio = GPIO_VOLUME_UP_PM8917,
2179 .wakeup = 1,
2180 .active_low = 1,
2181 .debounce_interval = 15,
2182 },
2183 {
2184 .code = KEY_VOLUMEDOWN,
2185 .type = EV_KEY,
2186 .desc = "volume_down",
2187 .gpio = GPIO_VOLUME_DOWN_PM8917,
2188 .wakeup = 1,
2189 .active_low = 1,
2190 .debounce_interval = 15,
2191 },
2192 {
2193 .code = KEY_CAMERA_FOCUS,
2194 .type = EV_KEY,
2195 .desc = "camera_focus",
2196 .gpio = GPIO_CAMERA_FOCUS_PM8917,
2197 .wakeup = 1,
2198 .active_low = 1,
2199 .debounce_interval = 15,
2200 },
2201 {
2202 .code = KEY_CAMERA_SNAPSHOT,
2203 .type = EV_KEY,
2204 .desc = "camera_snapshot",
2205 .gpio = GPIO_CAMERA_SNAPSHOT_PM8917,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302206 .wakeup = 1,
2207 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002208 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302209 },
2210};
2211
2212/* Add GPIO keys for 8930 */
2213static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
David Collinsfd344aa2012-08-06 15:02:03 -07002214 .buttons = keys_8930_pm8038,
2215 .nbuttons = ARRAY_SIZE(keys_8930_pm8038),
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302216};
2217
2218static struct platform_device gpio_keys_8930 = {
2219 .name = "gpio-keys",
2220 .id = -1,
2221 .dev = {
2222 .platform_data = &gpio_keys_8930_pdata,
2223 },
2224};
2225#endif /* MSM8930_PHASE_2 */
2226
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002227static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2228 .clk_freq = 100000,
2229 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002230};
2231
2232static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2233 .clk_freq = 100000,
2234 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002235};
2236
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002237static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
2238 .clk_freq = 100000,
2239 .src_clk_rate = 24000000,
2240};
2241
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002242static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2243 .clk_freq = 100000,
2244 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002245};
2246
2247static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2248 .clk_freq = 100000,
2249 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002250};
2251
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002252
2253static struct ks8851_pdata spi_eth_pdata = {
2254 .irq_gpio = KS8851_IRQ_GPIO,
2255 .rst_gpio = KS8851_RST_GPIO,
2256};
2257
2258static struct spi_board_info spi_board_info[] __initdata = {
2259 {
2260 .modalias = "ks8851",
2261 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2262 .max_speed_hz = 19200000,
2263 .bus_num = 0,
2264 .chip_select = 0,
2265 .mode = SPI_MODE_0,
2266 .platform_data = &spi_eth_pdata
2267 },
2268 {
2269 .modalias = "dsi_novatek_3d_panel_spi",
2270 .max_speed_hz = 10800000,
2271 .bus_num = 0,
2272 .chip_select = 1,
2273 .mode = SPI_MODE_0,
2274 },
2275};
2276
2277static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002278 .name = "saw-regulator",
2279 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002280 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002281 .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002282 },
2283};
2284
2285static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002286 .name = "saw-regulator",
2287 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002288 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002289 .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002290 },
2291};
2292
2293static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002294 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002295 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002296 .tsens_num_sensor = 10,
2297 .slope = {1132, 1135, 1137, 1135, 1157,
2298 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002299};
2300
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002301static struct platform_device msm_tsens_device = {
2302 .name = "tsens8960-tm",
2303 .id = -1,
2304};
2305
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002306static struct msm_thermal_data msm_thermal_pdata = {
2307 .sensor_id = 9,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002308 .poll_ms = 250,
2309 .limit_temp_degC = 60,
2310 .temp_hysteresis_degC = 10,
2311 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002312};
2313
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002314#ifdef CONFIG_MSM_FAKE_BATTERY
2315static struct platform_device fish_battery_device = {
2316 .name = "fish_battery",
2317};
2318#endif
2319
David Collins1d4061b2011-12-06 15:36:40 -08002320#ifndef MSM8930_PHASE_2
2321
2322/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002323static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002324 .name = GPIO_REGULATOR_DEV_NAME,
2325 .id = PM8921_MPP_PM_TO_SYS(7),
2326 .dev = {
2327 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2328 },
2329};
2330
Jay Chokshi06fa7542011-12-07 13:09:17 -08002331static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002332 .name = GPIO_REGULATOR_DEV_NAME,
2333 .id = 91,
2334 .dev = {
2335 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2336 },
2337};
2338
David Collins1d4061b2011-12-06 15:36:40 -08002339#else
2340
2341/* 8930 Phase 2 */
2342static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2343 .name = GPIO_REGULATOR_DEV_NAME,
2344 .id = 63,
2345 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002346 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2347 MSM8930_GPIO_VREG_ID_EXT_5V],
David Collins1d4061b2011-12-06 15:36:40 -08002348 },
2349};
2350
2351static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2352 .name = GPIO_REGULATOR_DEV_NAME,
2353 .id = 97,
2354 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002355 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2356 MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
David Collins1d4061b2011-12-06 15:36:40 -08002357 },
2358};
2359
2360#endif
2361
Jay Chokshi06fa7542011-12-07 13:09:17 -08002362static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002363 .name = "rpm-regulator",
2364 .id = -1,
2365 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002366#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002367 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002368#else
David Collins4614cb92012-08-20 12:17:09 -07002369 .platform_data = &msm8930_pm8038_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002370#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002371 },
2372};
2373
David Collins4614cb92012-08-20 12:17:09 -07002374static struct platform_device *early_common_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002375 &msm8960_device_dmov,
2376 &msm_device_smd,
2377 &msm8960_device_uart_gsbi5,
2378 &msm_device_uart_dm6,
2379 &msm_device_saw_core0,
2380 &msm_device_saw_core1,
David Collins4614cb92012-08-20 12:17:09 -07002381};
2382
2383/* ext_5v and ext_otg_sw are present when using PM8038 */
2384static struct platform_device *pmic_pm8038_devices[] __initdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002385 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002386#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002387 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002388#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002389 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002390#ifdef MSM8930_PHASE_2
2391 &msm8930_device_ext_otg_sw_vreg,
2392#endif
David Collins4614cb92012-08-20 12:17:09 -07002393};
2394
2395/* ext_5v and ext_otg_sw are not present when using PM8917 */
2396static struct platform_device *pmic_pm8917_devices[] __initdata = {
2397 &msm8960_device_ssbi_pmic,
2398};
2399
2400static struct platform_device *common_devices[] __initdata = {
Stephen Boyd28d54952011-12-16 13:19:51 -08002401 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002402 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002403 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002404 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002405 &msm8960_device_qup_spi_gsbi1,
2406 &msm8960_device_qup_i2c_gsbi3,
2407 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002408 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002409 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002410 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002411 &msm_slim_ctrl,
2412 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002413#if defined(CONFIG_QSEECOM)
2414 &qseecom_device,
2415#endif
2416
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002417#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2418 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2419 &qcrypto_device,
2420#endif
2421
2422#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2423 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2424 &qcedev_device,
2425#endif
2426#ifdef CONFIG_MSM_ROTATOR
2427 &msm_rotator_device,
2428#endif
2429 &msm_device_sps,
2430#ifdef CONFIG_MSM_FAKE_BATTERY
2431 &fish_battery_device,
2432#endif
2433#ifdef CONFIG_ANDROID_PMEM
2434#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002435 &msm8930_android_pmem_device,
2436 &msm8930_android_pmem_adsp_device,
2437 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302438#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2439#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002440 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002441 &msm_device_bam_dmux,
2442 &msm_fm_platform_init,
2443
2444#ifdef CONFIG_HW_RANDOM_MSM
2445 &msm_device_rng,
2446#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002447 &msm8930_rpm_device,
2448 &msm8930_rpm_log_device,
Girish Mahadevan898c56d2012-06-05 16:09:19 -06002449 &msm8930_rpm_rbcpr_device,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002450 &msm8930_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302451 &msm8930_rpm_master_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002452#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002453 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002454#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002455 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002456 &coresight_tpiu_device,
2457 &coresight_etb_device,
2458 &coresight_funnel_device,
2459 &coresight_etm0_device,
2460 &coresight_etm1_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002461 &msm_device_dspcrashd_8960,
2462 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302463#ifdef MSM8930_PHASE_2
2464 &gpio_keys_8930,
2465#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002466 &msm8930_rtb_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002467 &msm_bus_8930_apps_fabric,
2468 &msm_bus_8930_sys_fabric,
2469 &msm_bus_8930_mm_fabric,
2470 &msm_bus_8930_sys_fpb,
2471 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002472 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002473 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002474 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002475 &msm8930_cache_dump_device,
Anji Jonnalaf91d8972013-02-26 17:55:50 +05302476 &msm8930_cpu_slp_status,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002477};
2478
2479static struct platform_device *cdp_devices[] __initdata = {
2480 &msm8960_device_otg,
2481 &msm8960_device_gadget_peripheral,
2482 &msm_device_hsusb_host,
2483 &android_usb_device,
2484 &msm_pcm,
2485 &msm_pcm_routing,
2486 &msm_cpudai0,
2487 &msm_cpudai1,
2488 &msm_cpudai_hdmi_rx,
2489 &msm_cpudai_bt_rx,
2490 &msm_cpudai_bt_tx,
2491 &msm_cpudai_fm_rx,
2492 &msm_cpudai_fm_tx,
2493 &msm_cpudai_auxpcm_rx,
2494 &msm_cpudai_auxpcm_tx,
2495 &msm_cpu_fe,
2496 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002497#ifdef CONFIG_MSM_GEMINI
2498 &msm8960_gemini_device,
2499#endif
2500 &msm_voice,
2501 &msm_voip,
2502 &msm_lpa_pcm,
2503 &msm_cpudai_afe_01_rx,
2504 &msm_cpudai_afe_01_tx,
2505 &msm_cpudai_afe_02_rx,
2506 &msm_cpudai_afe_02_tx,
2507 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002508 &msm_compr_dsp,
2509 &msm_cpudai_incall_music_rx,
2510 &msm_cpudai_incall_record_rx,
2511 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002512 &msm_pcm_hostless,
Asish Bhattacharya705c6732012-08-14 23:22:55 +05302513 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002514 &msm_lowlatency_pcm,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002515};
2516
2517static void __init msm8930_i2c_init(void)
2518{
2519 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2520 &msm8960_i2c_qup_gsbi4_pdata;
2521
2522 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2523 &msm8960_i2c_qup_gsbi3_pdata;
2524
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002525 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2526 &msm8960_i2c_qup_gsbi9_pdata;
2527
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002528 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2529 &msm8960_i2c_qup_gsbi10_pdata;
2530
2531 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2532 &msm8960_i2c_qup_gsbi12_pdata;
2533}
2534
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002535static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2536 {
2537 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2538 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2539 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002540 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002541 },
2542
2543 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002544 MSM_PM_SLEEP_MODE_RETENTION,
2545 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2546 true,
2547 415, 715, 340827, 475,
2548 },
2549
2550 {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002551 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2552 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2553 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002554 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002555 },
2556
2557 {
2558 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2559 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2560 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002561 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002562 },
2563
2564 {
2565 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002566 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2567 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002568 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002569 },
2570
2571 {
2572 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2573 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2574 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002575 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002576 },
2577
2578 {
2579 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2580 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2581 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002582 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002583 },
2584
2585 {
2586 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2587 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2588 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002589 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002590 },
2591
2592 {
2593 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2594 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2595 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002596 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002597 },
2598};
2599
Praveen Chidambaram78499012011-11-01 17:15:17 -06002600static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2601 .levels = &msm_rpmrs_levels[0],
2602 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2603 .vdd_mem_levels = {
2604 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2605 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2606 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2607 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2608 },
2609 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002610 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2611 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2612 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2613 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002614 },
2615 .vdd_mask = 0x7FFFFF,
2616 .rpmrs_target_id = {
2617 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2618 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002619 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2620 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002621 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2622 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2623 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2624 },
2625};
2626
Praveen Chidambaram75b8c812012-08-10 16:26:37 -06002627static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = {
2628 .levels = &msm_rpmrs_levels[0],
2629 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2630 .vdd_mem_levels = {
2631 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2632 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2633 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2634 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2635 },
2636 .vdd_dig_levels = {
2637 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2638 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2639 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2640 [MSM_RPMRS_VDD_DIG_MAX] = 3,
2641 },
2642 .vdd_mask = 0x7FFFFF,
2643 .rpmrs_target_id = {
2644 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2645 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2646 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2647 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
2648 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0,
2649 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1,
2650 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2651 },
2652};
2653
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002654static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2655 .mode = MSM_PM_BOOT_CONFIG_TZ,
2656};
2657
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002658#ifdef CONFIG_I2C
2659#define I2C_SURF 1
2660#define I2C_FFA (1 << 1)
2661#define I2C_RUMI (1 << 2)
2662#define I2C_SIM (1 << 3)
2663#define I2C_FLUID (1 << 4)
2664#define I2C_LIQUID (1 << 5)
2665
2666struct i2c_registry {
2667 u8 machs;
2668 int bus;
2669 struct i2c_board_info *info;
2670 int len;
2671};
2672
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002673#ifdef CONFIG_INPUT_MPU3050
2674#define MPU3050_INT_GPIO 69
2675
2676static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2677 .gpio_int = MPU3050_INT_GPIO,
2678};
2679
2680static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2681 {
2682 I2C_BOARD_INFO("mpu3050", 0x68),
Wentao Xuc7769c02012-08-03 15:06:41 -04002683 .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO),
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002684 .platform_data = &mpu3050_gyro,
2685 },
2686};
2687#endif
2688
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002689#ifdef CONFIG_ISL9519_CHARGER
2690static struct isl_platform_data isl_data __initdata = {
2691 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2692 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2693 .max_system_voltage = 4200,
2694 .min_system_voltage = 3200,
2695 .chgcurrent = 1000, /* 1900, */
2696 .term_current = 400, /* Need fine tuning */
2697 .input_current = 2048,
2698};
2699
2700static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2701 {
2702 I2C_BOARD_INFO("isl9519q", 0x9),
2703 .irq = 0, /* Not required when notify-by-pmic */
2704 .platform_data = &isl_data,
2705 },
2706};
2707#endif /* CONFIG_ISL9519_CHARGER */
2708
Wentao Xu114c0152012-06-12 11:40:38 -04002709#ifdef CONFIG_STM_LIS3DH
2710static struct lis3dh_acc_platform_data lis3dh_accel = {
2711 .poll_interval = 200,
2712 .min_interval = 10,
2713 .g_range = LIS3DH_ACC_G_2G,
2714 .axis_map_x = 1,
2715 .axis_map_y = 0,
2716 .axis_map_z = 2,
2717 .negate_x = 0,
2718 .negate_y = 0,
2719 .negate_z = 1,
2720 .init = NULL,
2721 .exit = NULL,
2722 .gpio_int1 = -EINVAL,
2723 .gpio_int2 = -EINVAL,
2724};
2725
2726static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = {
2727 {
2728 I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18),
2729 .platform_data = &lis3dh_accel,
2730 },
2731};
2732#endif /* CONFIG_STM_LIS3DH */
2733
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002734static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002735#ifdef CONFIG_ISL9519_CHARGER
2736 {
2737 I2C_LIQUID,
2738 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2739 isl_charger_i2c_info,
2740 ARRAY_SIZE(isl_charger_i2c_info),
2741 },
2742#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002743#ifdef CONFIG_INPUT_MPU3050
2744 {
2745 I2C_FFA | I2C_FLUID,
2746 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2747 mpu3050_i2c_boardinfo,
2748 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2749 },
2750#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002751 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002752 I2C_SURF | I2C_FFA | I2C_FLUID,
2753 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002754 msm_isa1200_board_info,
2755 ARRAY_SIZE(msm_isa1200_board_info),
2756 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002757 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002758 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002759 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2760 mxt_device_info_8930,
2761 ARRAY_SIZE(mxt_device_info_8930),
2762 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002763 {
2764 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2765 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2766 sii_device_info,
2767 ARRAY_SIZE(sii_device_info),
2768 },
Wentao Xu114c0152012-06-12 11:40:38 -04002769#ifdef CONFIG_STM_LIS3DH
2770 {
2771 I2C_FFA | I2C_FLUID,
2772 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2773 lis3dh_i2c_boardinfo,
2774 ARRAY_SIZE(lis3dh_i2c_boardinfo),
2775 },
2776#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002777};
2778#endif /* CONFIG_I2C */
2779
2780static void __init register_i2c_devices(void)
2781{
2782#ifdef CONFIG_I2C
2783 u8 mach_mask = 0;
2784 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002785#ifdef CONFIG_MSM_CAMERA
2786 struct i2c_registry msm8930_camera_i2c_devices = {
2787 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2788 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2789 msm8930_camera_board_info.board_info,
2790 msm8930_camera_board_info.num_i2c_board_info,
2791 };
2792#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002793
2794 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002795 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002796 mach_mask = I2C_SURF;
2797 else if (machine_is_msm8930_fluid())
2798 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002799 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002800 mach_mask = I2C_FFA;
2801 else
2802 pr_err("unmatched machine ID in register_i2c_devices\n");
2803
2804 /* Run the array and install devices as appropriate */
2805 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2806 if (msm8960_i2c_devices[i].machs & mach_mask)
2807 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2808 msm8960_i2c_devices[i].info,
2809 msm8960_i2c_devices[i].len);
2810 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002811#ifdef CONFIG_MSM_CAMERA
2812 if (msm8930_camera_i2c_devices.machs & mach_mask)
2813 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2814 msm8930_camera_i2c_devices.info,
2815 msm8930_camera_i2c_devices.len);
2816#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002817#endif
2818}
2819
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -07002820/*Modify the WCD9xxx platform data to support supplies from PM8917 */
2821static void __init msm8930_pm8917_wcd9xxx_pdata_fixup(
2822 struct wcd9xxx_pdata *cdc_pdata)
2823{
2824 int i;
2825
2826 for (i = 0; i < ARRAY_SIZE(cdc_pdata->regulator); i++) {
2827
2828 if (cdc_pdata->regulator[i].name != NULL
2829 && strncmp(cdc_pdata->regulator[i].name,
2830 "CDC_VDD_CP", 10) == 0) {
2831 cdc_pdata->regulator[i].min_uV =
2832 cdc_pdata->regulator[i].max_uV = 1800000;
2833 pr_info("%s: CDC_VDD_CP forced to 1.8 volts for PM8917\n",
2834 __func__);
2835 return;
2836 }
2837 }
2838}
2839
David Collinsfd344aa2012-08-06 15:02:03 -07002840/* Modify platform data values to match requirements for PM8917. */
2841static void __init msm8930_pm8917_pdata_fixup(void)
2842{
Patrick Dalyc1227cb2012-08-28 13:39:17 -07002843 struct acpuclk_platform_data *pdata;
2844
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -07002845 msm8930_pm8917_wcd9xxx_pdata_fixup(&sitar_platform_data);
2846 msm8930_pm8917_wcd9xxx_pdata_fixup(&sitar1p1_platform_data);
2847
David Collinsfd344aa2012-08-06 15:02:03 -07002848 mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917;
2849
2850 gpio_keys_8930_pdata.buttons = keys_8930_pm8917;
2851 gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917);
David Collins4614cb92012-08-20 12:17:09 -07002852
2853 msm_device_saw_core0.dev.platform_data
2854 = &msm8930_pm8038_saw_regulator_core0_pdata;
2855 msm_device_saw_core1.dev.platform_data
2856 = &msm8930_pm8038_saw_regulator_core1_pdata;
2857
2858 msm8930_device_rpm_regulator.dev.platform_data
2859 = &msm8930_pm8917_rpm_regulator_pdata;
Patrick Dalyc1227cb2012-08-28 13:39:17 -07002860
2861 pdata = msm8930_device_acpuclk.dev.platform_data;
2862 pdata->uses_pm8917 = true;
Tianyi Gou2520b6e2012-10-29 19:13:53 -07002863
2864 pdata = msm8930ab_device_acpuclk.dev.platform_data;
2865 pdata->uses_pm8917 = true;
David Collinsfd344aa2012-08-06 15:02:03 -07002866}
2867
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302868static void __init msm8930ab_update_retention_spm(void)
2869{
2870 int i;
2871
2872 /* Update the SPM sequences for krait retention on all cores */
2873 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
2874 int j;
2875 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
2876 for (j = 0; j < pdata->num_modes; j++) {
2877 if (pdata->modes[j].cmd ==
2878 spm_retention_cmd_sequence)
2879 pdata->modes[j].cmd =
2880 spm_retention_with_krait_v3_cmd_sequence;
2881 }
2882 }
2883}
2884
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002885static void __init msm8930_cdp_init(void)
2886{
David Collinsfd344aa2012-08-06 15:02:03 -07002887 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2888 msm8930_pm8917_pdata_fixup();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002889 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2890 pr_err("meminfo_init() failed!\n");
2891
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07002892 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002893 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002894 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram75b8c812012-08-10 16:26:37 -06002895 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
2896 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2897 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
2898 } else {
2899 BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917));
2900 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917));
2901 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002902
2903 regulator_suppress_info_printing();
2904 if (msm_xo_init())
2905 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002906 platform_device_register(&msm8930_device_rpm_regulator);
Patrick Daly8fad60d2012-08-27 16:25:07 -07002907 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2908 msm_clock_init(&msm8930_pm8917_clock_init_data);
2909 else
2910 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana7e574162013-01-08 15:10:51 +05302911
2912 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
2913 /*
2914 * By default, set USB mode as USB Peripheral only due to
2915 * hardware rework requirement for USB Host Mode.
2916 * Provide pmic_id_irq number only if host mode is enable
2917 * by user assuming that hardware rework is available.
2918 */
2919 if (enable_usb_host_mode) {
2920 /* MPP01 IRQ number */
2921 msm_otg_pdata.pmic_id_irq =
2922 PM8921_MPP_IRQ(PM8917_IRQ_BASE, 1);
2923 } else {
2924 pr_err("Enabling USB Peripheral Only mode.\n");
2925 msm_otg_pdata.mode = USB_PERIPHERAL;
2926 }
2927 } else {
2928 msm_otg_pdata.pmic_id_irq =
2929 PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE);
2930 }
2931
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302932 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Aravind Venkateswaran06a46352012-08-16 14:52:39 -07002933 if (msm8930_mhl_display_enabled()) {
2934 mhl_platform_data.mhl_enabled = true;
2935 msm_otg_pdata.mhl_enable = true;
2936 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002937 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302938 android_usb_pdata.swfi_latency =
2939 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002940 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002941 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2942 &msm8960_qup_spi_gsbi1_pdata;
2943 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2944
Jay Chokshi06fa7542011-12-07 13:09:17 -08002945 /*
2946 * TODO: When physical 8930/PM8038 hardware becomes
2947 * available, remove this block or add the config
2948 * option.
2949 */
2950#ifndef MSM8930_PHASE_2
2951 msm8960_init_pmic();
2952#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002953 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002954#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002955 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302956 msm8930_init_gpu();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302957 if (cpu_is_krait_v3()) {
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07002958 struct msm_pm_init_data_type *pdata =
2959 msm8930_pm_8x60.dev.platform_data;
2960 pdata->retention_calls_tz = false;
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302961 msm8930ab_update_retention_spm();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302962 }
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07002963
2964 platform_device_register(&msm8930_pm_8x60);
2965
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002966 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2967 msm_spm_l2_init(msm_spm_l2_data);
2968 msm8930_init_buses();
Aravind Venkateswaran896d2f92012-10-29 17:54:55 -07002969 if (cpu_is_msm8627()) {
Tianyi Gou723843b2012-06-13 15:24:56 -07002970 platform_add_devices(msm8627_footswitch,
2971 msm8627_num_footswitch);
Aravind Venkateswaran896d2f92012-10-29 17:54:55 -07002972 } else {
2973 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2974 platform_add_devices(msm8930_pm8917_footswitch,
2975 msm8930_pm8917_num_footswitch);
2976 else
2977 platform_add_devices(msm8930_footswitch,
2978 msm8930_num_footswitch);
2979 }
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002980 if (cpu_is_msm8627())
Matt Wagantallab730bd2012-06-07 20:13:51 -07002981 platform_device_register(&msm8627_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002982 else if (cpu_is_msm8930())
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002983 platform_device_register(&msm8930_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002984 else if (cpu_is_msm8930aa())
2985 platform_device_register(&msm8930aa_device_acpuclk);
Tianyi Gou2520b6e2012-10-29 19:13:53 -07002986 else if (cpu_is_msm8930ab())
2987 platform_device_register(&msm8930ab_device_acpuclk);
David Collins4614cb92012-08-20 12:17:09 -07002988 platform_add_devices(early_common_devices,
2989 ARRAY_SIZE(early_common_devices));
2990 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2991 platform_add_devices(pmic_pm8038_devices,
2992 ARRAY_SIZE(pmic_pm8038_devices));
2993 else
2994 platform_add_devices(pmic_pm8917_devices,
2995 ARRAY_SIZE(pmic_pm8917_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002996 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002997 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002998 /*
2999 * TODO: When physical 8930/PM8038 hardware becomes
3000 * available, remove this block or add the config
3001 * option.
3002 */
3003#ifndef MSM8930_PHASE_2
3004 msm8960_pm8921_gpio_mpp_init();
3005#else
David Collinsfd344aa2012-08-06 15:02:03 -07003006 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3007 msm8930_pm8038_gpio_mpp_init();
3008 else
3009 msm8930_pm8917_gpio_mpp_init();
Jay Chokshi06fa7542011-12-07 13:09:17 -08003010#endif
Jin Hongd2e2d3b2012-11-01 14:16:33 -07003011 /* Don't add modem devices on APQ targets */
3012 if (socinfo_get_id() != 119 && socinfo_get_id() != 157
3013 && socinfo_get_id() != 160)
3014 platform_device_register(&msm_8960_q6_mss);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003015 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07003016#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003017 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003018#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003019 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07003020 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003021 register_i2c_devices();
3022 msm8930_init_fb();
3023 slim_register_board_info(msm_slim_devices,
3024 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003025 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003026 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003027
3028 if (PLATFORM_IS_CHARM25())
3029 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
3030}
3031
3032MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
3033 .map_io = msm8930_map_io,
3034 .reserve = msm8930_reserve,
3035 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303036 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003037 .timer = &msm_timer,
3038 .init_machine = msm8930_cdp_init,
3039 .init_early = msm8930_allocate_memory_regions,
3040 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003041 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003042 .smp = &msm8960_smp_ops,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003043MACHINE_END
3044
3045MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
3046 .map_io = msm8930_map_io,
3047 .reserve = msm8930_reserve,
3048 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303049 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003050 .timer = &msm_timer,
3051 .init_machine = msm8930_cdp_init,
3052 .init_early = msm8930_allocate_memory_regions,
3053 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003054 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003055 .smp = &msm8960_smp_ops,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003056MACHINE_END
3057
3058MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
3059 .map_io = msm8930_map_io,
3060 .reserve = msm8930_reserve,
3061 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303062 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003063 .timer = &msm_timer,
3064 .init_machine = msm8930_cdp_init,
3065 .init_early = msm8930_allocate_memory_regions,
3066 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003067 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003068 .smp = &msm8960_smp_ops,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003069MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003070
3071MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
3072 .map_io = msm8930_map_io,
3073 .reserve = msm8930_reserve,
3074 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303075 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003076 .timer = &msm_timer,
3077 .init_machine = msm8930_cdp_init,
3078 .init_early = msm8930_allocate_memory_regions,
3079 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003080 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003081 .smp = &msm8960_smp_ops,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003082MACHINE_END
3083
3084MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
3085 .map_io = msm8930_map_io,
3086 .reserve = msm8930_reserve,
3087 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303088 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003089 .timer = &msm_timer,
3090 .init_machine = msm8930_cdp_init,
3091 .init_early = msm8930_allocate_memory_regions,
3092 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003093 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003094 .smp = &msm8960_smp_ops,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003095MACHINE_END