blob: 891ed909e13341573ece92d07686664ff1c5b8df [file] [log] [blame]
Abhijeet Dharmapurikar44451662012-08-23 18:58:44 -07001/* Copyright (c) 2011-2012, 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 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/i2c.h>
18#include <linux/i2c/sx150x.h>
19#include <linux/i2c/isl9519.h>
20#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070022#include <linux/regulator/msm-gpio-regulator.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080023#include <linux/mfd/pm8xxx/pm8921.h>
24#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
25#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080029#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080032#include <linux/dma-mapping.h>
33#include <linux/platform_data/qcom_crypto_device.h>
34#include <linux/platform_data/qcom_wcnss_device.h>
35#include <linux/leds.h>
36#include <linux/leds-pm8xxx.h>
37#include <linux/i2c/atmel_mxt_ts.h>
38#include <linux/msm_tsens.h>
39#include <linux/ks8851.h>
40#include <linux/i2c/isa1200.h>
Anirudh Ghayaleb3af972011-12-13 17:29:06 +053041#include <linux/gpio_keys.h>
Jack Cheung6ce8f682012-01-17 10:35:42 -080042#include <linux/memory.h>
Hanumant Singheea62562012-05-14 11:32:45 -070043#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060044#include <linux/msm_thermal.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080045
Asish Bhattacharyab86c3472012-02-15 08:31:52 +053046#include <linux/slimbus/slimbus.h>
47#include <linux/mfd/wcd9xxx/core.h>
48#include <linux/mfd/wcd9xxx/pdata.h>
49
Wentao Xu114c0152012-06-12 11:40:38 -040050#ifdef CONFIG_STM_LIS3DH
51#include <linux/input/lis3dh.h>
52#endif
53
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080054#include <asm/mach-types.h>
55#include <asm/mach/arch.h>
56#include <asm/setup.h>
57#include <asm/hardware/gic.h>
58#include <asm/mach/mmc.h>
59
60#include <mach/board.h>
61#include <mach/msm_iomap.h>
62#include <mach/msm_spi.h>
63#ifdef CONFIG_USB_MSM_OTG_72K
64#include <mach/msm_hsusb.h>
65#else
66#include <linux/usb/msm_hsusb.h>
67#endif
68#include <linux/usb/android.h>
69#include <mach/usbdiag.h>
70#include <mach/socinfo.h>
71#include <mach/rpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080072#include <mach/gpiomux.h>
73#include <mach/msm_bus_board.h>
74#include <mach/msm_memtypes.h>
75#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080076#include <mach/msm_xo.h>
77#include <mach/restart.h>
78
Mitchel Humpherysb8055522012-09-06 11:33:28 -070079#include <linux/msm_ion.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080080#include <mach/ion.h>
81#include <mach/mdm2.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080082#include <mach/msm_rtb.h>
Hanumant Singheea62562012-05-14 11:32:45 -070083#include <linux/fmem.h>
Laura Abbottf3173042012-05-29 15:23:18 -070084#include <mach/msm_cache_dump.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080085
Jordan Crouse914de9b2012-07-09 13:49:46 -060086#include <mach/kgsl.h>
Wentao Xuf59ce4e2012-05-22 17:30:13 -040087#ifdef CONFIG_INPUT_MPU3050
88#include <linux/input/mpu3050.h>
89#endif
90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080091#include "timer.h"
92#include "devices.h"
93#include "devices-msm8x60.h"
94#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080095#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080096#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080097#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053098#include <mach/mpm.h>
Matt Wagantall33d01f52012-02-23 23:27:44 -080099#include "clock.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800100#include "smd_private.h"
101#include "pm-boot.h"
102#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -0800103#include "board-8930.h"
Patrick Dalyc1227cb2012-08-28 13:39:17 -0700104#include "acpuclock-krait.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800105
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800106static struct platform_device msm_fm_platform_init = {
107 .name = "iris_fm",
108 .id = -1,
109};
110
111#define KS8851_RST_GPIO 89
112#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800113#define HAP_SHIFT_LVL_OE_GPIO 47
114
Manoj Raoc6d904c2012-06-22 00:32:14 -0700115#define HDMI_MHL_MUX_GPIO 73
116#define MHL_GPIO_INT 72
117#define MHL_GPIO_RESET 71
118#define MHL_GPIO_PWR_EN 5
119
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800120#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
121
122struct sx150x_platform_data msm8930_sx150x_data[] = {
123 [SX150X_CAM] = {
124 .gpio_base = GPIO_CAM_EXPANDER_BASE,
125 .oscio_is_gpo = false,
126 .io_pullup_ena = 0x0,
127 .io_pulldn_ena = 0xc0,
128 .io_open_drain_ena = 0x0,
129 .irq_summary = -1,
130 },
131};
132
133#endif
134
Olav Haugana21169d2012-01-04 09:17:06 -0800135#define MSM_PMEM_ADSP_SIZE 0x7800000
Jay Wang01dbdcf2012-10-16 13:32:21 -0700136#define MSM_PMEM_AUDIO_SIZE 0x314000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800137#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
138#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
139#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800140#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800141#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700142#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800143
144#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur9830bf02012-06-01 15:04:29 -0700145#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700146#define MSM_CONTIG_MEM_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700147#ifdef CONFIG_MSM_IOMMU
148#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
149#define MSM_ION_SF_SIZE 0x0
Olav Haugan494e4dc2012-05-15 15:14:31 -0700150#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Hanumant Singhedfb0462012-05-15 14:49:32 -0700151#define MSM_ION_HEAP_NUM 7
152#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800153#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800154#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan494e4dc2012-05-15 15:14:31 -0700155#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Hanumant Singheea62562012-05-14 11:32:45 -0700156#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700157#endif
Deepak Kotur9830bf02012-06-01 15:04:29 -0700158#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800159#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800160#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700161
162#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
163#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
164#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
165
Deepak Kotur9830bf02012-06-01 15:04:29 -0700166#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */
167#define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
168 HOLE_SIZE))
Hanumant Singheea62562012-05-14 11:32:45 -0700169#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur9830bf02012-06-01 15:04:29 -0700170#define MSM8930_FW_START MSM8930_FIXED_AREA_START
Hanumant Singheea62562012-05-14 11:32:45 -0700171
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800172#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700173#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800174#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800175#endif
176
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700177#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
178static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
179static int __init msm_contig_mem_size_setup(char *p)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800180{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700181 msm_contig_mem_size = memparse(p, NULL);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800182 return 0;
183}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700184early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800185#endif
186
187#ifdef CONFIG_ANDROID_PMEM
188static unsigned pmem_size = MSM_PMEM_SIZE;
189static int __init pmem_size_setup(char *p)
190{
191 pmem_size = memparse(p, NULL);
192 return 0;
193}
194early_param("pmem_size", pmem_size_setup);
195
196static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
197
198static int __init pmem_adsp_size_setup(char *p)
199{
200 pmem_adsp_size = memparse(p, NULL);
201 return 0;
202}
203early_param("pmem_adsp_size", pmem_adsp_size_setup);
204
205static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
206
207static int __init pmem_audio_size_setup(char *p)
208{
209 pmem_audio_size = memparse(p, NULL);
210 return 0;
211}
212early_param("pmem_audio_size", pmem_audio_size_setup);
213#endif
214
215#ifdef CONFIG_ANDROID_PMEM
216#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
217static struct android_pmem_platform_data android_pmem_pdata = {
218 .name = "pmem",
219 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
220 .cached = 1,
221 .memory_type = MEMTYPE_EBI1,
222};
223
Laura Abbottb93525f2012-04-12 09:57:19 -0700224static struct platform_device msm8930_android_pmem_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800225 .name = "android_pmem",
226 .id = 0,
227 .dev = {.platform_data = &android_pmem_pdata},
228};
229
230static struct android_pmem_platform_data android_pmem_adsp_pdata = {
231 .name = "pmem_adsp",
232 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
233 .cached = 0,
234 .memory_type = MEMTYPE_EBI1,
235};
Laura Abbottb93525f2012-04-12 09:57:19 -0700236static struct platform_device msm8930_android_pmem_adsp_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800237 .name = "android_pmem",
238 .id = 2,
239 .dev = { .platform_data = &android_pmem_adsp_pdata },
240};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800241
242static struct android_pmem_platform_data android_pmem_audio_pdata = {
243 .name = "pmem_audio",
244 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
245 .cached = 0,
246 .memory_type = MEMTYPE_EBI1,
247};
248
Laura Abbottb93525f2012-04-12 09:57:19 -0700249static struct platform_device msm8930_android_pmem_audio_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800250 .name = "android_pmem",
251 .id = 4,
252 .dev = { .platform_data = &android_pmem_audio_pdata },
253};
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530254#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
255#endif /* CONFIG_ANDROID_PMEM */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800256
Hanumant Singheea62562012-05-14 11:32:45 -0700257struct fmem_platform_data msm8930_fmem_pdata = {
258};
259
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800260#define DSP_RAM_BASE_8960 0x8da00000
261#define DSP_RAM_SIZE_8960 0x1800000
262static int dspcrashd_pdata_8960 = 0xDEADDEAD;
263
264static struct resource resources_dspcrashd_8960[] = {
265 {
266 .name = "msm_dspcrashd",
267 .start = DSP_RAM_BASE_8960,
268 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
269 .flags = IORESOURCE_DMA,
270 },
271};
272
273static struct platform_device msm_device_dspcrashd_8960 = {
274 .name = "msm_dspcrashd",
275 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
276 .resource = resources_dspcrashd_8960,
277 .dev = { .platform_data = &dspcrashd_pdata_8960 },
278};
279
280static struct memtype_reserve msm8930_reserve_table[] __initdata = {
281 [MEMTYPE_SMI] = {
282 },
283 [MEMTYPE_EBI0] = {
284 .flags = MEMTYPE_FLAGS_1M_ALIGN,
285 },
286 [MEMTYPE_EBI1] = {
287 .flags = MEMTYPE_FLAGS_1M_ALIGN,
288 },
289};
290
Laura Abbottf8c03b92012-02-16 14:57:58 -0800291
292static void __init reserve_rtb_memory(void)
293{
294#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700295 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800296#endif
297}
298
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800299static void __init size_pmem_devices(void)
300{
301#ifdef CONFIG_ANDROID_PMEM
302#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
303 android_pmem_adsp_pdata.size = pmem_adsp_size;
304 android_pmem_pdata.size = pmem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800305 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530306#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
307#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800308}
309
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530310#ifdef CONFIG_ANDROID_PMEM
311#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800312static void __init reserve_memory_for(struct android_pmem_platform_data *p)
313{
314 msm8930_reserve_table[p->memory_type].size += p->size;
315}
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530316#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
317#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800318
319static void __init reserve_pmem_memory(void)
320{
321#ifdef CONFIG_ANDROID_PMEM
322#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
323 reserve_memory_for(&android_pmem_adsp_pdata);
324 reserve_memory_for(&android_pmem_pdata);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800325 reserve_memory_for(&android_pmem_audio_pdata);
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530326#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700327 msm8930_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530328#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800329}
330
331static int msm8930_paddr_to_memtype(unsigned int paddr)
332{
333 return MEMTYPE_EBI1;
334}
335
Steve Mucklef132c6c2012-06-06 18:30:57 -0700336#define FMEM_ENABLED 0
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800337#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800338#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700339static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800340 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800341 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700342 .reusable = FMEM_ENABLED,
343 .mem_is_fmem = FMEM_ENABLED,
344 .fixed_position = FIXED_MIDDLE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800345};
346
Laura Abbottb93525f2012-04-12 09:57:19 -0700347static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800348 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800349 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700350 .reusable = 0,
351 .mem_is_fmem = FMEM_ENABLED,
352 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800353};
Hanumant Singheea62562012-05-14 11:32:45 -0700354
Laura Abbottb93525f2012-04-12 09:57:19 -0700355static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800356 .adjacent_mem_id = INVALID_HEAP_ID,
357 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700358 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800359};
Hanumant Singheea62562012-05-14 11:32:45 -0700360
Laura Abbottb93525f2012-04-12 09:57:19 -0700361static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800362 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
363 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700364 .mem_is_fmem = FMEM_ENABLED,
365 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800366};
367#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800368
369/**
370 * These heaps are listed in the order they will be allocated. Due to
371 * video hardware restrictions and content protection the FW heap has to
372 * be allocated adjacent (below) the MM heap and the MFC heap has to be
373 * allocated after the MM heap to ensure MFC heap is not more than 256MB
374 * away from the base address of the FW heap.
375 * However, the order of FW heap and MM heap doesn't matter since these
376 * two heaps are taken care of by separate code to ensure they are adjacent
377 * to each other.
378 * Don't swap the order unless you know what you are doing!
379 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700380static struct ion_platform_data msm8930_ion_pdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800381 .nr = MSM_ION_HEAP_NUM,
382 .heaps = {
383 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800384 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800385 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800386 .name = ION_VMALLOC_HEAP_NAME,
387 },
388#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
389 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800390 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800391 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800392 .name = ION_MM_HEAP_NAME,
393 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800394 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700395 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800396 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800397 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800398 .id = ION_MM_FIRMWARE_HEAP_ID,
399 .type = ION_HEAP_TYPE_CARVEOUT,
400 .name = ION_MM_FIRMWARE_HEAP_NAME,
401 .size = MSM_ION_MM_FW_SIZE,
402 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700403 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800404 },
405 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800406 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800407 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800408 .name = ION_MFC_HEAP_NAME,
409 .size = MSM_ION_MFC_SIZE,
410 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700411 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800412 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700413#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800414 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800415 .id = ION_SF_HEAP_ID,
416 .type = ION_HEAP_TYPE_CARVEOUT,
417 .name = ION_SF_HEAP_NAME,
418 .size = MSM_ION_SF_SIZE,
419 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700420 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800421 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700422#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800423 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800424 .id = ION_IOMMU_HEAP_ID,
425 .type = ION_HEAP_TYPE_IOMMU,
426 .name = ION_IOMMU_HEAP_NAME,
427 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800428 {
429 .id = ION_QSECOM_HEAP_ID,
430 .type = ION_HEAP_TYPE_CARVEOUT,
431 .name = ION_QSECOM_HEAP_NAME,
432 .size = MSM_ION_QSECOM_SIZE,
433 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700434 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800435 },
Olav Haugan7355db02012-01-13 16:59:13 -0800436 {
437 .id = ION_AUDIO_HEAP_ID,
438 .type = ION_HEAP_TYPE_CARVEOUT,
439 .name = ION_AUDIO_HEAP_NAME,
440 .size = MSM_ION_AUDIO_SIZE,
441 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700442 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800443 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800444#endif
445 }
446};
447
Laura Abbottb93525f2012-04-12 09:57:19 -0700448static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800449 .name = "ion-msm",
450 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700451 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800452};
453#endif
454
Hanumant Singheea62562012-05-14 11:32:45 -0700455struct platform_device msm8930_fmem_device = {
456 .name = "fmem",
457 .id = 1,
458 .dev = { .platform_data = &msm8930_fmem_pdata },
459};
460
461static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
462 unsigned long size)
463{
464 msm8930_reserve_table[mem_type].size += size;
465}
466
467static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
468{
469#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
470 int ret;
471
472 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
473 panic("fixed area size is larger than %dM\n",
474 MAX_FIXED_AREA_SIZE >> 20);
475
476 reserve_info->fixed_area_size = fixed_area_size;
477 reserve_info->fixed_area_start = MSM8930_FW_START;
478
479 ret = memblock_remove(reserve_info->fixed_area_start,
480 reserve_info->fixed_area_size);
481 BUG_ON(ret);
482#endif
483}
484
485/**
486 * Reserve memory for ION and calculate amount of reusable memory for fmem.
487 * We only reserve memory for heaps that are not reusable. However, we only
488 * support one reusable heap at the moment so we ignore the reusable flag for
489 * other than the first heap with reusable flag set. Also handle special case
490 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
491 * at a higher address than FW in addition to not more than 256MB away from the
492 * base address of the firmware. This means that if MM is reusable the other
493 * two heaps must be allocated in the same region as FW. This is handled by the
494 * mem_is_fmem flag in the platform data. In addition the MM heap must be
495 * adjacent to the FW heap for content protection purposes.
496 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700497static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800498{
499#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700500 unsigned int i;
Hanumant Singheea62562012-05-14 11:32:45 -0700501 unsigned int fixed_size = 0;
502 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
503 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
504
Hanumant Singheea62562012-05-14 11:32:45 -0700505 fixed_low_size = 0;
506 fixed_middle_size = 0;
507 fixed_high_size = 0;
508
Hanumant Singheea62562012-05-14 11:32:45 -0700509 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
510 const struct ion_platform_heap *heap =
511 &(msm8930_ion_pdata.heaps[i]);
512
513 if (heap->extra_data) {
514 int fixed_position = NOT_FIXED;
Hanumant Singheea62562012-05-14 11:32:45 -0700515
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700516 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700517 case ION_HEAP_TYPE_CP:
Hanumant Singheea62562012-05-14 11:32:45 -0700518 fixed_position = ((struct ion_cp_heap_pdata *)
519 heap->extra_data)->fixed_position;
520 break;
521 case ION_HEAP_TYPE_CARVEOUT:
Hanumant Singheea62562012-05-14 11:32:45 -0700522 fixed_position = ((struct ion_co_heap_pdata *)
523 heap->extra_data)->fixed_position;
524 break;
525 default:
526 break;
527 }
528
529 if (fixed_position != NOT_FIXED)
530 fixed_size += heap->size;
531 else
532 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
533
534 if (fixed_position == FIXED_LOW)
535 fixed_low_size += heap->size;
536 else if (fixed_position == FIXED_MIDDLE)
537 fixed_middle_size += heap->size;
538 else if (fixed_position == FIXED_HIGH)
539 fixed_high_size += heap->size;
540
Hanumant Singheea62562012-05-14 11:32:45 -0700541 }
542 }
543
544 if (!fixed_size)
545 return;
546
Hanumant Singheea62562012-05-14 11:32:45 -0700547 /* Since the fixed area may be carved out of lowmem,
548 * make sure the length is a multiple of 1M.
549 */
550 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
551 & SECTION_MASK;
552 msm8930_reserve_fixed_area(fixed_size);
553
554 fixed_low_start = MSM8930_FIXED_AREA_START;
Deepak Kotur9830bf02012-06-01 15:04:29 -0700555 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700556 fixed_high_start = fixed_middle_start + fixed_middle_size;
557
558 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
559 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
560
561 if (heap->extra_data) {
562 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700563 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700564
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700565 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700566 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700567 pdata =
568 (struct ion_cp_heap_pdata *)heap->extra_data;
569 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700570 break;
571 case ION_HEAP_TYPE_CARVEOUT:
572 fixed_position = ((struct ion_co_heap_pdata *)
573 heap->extra_data)->fixed_position;
574 break;
575 default:
576 break;
577 }
578
579 switch (fixed_position) {
580 case FIXED_LOW:
581 heap->base = fixed_low_start;
582 break;
583 case FIXED_MIDDLE:
584 heap->base = fixed_middle_start;
Deepak Kotur9830bf02012-06-01 15:04:29 -0700585 pdata->secure_base = fixed_middle_start
586 - HOLE_SIZE;
587 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700588 break;
589 case FIXED_HIGH:
590 heap->base = fixed_high_start;
591 break;
592 default:
593 break;
594 }
595 }
596 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800597#endif
598}
Huaibin Yanga5419422011-12-08 23:52:10 -0800599
600static void __init reserve_mdp_memory(void)
601{
602 msm8930_mdp_writeback(msm8930_reserve_table);
603}
604
Laura Abbottf3173042012-05-29 15:23:18 -0700605#ifdef CONFIG_MSM_CACHE_DUMP
606static void __init reserve_cache_dump_memory(void)
607{
608 unsigned int total;
609
610 total = msm8930_cache_dump_pdata.l1_size +
611 msm8930_cache_dump_pdata.l2_size;
612 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
613}
614#else
615static void __init reserve_cache_dump_memory(void) { }
616#endif
617
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800618static void __init msm8930_calculate_reserve_sizes(void)
619{
620 size_pmem_devices();
621 reserve_pmem_memory();
622 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800623 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800624 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700625 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800626}
627
628static struct reserve_info msm8930_reserve_info __initdata = {
629 .memtype_reserve_table = msm8930_reserve_table,
630 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700631 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800632 .paddr_to_memtype = msm8930_paddr_to_memtype,
633};
634
635static int msm8930_memory_bank_size(void)
636{
637 return 1<<29;
638}
639
640static void __init locate_unstable_memory(void)
641{
642 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
643 unsigned long bank_size;
644 unsigned long low, high;
645
646 bank_size = msm8930_memory_bank_size();
647 low = meminfo.bank[0].start;
648 high = mb->start + mb->size;
649
650 /* Check if 32 bit overflow occured */
651 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700652 high -= PAGE_SIZE;
653
654 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
655 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800656
657 low &= ~(bank_size - 1);
658
659 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700660 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800661
662 msm8930_reserve_info.bank_size = bank_size;
663#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800664 msm8930_reserve_info.low_unstable_address = mb->start -
665 MIN_MEMORY_BLOCK_SIZE + mb->size;
666 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800667 pr_info("low unstable address %lx max size %lx bank size %lx\n",
668 msm8930_reserve_info.low_unstable_address,
669 msm8930_reserve_info.max_unstable_size,
670 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700671 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800672#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700673no_dmm:
674 msm8930_reserve_info.low_unstable_address = high;
675 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800676}
677
678static void __init place_movable_zone(void)
679{
Larry Basselb8d61022012-02-24 10:49:45 -0800680#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800681 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
682 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
683 pr_info("movable zone start %lx size %lx\n",
684 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800685#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800686}
687
688static void __init msm8930_early_memory(void)
689{
690 reserve_info = &msm8930_reserve_info;
691 locate_unstable_memory();
692 place_movable_zone();
693}
694
Aravind Venkateswaran06a46352012-08-16 14:52:39 -0700695static char prim_panel_name[PANEL_NAME_MAX_LEN];
696static char ext_panel_name[PANEL_NAME_MAX_LEN];
697
698static int __init prim_display_setup(char *param)
699{
700 if (strnlen(param, PANEL_NAME_MAX_LEN))
701 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
702 return 0;
703}
704early_param("prim_display", prim_display_setup);
705
706static int __init ext_display_setup(char *param)
707{
708 if (strnlen(param, PANEL_NAME_MAX_LEN))
709 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
710 return 0;
711}
712early_param("ext_display", ext_display_setup);
713
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800714static void __init msm8930_reserve(void)
715{
Aravind Venkateswaran06a46352012-08-16 14:52:39 -0700716 msm8930_set_display_params(prim_panel_name, ext_panel_name);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800717 msm_reserve();
718}
719
720static int msm8930_change_memory_power(u64 start, u64 size,
721 int change_type)
722{
723 return soc_change_memory_power(start, size, change_type);
724}
725
726static void __init msm8930_allocate_memory_regions(void)
727{
728 msm8930_allocate_fb_region();
729}
730
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530731#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800732
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530733#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800734
735/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
736 * 4 micbiases are used to power various analog and digital
737 * microphones operating at 1800 mV. Technically, all micbiases
738 * can source from single cfilter since all microphones operate
739 * at the same voltage level. The arrangement below is to make
740 * sure all cfilters are exercised. LDO_H regulator ouput level
741 * does not need to be as high as 2.85V. It is choosen for
742 * microphone sensitivity purpose.
743 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530744static struct wcd9xxx_pdata sitar_platform_data = {
745 .slimbus_slave_device = {
746 .name = "sitar-slave",
747 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800748 },
749 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530750 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530751 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530752 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800753 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530754 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800755 .cfilt1_mv = 1800,
756 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530757 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
758 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700759 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
760 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530761 },
762 .regulator = {
763 {
764 .name = "CDC_VDD_CP",
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -0700765 .min_uV = 2200000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530766 .max_uV = 2200000,
767 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
768 },
769 {
770 .name = "CDC_VDDA_RX",
771 .min_uV = 1800000,
772 .max_uV = 1800000,
773 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
774 },
775 {
776 .name = "CDC_VDDA_TX",
777 .min_uV = 1800000,
778 .max_uV = 1800000,
779 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
780 },
781 {
782 .name = "VDDIO_CDC",
783 .min_uV = 1800000,
784 .max_uV = 1800000,
785 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
786 },
787 {
788 .name = "VDDD_CDC_D",
789 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700790 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530791 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
792 },
793 {
794 .name = "CDC_VDDA_A_1P2V",
795 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700796 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530797 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
798 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800799 },
800};
801
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530802static struct slim_device msm_slim_sitar = {
803 .name = "sitar-slim",
804 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800805 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530806 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800807 },
808};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700809
810static struct wcd9xxx_pdata sitar1p1_platform_data = {
811 .slimbus_slave_device = {
812 .name = "sitar-slave",
813 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
814 },
815 .irq = MSM_GPIO_TO_INT(62),
816 .irq_base = SITAR_INTERRUPT_BASE,
817 .num_irqs = NR_WCD9XXX_IRQS,
818 .reset_gpio = 42,
819 .micbias = {
820 .ldoh_v = SITAR_LDOH_2P85_V,
821 .cfilt1_mv = 1800,
822 .cfilt2_mv = 1800,
823 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
824 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700825 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
826 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700827 },
828 .regulator = {
829 {
830 .name = "CDC_VDD_CP",
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -0700831 .min_uV = 2200000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700832 .max_uV = 2200000,
833 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
834 },
835 {
836 .name = "CDC_VDDA_RX",
837 .min_uV = 1800000,
838 .max_uV = 1800000,
839 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
840 },
841 {
842 .name = "CDC_VDDA_TX",
843 .min_uV = 1800000,
844 .max_uV = 1800000,
845 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
846 },
847 {
848 .name = "VDDIO_CDC",
849 .min_uV = 1800000,
850 .max_uV = 1800000,
851 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
852 },
853 {
854 .name = "VDDD_CDC_D",
855 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700856 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700857 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
858 },
859 {
860 .name = "CDC_VDDA_A_1P2V",
861 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700862 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700863 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
864 },
865 },
866};
867
868static struct slim_device msm_slim_sitar1p1 = {
869 .name = "sitar1p1-slim",
870 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
871 .dev = {
872 .platform_data = &sitar1p1_platform_data,
873 },
874};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800875#endif
876
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530877
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800878static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530879#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800880 {
881 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530882 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800883 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700884 {
885 .bus_num = 1,
886 .slim_slave = &msm_slim_sitar1p1,
887 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800888#endif
889 /* add more slimbus slaves as needed */
890};
891
892#define MSM_WCNSS_PHYS 0x03000000
893#define MSM_WCNSS_SIZE 0x280000
894
895static struct resource resources_wcnss_wlan[] = {
896 {
897 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
898 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
899 .name = "wcnss_wlanrx_irq",
900 .flags = IORESOURCE_IRQ,
901 },
902 {
903 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
904 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
905 .name = "wcnss_wlantx_irq",
906 .flags = IORESOURCE_IRQ,
907 },
908 {
909 .start = MSM_WCNSS_PHYS,
910 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
911 .name = "wcnss_mmio",
912 .flags = IORESOURCE_MEM,
913 },
914 {
915 .start = 84,
916 .end = 88,
917 .name = "wcnss_gpios_5wire",
918 .flags = IORESOURCE_IO,
919 },
920};
921
922static struct qcom_wcnss_opts qcom_wcnss_pdata = {
923 .has_48mhz_xo = 1,
924};
925
926static struct platform_device msm_device_wcnss_wlan = {
927 .name = "wcnss_wlan",
928 .id = 0,
929 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
930 .resource = resources_wcnss_wlan,
931 .dev = {.platform_data = &qcom_wcnss_pdata},
932};
933
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700934#ifdef CONFIG_QSEECOM
935/* qseecom bus scaling */
936static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
937 {
938 .src = MSM_BUS_MASTER_SPS,
939 .dst = MSM_BUS_SLAVE_EBI_CH0,
940 .ib = 0,
941 .ab = 0,
942 },
943 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700944 .src = MSM_BUS_MASTER_SPS,
945 .dst = MSM_BUS_SLAVE_SPS,
946 .ib = 0,
947 .ab = 0,
948 },
949 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700950 .src = MSM_BUS_MASTER_SPDM,
951 .dst = MSM_BUS_SLAVE_SPDM,
952 .ib = 0,
953 .ab = 0,
954 },
955};
956
957static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
958 {
959 .src = MSM_BUS_MASTER_SPS,
960 .dst = MSM_BUS_SLAVE_EBI_CH0,
961 .ib = (492 * 8) * 1000000UL,
962 .ab = (492 * 8) * 100000UL,
963 },
964 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700965 .src = MSM_BUS_MASTER_SPS,
966 .dst = MSM_BUS_SLAVE_SPS,
967 .ib = (492 * 8) * 1000000UL,
968 .ab = (492 * 8) * 100000UL,
969 },
970 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700971 .src = MSM_BUS_MASTER_SPDM,
972 .dst = MSM_BUS_SLAVE_SPDM,
973 .ib = 0,
974 .ab = 0,
975 },
976};
977
978static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
979 {
980 .src = MSM_BUS_MASTER_SPS,
981 .dst = MSM_BUS_SLAVE_EBI_CH0,
982 .ib = 0,
983 .ab = 0,
984 },
985 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700986 .src = MSM_BUS_MASTER_SPS,
987 .dst = MSM_BUS_SLAVE_SPS,
988 .ib = 0,
989 .ab = 0,
990 },
991 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700992 .src = MSM_BUS_MASTER_SPDM,
993 .dst = MSM_BUS_SLAVE_SPDM,
994 .ib = (64 * 8) * 1000000UL,
995 .ab = (64 * 8) * 100000UL,
996 },
997};
998
Ramesh Masavarapu8d756582012-10-03 10:18:06 -0700999static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1000 {
1001 .src = MSM_BUS_MASTER_SPS,
1002 .dst = MSM_BUS_SLAVE_EBI_CH0,
1003 .ib = (492 * 8) * 1000000UL,
1004 .ab = (492 * 8) * 100000UL,
1005 },
1006 {
1007 .src = MSM_BUS_MASTER_SPS,
1008 .dst = MSM_BUS_SLAVE_SPS,
1009 .ib = (492 * 8) * 1000000UL,
1010 .ab = (492 * 8) * 100000UL,
1011 },
1012 {
1013 .src = MSM_BUS_MASTER_SPDM,
1014 .dst = MSM_BUS_SLAVE_SPDM,
1015 .ib = (64 * 8) * 1000000UL,
1016 .ab = (64 * 8) * 100000UL,
1017 },
1018};
1019
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001020static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1021 {
1022 ARRAY_SIZE(qseecom_clks_init_vectors),
1023 qseecom_clks_init_vectors,
1024 },
1025 {
1026 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1027 qseecom_enable_sfpb_vectors,
1028 },
1029 {
1030 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1031 qseecom_enable_sfpb_vectors,
1032 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001033 {
1034 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1035 qseecom_enable_dfab_sfpb_vectors,
1036 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001037};
1038
1039static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1040 qseecom_hw_bus_scale_usecases,
1041 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1042 .name = "qsee",
1043};
1044
1045static struct platform_device qseecom_device = {
1046 .name = "qseecom",
1047 .id = 0,
1048 .dev = {
1049 .platform_data = &qseecom_bus_pdata,
1050 },
1051};
1052#endif
1053
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001054#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1055 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1056 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1057 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1058
1059#define QCE_SIZE 0x10000
1060#define QCE_0_BASE 0x18500000
1061
1062#define QCE_HW_KEY_SUPPORT 0
1063#define QCE_SHA_HMAC_SUPPORT 1
1064#define QCE_SHARE_CE_RESOURCE 1
1065#define QCE_CE_SHARED 0
1066
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001067/* Begin Bus scaling definitions */
1068static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1069 {
1070 .src = MSM_BUS_MASTER_ADM_PORT0,
1071 .dst = MSM_BUS_SLAVE_EBI_CH0,
1072 .ab = 0,
1073 .ib = 0,
1074 },
1075 {
1076 .src = MSM_BUS_MASTER_ADM_PORT1,
1077 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1078 .ab = 0,
1079 .ib = 0,
1080 },
1081};
1082
1083static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1084 {
1085 .src = MSM_BUS_MASTER_ADM_PORT0,
1086 .dst = MSM_BUS_SLAVE_EBI_CH0,
1087 .ab = 70000000UL,
1088 .ib = 70000000UL,
1089 },
1090 {
1091 .src = MSM_BUS_MASTER_ADM_PORT1,
1092 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1093 .ab = 2480000000UL,
1094 .ib = 2480000000UL,
1095 },
1096};
1097
1098static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1099 {
1100 ARRAY_SIZE(crypto_hw_init_vectors),
1101 crypto_hw_init_vectors,
1102 },
1103 {
1104 ARRAY_SIZE(crypto_hw_active_vectors),
1105 crypto_hw_active_vectors,
1106 },
1107};
1108
1109static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1110 crypto_hw_bus_scale_usecases,
1111 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1112 .name = "cryptohw",
1113};
1114/* End Bus Scaling Definitions*/
1115
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001116static struct resource qcrypto_resources[] = {
1117 [0] = {
1118 .start = QCE_0_BASE,
1119 .end = QCE_0_BASE + QCE_SIZE - 1,
1120 .flags = IORESOURCE_MEM,
1121 },
1122 [1] = {
1123 .name = "crypto_channels",
1124 .start = DMOV_CE_IN_CHAN,
1125 .end = DMOV_CE_OUT_CHAN,
1126 .flags = IORESOURCE_DMA,
1127 },
1128 [2] = {
1129 .name = "crypto_crci_in",
1130 .start = DMOV_CE_IN_CRCI,
1131 .end = DMOV_CE_IN_CRCI,
1132 .flags = IORESOURCE_DMA,
1133 },
1134 [3] = {
1135 .name = "crypto_crci_out",
1136 .start = DMOV_CE_OUT_CRCI,
1137 .end = DMOV_CE_OUT_CRCI,
1138 .flags = IORESOURCE_DMA,
1139 },
1140};
1141
1142static struct resource qcedev_resources[] = {
1143 [0] = {
1144 .start = QCE_0_BASE,
1145 .end = QCE_0_BASE + QCE_SIZE - 1,
1146 .flags = IORESOURCE_MEM,
1147 },
1148 [1] = {
1149 .name = "crypto_channels",
1150 .start = DMOV_CE_IN_CHAN,
1151 .end = DMOV_CE_OUT_CHAN,
1152 .flags = IORESOURCE_DMA,
1153 },
1154 [2] = {
1155 .name = "crypto_crci_in",
1156 .start = DMOV_CE_IN_CRCI,
1157 .end = DMOV_CE_IN_CRCI,
1158 .flags = IORESOURCE_DMA,
1159 },
1160 [3] = {
1161 .name = "crypto_crci_out",
1162 .start = DMOV_CE_OUT_CRCI,
1163 .end = DMOV_CE_OUT_CRCI,
1164 .flags = IORESOURCE_DMA,
1165 },
1166};
1167
1168#endif
1169
1170#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1171 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1172
1173static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1174 .ce_shared = QCE_CE_SHARED,
1175 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1176 .hw_key_support = QCE_HW_KEY_SUPPORT,
1177 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001178 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001179};
1180
1181static struct platform_device qcrypto_device = {
1182 .name = "qcrypto",
1183 .id = 0,
1184 .num_resources = ARRAY_SIZE(qcrypto_resources),
1185 .resource = qcrypto_resources,
1186 .dev = {
1187 .coherent_dma_mask = DMA_BIT_MASK(32),
1188 .platform_data = &qcrypto_ce_hw_suppport,
1189 },
1190};
1191#endif
1192
1193#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1194 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1195
1196static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1197 .ce_shared = QCE_CE_SHARED,
1198 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1199 .hw_key_support = QCE_HW_KEY_SUPPORT,
1200 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001201 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001202};
1203
1204static struct platform_device qcedev_device = {
1205 .name = "qce",
1206 .id = 0,
1207 .num_resources = ARRAY_SIZE(qcedev_resources),
1208 .resource = qcedev_resources,
1209 .dev = {
1210 .coherent_dma_mask = DMA_BIT_MASK(32),
1211 .platform_data = &qcedev_ce_hw_suppport,
1212 },
1213};
1214#endif
1215
1216#define MDM2AP_ERRFATAL 70
1217#define AP2MDM_ERRFATAL 95
1218#define MDM2AP_STATUS 69
1219#define AP2MDM_STATUS 94
1220#define AP2MDM_PMIC_RESET_N 80
1221#define AP2MDM_KPDPWR_N 81
1222
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001223static struct resource mdm_resources[] = {
1224 {
1225 .start = MDM2AP_ERRFATAL,
1226 .end = MDM2AP_ERRFATAL,
1227 .name = "MDM2AP_ERRFATAL",
1228 .flags = IORESOURCE_IO,
1229 },
1230 {
1231 .start = AP2MDM_ERRFATAL,
1232 .end = AP2MDM_ERRFATAL,
1233 .name = "AP2MDM_ERRFATAL",
1234 .flags = IORESOURCE_IO,
1235 },
1236 {
1237 .start = MDM2AP_STATUS,
1238 .end = MDM2AP_STATUS,
1239 .name = "MDM2AP_STATUS",
1240 .flags = IORESOURCE_IO,
1241 },
1242 {
1243 .start = AP2MDM_STATUS,
1244 .end = AP2MDM_STATUS,
1245 .name = "AP2MDM_STATUS",
1246 .flags = IORESOURCE_IO,
1247 },
1248 {
1249 .start = AP2MDM_PMIC_RESET_N,
1250 .end = AP2MDM_PMIC_RESET_N,
1251 .name = "AP2MDM_PMIC_RESET_N",
1252 .flags = IORESOURCE_IO,
1253 },
1254 {
1255 .start = AP2MDM_KPDPWR_N,
1256 .end = AP2MDM_KPDPWR_N,
1257 .name = "AP2MDM_KPDPWR_N",
1258 .flags = IORESOURCE_IO,
1259 },
1260};
1261
1262static struct mdm_platform_data mdm_platform_data = {
1263 .mdm_version = "2.5",
1264};
1265
1266static struct platform_device mdm_device = {
1267 .name = "mdm2_modem",
1268 .id = -1,
1269 .num_resources = ARRAY_SIZE(mdm_resources),
1270 .resource = mdm_resources,
1271 .dev = {
1272 .platform_data = &mdm_platform_data,
1273 },
1274};
1275
1276static struct platform_device *mdm_devices[] __initdata = {
1277 &mdm_device,
1278};
1279
Praveen Chidambaram78499012011-11-01 17:15:17 -06001280#ifdef CONFIG_MSM_MPM
1281static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1282 [1] = MSM_GPIO_TO_INT(46),
1283 [2] = MSM_GPIO_TO_INT(150),
1284 [4] = MSM_GPIO_TO_INT(103),
1285 [5] = MSM_GPIO_TO_INT(104),
1286 [6] = MSM_GPIO_TO_INT(105),
1287 [7] = MSM_GPIO_TO_INT(106),
1288 [8] = MSM_GPIO_TO_INT(107),
1289 [9] = MSM_GPIO_TO_INT(7),
1290 [10] = MSM_GPIO_TO_INT(11),
1291 [11] = MSM_GPIO_TO_INT(15),
1292 [12] = MSM_GPIO_TO_INT(19),
1293 [13] = MSM_GPIO_TO_INT(23),
1294 [14] = MSM_GPIO_TO_INT(27),
1295 [15] = MSM_GPIO_TO_INT(31),
1296 [16] = MSM_GPIO_TO_INT(35),
1297 [19] = MSM_GPIO_TO_INT(90),
1298 [20] = MSM_GPIO_TO_INT(92),
1299 [23] = MSM_GPIO_TO_INT(85),
1300 [24] = MSM_GPIO_TO_INT(83),
1301 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001302 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001303 [27] = HDMI_IRQ,
1304 [29] = MSM_GPIO_TO_INT(10),
1305 [30] = MSM_GPIO_TO_INT(102),
1306 [31] = MSM_GPIO_TO_INT(81),
1307 [32] = MSM_GPIO_TO_INT(78),
1308 [33] = MSM_GPIO_TO_INT(94),
1309 [34] = MSM_GPIO_TO_INT(72),
1310 [35] = MSM_GPIO_TO_INT(39),
1311 [36] = MSM_GPIO_TO_INT(43),
1312 [37] = MSM_GPIO_TO_INT(61),
1313 [38] = MSM_GPIO_TO_INT(50),
1314 [39] = MSM_GPIO_TO_INT(42),
1315 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001316 [42] = MSM_GPIO_TO_INT(8),
1317 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001318 [44] = MSM_GPIO_TO_INT(70),
1319 [45] = MSM_GPIO_TO_INT(69),
1320 [46] = MSM_GPIO_TO_INT(67),
1321 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001322 [48] = MSM_GPIO_TO_INT(55),
1323 [49] = MSM_GPIO_TO_INT(74),
1324 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001325 [51] = MSM_GPIO_TO_INT(49),
1326 [52] = MSM_GPIO_TO_INT(40),
1327 [53] = MSM_GPIO_TO_INT(37),
1328 [54] = MSM_GPIO_TO_INT(24),
1329 [55] = MSM_GPIO_TO_INT(14),
1330};
1331
1332static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1333 TLMM_MSM_SUMMARY_IRQ,
1334 RPM_APCC_CPU0_GP_HIGH_IRQ,
1335 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1336 RPM_APCC_CPU0_GP_LOW_IRQ,
1337 RPM_APCC_CPU0_WAKE_UP_IRQ,
1338 RPM_APCC_CPU1_GP_HIGH_IRQ,
1339 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1340 RPM_APCC_CPU1_GP_LOW_IRQ,
1341 RPM_APCC_CPU1_WAKE_UP_IRQ,
1342 MSS_TO_APPS_IRQ_0,
1343 MSS_TO_APPS_IRQ_1,
1344 MSS_TO_APPS_IRQ_2,
1345 MSS_TO_APPS_IRQ_3,
1346 MSS_TO_APPS_IRQ_4,
1347 MSS_TO_APPS_IRQ_5,
1348 MSS_TO_APPS_IRQ_6,
1349 MSS_TO_APPS_IRQ_7,
1350 MSS_TO_APPS_IRQ_8,
1351 MSS_TO_APPS_IRQ_9,
1352 LPASS_SCSS_GP_LOW_IRQ,
1353 LPASS_SCSS_GP_MEDIUM_IRQ,
1354 LPASS_SCSS_GP_HIGH_IRQ,
1355 SPS_MTI_30,
1356 SPS_MTI_31,
1357 RIVA_APSS_SPARE_IRQ,
1358 RIVA_APPS_WLAN_SMSM_IRQ,
1359 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1360 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1361};
1362
1363struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1364 .irqs_m2a = msm_mpm_irqs_m2a,
1365 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1366 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1367 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1368 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1369 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1370 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1371 .mpm_apps_ipc_val = BIT(1),
1372 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1373
1374};
1375#endif
1376
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001377#define MSM_SHARED_RAM_PHYS 0x80000000
1378
1379static void __init msm8930_map_io(void)
1380{
1381 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1382 msm_map_msm8930_io();
1383
1384 if (socinfo_init() < 0)
1385 pr_err("socinfo_init() failed!\n");
1386}
1387
1388static void __init msm8930_init_irq(void)
1389{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001390 struct msm_mpm_device_data *data = NULL;
1391#ifdef CONFIG_MSM_MPM
1392 data = &msm8930_mpm_dev_data;
1393#endif
1394
1395 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001396 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1397 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001398}
1399
1400static void __init msm8930_init_buses(void)
1401{
1402#ifdef CONFIG_MSM_BUS_SCALING
1403 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001404 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1405 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1406 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1407 msm_bus_8930_apps_fabric.dev.platform_data =
1408 &msm_bus_8930_apps_fabric_pdata;
1409 msm_bus_8930_sys_fabric.dev.platform_data =
1410 &msm_bus_8930_sys_fabric_pdata;
1411 msm_bus_8930_mm_fabric.dev.platform_data =
1412 &msm_bus_8930_mm_fabric_pdata;
1413 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1414 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001415#endif
1416}
1417
1418static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1419 .max_clock_speed = 15060000,
1420};
1421
1422#ifdef CONFIG_USB_MSM_OTG_72K
1423static struct msm_otg_platform_data msm_otg_pdata;
1424#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301425#ifdef CONFIG_MSM_BUS_SCALING
1426/* Bandwidth requests (zero) if no vote placed */
1427static struct msm_bus_vectors usb_init_vectors[] = {
1428 {
1429 .src = MSM_BUS_MASTER_SPS,
1430 .dst = MSM_BUS_SLAVE_EBI_CH0,
1431 .ab = 0,
1432 .ib = 0,
1433 },
1434};
1435
1436/* Bus bandwidth requests in Bytes/sec */
1437static struct msm_bus_vectors usb_max_vectors[] = {
1438 {
1439 .src = MSM_BUS_MASTER_SPS,
1440 .dst = MSM_BUS_SLAVE_EBI_CH0,
1441 .ab = 60000000, /* At least 480Mbps on bus. */
1442 .ib = 960000000, /* MAX bursts rate */
1443 },
1444};
1445
1446static struct msm_bus_paths usb_bus_scale_usecases[] = {
1447 {
1448 ARRAY_SIZE(usb_init_vectors),
1449 usb_init_vectors,
1450 },
1451 {
1452 ARRAY_SIZE(usb_max_vectors),
1453 usb_max_vectors,
1454 },
1455};
1456
1457static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1458 usb_bus_scale_usecases,
1459 ARRAY_SIZE(usb_bus_scale_usecases),
1460 .name = "usb",
1461};
1462#endif
1463
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301464static int hsusb_phy_init_seq[] = {
1465 0x44, 0x80, /* set VBUS valid threshold
1466 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301467 0x68, 0x81, /* update DC voltage level */
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301468 0x24, 0x82, /* set preemphasis and rise/fall time */
1469 0x13, 0x83, /* set source impedance adjusment */
1470 -1};
1471
Jack Pham87f202f2012-08-06 00:24:22 -07001472#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1473
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001474static struct msm_otg_platform_data msm_otg_pdata = {
1475 .mode = USB_OTG,
1476 .otg_control = OTG_PMIC_CONTROL,
1477 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001478 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001479 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301480#ifdef CONFIG_MSM_BUS_SCALING
1481 .bus_scale_table = &usb_bus_scale_pdata,
1482#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301483#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1484 .mhl_dev_name = "sii8334",
1485#endif
Jack Pham87f202f2012-08-06 00:24:22 -07001486 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001487};
1488#endif
1489
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001490#define PID_MAGIC_ID 0x71432909
1491#define SERIAL_NUM_MAGIC_ID 0x61945374
1492#define SERIAL_NUMBER_LENGTH 127
1493#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1494
1495struct magic_num_struct {
1496 uint32_t pid;
1497 uint32_t serial_num;
1498};
1499
1500struct dload_struct {
1501 uint32_t reserved1;
1502 uint32_t reserved2;
1503 uint32_t reserved3;
1504 uint16_t reserved4;
1505 uint16_t pid;
1506 char serial_number[SERIAL_NUMBER_LENGTH];
1507 uint16_t reserved5;
1508 struct magic_num_struct magic_struct;
1509};
1510
1511static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1512{
1513 struct dload_struct __iomem *dload = 0;
1514
1515 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1516 if (!dload) {
1517 pr_err("%s: cannot remap I/O memory region: %08x\n",
1518 __func__, DLOAD_USB_BASE_ADD);
1519 return -ENXIO;
1520 }
1521
1522 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1523 __func__, dload, pid, snum);
1524 /* update pid */
1525 dload->magic_struct.pid = PID_MAGIC_ID;
1526 dload->pid = pid;
1527
1528 /* update serial number */
1529 dload->magic_struct.serial_num = 0;
1530 if (!snum) {
1531 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1532 goto out;
1533 }
1534
1535 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1536 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1537out:
1538 iounmap(dload);
1539 return 0;
1540}
1541
1542static struct android_usb_platform_data android_usb_pdata = {
1543 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1544};
1545
1546static struct platform_device android_usb_device = {
1547 .name = "android_usb",
1548 .id = -1,
1549 .dev = {
1550 .platform_data = &android_usb_pdata,
1551 },
1552};
1553
1554static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001555 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001556};
1557
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001558static uint8_t spm_retention_cmd_sequence[] __initdata = {
1559 0x00, 0x05, 0x03, 0x0D,
1560 0x0B, 0x00, 0x0f,
1561};
1562
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001563static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001564 0x00, 0x24, 0x54, 0x10,
1565 0x09, 0x03, 0x01,
1566 0x10, 0x54, 0x30, 0x0C,
1567 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001568};
1569
1570static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001571 0x00, 0x24, 0x54, 0x10,
1572 0x09, 0x07, 0x01, 0x0B,
1573 0x10, 0x54, 0x30, 0x0C,
1574 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001575};
1576
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001577static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1578 [0] = {
1579 .mode = MSM_SPM_MODE_CLOCK_GATING,
1580 .notify_rpm = false,
1581 .cmd = spm_wfi_cmd_sequence,
1582 },
1583 [1] = {
1584 .mode = MSM_SPM_MODE_POWER_RETENTION,
1585 .notify_rpm = false,
1586 .cmd = spm_retention_cmd_sequence,
1587 },
1588 [2] = {
1589 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1590 .notify_rpm = false,
1591 .cmd = spm_power_collapse_without_rpm,
1592 },
1593 [3] = {
1594 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1595 .notify_rpm = true,
1596 .cmd = spm_power_collapse_with_rpm,
1597 },
1598};
1599
1600static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001601 [0] = {
1602 .mode = MSM_SPM_MODE_CLOCK_GATING,
1603 .notify_rpm = false,
1604 .cmd = spm_wfi_cmd_sequence,
1605 },
1606 [1] = {
1607 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1608 .notify_rpm = false,
1609 .cmd = spm_power_collapse_without_rpm,
1610 },
1611 [2] = {
1612 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1613 .notify_rpm = true,
1614 .cmd = spm_power_collapse_with_rpm,
1615 },
1616};
1617
1618static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1619 [0] = {
1620 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001621 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001622#if defined(CONFIG_MSM_AVS_HW)
1623 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1624 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1625#endif
1626 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001627 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1628 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1629 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001630 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001631 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1632 .modes = msm_spm_boot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001633 },
1634 [1] = {
1635 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001636 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001637#if defined(CONFIG_MSM_AVS_HW)
1638 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1639 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1640#endif
1641 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001642 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001643 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1644 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1645 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001646 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1647 .modes = msm_spm_nonboot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001648 },
1649};
1650
1651static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001652 0x00, 0x20, 0x03, 0x20,
1653 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001654};
1655
1656static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001657 0x00, 0x20, 0x34, 0x64,
1658 0x48, 0x07, 0x48, 0x20,
1659 0x50, 0x64, 0x04, 0x34,
1660 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001661};
1662static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001663 0x00, 0x10, 0x34, 0x64,
1664 0x48, 0x07, 0x48, 0x10,
1665 0x50, 0x64, 0x04, 0x34,
1666 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001667};
1668
1669static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1670 [0] = {
1671 .mode = MSM_SPM_L2_MODE_RETENTION,
1672 .notify_rpm = false,
1673 .cmd = l2_spm_wfi_cmd_sequence,
1674 },
1675 [1] = {
1676 .mode = MSM_SPM_L2_MODE_GDHS,
1677 .notify_rpm = true,
1678 .cmd = l2_spm_gdhs_cmd_sequence,
1679 },
1680 [2] = {
1681 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1682 .notify_rpm = true,
1683 .cmd = l2_spm_power_off_cmd_sequence,
1684 },
1685};
1686
1687static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1688 [0] = {
1689 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001690 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001691 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001692 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1693 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1694 .modes = msm_spm_l2_seq_list,
1695 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1696 },
1697};
1698
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301699#define ISA1200_HAP_EN_GPIO 77
1700#define ISA1200_HAP_LEN_GPIO 78
David Collinsfd344aa2012-08-06 15:02:03 -07001701#define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7)
1702#define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001703
1704static int isa1200_power(int on)
1705{
David Collinsfd344aa2012-08-06 15:02:03 -07001706 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
1707 enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1;
Amy Malocheb20c1052012-04-11 10:36:13 -07001708 int rc = 0;
1709
David Collinsfd344aa2012-08-06 15:02:03 -07001710 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
1711 gpio = ISA1200_HAP_CLK_PM8917;
1712 clk_id = CLK_MP3_2;
1713 }
1714
1715 gpio_set_value_cansleep(gpio, !!on);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301716
Amy Malocheb20c1052012-04-11 10:36:13 -07001717 if (on)
David Collinsfd344aa2012-08-06 15:02:03 -07001718 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001719 else
David Collinsfd344aa2012-08-06 15:02:03 -07001720 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001721
1722 if (rc) {
1723 pr_err("%s: unable to write aux clock register(%d)\n",
1724 __func__, rc);
1725 }
1726
1727 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001728}
1729
1730static int isa1200_dev_setup(bool enable)
1731{
David Collinsfd344aa2012-08-06 15:02:03 -07001732 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001733 int rc = 0;
1734
David Collinsfd344aa2012-08-06 15:02:03 -07001735 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1736 gpio = ISA1200_HAP_CLK_PM8917;
1737
Amy Malocheb20c1052012-04-11 10:36:13 -07001738 if (!enable)
1739 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301740
David Collinsfd344aa2012-08-06 15:02:03 -07001741 rc = gpio_request(gpio, "haptics_clk");
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301742 if (rc) {
1743 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
David Collinsfd344aa2012-08-06 15:02:03 -07001744 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301745 goto fail_gpio_req;
1746 }
1747
David Collinsfd344aa2012-08-06 15:02:03 -07001748 rc = gpio_direction_output(gpio, 0);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301749 if (rc) {
1750 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
David Collinsfd344aa2012-08-06 15:02:03 -07001751 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301752 goto fail_gpio_dir;
1753 }
1754
1755 return 0;
1756
1757fail_gpio_dir:
David Collinsfd344aa2012-08-06 15:02:03 -07001758 gpio_free(gpio);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301759fail_gpio_req:
1760 return rc;
1761
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001762}
1763
1764static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301765 {
1766 .name = "vddp",
1767 .min_uV = ISA_I2C_VTG_MIN_UV,
1768 .max_uV = ISA_I2C_VTG_MAX_UV,
1769 .load_uA = ISA_I2C_CURR_UA,
1770 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001771 {
1772 .name = "vcc_i2c",
1773 .min_uV = ISA_I2C_VTG_MIN_UV,
1774 .max_uV = ISA_I2C_VTG_MAX_UV,
1775 .load_uA = ISA_I2C_CURR_UA,
1776 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001777};
1778
1779static struct isa1200_platform_data isa1200_1_pdata = {
1780 .name = "vibrator",
1781 .dev_setup = isa1200_dev_setup,
1782 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301783 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1784 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001785 .max_timeout = 15000,
1786 .mode_ctrl = PWM_GEN_MODE,
1787 .pwm_fd = {
1788 .pwm_div = 256,
1789 },
1790 .is_erm = false,
1791 .smart_en = true,
1792 .ext_clk_en = true,
1793 .chip_en = 1,
1794 .regulator_info = isa1200_reg_data,
1795 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1796};
1797
1798static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1799 {
1800 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1801 .platform_data = &isa1200_1_pdata,
1802 },
1803};
1804
Amy Malochef3c9db42011-12-08 15:17:35 -08001805#define MXT_TS_GPIO_IRQ 11
1806#define MXT_TS_RESET_GPIO 52
1807
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301808static const u8 mxt_config_data_8930_v1[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001809 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001810 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001811 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301812 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001813 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301814 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001815 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301816 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001817 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301818 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1819 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1820 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1821 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001822 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001823 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1824 0,
1825 /* T18 Object */
1826 0, 0,
1827 /* T19 Object */
1828 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1829 0, 0, 0, 0, 0, 0,
1830 /* T23 Object */
1831 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1832 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001833 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001834 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1835 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001836 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001837 0, 0, 0, 0, 0,
1838 /* T42 Object */
1839 0, 0, 0, 0, 0, 0, 0, 0,
1840 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301841 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001842 /* T47 Object */
1843 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1844 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301845 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1846 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1847 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001848 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1849 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1850 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001851};
1852
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301853static const u8 mxt_config_data_8930_v2[] = {
1854 /* T6 Object */
1855 0, 0, 0, 0, 0, 0,
1856 /* T38 Object */
1857 15, 4, 0, 9, 7, 12, 0, 0,
1858 /* T7 Object */
1859 32, 16, 50,
1860 /* T8 Object */
1861 30, 0, 5, 10, 0, 0, 10, 10, 0, 0,
1862 /* T9 Object */
1863 131, 0, 0, 19, 11, 0, 16, 50, 1, 3,
1864 12, 7, 2, 0, 4, 5, 2, 10, 43, 4,
1865 54, 2, -25, 29, 38, 18, 143, 40, 207, 80,
1866 17, 5, 50, 50, 0,
1867 /* T18 Object */
1868 0, 0,
1869 /* T19 Object */
1870 0, 0, 0, 0, 0, 0,
1871 /* T25 Object */
1872 0, 0, 0, 0, 0, 0,
1873 /* T42 Object */
1874 3, 60, 20, 20, 150, 0, 0, 0,
1875 /* T46 Object */
1876 0, 3, 28, 28, 0, 0, 1, 0, 0,
1877 /* T47 Object */
1878 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1879 /* T48 Object */
1880 1, 3, 82, 0, 0, 0, 0, 0, 0, 0,
1881 16, 30, 0, 6, 6, 0, 0, 124, 4, 100,
1882 0, 0, 0, 5, 0, 42, 0, 1, 0, 40,
1883 52, 20, 0, 0, 0, 50, 1, 5, 2, 1,
1884 4, 5, 3, -25, 29, 38, 18, 143, 40, 207,
1885 80, 10, 5, 2,
1886 /* T55 Object */
1887 0, 0, 0, 0,
1888};
1889
Amy Malochef3c9db42011-12-08 15:17:35 -08001890static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1891 struct kobj_attribute *attr, char *buf)
1892{
1893 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301894 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1895 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1896 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1897 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001898 "\n");
1899}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001900
Amy Malochef3c9db42011-12-08 15:17:35 -08001901static struct kobj_attribute mxt224e_vkeys_attr = {
1902 .attr = {
1903 .mode = S_IRUGO,
1904 },
1905 .show = &mxt224e_vkeys_show,
1906};
1907
1908static struct attribute *mxt224e_properties_attrs[] = {
1909 &mxt224e_vkeys_attr.attr,
1910 NULL
1911};
1912
1913static struct attribute_group mxt224e_properties_attr_group = {
1914 .attrs = mxt224e_properties_attrs,
1915};
1916
1917static void mxt_init_vkeys_8930(void)
1918{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001919 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001920 static struct kobject *mxt224e_properties_kobj;
1921
1922 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1923 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1924 NULL);
1925 if (mxt224e_properties_kobj)
1926 rc = sysfs_create_group(mxt224e_properties_kobj,
1927 &mxt224e_properties_attr_group);
1928 if (!mxt224e_properties_kobj || rc)
1929 pr_err("%s: failed to create board_properties\n",
1930 __func__);
1931
1932 return;
1933}
1934
Jing Lindc4413c2012-01-16 15:22:52 -08001935static struct mxt_config_info mxt_config_array[] = {
1936 {
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301937 .config = mxt_config_data_8930_v1,
1938 .config_length = ARRAY_SIZE(mxt_config_data_8930_v1),
Jing Lindc4413c2012-01-16 15:22:52 -08001939 .family_id = 0x81,
1940 .variant_id = 0x01,
1941 .version = 0x10,
1942 .build = 0xAA,
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301943 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1944 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1945 },
1946 {
1947 .config = mxt_config_data_8930_v2,
1948 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1949 .family_id = 0x81,
1950 .variant_id = 0x15,
1951 .version = 0x11,
1952 .build = 0xAA,
1953 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1954 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1955 },
1956 {
1957 .config = mxt_config_data_8930_v2,
1958 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1959 .family_id = 0x81,
1960 .variant_id = 0x01,
1961 .version = 0x20,
1962 .build = 0xAB,
1963 .bootldr_id = MXT_BOOTLOADER_ID_224E,
Jing Lindc4413c2012-01-16 15:22:52 -08001964 },
1965};
1966
Amy Malochef3c9db42011-12-08 15:17:35 -08001967static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001968 .config_array = mxt_config_array,
1969 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001970 .panel_minx = 0,
1971 .panel_maxx = 566,
1972 .panel_miny = 0,
1973 .panel_maxy = 1067,
1974 .disp_minx = 0,
1975 .disp_maxx = 540,
1976 .disp_miny = 0,
1977 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001978 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301979#ifdef MSM8930_PHASE_2
1980 .digital_pwr_regulator = true,
1981#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001982 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001983 .reset_gpio = MXT_TS_RESET_GPIO,
1984 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001985};
1986
Amy Malochef3c9db42011-12-08 15:17:35 -08001987static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001988 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001989 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1990 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001991 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1992 },
1993};
1994
David Collinsfd344aa2012-08-06 15:02:03 -07001995#define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
1996#define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25)
Manoj Raoc6d904c2012-06-22 00:32:14 -07001997static struct msm_mhl_platform_data mhl_platform_data = {
1998 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
1999 .gpio_mhl_int = MHL_GPIO_INT,
2000 .gpio_mhl_reset = MHL_GPIO_RESET,
David Collinsfd344aa2012-08-06 15:02:03 -07002001 .gpio_mhl_power = MHL_POWER_GPIO_PM8038,
Manoj Raoc6d904c2012-06-22 00:32:14 -07002002 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
2003};
2004
2005static struct i2c_board_info sii_device_info[] __initdata = {
2006 {
2007 /*
2008 * keeps SI 8334 as the default
2009 * MHL TX
2010 */
2011 I2C_BOARD_INFO("sii8334", 0x39),
2012 .platform_data = &mhl_platform_data,
2013 .flags = I2C_CLIENT_WAKE,
2014 },
2015};
2016
2017
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302018#ifdef MSM8930_PHASE_2
2019
David Collinsfd344aa2012-08-06 15:02:03 -07002020#define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3)
2021#define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8)
2022#define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10)
2023#define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11)
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302024
David Collinsfd344aa2012-08-06 15:02:03 -07002025#define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27)
2026#define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28)
2027#define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36)
2028#define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37)
2029
2030static struct gpio_keys_button keys_8930_pm8038[] = {
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302031 {
2032 .code = KEY_VOLUMEUP,
2033 .type = EV_KEY,
2034 .desc = "volume_up",
David Collinsfd344aa2012-08-06 15:02:03 -07002035 .gpio = GPIO_VOLUME_UP_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302036 .wakeup = 1,
2037 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002038 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302039 },
2040 {
2041 .code = KEY_VOLUMEDOWN,
2042 .type = EV_KEY,
2043 .desc = "volume_down",
David Collinsfd344aa2012-08-06 15:02:03 -07002044 .gpio = GPIO_VOLUME_DOWN_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302045 .wakeup = 1,
2046 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002047 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302048 },
2049 {
2050 .code = KEY_CAMERA_FOCUS,
2051 .type = EV_KEY,
2052 .desc = "camera_focus",
David Collinsfd344aa2012-08-06 15:02:03 -07002053 .gpio = GPIO_CAMERA_FOCUS_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302054 .wakeup = 1,
2055 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002056 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302057 },
2058 {
2059 .code = KEY_CAMERA_SNAPSHOT,
2060 .type = EV_KEY,
2061 .desc = "camera_snapshot",
David Collinsfd344aa2012-08-06 15:02:03 -07002062 .gpio = GPIO_CAMERA_SNAPSHOT_PM8038,
2063 .wakeup = 1,
2064 .active_low = 1,
2065 .debounce_interval = 15,
2066 },
2067};
2068
2069static struct gpio_keys_button keys_8930_pm8917[] = {
2070 {
2071 .code = KEY_VOLUMEUP,
2072 .type = EV_KEY,
2073 .desc = "volume_up",
2074 .gpio = GPIO_VOLUME_UP_PM8917,
2075 .wakeup = 1,
2076 .active_low = 1,
2077 .debounce_interval = 15,
2078 },
2079 {
2080 .code = KEY_VOLUMEDOWN,
2081 .type = EV_KEY,
2082 .desc = "volume_down",
2083 .gpio = GPIO_VOLUME_DOWN_PM8917,
2084 .wakeup = 1,
2085 .active_low = 1,
2086 .debounce_interval = 15,
2087 },
2088 {
2089 .code = KEY_CAMERA_FOCUS,
2090 .type = EV_KEY,
2091 .desc = "camera_focus",
2092 .gpio = GPIO_CAMERA_FOCUS_PM8917,
2093 .wakeup = 1,
2094 .active_low = 1,
2095 .debounce_interval = 15,
2096 },
2097 {
2098 .code = KEY_CAMERA_SNAPSHOT,
2099 .type = EV_KEY,
2100 .desc = "camera_snapshot",
2101 .gpio = GPIO_CAMERA_SNAPSHOT_PM8917,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302102 .wakeup = 1,
2103 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002104 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302105 },
2106};
2107
2108/* Add GPIO keys for 8930 */
2109static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
David Collinsfd344aa2012-08-06 15:02:03 -07002110 .buttons = keys_8930_pm8038,
2111 .nbuttons = ARRAY_SIZE(keys_8930_pm8038),
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302112};
2113
2114static struct platform_device gpio_keys_8930 = {
2115 .name = "gpio-keys",
2116 .id = -1,
2117 .dev = {
2118 .platform_data = &gpio_keys_8930_pdata,
2119 },
2120};
2121#endif /* MSM8930_PHASE_2 */
2122
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002123static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2124 .clk_freq = 100000,
2125 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002126};
2127
2128static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2129 .clk_freq = 100000,
2130 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002131};
2132
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002133static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
2134 .clk_freq = 100000,
2135 .src_clk_rate = 24000000,
2136};
2137
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002138static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2139 .clk_freq = 100000,
2140 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002141};
2142
2143static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2144 .clk_freq = 100000,
2145 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002146};
2147
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002148
2149static struct ks8851_pdata spi_eth_pdata = {
2150 .irq_gpio = KS8851_IRQ_GPIO,
2151 .rst_gpio = KS8851_RST_GPIO,
2152};
2153
2154static struct spi_board_info spi_board_info[] __initdata = {
2155 {
2156 .modalias = "ks8851",
2157 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2158 .max_speed_hz = 19200000,
2159 .bus_num = 0,
2160 .chip_select = 0,
2161 .mode = SPI_MODE_0,
2162 .platform_data = &spi_eth_pdata
2163 },
2164 {
2165 .modalias = "dsi_novatek_3d_panel_spi",
2166 .max_speed_hz = 10800000,
2167 .bus_num = 0,
2168 .chip_select = 1,
2169 .mode = SPI_MODE_0,
2170 },
2171};
2172
2173static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002174 .name = "saw-regulator",
2175 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002176 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002177 .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002178 },
2179};
2180
2181static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002182 .name = "saw-regulator",
2183 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002184 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002185 .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002186 },
2187};
2188
2189static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002190 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002191 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002192 .tsens_num_sensor = 10,
2193 .slope = {1132, 1135, 1137, 1135, 1157,
2194 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002195};
2196
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002197static struct platform_device msm_tsens_device = {
2198 .name = "tsens8960-tm",
2199 .id = -1,
2200};
2201
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002202static struct msm_thermal_data msm_thermal_pdata = {
2203 .sensor_id = 9,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002204 .poll_ms = 250,
2205 .limit_temp_degC = 60,
2206 .temp_hysteresis_degC = 10,
2207 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002208};
2209
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002210#ifdef CONFIG_MSM_FAKE_BATTERY
2211static struct platform_device fish_battery_device = {
2212 .name = "fish_battery",
2213};
2214#endif
2215
David Collins1d4061b2011-12-06 15:36:40 -08002216#ifndef MSM8930_PHASE_2
2217
2218/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002219static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002220 .name = GPIO_REGULATOR_DEV_NAME,
2221 .id = PM8921_MPP_PM_TO_SYS(7),
2222 .dev = {
2223 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2224 },
2225};
2226
Jay Chokshi06fa7542011-12-07 13:09:17 -08002227static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002228 .name = GPIO_REGULATOR_DEV_NAME,
2229 .id = 91,
2230 .dev = {
2231 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2232 },
2233};
2234
David Collins1d4061b2011-12-06 15:36:40 -08002235#else
2236
2237/* 8930 Phase 2 */
2238static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2239 .name = GPIO_REGULATOR_DEV_NAME,
2240 .id = 63,
2241 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002242 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2243 MSM8930_GPIO_VREG_ID_EXT_5V],
David Collins1d4061b2011-12-06 15:36:40 -08002244 },
2245};
2246
2247static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2248 .name = GPIO_REGULATOR_DEV_NAME,
2249 .id = 97,
2250 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002251 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2252 MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
David Collins1d4061b2011-12-06 15:36:40 -08002253 },
2254};
2255
2256#endif
2257
Jay Chokshi06fa7542011-12-07 13:09:17 -08002258static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002259 .name = "rpm-regulator",
2260 .id = -1,
2261 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002262#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002263 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002264#else
David Collins4614cb92012-08-20 12:17:09 -07002265 .platform_data = &msm8930_pm8038_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002266#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002267 },
2268};
2269
David Collins4614cb92012-08-20 12:17:09 -07002270static struct platform_device *early_common_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002271 &msm8960_device_dmov,
2272 &msm_device_smd,
2273 &msm8960_device_uart_gsbi5,
2274 &msm_device_uart_dm6,
2275 &msm_device_saw_core0,
2276 &msm_device_saw_core1,
David Collins4614cb92012-08-20 12:17:09 -07002277};
2278
2279/* ext_5v and ext_otg_sw are present when using PM8038 */
2280static struct platform_device *pmic_pm8038_devices[] __initdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002281 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002282#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002283 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002284#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002285 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002286#ifdef MSM8930_PHASE_2
2287 &msm8930_device_ext_otg_sw_vreg,
2288#endif
David Collins4614cb92012-08-20 12:17:09 -07002289};
2290
2291/* ext_5v and ext_otg_sw are not present when using PM8917 */
2292static struct platform_device *pmic_pm8917_devices[] __initdata = {
2293 &msm8960_device_ssbi_pmic,
2294};
2295
2296static struct platform_device *common_devices[] __initdata = {
Stephen Boyd28d54952011-12-16 13:19:51 -08002297 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002298 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002299 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002300 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002301 &msm8960_device_qup_spi_gsbi1,
2302 &msm8960_device_qup_i2c_gsbi3,
2303 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002304 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002305 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002306 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002307 &msm_slim_ctrl,
2308 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002309#if defined(CONFIG_QSEECOM)
2310 &qseecom_device,
2311#endif
2312
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002313#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2314 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2315 &qcrypto_device,
2316#endif
2317
2318#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2319 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2320 &qcedev_device,
2321#endif
2322#ifdef CONFIG_MSM_ROTATOR
2323 &msm_rotator_device,
2324#endif
2325 &msm_device_sps,
2326#ifdef CONFIG_MSM_FAKE_BATTERY
2327 &fish_battery_device,
2328#endif
2329#ifdef CONFIG_ANDROID_PMEM
2330#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002331 &msm8930_android_pmem_device,
2332 &msm8930_android_pmem_adsp_device,
2333 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302334#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2335#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002336 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002337 &msm_device_bam_dmux,
2338 &msm_fm_platform_init,
2339
2340#ifdef CONFIG_HW_RANDOM_MSM
2341 &msm_device_rng,
2342#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002343 &msm8930_rpm_device,
2344 &msm8930_rpm_log_device,
Girish Mahadevan898c56d2012-06-05 16:09:19 -06002345 &msm8930_rpm_rbcpr_device,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002346 &msm8930_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302347 &msm8930_rpm_master_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002348#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002349 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002350#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002351 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002352 &coresight_tpiu_device,
2353 &coresight_etb_device,
2354 &coresight_funnel_device,
2355 &coresight_etm0_device,
2356 &coresight_etm1_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002357 &msm_device_dspcrashd_8960,
2358 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302359#ifdef MSM8930_PHASE_2
2360 &gpio_keys_8930,
2361#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002362 &msm8930_rtb_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002363 &msm_bus_8930_apps_fabric,
2364 &msm_bus_8930_sys_fabric,
2365 &msm_bus_8930_mm_fabric,
2366 &msm_bus_8930_sys_fpb,
2367 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002368 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002369 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002370 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002371 &msm8930_cache_dump_device,
Anji Jonnala6c2b6852012-09-21 13:34:44 +05302372 &msm8930_pc_cntr,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002373};
2374
2375static struct platform_device *cdp_devices[] __initdata = {
2376 &msm8960_device_otg,
2377 &msm8960_device_gadget_peripheral,
2378 &msm_device_hsusb_host,
2379 &android_usb_device,
2380 &msm_pcm,
2381 &msm_pcm_routing,
2382 &msm_cpudai0,
2383 &msm_cpudai1,
2384 &msm_cpudai_hdmi_rx,
2385 &msm_cpudai_bt_rx,
2386 &msm_cpudai_bt_tx,
2387 &msm_cpudai_fm_rx,
2388 &msm_cpudai_fm_tx,
2389 &msm_cpudai_auxpcm_rx,
2390 &msm_cpudai_auxpcm_tx,
2391 &msm_cpu_fe,
2392 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002393#ifdef CONFIG_MSM_GEMINI
2394 &msm8960_gemini_device,
2395#endif
2396 &msm_voice,
2397 &msm_voip,
2398 &msm_lpa_pcm,
2399 &msm_cpudai_afe_01_rx,
2400 &msm_cpudai_afe_01_tx,
2401 &msm_cpudai_afe_02_rx,
2402 &msm_cpudai_afe_02_tx,
2403 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002404 &msm_compr_dsp,
2405 &msm_cpudai_incall_music_rx,
2406 &msm_cpudai_incall_record_rx,
2407 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002408 &msm_pcm_hostless,
Asish Bhattacharya705c6732012-08-14 23:22:55 +05302409 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002410 &msm_lowlatency_pcm,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002411};
2412
2413static void __init msm8930_i2c_init(void)
2414{
2415 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2416 &msm8960_i2c_qup_gsbi4_pdata;
2417
2418 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2419 &msm8960_i2c_qup_gsbi3_pdata;
2420
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002421 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2422 &msm8960_i2c_qup_gsbi9_pdata;
2423
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002424 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2425 &msm8960_i2c_qup_gsbi10_pdata;
2426
2427 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2428 &msm8960_i2c_qup_gsbi12_pdata;
2429}
2430
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002431static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2432 {
2433 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2434 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2435 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002436 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002437 },
2438
2439 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002440 MSM_PM_SLEEP_MODE_RETENTION,
2441 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2442 true,
2443 415, 715, 340827, 475,
2444 },
2445
2446 {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002447 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2448 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2449 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002450 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002451 },
2452
2453 {
2454 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2455 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2456 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002457 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002458 },
2459
2460 {
2461 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002462 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2463 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002464 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002465 },
2466
2467 {
2468 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2469 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2470 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002471 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002472 },
2473
2474 {
2475 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2476 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2477 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002478 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002479 },
2480
2481 {
2482 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2483 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2484 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002485 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002486 },
2487
2488 {
2489 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2490 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2491 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002492 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002493 },
2494};
2495
Praveen Chidambaram78499012011-11-01 17:15:17 -06002496static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2497 .levels = &msm_rpmrs_levels[0],
2498 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2499 .vdd_mem_levels = {
2500 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2501 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2502 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2503 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2504 },
2505 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002506 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2507 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2508 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2509 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002510 },
2511 .vdd_mask = 0x7FFFFF,
2512 .rpmrs_target_id = {
2513 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2514 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002515 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2516 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002517 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2518 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2519 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2520 },
2521};
2522
Praveen Chidambaram75b8c812012-08-10 16:26:37 -06002523static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = {
2524 .levels = &msm_rpmrs_levels[0],
2525 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2526 .vdd_mem_levels = {
2527 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2528 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2529 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2530 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2531 },
2532 .vdd_dig_levels = {
2533 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2534 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2535 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2536 [MSM_RPMRS_VDD_DIG_MAX] = 3,
2537 },
2538 .vdd_mask = 0x7FFFFF,
2539 .rpmrs_target_id = {
2540 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2541 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2542 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2543 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
2544 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0,
2545 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1,
2546 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2547 },
2548};
2549
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002550static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2551 .mode = MSM_PM_BOOT_CONFIG_TZ,
2552};
2553
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002554#ifdef CONFIG_I2C
2555#define I2C_SURF 1
2556#define I2C_FFA (1 << 1)
2557#define I2C_RUMI (1 << 2)
2558#define I2C_SIM (1 << 3)
2559#define I2C_FLUID (1 << 4)
2560#define I2C_LIQUID (1 << 5)
2561
2562struct i2c_registry {
2563 u8 machs;
2564 int bus;
2565 struct i2c_board_info *info;
2566 int len;
2567};
2568
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002569#ifdef CONFIG_INPUT_MPU3050
2570#define MPU3050_INT_GPIO 69
2571
2572static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2573 .gpio_int = MPU3050_INT_GPIO,
2574};
2575
2576static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2577 {
2578 I2C_BOARD_INFO("mpu3050", 0x68),
Wentao Xuc7769c02012-08-03 15:06:41 -04002579 .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO),
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002580 .platform_data = &mpu3050_gyro,
2581 },
2582};
2583#endif
2584
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002585#ifdef CONFIG_ISL9519_CHARGER
2586static struct isl_platform_data isl_data __initdata = {
2587 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2588 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2589 .max_system_voltage = 4200,
2590 .min_system_voltage = 3200,
2591 .chgcurrent = 1000, /* 1900, */
2592 .term_current = 400, /* Need fine tuning */
2593 .input_current = 2048,
2594};
2595
2596static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2597 {
2598 I2C_BOARD_INFO("isl9519q", 0x9),
2599 .irq = 0, /* Not required when notify-by-pmic */
2600 .platform_data = &isl_data,
2601 },
2602};
2603#endif /* CONFIG_ISL9519_CHARGER */
2604
Wentao Xu114c0152012-06-12 11:40:38 -04002605#ifdef CONFIG_STM_LIS3DH
2606static struct lis3dh_acc_platform_data lis3dh_accel = {
2607 .poll_interval = 200,
2608 .min_interval = 10,
2609 .g_range = LIS3DH_ACC_G_2G,
2610 .axis_map_x = 1,
2611 .axis_map_y = 0,
2612 .axis_map_z = 2,
2613 .negate_x = 0,
2614 .negate_y = 0,
2615 .negate_z = 1,
2616 .init = NULL,
2617 .exit = NULL,
2618 .gpio_int1 = -EINVAL,
2619 .gpio_int2 = -EINVAL,
2620};
2621
2622static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = {
2623 {
2624 I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18),
2625 .platform_data = &lis3dh_accel,
2626 },
2627};
2628#endif /* CONFIG_STM_LIS3DH */
2629
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002630static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002631#ifdef CONFIG_ISL9519_CHARGER
2632 {
2633 I2C_LIQUID,
2634 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2635 isl_charger_i2c_info,
2636 ARRAY_SIZE(isl_charger_i2c_info),
2637 },
2638#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002639#ifdef CONFIG_INPUT_MPU3050
2640 {
2641 I2C_FFA | I2C_FLUID,
2642 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2643 mpu3050_i2c_boardinfo,
2644 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2645 },
2646#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002647 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002648 I2C_SURF | I2C_FFA | I2C_FLUID,
2649 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002650 msm_isa1200_board_info,
2651 ARRAY_SIZE(msm_isa1200_board_info),
2652 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002653 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002654 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002655 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2656 mxt_device_info_8930,
2657 ARRAY_SIZE(mxt_device_info_8930),
2658 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002659 {
2660 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2661 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2662 sii_device_info,
2663 ARRAY_SIZE(sii_device_info),
2664 },
Wentao Xu114c0152012-06-12 11:40:38 -04002665#ifdef CONFIG_STM_LIS3DH
2666 {
2667 I2C_FFA | I2C_FLUID,
2668 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2669 lis3dh_i2c_boardinfo,
2670 ARRAY_SIZE(lis3dh_i2c_boardinfo),
2671 },
2672#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002673};
2674#endif /* CONFIG_I2C */
2675
2676static void __init register_i2c_devices(void)
2677{
2678#ifdef CONFIG_I2C
2679 u8 mach_mask = 0;
2680 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002681#ifdef CONFIG_MSM_CAMERA
2682 struct i2c_registry msm8930_camera_i2c_devices = {
2683 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2684 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2685 msm8930_camera_board_info.board_info,
2686 msm8930_camera_board_info.num_i2c_board_info,
2687 };
2688#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002689
2690 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002691 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002692 mach_mask = I2C_SURF;
2693 else if (machine_is_msm8930_fluid())
2694 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002695 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002696 mach_mask = I2C_FFA;
2697 else
2698 pr_err("unmatched machine ID in register_i2c_devices\n");
2699
2700 /* Run the array and install devices as appropriate */
2701 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2702 if (msm8960_i2c_devices[i].machs & mach_mask)
2703 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2704 msm8960_i2c_devices[i].info,
2705 msm8960_i2c_devices[i].len);
2706 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002707#ifdef CONFIG_MSM_CAMERA
2708 if (msm8930_camera_i2c_devices.machs & mach_mask)
2709 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2710 msm8930_camera_i2c_devices.info,
2711 msm8930_camera_i2c_devices.len);
2712#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002713#endif
2714}
2715
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -07002716/*Modify the WCD9xxx platform data to support supplies from PM8917 */
2717static void __init msm8930_pm8917_wcd9xxx_pdata_fixup(
2718 struct wcd9xxx_pdata *cdc_pdata)
2719{
2720 int i;
2721
2722 for (i = 0; i < ARRAY_SIZE(cdc_pdata->regulator); i++) {
2723
2724 if (cdc_pdata->regulator[i].name != NULL
2725 && strncmp(cdc_pdata->regulator[i].name,
2726 "CDC_VDD_CP", 10) == 0) {
2727 cdc_pdata->regulator[i].min_uV =
2728 cdc_pdata->regulator[i].max_uV = 1800000;
2729 pr_info("%s: CDC_VDD_CP forced to 1.8 volts for PM8917\n",
2730 __func__);
2731 return;
2732 }
2733 }
2734}
2735
David Collinsfd344aa2012-08-06 15:02:03 -07002736/* Modify platform data values to match requirements for PM8917. */
2737static void __init msm8930_pm8917_pdata_fixup(void)
2738{
Patrick Dalyc1227cb2012-08-28 13:39:17 -07002739 struct acpuclk_platform_data *pdata;
2740
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -07002741 msm8930_pm8917_wcd9xxx_pdata_fixup(&sitar_platform_data);
2742 msm8930_pm8917_wcd9xxx_pdata_fixup(&sitar1p1_platform_data);
2743
David Collinsfd344aa2012-08-06 15:02:03 -07002744 mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917;
2745
2746 gpio_keys_8930_pdata.buttons = keys_8930_pm8917;
2747 gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917);
David Collins4614cb92012-08-20 12:17:09 -07002748
2749 msm_device_saw_core0.dev.platform_data
2750 = &msm8930_pm8038_saw_regulator_core0_pdata;
2751 msm_device_saw_core1.dev.platform_data
2752 = &msm8930_pm8038_saw_regulator_core1_pdata;
2753
2754 msm8930_device_rpm_regulator.dev.platform_data
2755 = &msm8930_pm8917_rpm_regulator_pdata;
Patrick Dalyc1227cb2012-08-28 13:39:17 -07002756
2757 pdata = msm8930_device_acpuclk.dev.platform_data;
2758 pdata->uses_pm8917 = true;
Tianyi Gou2520b6e2012-10-29 19:13:53 -07002759
2760 pdata = msm8930ab_device_acpuclk.dev.platform_data;
2761 pdata->uses_pm8917 = true;
David Collinsfd344aa2012-08-06 15:02:03 -07002762}
2763
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002764static void __init msm8930_cdp_init(void)
2765{
David Collinsfd344aa2012-08-06 15:02:03 -07002766 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2767 msm8930_pm8917_pdata_fixup();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002768 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2769 pr_err("meminfo_init() failed!\n");
2770
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07002771 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002772 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002773 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram75b8c812012-08-10 16:26:37 -06002774 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
2775 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2776 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
2777 } else {
2778 BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917));
2779 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917));
2780 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002781
2782 regulator_suppress_info_printing();
2783 if (msm_xo_init())
2784 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002785 platform_device_register(&msm8930_device_rpm_regulator);
Patrick Daly8fad60d2012-08-27 16:25:07 -07002786 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2787 msm_clock_init(&msm8930_pm8917_clock_init_data);
2788 else
2789 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302790 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Aravind Venkateswaran06a46352012-08-16 14:52:39 -07002791 if (msm8930_mhl_display_enabled()) {
2792 mhl_platform_data.mhl_enabled = true;
2793 msm_otg_pdata.mhl_enable = true;
2794 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002795 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302796 android_usb_pdata.swfi_latency =
2797 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002798 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002799 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2800 &msm8960_qup_spi_gsbi1_pdata;
2801 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2802
Jay Chokshi06fa7542011-12-07 13:09:17 -08002803 /*
2804 * TODO: When physical 8930/PM8038 hardware becomes
2805 * available, remove this block or add the config
2806 * option.
2807 */
2808#ifndef MSM8930_PHASE_2
2809 msm8960_init_pmic();
2810#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002811 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002812#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002813 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302814 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002815 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2816 msm_spm_l2_init(msm_spm_l2_data);
2817 msm8930_init_buses();
Aravind Venkateswaran896d2f92012-10-29 17:54:55 -07002818 if (cpu_is_msm8627()) {
Tianyi Gou723843b2012-06-13 15:24:56 -07002819 platform_add_devices(msm8627_footswitch,
2820 msm8627_num_footswitch);
Aravind Venkateswaran896d2f92012-10-29 17:54:55 -07002821 } else {
2822 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2823 platform_add_devices(msm8930_pm8917_footswitch,
2824 msm8930_pm8917_num_footswitch);
2825 else
2826 platform_add_devices(msm8930_footswitch,
2827 msm8930_num_footswitch);
2828 }
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002829 if (cpu_is_msm8627())
Matt Wagantallab730bd2012-06-07 20:13:51 -07002830 platform_device_register(&msm8627_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002831 else if (cpu_is_msm8930())
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002832 platform_device_register(&msm8930_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002833 else if (cpu_is_msm8930aa())
2834 platform_device_register(&msm8930aa_device_acpuclk);
Tianyi Gou2520b6e2012-10-29 19:13:53 -07002835 else if (cpu_is_msm8930ab())
2836 platform_device_register(&msm8930ab_device_acpuclk);
David Collins4614cb92012-08-20 12:17:09 -07002837 platform_add_devices(early_common_devices,
2838 ARRAY_SIZE(early_common_devices));
2839 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2840 platform_add_devices(pmic_pm8038_devices,
2841 ARRAY_SIZE(pmic_pm8038_devices));
2842 else
2843 platform_add_devices(pmic_pm8917_devices,
2844 ARRAY_SIZE(pmic_pm8917_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002845 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002846 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002847 /*
2848 * TODO: When physical 8930/PM8038 hardware becomes
2849 * available, remove this block or add the config
2850 * option.
2851 */
2852#ifndef MSM8930_PHASE_2
2853 msm8960_pm8921_gpio_mpp_init();
2854#else
David Collinsfd344aa2012-08-06 15:02:03 -07002855 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2856 msm8930_pm8038_gpio_mpp_init();
2857 else
2858 msm8930_pm8917_gpio_mpp_init();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002859#endif
Jin Hongd2e2d3b2012-11-01 14:16:33 -07002860 /* Don't add modem devices on APQ targets */
2861 if (socinfo_get_id() != 119 && socinfo_get_id() != 157
2862 && socinfo_get_id() != 160)
2863 platform_device_register(&msm_8960_q6_mss);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002864 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002865#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002866 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002867#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002868 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002869 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002870 register_i2c_devices();
2871 msm8930_init_fb();
2872 slim_register_board_info(msm_slim_devices,
2873 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002874 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002875 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002876 msm_pm_set_tz_retention_flag(1);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002877
2878 if (PLATFORM_IS_CHARM25())
2879 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2880}
2881
2882MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2883 .map_io = msm8930_map_io,
2884 .reserve = msm8930_reserve,
2885 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302886 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002887 .timer = &msm_timer,
2888 .init_machine = msm8930_cdp_init,
2889 .init_early = msm8930_allocate_memory_regions,
2890 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002891 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002892MACHINE_END
2893
2894MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2895 .map_io = msm8930_map_io,
2896 .reserve = msm8930_reserve,
2897 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302898 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002899 .timer = &msm_timer,
2900 .init_machine = msm8930_cdp_init,
2901 .init_early = msm8930_allocate_memory_regions,
2902 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002903 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002904MACHINE_END
2905
2906MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2907 .map_io = msm8930_map_io,
2908 .reserve = msm8930_reserve,
2909 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302910 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002911 .timer = &msm_timer,
2912 .init_machine = msm8930_cdp_init,
2913 .init_early = msm8930_allocate_memory_regions,
2914 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002915 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002916MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002917
2918MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2919 .map_io = msm8930_map_io,
2920 .reserve = msm8930_reserve,
2921 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302922 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002923 .timer = &msm_timer,
2924 .init_machine = msm8930_cdp_init,
2925 .init_early = msm8930_allocate_memory_regions,
2926 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002927 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002928MACHINE_END
2929
2930MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2931 .map_io = msm8930_map_io,
2932 .reserve = msm8930_reserve,
2933 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302934 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002935 .timer = &msm_timer,
2936 .init_machine = msm8930_cdp_init,
2937 .init_early = msm8930_allocate_memory_regions,
2938 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002939 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002940MACHINE_END