blob: 9d8519010eb3a5ebb53c6b31b47eec2b32f1ddc8 [file] [log] [blame]
Abhijeet Dharmapurikar7e37e6e2012-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
Laura Abbott87eafac2012-09-18 11:45:43 -070032#include <linux/dma-contiguous.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080033#include <linux/dma-mapping.h>
34#include <linux/platform_data/qcom_crypto_device.h>
35#include <linux/platform_data/qcom_wcnss_device.h>
36#include <linux/leds.h>
37#include <linux/leds-pm8xxx.h>
38#include <linux/i2c/atmel_mxt_ts.h>
39#include <linux/msm_tsens.h>
40#include <linux/ks8851.h>
41#include <linux/i2c/isa1200.h>
Anirudh Ghayaleb3af972011-12-13 17:29:06 +053042#include <linux/gpio_keys.h>
Jack Cheung6ce8f682012-01-17 10:35:42 -080043#include <linux/memory.h>
Hanumant Singheea62562012-05-14 11:32:45 -070044#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060045#include <linux/msm_thermal.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080046
Asish Bhattacharyab86c3472012-02-15 08:31:52 +053047#include <linux/slimbus/slimbus.h>
48#include <linux/mfd/wcd9xxx/core.h>
49#include <linux/mfd/wcd9xxx/pdata.h>
50
Wentao Xu114c0152012-06-12 11:40:38 -040051#ifdef CONFIG_STM_LIS3DH
52#include <linux/input/lis3dh.h>
53#endif
54
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080055#include <asm/mach-types.h>
56#include <asm/mach/arch.h>
57#include <asm/setup.h>
58#include <asm/hardware/gic.h>
59#include <asm/mach/mmc.h>
60
61#include <mach/board.h>
62#include <mach/msm_iomap.h>
63#include <mach/msm_spi.h>
64#ifdef CONFIG_USB_MSM_OTG_72K
65#include <mach/msm_hsusb.h>
66#else
67#include <linux/usb/msm_hsusb.h>
68#endif
69#include <linux/usb/android.h>
70#include <mach/usbdiag.h>
71#include <mach/socinfo.h>
72#include <mach/rpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080073#include <mach/gpiomux.h>
74#include <mach/msm_bus_board.h>
75#include <mach/msm_memtypes.h>
76#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080077#include <mach/msm_xo.h>
78#include <mach/restart.h>
79
Mitchel Humpherys46475f62012-09-06 11:33:28 -070080#include <linux/msm_ion.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080081#include <mach/ion.h>
82#include <mach/mdm2.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080083#include <mach/msm_rtb.h>
Hanumant Singheea62562012-05-14 11:32:45 -070084#include <linux/fmem.h>
Laura Abbottf3173042012-05-29 15:23:18 -070085#include <mach/msm_cache_dump.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080086
Jordan Crouse914de9b2012-07-09 13:49:46 -060087#include <mach/kgsl.h>
Wentao Xuf59ce4e2012-05-22 17:30:13 -040088#ifdef CONFIG_INPUT_MPU3050
89#include <linux/input/mpu3050.h>
90#endif
91
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080092#include "timer.h"
93#include "devices.h"
94#include "devices-msm8x60.h"
95#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080096#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080097#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080098#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053099#include <mach/mpm.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 Dalya3b73c42012-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
Sudhir Sharmab83b1472012-11-28 19:46:13 -0800136#define MSM_PMEM_AUDIO_SIZE 0x4CF000
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
Laura Abbott87eafac2012-09-18 11:45:43 -0700369
370static u64 msm_dmamask = DMA_BIT_MASK(32);
371
372static struct platform_device ion_mm_heap_device = {
373 .name = "ion-mm-heap-device",
374 .id = -1,
375 .dev = {
376 .dma_mask = &msm_dmamask,
377 .coherent_dma_mask = DMA_BIT_MASK(32),
378 }
379};
380
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800381/**
382 * These heaps are listed in the order they will be allocated. Due to
383 * video hardware restrictions and content protection the FW heap has to
384 * be allocated adjacent (below) the MM heap and the MFC heap has to be
385 * allocated after the MM heap to ensure MFC heap is not more than 256MB
386 * away from the base address of the FW heap.
387 * However, the order of FW heap and MM heap doesn't matter since these
388 * two heaps are taken care of by separate code to ensure they are adjacent
389 * to each other.
390 * Don't swap the order unless you know what you are doing!
391 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700392struct ion_platform_heap msm8930_heaps[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800393 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800394 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800395 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800396 .name = ION_VMALLOC_HEAP_NAME,
397 },
398#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
399 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800400 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800401 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800402 .name = ION_MM_HEAP_NAME,
403 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800404 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700405 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Laura Abbott87eafac2012-09-18 11:45:43 -0700406 .priv = &ion_mm_heap_device.dev
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800407 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800408 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800409 .id = ION_MM_FIRMWARE_HEAP_ID,
410 .type = ION_HEAP_TYPE_CARVEOUT,
411 .name = ION_MM_FIRMWARE_HEAP_NAME,
412 .size = MSM_ION_MM_FW_SIZE,
413 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700414 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800415 },
416 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800417 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800418 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800419 .name = ION_MFC_HEAP_NAME,
420 .size = MSM_ION_MFC_SIZE,
421 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700422 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800423 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700424#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800425 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800426 .id = ION_SF_HEAP_ID,
427 .type = ION_HEAP_TYPE_CARVEOUT,
428 .name = ION_SF_HEAP_NAME,
429 .size = MSM_ION_SF_SIZE,
430 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700431 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800432 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700433#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800434 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800435 .id = ION_IOMMU_HEAP_ID,
436 .type = ION_HEAP_TYPE_IOMMU,
437 .name = ION_IOMMU_HEAP_NAME,
438 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800439 {
440 .id = ION_QSECOM_HEAP_ID,
441 .type = ION_HEAP_TYPE_CARVEOUT,
442 .name = ION_QSECOM_HEAP_NAME,
443 .size = MSM_ION_QSECOM_SIZE,
444 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700445 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800446 },
Olav Haugan7355db02012-01-13 16:59:13 -0800447 {
448 .id = ION_AUDIO_HEAP_ID,
449 .type = ION_HEAP_TYPE_CARVEOUT,
450 .name = ION_AUDIO_HEAP_NAME,
451 .size = MSM_ION_AUDIO_SIZE,
452 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700453 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800454 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800455#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700456};
457
458static struct ion_platform_data msm8930_ion_pdata = {
459 .nr = MSM_ION_HEAP_NUM,
460 .heaps = msm8930_heaps,
461
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800462};
463
Laura Abbottb93525f2012-04-12 09:57:19 -0700464static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800465 .name = "ion-msm",
466 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700467 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800468};
469#endif
470
Hanumant Singheea62562012-05-14 11:32:45 -0700471struct platform_device msm8930_fmem_device = {
472 .name = "fmem",
473 .id = 1,
474 .dev = { .platform_data = &msm8930_fmem_pdata },
475};
476
477static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
478 unsigned long size)
479{
480 msm8930_reserve_table[mem_type].size += size;
481}
482
483static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
484{
485#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
486 int ret;
487
488 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
489 panic("fixed area size is larger than %dM\n",
490 MAX_FIXED_AREA_SIZE >> 20);
491
492 reserve_info->fixed_area_size = fixed_area_size;
493 reserve_info->fixed_area_start = MSM8930_FW_START;
494
495 ret = memblock_remove(reserve_info->fixed_area_start,
496 reserve_info->fixed_area_size);
497 BUG_ON(ret);
498#endif
499}
500
501/**
502 * Reserve memory for ION and calculate amount of reusable memory for fmem.
503 * We only reserve memory for heaps that are not reusable. However, we only
504 * support one reusable heap at the moment so we ignore the reusable flag for
505 * other than the first heap with reusable flag set. Also handle special case
506 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
507 * at a higher address than FW in addition to not more than 256MB away from the
508 * base address of the firmware. This means that if MM is reusable the other
509 * two heaps must be allocated in the same region as FW. This is handled by the
510 * mem_is_fmem flag in the platform data. In addition the MM heap must be
511 * adjacent to the FW heap for content protection purposes.
512 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700513static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800514{
515#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700516 unsigned int i;
Laura Abbott87eafac2012-09-18 11:45:43 -0700517 int ret;
Hanumant Singheea62562012-05-14 11:32:45 -0700518 unsigned int fixed_size = 0;
519 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
520 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700521 unsigned long cma_alignment;
522 unsigned int low_use_cma = 0;
523 unsigned int middle_use_cma = 0;
524 unsigned int high_use_cma = 0;
Hanumant Singheea62562012-05-14 11:32:45 -0700525
Hanumant Singheea62562012-05-14 11:32:45 -0700526 fixed_low_size = 0;
527 fixed_middle_size = 0;
528 fixed_high_size = 0;
529
Laura Abbott87eafac2012-09-18 11:45:43 -0700530 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
531
Hanumant Singheea62562012-05-14 11:32:45 -0700532 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
Laura Abbott87eafac2012-09-18 11:45:43 -0700533 struct ion_platform_heap *heap =
Hanumant Singheea62562012-05-14 11:32:45 -0700534 &(msm8930_ion_pdata.heaps[i]);
535
Laura Abbott87eafac2012-09-18 11:45:43 -0700536 int use_cma = 0;
537
Hanumant Singheea62562012-05-14 11:32:45 -0700538 if (heap->extra_data) {
539 int fixed_position = NOT_FIXED;
Hanumant Singheea62562012-05-14 11:32:45 -0700540
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700541 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700542 case ION_HEAP_TYPE_CP:
Laura Abbott87eafac2012-09-18 11:45:43 -0700543 if (((struct ion_cp_heap_pdata *)
544 heap->extra_data)->is_cma) {
545 heap->size = ALIGN(heap->size,
546 cma_alignment);
547 use_cma = 1;
548 }
Hanumant Singheea62562012-05-14 11:32:45 -0700549 fixed_position = ((struct ion_cp_heap_pdata *)
550 heap->extra_data)->fixed_position;
551 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700552 case ION_HEAP_TYPE_DMA:
553 use_cma = 1;
554 /* Purposely fall through here */
Hanumant Singheea62562012-05-14 11:32:45 -0700555 case ION_HEAP_TYPE_CARVEOUT:
Hanumant Singheea62562012-05-14 11:32:45 -0700556 fixed_position = ((struct ion_co_heap_pdata *)
557 heap->extra_data)->fixed_position;
558 break;
559 default:
560 break;
561 }
562
563 if (fixed_position != NOT_FIXED)
564 fixed_size += heap->size;
565 else
566 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
567
Laura Abbott87eafac2012-09-18 11:45:43 -0700568 if (fixed_position == FIXED_LOW) {
Hanumant Singheea62562012-05-14 11:32:45 -0700569 fixed_low_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700570 low_use_cma = use_cma;
571 } else if (fixed_position == FIXED_MIDDLE) {
Hanumant Singheea62562012-05-14 11:32:45 -0700572 fixed_middle_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700573 middle_use_cma = use_cma;
574 } else if (fixed_position == FIXED_HIGH) {
Hanumant Singheea62562012-05-14 11:32:45 -0700575 fixed_high_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700576 high_use_cma = use_cma;
577 } else if (use_cma) {
578 /*
579 * Heaps that use CMA but are not part of the
580 * fixed set. Create wherever.
581 */
582 dma_declare_contiguous(
583 heap->priv,
584 heap->size,
585 0,
586 0xb0000000);
587 }
Hanumant Singheea62562012-05-14 11:32:45 -0700588 }
589 }
590
591 if (!fixed_size)
592 return;
Laura Abbott87eafac2012-09-18 11:45:43 -0700593 /*
594 * Given the setup for the fixed area, we can't round up all sizes.
595 * Some sizes must be set up exactly and aligned correctly. Incorrect
596 * alignments are considered a configuration issue
Hanumant Singheea62562012-05-14 11:32:45 -0700597 */
Hanumant Singheea62562012-05-14 11:32:45 -0700598
599 fixed_low_start = MSM8930_FIXED_AREA_START;
Laura Abbott87eafac2012-09-18 11:45:43 -0700600 if (low_use_cma) {
601 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
602 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
603 } else {
604 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
605 ret = memblock_remove(fixed_low_start,
606 fixed_low_size + HOLE_SIZE);
607 BUG_ON(ret);
608 }
609
Deepak Kotur9830bf02012-06-01 15:04:29 -0700610 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott87eafac2012-09-18 11:45:43 -0700611 if (middle_use_cma) {
612 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
613 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
614 } else {
615 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
616 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
617 BUG_ON(ret);
618 }
619
Hanumant Singheea62562012-05-14 11:32:45 -0700620 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700621 if (high_use_cma) {
622 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
623 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
624 } else {
625 /* This is the end of the fixed area so it's okay to round up */
626 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
627 ret = memblock_remove(fixed_high_start, fixed_high_size);
628 BUG_ON(ret);
629 }
Hanumant Singheea62562012-05-14 11:32:45 -0700630
631 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
632 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
633
634 if (heap->extra_data) {
635 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700636 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700637
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700638 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700639 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700640 pdata =
641 (struct ion_cp_heap_pdata *)heap->extra_data;
642 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700643 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700644 case ION_HEAP_TYPE_DMA:
Hanumant Singheea62562012-05-14 11:32:45 -0700645 case ION_HEAP_TYPE_CARVEOUT:
646 fixed_position = ((struct ion_co_heap_pdata *)
647 heap->extra_data)->fixed_position;
648 break;
649 default:
650 break;
651 }
652
653 switch (fixed_position) {
654 case FIXED_LOW:
655 heap->base = fixed_low_start;
656 break;
657 case FIXED_MIDDLE:
658 heap->base = fixed_middle_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700659 if (middle_use_cma)
660 dma_declare_contiguous(
661 &ion_mm_heap_device.dev,
662 heap->size,
663 fixed_middle_start,
664 0xa0000000);
Deepak Kotur9830bf02012-06-01 15:04:29 -0700665 pdata->secure_base = fixed_middle_start
666 - HOLE_SIZE;
667 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700668 break;
669 case FIXED_HIGH:
670 heap->base = fixed_high_start;
671 break;
672 default:
673 break;
674 }
675 }
676 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800677#endif
678}
Huaibin Yanga5419422011-12-08 23:52:10 -0800679
680static void __init reserve_mdp_memory(void)
681{
682 msm8930_mdp_writeback(msm8930_reserve_table);
683}
684
Laura Abbottf3173042012-05-29 15:23:18 -0700685#ifdef CONFIG_MSM_CACHE_DUMP
686static void __init reserve_cache_dump_memory(void)
687{
688 unsigned int total;
689
690 total = msm8930_cache_dump_pdata.l1_size +
691 msm8930_cache_dump_pdata.l2_size;
692 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
693}
694#else
695static void __init reserve_cache_dump_memory(void) { }
696#endif
697
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800698static void __init msm8930_calculate_reserve_sizes(void)
699{
700 size_pmem_devices();
701 reserve_pmem_memory();
702 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800703 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800704 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700705 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800706}
707
708static struct reserve_info msm8930_reserve_info __initdata = {
709 .memtype_reserve_table = msm8930_reserve_table,
710 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700711 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800712 .paddr_to_memtype = msm8930_paddr_to_memtype,
713};
714
715static int msm8930_memory_bank_size(void)
716{
717 return 1<<29;
718}
719
720static void __init locate_unstable_memory(void)
721{
722 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
723 unsigned long bank_size;
724 unsigned long low, high;
725
726 bank_size = msm8930_memory_bank_size();
727 low = meminfo.bank[0].start;
728 high = mb->start + mb->size;
729
730 /* Check if 32 bit overflow occured */
731 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700732 high -= PAGE_SIZE;
733
734 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
735 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800736
737 low &= ~(bank_size - 1);
738
739 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700740 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800741
742 msm8930_reserve_info.bank_size = bank_size;
743#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800744 msm8930_reserve_info.low_unstable_address = mb->start -
745 MIN_MEMORY_BLOCK_SIZE + mb->size;
746 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800747 pr_info("low unstable address %lx max size %lx bank size %lx\n",
748 msm8930_reserve_info.low_unstable_address,
749 msm8930_reserve_info.max_unstable_size,
750 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700751 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800752#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700753no_dmm:
754 msm8930_reserve_info.low_unstable_address = high;
755 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800756}
757
758static void __init place_movable_zone(void)
759{
Larry Basselb8d61022012-02-24 10:49:45 -0800760#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800761 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
762 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
763 pr_info("movable zone start %lx size %lx\n",
764 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800765#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800766}
767
768static void __init msm8930_early_memory(void)
769{
770 reserve_info = &msm8930_reserve_info;
771 locate_unstable_memory();
772 place_movable_zone();
773}
774
775static void __init msm8930_reserve(void)
776{
777 msm_reserve();
778}
779
780static int msm8930_change_memory_power(u64 start, u64 size,
781 int change_type)
782{
783 return soc_change_memory_power(start, size, change_type);
784}
785
786static void __init msm8930_allocate_memory_regions(void)
787{
788 msm8930_allocate_fb_region();
789}
790
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530791#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800792
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530793#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800794
795/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
796 * 4 micbiases are used to power various analog and digital
797 * microphones operating at 1800 mV. Technically, all micbiases
798 * can source from single cfilter since all microphones operate
799 * at the same voltage level. The arrangement below is to make
800 * sure all cfilters are exercised. LDO_H regulator ouput level
801 * does not need to be as high as 2.85V. It is choosen for
802 * microphone sensitivity purpose.
803 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530804static struct wcd9xxx_pdata sitar_platform_data = {
805 .slimbus_slave_device = {
806 .name = "sitar-slave",
807 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800808 },
809 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530810 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530811 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530812 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800813 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530814 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800815 .cfilt1_mv = 1800,
816 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530817 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
818 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700819 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
820 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530821 },
822 .regulator = {
823 {
824 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700825 .min_uV = 1800000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530826 .max_uV = 2200000,
827 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
828 },
829 {
830 .name = "CDC_VDDA_RX",
831 .min_uV = 1800000,
832 .max_uV = 1800000,
833 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
834 },
835 {
836 .name = "CDC_VDDA_TX",
837 .min_uV = 1800000,
838 .max_uV = 1800000,
839 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
840 },
841 {
842 .name = "VDDIO_CDC",
843 .min_uV = 1800000,
844 .max_uV = 1800000,
845 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
846 },
847 {
848 .name = "VDDD_CDC_D",
849 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700850 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530851 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
852 },
853 {
854 .name = "CDC_VDDA_A_1P2V",
855 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700856 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530857 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
858 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800859 },
860};
861
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530862static struct slim_device msm_slim_sitar = {
863 .name = "sitar-slim",
864 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800865 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530866 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800867 },
868};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700869
870static struct wcd9xxx_pdata sitar1p1_platform_data = {
871 .slimbus_slave_device = {
872 .name = "sitar-slave",
873 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
874 },
875 .irq = MSM_GPIO_TO_INT(62),
876 .irq_base = SITAR_INTERRUPT_BASE,
877 .num_irqs = NR_WCD9XXX_IRQS,
878 .reset_gpio = 42,
879 .micbias = {
880 .ldoh_v = SITAR_LDOH_2P85_V,
881 .cfilt1_mv = 1800,
882 .cfilt2_mv = 1800,
883 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
884 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700885 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
886 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700887 },
888 .regulator = {
889 {
890 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700891 .min_uV = 1800000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700892 .max_uV = 2200000,
893 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
894 },
895 {
896 .name = "CDC_VDDA_RX",
897 .min_uV = 1800000,
898 .max_uV = 1800000,
899 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
900 },
901 {
902 .name = "CDC_VDDA_TX",
903 .min_uV = 1800000,
904 .max_uV = 1800000,
905 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
906 },
907 {
908 .name = "VDDIO_CDC",
909 .min_uV = 1800000,
910 .max_uV = 1800000,
911 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
912 },
913 {
914 .name = "VDDD_CDC_D",
915 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700916 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700917 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
918 },
919 {
920 .name = "CDC_VDDA_A_1P2V",
921 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700922 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700923 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
924 },
925 },
926};
927
928static struct slim_device msm_slim_sitar1p1 = {
929 .name = "sitar1p1-slim",
930 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
931 .dev = {
932 .platform_data = &sitar1p1_platform_data,
933 },
934};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800935#endif
936
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530937
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800938static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530939#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800940 {
941 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530942 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800943 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700944 {
945 .bus_num = 1,
946 .slim_slave = &msm_slim_sitar1p1,
947 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800948#endif
949 /* add more slimbus slaves as needed */
950};
951
952#define MSM_WCNSS_PHYS 0x03000000
953#define MSM_WCNSS_SIZE 0x280000
954
955static struct resource resources_wcnss_wlan[] = {
956 {
957 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
958 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
959 .name = "wcnss_wlanrx_irq",
960 .flags = IORESOURCE_IRQ,
961 },
962 {
963 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
964 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
965 .name = "wcnss_wlantx_irq",
966 .flags = IORESOURCE_IRQ,
967 },
968 {
969 .start = MSM_WCNSS_PHYS,
970 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
971 .name = "wcnss_mmio",
972 .flags = IORESOURCE_MEM,
973 },
974 {
975 .start = 84,
976 .end = 88,
977 .name = "wcnss_gpios_5wire",
978 .flags = IORESOURCE_IO,
979 },
980};
981
982static struct qcom_wcnss_opts qcom_wcnss_pdata = {
983 .has_48mhz_xo = 1,
984};
985
986static struct platform_device msm_device_wcnss_wlan = {
987 .name = "wcnss_wlan",
988 .id = 0,
989 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
990 .resource = resources_wcnss_wlan,
991 .dev = {.platform_data = &qcom_wcnss_pdata},
992};
993
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700994#ifdef CONFIG_QSEECOM
995/* qseecom bus scaling */
996static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
997 {
998 .src = MSM_BUS_MASTER_SPS,
999 .dst = MSM_BUS_SLAVE_EBI_CH0,
1000 .ib = 0,
1001 .ab = 0,
1002 },
1003 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001004 .src = MSM_BUS_MASTER_SPS,
1005 .dst = MSM_BUS_SLAVE_SPS,
1006 .ib = 0,
1007 .ab = 0,
1008 },
1009 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001010 .src = MSM_BUS_MASTER_SPDM,
1011 .dst = MSM_BUS_SLAVE_SPDM,
1012 .ib = 0,
1013 .ab = 0,
1014 },
1015};
1016
1017static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1018 {
1019 .src = MSM_BUS_MASTER_SPS,
1020 .dst = MSM_BUS_SLAVE_EBI_CH0,
1021 .ib = (492 * 8) * 1000000UL,
1022 .ab = (492 * 8) * 100000UL,
1023 },
1024 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001025 .src = MSM_BUS_MASTER_SPS,
1026 .dst = MSM_BUS_SLAVE_SPS,
1027 .ib = (492 * 8) * 1000000UL,
1028 .ab = (492 * 8) * 100000UL,
1029 },
1030 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001031 .src = MSM_BUS_MASTER_SPDM,
1032 .dst = MSM_BUS_SLAVE_SPDM,
1033 .ib = 0,
1034 .ab = 0,
1035 },
1036};
1037
1038static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1039 {
1040 .src = MSM_BUS_MASTER_SPS,
1041 .dst = MSM_BUS_SLAVE_EBI_CH0,
1042 .ib = 0,
1043 .ab = 0,
1044 },
1045 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001046 .src = MSM_BUS_MASTER_SPS,
1047 .dst = MSM_BUS_SLAVE_SPS,
1048 .ib = 0,
1049 .ab = 0,
1050 },
1051 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001052 .src = MSM_BUS_MASTER_SPDM,
1053 .dst = MSM_BUS_SLAVE_SPDM,
1054 .ib = (64 * 8) * 1000000UL,
1055 .ab = (64 * 8) * 100000UL,
1056 },
1057};
1058
1059static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1060 {
1061 ARRAY_SIZE(qseecom_clks_init_vectors),
1062 qseecom_clks_init_vectors,
1063 },
1064 {
1065 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1066 qseecom_enable_sfpb_vectors,
1067 },
1068 {
1069 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1070 qseecom_enable_sfpb_vectors,
1071 },
1072};
1073
1074static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1075 qseecom_hw_bus_scale_usecases,
1076 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1077 .name = "qsee",
1078};
1079
1080static struct platform_device qseecom_device = {
1081 .name = "qseecom",
1082 .id = 0,
1083 .dev = {
1084 .platform_data = &qseecom_bus_pdata,
1085 },
1086};
1087#endif
1088
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001089#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1090 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1091 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1092 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1093
1094#define QCE_SIZE 0x10000
1095#define QCE_0_BASE 0x18500000
1096
1097#define QCE_HW_KEY_SUPPORT 0
1098#define QCE_SHA_HMAC_SUPPORT 1
1099#define QCE_SHARE_CE_RESOURCE 1
1100#define QCE_CE_SHARED 0
1101
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001102/* Begin Bus scaling definitions */
1103static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1104 {
1105 .src = MSM_BUS_MASTER_ADM_PORT0,
1106 .dst = MSM_BUS_SLAVE_EBI_CH0,
1107 .ab = 0,
1108 .ib = 0,
1109 },
1110 {
1111 .src = MSM_BUS_MASTER_ADM_PORT1,
1112 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1113 .ab = 0,
1114 .ib = 0,
1115 },
1116};
1117
1118static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1119 {
1120 .src = MSM_BUS_MASTER_ADM_PORT0,
1121 .dst = MSM_BUS_SLAVE_EBI_CH0,
1122 .ab = 70000000UL,
1123 .ib = 70000000UL,
1124 },
1125 {
1126 .src = MSM_BUS_MASTER_ADM_PORT1,
1127 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1128 .ab = 2480000000UL,
1129 .ib = 2480000000UL,
1130 },
1131};
1132
1133static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1134 {
1135 ARRAY_SIZE(crypto_hw_init_vectors),
1136 crypto_hw_init_vectors,
1137 },
1138 {
1139 ARRAY_SIZE(crypto_hw_active_vectors),
1140 crypto_hw_active_vectors,
1141 },
1142};
1143
1144static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1145 crypto_hw_bus_scale_usecases,
1146 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1147 .name = "cryptohw",
1148};
1149/* End Bus Scaling Definitions*/
1150
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001151static struct resource qcrypto_resources[] = {
1152 [0] = {
1153 .start = QCE_0_BASE,
1154 .end = QCE_0_BASE + QCE_SIZE - 1,
1155 .flags = IORESOURCE_MEM,
1156 },
1157 [1] = {
1158 .name = "crypto_channels",
1159 .start = DMOV_CE_IN_CHAN,
1160 .end = DMOV_CE_OUT_CHAN,
1161 .flags = IORESOURCE_DMA,
1162 },
1163 [2] = {
1164 .name = "crypto_crci_in",
1165 .start = DMOV_CE_IN_CRCI,
1166 .end = DMOV_CE_IN_CRCI,
1167 .flags = IORESOURCE_DMA,
1168 },
1169 [3] = {
1170 .name = "crypto_crci_out",
1171 .start = DMOV_CE_OUT_CRCI,
1172 .end = DMOV_CE_OUT_CRCI,
1173 .flags = IORESOURCE_DMA,
1174 },
1175};
1176
1177static struct resource qcedev_resources[] = {
1178 [0] = {
1179 .start = QCE_0_BASE,
1180 .end = QCE_0_BASE + QCE_SIZE - 1,
1181 .flags = IORESOURCE_MEM,
1182 },
1183 [1] = {
1184 .name = "crypto_channels",
1185 .start = DMOV_CE_IN_CHAN,
1186 .end = DMOV_CE_OUT_CHAN,
1187 .flags = IORESOURCE_DMA,
1188 },
1189 [2] = {
1190 .name = "crypto_crci_in",
1191 .start = DMOV_CE_IN_CRCI,
1192 .end = DMOV_CE_IN_CRCI,
1193 .flags = IORESOURCE_DMA,
1194 },
1195 [3] = {
1196 .name = "crypto_crci_out",
1197 .start = DMOV_CE_OUT_CRCI,
1198 .end = DMOV_CE_OUT_CRCI,
1199 .flags = IORESOURCE_DMA,
1200 },
1201};
1202
1203#endif
1204
1205#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1206 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1207
1208static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1209 .ce_shared = QCE_CE_SHARED,
1210 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1211 .hw_key_support = QCE_HW_KEY_SUPPORT,
1212 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001213 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001214};
1215
1216static struct platform_device qcrypto_device = {
1217 .name = "qcrypto",
1218 .id = 0,
1219 .num_resources = ARRAY_SIZE(qcrypto_resources),
1220 .resource = qcrypto_resources,
1221 .dev = {
1222 .coherent_dma_mask = DMA_BIT_MASK(32),
1223 .platform_data = &qcrypto_ce_hw_suppport,
1224 },
1225};
1226#endif
1227
1228#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1229 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1230
1231static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1232 .ce_shared = QCE_CE_SHARED,
1233 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1234 .hw_key_support = QCE_HW_KEY_SUPPORT,
1235 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001236 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001237};
1238
1239static struct platform_device qcedev_device = {
1240 .name = "qce",
1241 .id = 0,
1242 .num_resources = ARRAY_SIZE(qcedev_resources),
1243 .resource = qcedev_resources,
1244 .dev = {
1245 .coherent_dma_mask = DMA_BIT_MASK(32),
1246 .platform_data = &qcedev_ce_hw_suppport,
1247 },
1248};
1249#endif
1250
1251#define MDM2AP_ERRFATAL 70
1252#define AP2MDM_ERRFATAL 95
1253#define MDM2AP_STATUS 69
1254#define AP2MDM_STATUS 94
1255#define AP2MDM_PMIC_RESET_N 80
1256#define AP2MDM_KPDPWR_N 81
1257
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001258static struct resource mdm_resources[] = {
1259 {
1260 .start = MDM2AP_ERRFATAL,
1261 .end = MDM2AP_ERRFATAL,
1262 .name = "MDM2AP_ERRFATAL",
1263 .flags = IORESOURCE_IO,
1264 },
1265 {
1266 .start = AP2MDM_ERRFATAL,
1267 .end = AP2MDM_ERRFATAL,
1268 .name = "AP2MDM_ERRFATAL",
1269 .flags = IORESOURCE_IO,
1270 },
1271 {
1272 .start = MDM2AP_STATUS,
1273 .end = MDM2AP_STATUS,
1274 .name = "MDM2AP_STATUS",
1275 .flags = IORESOURCE_IO,
1276 },
1277 {
1278 .start = AP2MDM_STATUS,
1279 .end = AP2MDM_STATUS,
1280 .name = "AP2MDM_STATUS",
1281 .flags = IORESOURCE_IO,
1282 },
1283 {
1284 .start = AP2MDM_PMIC_RESET_N,
1285 .end = AP2MDM_PMIC_RESET_N,
1286 .name = "AP2MDM_PMIC_RESET_N",
1287 .flags = IORESOURCE_IO,
1288 },
1289 {
1290 .start = AP2MDM_KPDPWR_N,
1291 .end = AP2MDM_KPDPWR_N,
1292 .name = "AP2MDM_KPDPWR_N",
1293 .flags = IORESOURCE_IO,
1294 },
1295};
1296
1297static struct mdm_platform_data mdm_platform_data = {
1298 .mdm_version = "2.5",
1299};
1300
1301static struct platform_device mdm_device = {
1302 .name = "mdm2_modem",
1303 .id = -1,
1304 .num_resources = ARRAY_SIZE(mdm_resources),
1305 .resource = mdm_resources,
1306 .dev = {
1307 .platform_data = &mdm_platform_data,
1308 },
1309};
1310
1311static struct platform_device *mdm_devices[] __initdata = {
1312 &mdm_device,
1313};
1314
Praveen Chidambaram78499012011-11-01 17:15:17 -06001315#ifdef CONFIG_MSM_MPM
1316static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1317 [1] = MSM_GPIO_TO_INT(46),
1318 [2] = MSM_GPIO_TO_INT(150),
1319 [4] = MSM_GPIO_TO_INT(103),
1320 [5] = MSM_GPIO_TO_INT(104),
1321 [6] = MSM_GPIO_TO_INT(105),
1322 [7] = MSM_GPIO_TO_INT(106),
1323 [8] = MSM_GPIO_TO_INT(107),
1324 [9] = MSM_GPIO_TO_INT(7),
1325 [10] = MSM_GPIO_TO_INT(11),
1326 [11] = MSM_GPIO_TO_INT(15),
1327 [12] = MSM_GPIO_TO_INT(19),
1328 [13] = MSM_GPIO_TO_INT(23),
1329 [14] = MSM_GPIO_TO_INT(27),
1330 [15] = MSM_GPIO_TO_INT(31),
1331 [16] = MSM_GPIO_TO_INT(35),
1332 [19] = MSM_GPIO_TO_INT(90),
1333 [20] = MSM_GPIO_TO_INT(92),
1334 [23] = MSM_GPIO_TO_INT(85),
1335 [24] = MSM_GPIO_TO_INT(83),
1336 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001337 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001338 [27] = HDMI_IRQ,
1339 [29] = MSM_GPIO_TO_INT(10),
1340 [30] = MSM_GPIO_TO_INT(102),
1341 [31] = MSM_GPIO_TO_INT(81),
1342 [32] = MSM_GPIO_TO_INT(78),
1343 [33] = MSM_GPIO_TO_INT(94),
1344 [34] = MSM_GPIO_TO_INT(72),
1345 [35] = MSM_GPIO_TO_INT(39),
1346 [36] = MSM_GPIO_TO_INT(43),
1347 [37] = MSM_GPIO_TO_INT(61),
1348 [38] = MSM_GPIO_TO_INT(50),
1349 [39] = MSM_GPIO_TO_INT(42),
1350 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001351 [42] = MSM_GPIO_TO_INT(8),
1352 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001353 [44] = MSM_GPIO_TO_INT(70),
1354 [45] = MSM_GPIO_TO_INT(69),
1355 [46] = MSM_GPIO_TO_INT(67),
1356 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001357 [48] = MSM_GPIO_TO_INT(55),
1358 [49] = MSM_GPIO_TO_INT(74),
1359 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001360 [51] = MSM_GPIO_TO_INT(49),
1361 [52] = MSM_GPIO_TO_INT(40),
1362 [53] = MSM_GPIO_TO_INT(37),
1363 [54] = MSM_GPIO_TO_INT(24),
1364 [55] = MSM_GPIO_TO_INT(14),
1365};
1366
1367static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1368 TLMM_MSM_SUMMARY_IRQ,
1369 RPM_APCC_CPU0_GP_HIGH_IRQ,
1370 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1371 RPM_APCC_CPU0_GP_LOW_IRQ,
1372 RPM_APCC_CPU0_WAKE_UP_IRQ,
1373 RPM_APCC_CPU1_GP_HIGH_IRQ,
1374 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1375 RPM_APCC_CPU1_GP_LOW_IRQ,
1376 RPM_APCC_CPU1_WAKE_UP_IRQ,
1377 MSS_TO_APPS_IRQ_0,
1378 MSS_TO_APPS_IRQ_1,
1379 MSS_TO_APPS_IRQ_2,
1380 MSS_TO_APPS_IRQ_3,
1381 MSS_TO_APPS_IRQ_4,
1382 MSS_TO_APPS_IRQ_5,
1383 MSS_TO_APPS_IRQ_6,
1384 MSS_TO_APPS_IRQ_7,
1385 MSS_TO_APPS_IRQ_8,
1386 MSS_TO_APPS_IRQ_9,
1387 LPASS_SCSS_GP_LOW_IRQ,
1388 LPASS_SCSS_GP_MEDIUM_IRQ,
1389 LPASS_SCSS_GP_HIGH_IRQ,
1390 SPS_MTI_30,
1391 SPS_MTI_31,
1392 RIVA_APSS_SPARE_IRQ,
1393 RIVA_APPS_WLAN_SMSM_IRQ,
1394 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1395 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1396};
1397
1398struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1399 .irqs_m2a = msm_mpm_irqs_m2a,
1400 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1401 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1402 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1403 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1404 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1405 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1406 .mpm_apps_ipc_val = BIT(1),
1407 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1408
1409};
1410#endif
1411
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001412#define MSM_SHARED_RAM_PHYS 0x80000000
1413
1414static void __init msm8930_map_io(void)
1415{
1416 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1417 msm_map_msm8930_io();
1418
1419 if (socinfo_init() < 0)
1420 pr_err("socinfo_init() failed!\n");
1421}
1422
1423static void __init msm8930_init_irq(void)
1424{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001425 struct msm_mpm_device_data *data = NULL;
1426#ifdef CONFIG_MSM_MPM
1427 data = &msm8930_mpm_dev_data;
1428#endif
1429
1430 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001431 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1432 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001433}
1434
1435static void __init msm8930_init_buses(void)
1436{
1437#ifdef CONFIG_MSM_BUS_SCALING
1438 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001439 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1440 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1441 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1442 msm_bus_8930_apps_fabric.dev.platform_data =
1443 &msm_bus_8930_apps_fabric_pdata;
1444 msm_bus_8930_sys_fabric.dev.platform_data =
1445 &msm_bus_8930_sys_fabric_pdata;
1446 msm_bus_8930_mm_fabric.dev.platform_data =
1447 &msm_bus_8930_mm_fabric_pdata;
1448 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1449 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001450#endif
1451}
1452
1453static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1454 .max_clock_speed = 15060000,
1455};
1456
1457#ifdef CONFIG_USB_MSM_OTG_72K
1458static struct msm_otg_platform_data msm_otg_pdata;
1459#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301460#ifdef CONFIG_MSM_BUS_SCALING
1461/* Bandwidth requests (zero) if no vote placed */
1462static struct msm_bus_vectors usb_init_vectors[] = {
1463 {
1464 .src = MSM_BUS_MASTER_SPS,
1465 .dst = MSM_BUS_SLAVE_EBI_CH0,
1466 .ab = 0,
1467 .ib = 0,
1468 },
1469};
1470
1471/* Bus bandwidth requests in Bytes/sec */
1472static struct msm_bus_vectors usb_max_vectors[] = {
1473 {
1474 .src = MSM_BUS_MASTER_SPS,
1475 .dst = MSM_BUS_SLAVE_EBI_CH0,
1476 .ab = 60000000, /* At least 480Mbps on bus. */
1477 .ib = 960000000, /* MAX bursts rate */
1478 },
1479};
1480
1481static struct msm_bus_paths usb_bus_scale_usecases[] = {
1482 {
1483 ARRAY_SIZE(usb_init_vectors),
1484 usb_init_vectors,
1485 },
1486 {
1487 ARRAY_SIZE(usb_max_vectors),
1488 usb_max_vectors,
1489 },
1490};
1491
1492static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1493 usb_bus_scale_usecases,
1494 ARRAY_SIZE(usb_bus_scale_usecases),
1495 .name = "usb",
1496};
1497#endif
1498
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301499static int hsusb_phy_init_seq[] = {
1500 0x44, 0x80, /* set VBUS valid threshold
1501 and disconnect valid threshold */
1502 0x38, 0x81, /* update DC voltage level */
1503 0x24, 0x82, /* set preemphasis and rise/fall time */
1504 0x13, 0x83, /* set source impedance adjusment */
1505 -1};
1506
Jack Pham87f202f2012-08-06 00:24:22 -07001507#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1508
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001509static struct msm_otg_platform_data msm_otg_pdata = {
1510 .mode = USB_OTG,
1511 .otg_control = OTG_PMIC_CONTROL,
1512 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001513 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001514 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301515#ifdef CONFIG_MSM_BUS_SCALING
1516 .bus_scale_table = &usb_bus_scale_pdata,
1517#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301518#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1519 .mhl_dev_name = "sii8334",
1520#endif
Jack Pham87f202f2012-08-06 00:24:22 -07001521 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001522};
1523#endif
1524
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001525#define PID_MAGIC_ID 0x71432909
1526#define SERIAL_NUM_MAGIC_ID 0x61945374
1527#define SERIAL_NUMBER_LENGTH 127
1528#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1529
1530struct magic_num_struct {
1531 uint32_t pid;
1532 uint32_t serial_num;
1533};
1534
1535struct dload_struct {
1536 uint32_t reserved1;
1537 uint32_t reserved2;
1538 uint32_t reserved3;
1539 uint16_t reserved4;
1540 uint16_t pid;
1541 char serial_number[SERIAL_NUMBER_LENGTH];
1542 uint16_t reserved5;
1543 struct magic_num_struct magic_struct;
1544};
1545
1546static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1547{
1548 struct dload_struct __iomem *dload = 0;
1549
1550 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1551 if (!dload) {
1552 pr_err("%s: cannot remap I/O memory region: %08x\n",
1553 __func__, DLOAD_USB_BASE_ADD);
1554 return -ENXIO;
1555 }
1556
1557 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1558 __func__, dload, pid, snum);
1559 /* update pid */
1560 dload->magic_struct.pid = PID_MAGIC_ID;
1561 dload->pid = pid;
1562
1563 /* update serial number */
1564 dload->magic_struct.serial_num = 0;
1565 if (!snum) {
1566 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1567 goto out;
1568 }
1569
1570 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1571 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1572out:
1573 iounmap(dload);
1574 return 0;
1575}
1576
1577static struct android_usb_platform_data android_usb_pdata = {
1578 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1579};
1580
1581static struct platform_device android_usb_device = {
1582 .name = "android_usb",
1583 .id = -1,
1584 .dev = {
1585 .platform_data = &android_usb_pdata,
1586 },
1587};
1588
1589static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001590 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001591};
1592
1593static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001594 0x00, 0x24, 0x54, 0x10,
1595 0x09, 0x03, 0x01,
1596 0x10, 0x54, 0x30, 0x0C,
1597 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001598};
1599
1600static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001601 0x00, 0x24, 0x54, 0x10,
1602 0x09, 0x07, 0x01, 0x0B,
1603 0x10, 0x54, 0x30, 0x0C,
1604 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001605};
1606
1607static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1608 [0] = {
1609 .mode = MSM_SPM_MODE_CLOCK_GATING,
1610 .notify_rpm = false,
1611 .cmd = spm_wfi_cmd_sequence,
1612 },
1613 [1] = {
1614 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1615 .notify_rpm = false,
1616 .cmd = spm_power_collapse_without_rpm,
1617 },
1618 [2] = {
1619 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1620 .notify_rpm = true,
1621 .cmd = spm_power_collapse_with_rpm,
1622 },
1623};
1624
1625static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1626 [0] = {
1627 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001628 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001629#if defined(CONFIG_MSM_AVS_HW)
1630 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1631 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1632#endif
1633 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001634 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001635 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1636 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1637 .vctl_timeout_us = 50,
1638 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1639 .modes = msm_spm_seq_list,
1640 },
1641 [1] = {
1642 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001643 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001644#if defined(CONFIG_MSM_AVS_HW)
1645 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1646 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1647#endif
1648 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001649 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001650 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1651 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1652 .vctl_timeout_us = 50,
1653 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1654 .modes = msm_spm_seq_list,
1655 },
1656};
1657
1658static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001659 0x00, 0x20, 0x03, 0x20,
1660 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001661};
1662
1663static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001664 0x00, 0x20, 0x34, 0x64,
1665 0x48, 0x07, 0x48, 0x20,
1666 0x50, 0x64, 0x04, 0x34,
1667 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001668};
1669static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001670 0x00, 0x10, 0x34, 0x64,
1671 0x48, 0x07, 0x48, 0x10,
1672 0x50, 0x64, 0x04, 0x34,
1673 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001674};
1675
1676static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1677 [0] = {
1678 .mode = MSM_SPM_L2_MODE_RETENTION,
1679 .notify_rpm = false,
1680 .cmd = l2_spm_wfi_cmd_sequence,
1681 },
1682 [1] = {
1683 .mode = MSM_SPM_L2_MODE_GDHS,
1684 .notify_rpm = true,
1685 .cmd = l2_spm_gdhs_cmd_sequence,
1686 },
1687 [2] = {
1688 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1689 .notify_rpm = true,
1690 .cmd = l2_spm_power_off_cmd_sequence,
1691 },
1692};
1693
1694static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1695 [0] = {
1696 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001697 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001698 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001699 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1700 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1701 .modes = msm_spm_l2_seq_list,
1702 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1703 },
1704};
1705
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301706#define ISA1200_HAP_EN_GPIO 77
1707#define ISA1200_HAP_LEN_GPIO 78
David Collins04499982012-08-06 15:02:03 -07001708#define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7)
1709#define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001710
1711static int isa1200_power(int on)
1712{
David Collins04499982012-08-06 15:02:03 -07001713 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
1714 enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1;
Amy Malocheb20c1052012-04-11 10:36:13 -07001715 int rc = 0;
1716
David Collins04499982012-08-06 15:02:03 -07001717 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
1718 gpio = ISA1200_HAP_CLK_PM8917;
1719 clk_id = CLK_MP3_2;
1720 }
1721
1722 gpio_set_value_cansleep(gpio, !!on);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301723
Amy Malocheb20c1052012-04-11 10:36:13 -07001724 if (on)
David Collins04499982012-08-06 15:02:03 -07001725 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001726 else
David Collins04499982012-08-06 15:02:03 -07001727 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001728
1729 if (rc) {
1730 pr_err("%s: unable to write aux clock register(%d)\n",
1731 __func__, rc);
1732 }
1733
1734 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001735}
1736
1737static int isa1200_dev_setup(bool enable)
1738{
David Collins04499982012-08-06 15:02:03 -07001739 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001740 int rc = 0;
1741
David Collins04499982012-08-06 15:02:03 -07001742 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1743 gpio = ISA1200_HAP_CLK_PM8917;
1744
Amy Malocheb20c1052012-04-11 10:36:13 -07001745 if (!enable)
1746 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301747
David Collins04499982012-08-06 15:02:03 -07001748 rc = gpio_request(gpio, "haptics_clk");
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301749 if (rc) {
1750 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001751 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301752 goto fail_gpio_req;
1753 }
1754
David Collins04499982012-08-06 15:02:03 -07001755 rc = gpio_direction_output(gpio, 0);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301756 if (rc) {
1757 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001758 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301759 goto fail_gpio_dir;
1760 }
1761
1762 return 0;
1763
1764fail_gpio_dir:
David Collins04499982012-08-06 15:02:03 -07001765 gpio_free(gpio);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301766fail_gpio_req:
1767 return rc;
1768
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001769}
1770
1771static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301772 {
1773 .name = "vddp",
1774 .min_uV = ISA_I2C_VTG_MIN_UV,
1775 .max_uV = ISA_I2C_VTG_MAX_UV,
1776 .load_uA = ISA_I2C_CURR_UA,
1777 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001778 {
1779 .name = "vcc_i2c",
1780 .min_uV = ISA_I2C_VTG_MIN_UV,
1781 .max_uV = ISA_I2C_VTG_MAX_UV,
1782 .load_uA = ISA_I2C_CURR_UA,
1783 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001784};
1785
1786static struct isa1200_platform_data isa1200_1_pdata = {
1787 .name = "vibrator",
1788 .dev_setup = isa1200_dev_setup,
1789 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301790 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1791 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001792 .max_timeout = 15000,
1793 .mode_ctrl = PWM_GEN_MODE,
1794 .pwm_fd = {
1795 .pwm_div = 256,
1796 },
1797 .is_erm = false,
1798 .smart_en = true,
1799 .ext_clk_en = true,
1800 .chip_en = 1,
1801 .regulator_info = isa1200_reg_data,
1802 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1803};
1804
1805static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1806 {
1807 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1808 .platform_data = &isa1200_1_pdata,
1809 },
1810};
1811
Amy Malochef3c9db42011-12-08 15:17:35 -08001812#define MXT_TS_GPIO_IRQ 11
1813#define MXT_TS_RESET_GPIO 52
1814
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301815static const u8 mxt_config_data_8930_v1[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001816 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001817 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001818 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301819 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001820 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301821 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001822 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301823 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001824 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301825 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1826 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1827 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1828 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001829 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001830 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1831 0,
1832 /* T18 Object */
1833 0, 0,
1834 /* T19 Object */
1835 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1836 0, 0, 0, 0, 0, 0,
1837 /* T23 Object */
1838 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1839 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001840 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001841 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1842 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001843 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001844 0, 0, 0, 0, 0,
1845 /* T42 Object */
1846 0, 0, 0, 0, 0, 0, 0, 0,
1847 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301848 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001849 /* T47 Object */
1850 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1851 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301852 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1853 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1854 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001855 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1856 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1857 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001858};
1859
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301860static const u8 mxt_config_data_8930_v2[] = {
1861 /* T6 Object */
1862 0, 0, 0, 0, 0, 0,
1863 /* T38 Object */
1864 15, 4, 0, 9, 7, 12, 0, 0,
1865 /* T7 Object */
1866 32, 16, 50,
1867 /* T8 Object */
1868 30, 0, 5, 10, 0, 0, 10, 10, 0, 0,
1869 /* T9 Object */
1870 131, 0, 0, 19, 11, 0, 16, 50, 1, 3,
1871 12, 7, 2, 0, 4, 5, 2, 10, 43, 4,
1872 54, 2, -25, 29, 38, 18, 143, 40, 207, 80,
1873 17, 5, 50, 50, 0,
1874 /* T18 Object */
1875 0, 0,
1876 /* T19 Object */
1877 0, 0, 0, 0, 0, 0,
1878 /* T25 Object */
1879 0, 0, 0, 0, 0, 0,
1880 /* T42 Object */
1881 3, 60, 20, 20, 150, 0, 0, 0,
1882 /* T46 Object */
1883 0, 3, 28, 28, 0, 0, 1, 0, 0,
1884 /* T47 Object */
1885 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1886 /* T48 Object */
1887 1, 3, 82, 0, 0, 0, 0, 0, 0, 0,
1888 16, 30, 0, 6, 6, 0, 0, 124, 4, 100,
1889 0, 0, 0, 5, 0, 42, 0, 1, 0, 40,
1890 52, 20, 0, 0, 0, 50, 1, 5, 2, 1,
1891 4, 5, 3, -25, 29, 38, 18, 143, 40, 207,
1892 80, 10, 5, 2,
1893 /* T55 Object */
1894 0, 0, 0, 0,
1895};
1896
Amy Malochef3c9db42011-12-08 15:17:35 -08001897static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1898 struct kobj_attribute *attr, char *buf)
1899{
1900 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301901 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1902 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1903 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1904 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001905 "\n");
1906}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001907
Amy Malochef3c9db42011-12-08 15:17:35 -08001908static struct kobj_attribute mxt224e_vkeys_attr = {
1909 .attr = {
1910 .mode = S_IRUGO,
1911 },
1912 .show = &mxt224e_vkeys_show,
1913};
1914
1915static struct attribute *mxt224e_properties_attrs[] = {
1916 &mxt224e_vkeys_attr.attr,
1917 NULL
1918};
1919
1920static struct attribute_group mxt224e_properties_attr_group = {
1921 .attrs = mxt224e_properties_attrs,
1922};
1923
1924static void mxt_init_vkeys_8930(void)
1925{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001926 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001927 static struct kobject *mxt224e_properties_kobj;
1928
1929 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1930 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1931 NULL);
1932 if (mxt224e_properties_kobj)
1933 rc = sysfs_create_group(mxt224e_properties_kobj,
1934 &mxt224e_properties_attr_group);
1935 if (!mxt224e_properties_kobj || rc)
1936 pr_err("%s: failed to create board_properties\n",
1937 __func__);
1938
1939 return;
1940}
1941
Jing Lindc4413c2012-01-16 15:22:52 -08001942static struct mxt_config_info mxt_config_array[] = {
1943 {
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301944 .config = mxt_config_data_8930_v1,
1945 .config_length = ARRAY_SIZE(mxt_config_data_8930_v1),
Jing Lindc4413c2012-01-16 15:22:52 -08001946 .family_id = 0x81,
1947 .variant_id = 0x01,
1948 .version = 0x10,
1949 .build = 0xAA,
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301950 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1951 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1952 },
1953 {
1954 .config = mxt_config_data_8930_v2,
1955 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1956 .family_id = 0x81,
1957 .variant_id = 0x15,
1958 .version = 0x11,
1959 .build = 0xAA,
1960 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1961 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1962 },
1963 {
1964 .config = mxt_config_data_8930_v2,
1965 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1966 .family_id = 0x81,
1967 .variant_id = 0x01,
1968 .version = 0x20,
1969 .build = 0xAB,
1970 .bootldr_id = MXT_BOOTLOADER_ID_224E,
Jing Lindc4413c2012-01-16 15:22:52 -08001971 },
1972};
1973
Amy Malochef3c9db42011-12-08 15:17:35 -08001974static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001975 .config_array = mxt_config_array,
1976 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001977 .panel_minx = 0,
1978 .panel_maxx = 566,
1979 .panel_miny = 0,
1980 .panel_maxy = 1067,
1981 .disp_minx = 0,
1982 .disp_maxx = 540,
1983 .disp_miny = 0,
1984 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001985 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301986#ifdef MSM8930_PHASE_2
1987 .digital_pwr_regulator = true,
1988#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001989 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001990 .reset_gpio = MXT_TS_RESET_GPIO,
1991 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001992};
1993
Amy Malochef3c9db42011-12-08 15:17:35 -08001994static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001995 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001996 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1997 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001998 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1999 },
2000};
2001
David Collins04499982012-08-06 15:02:03 -07002002#define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
2003#define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25)
Manoj Raoc6d904c2012-06-22 00:32:14 -07002004static struct msm_mhl_platform_data mhl_platform_data = {
2005 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
2006 .gpio_mhl_int = MHL_GPIO_INT,
2007 .gpio_mhl_reset = MHL_GPIO_RESET,
David Collins04499982012-08-06 15:02:03 -07002008 .gpio_mhl_power = MHL_POWER_GPIO_PM8038,
Manoj Raoc6d904c2012-06-22 00:32:14 -07002009 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
2010};
2011
2012static struct i2c_board_info sii_device_info[] __initdata = {
2013 {
2014 /*
2015 * keeps SI 8334 as the default
2016 * MHL TX
2017 */
2018 I2C_BOARD_INFO("sii8334", 0x39),
2019 .platform_data = &mhl_platform_data,
2020 .flags = I2C_CLIENT_WAKE,
2021 },
2022};
2023
2024
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302025#ifdef MSM8930_PHASE_2
2026
David Collins04499982012-08-06 15:02:03 -07002027#define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3)
2028#define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8)
2029#define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10)
2030#define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11)
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302031
David Collins04499982012-08-06 15:02:03 -07002032#define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27)
2033#define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28)
2034#define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36)
2035#define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37)
2036
2037static struct gpio_keys_button keys_8930_pm8038[] = {
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302038 {
2039 .code = KEY_VOLUMEUP,
2040 .type = EV_KEY,
2041 .desc = "volume_up",
David Collins04499982012-08-06 15:02:03 -07002042 .gpio = GPIO_VOLUME_UP_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302043 .wakeup = 1,
2044 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002045 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302046 },
2047 {
2048 .code = KEY_VOLUMEDOWN,
2049 .type = EV_KEY,
2050 .desc = "volume_down",
David Collins04499982012-08-06 15:02:03 -07002051 .gpio = GPIO_VOLUME_DOWN_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302052 .wakeup = 1,
2053 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002054 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302055 },
2056 {
2057 .code = KEY_CAMERA_FOCUS,
2058 .type = EV_KEY,
2059 .desc = "camera_focus",
David Collins04499982012-08-06 15:02:03 -07002060 .gpio = GPIO_CAMERA_FOCUS_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302061 .wakeup = 1,
2062 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002063 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302064 },
2065 {
2066 .code = KEY_CAMERA_SNAPSHOT,
2067 .type = EV_KEY,
2068 .desc = "camera_snapshot",
David Collins04499982012-08-06 15:02:03 -07002069 .gpio = GPIO_CAMERA_SNAPSHOT_PM8038,
2070 .wakeup = 1,
2071 .active_low = 1,
2072 .debounce_interval = 15,
2073 },
2074};
2075
2076static struct gpio_keys_button keys_8930_pm8917[] = {
2077 {
2078 .code = KEY_VOLUMEUP,
2079 .type = EV_KEY,
2080 .desc = "volume_up",
2081 .gpio = GPIO_VOLUME_UP_PM8917,
2082 .wakeup = 1,
2083 .active_low = 1,
2084 .debounce_interval = 15,
2085 },
2086 {
2087 .code = KEY_VOLUMEDOWN,
2088 .type = EV_KEY,
2089 .desc = "volume_down",
2090 .gpio = GPIO_VOLUME_DOWN_PM8917,
2091 .wakeup = 1,
2092 .active_low = 1,
2093 .debounce_interval = 15,
2094 },
2095 {
2096 .code = KEY_CAMERA_FOCUS,
2097 .type = EV_KEY,
2098 .desc = "camera_focus",
2099 .gpio = GPIO_CAMERA_FOCUS_PM8917,
2100 .wakeup = 1,
2101 .active_low = 1,
2102 .debounce_interval = 15,
2103 },
2104 {
2105 .code = KEY_CAMERA_SNAPSHOT,
2106 .type = EV_KEY,
2107 .desc = "camera_snapshot",
2108 .gpio = GPIO_CAMERA_SNAPSHOT_PM8917,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302109 .wakeup = 1,
2110 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002111 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302112 },
2113};
2114
2115/* Add GPIO keys for 8930 */
2116static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
David Collins04499982012-08-06 15:02:03 -07002117 .buttons = keys_8930_pm8038,
2118 .nbuttons = ARRAY_SIZE(keys_8930_pm8038),
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302119};
2120
2121static struct platform_device gpio_keys_8930 = {
2122 .name = "gpio-keys",
2123 .id = -1,
2124 .dev = {
2125 .platform_data = &gpio_keys_8930_pdata,
2126 },
2127};
2128#endif /* MSM8930_PHASE_2 */
2129
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002130static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2131 .clk_freq = 100000,
2132 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002133};
2134
2135static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2136 .clk_freq = 100000,
2137 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002138};
2139
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002140static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
2141 .clk_freq = 100000,
2142 .src_clk_rate = 24000000,
2143};
2144
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002145static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2146 .clk_freq = 100000,
2147 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002148};
2149
2150static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2151 .clk_freq = 100000,
2152 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002153};
2154
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002155
2156static struct ks8851_pdata spi_eth_pdata = {
2157 .irq_gpio = KS8851_IRQ_GPIO,
2158 .rst_gpio = KS8851_RST_GPIO,
2159};
2160
2161static struct spi_board_info spi_board_info[] __initdata = {
2162 {
2163 .modalias = "ks8851",
2164 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2165 .max_speed_hz = 19200000,
2166 .bus_num = 0,
2167 .chip_select = 0,
2168 .mode = SPI_MODE_0,
2169 .platform_data = &spi_eth_pdata
2170 },
2171 {
2172 .modalias = "dsi_novatek_3d_panel_spi",
2173 .max_speed_hz = 10800000,
2174 .bus_num = 0,
2175 .chip_select = 1,
2176 .mode = SPI_MODE_0,
2177 },
2178};
2179
2180static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002181 .name = "saw-regulator",
2182 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002183 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002184 .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002185 },
2186};
2187
2188static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002189 .name = "saw-regulator",
2190 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002191 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002192 .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002193 },
2194};
2195
2196static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002197 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002198 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002199 .tsens_num_sensor = 10,
2200 .slope = {1132, 1135, 1137, 1135, 1157,
2201 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002202};
2203
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002204static struct platform_device msm_tsens_device = {
2205 .name = "tsens8960-tm",
2206 .id = -1,
2207};
2208
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002209static struct msm_thermal_data msm_thermal_pdata = {
2210 .sensor_id = 9,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002211 .poll_ms = 250,
2212 .limit_temp_degC = 60,
2213 .temp_hysteresis_degC = 10,
2214 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002215};
2216
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002217#ifdef CONFIG_MSM_FAKE_BATTERY
2218static struct platform_device fish_battery_device = {
2219 .name = "fish_battery",
2220};
2221#endif
2222
David Collins1d4061b2011-12-06 15:36:40 -08002223#ifndef MSM8930_PHASE_2
2224
2225/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002226static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002227 .name = GPIO_REGULATOR_DEV_NAME,
2228 .id = PM8921_MPP_PM_TO_SYS(7),
2229 .dev = {
2230 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2231 },
2232};
2233
Jay Chokshi06fa7542011-12-07 13:09:17 -08002234static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002235 .name = GPIO_REGULATOR_DEV_NAME,
2236 .id = 91,
2237 .dev = {
2238 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2239 },
2240};
2241
David Collins1d4061b2011-12-06 15:36:40 -08002242#else
2243
2244/* 8930 Phase 2 */
2245static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2246 .name = GPIO_REGULATOR_DEV_NAME,
2247 .id = 63,
2248 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002249 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2250 MSM8930_GPIO_VREG_ID_EXT_5V],
David Collins1d4061b2011-12-06 15:36:40 -08002251 },
2252};
2253
2254static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2255 .name = GPIO_REGULATOR_DEV_NAME,
2256 .id = 97,
2257 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002258 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2259 MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
David Collins1d4061b2011-12-06 15:36:40 -08002260 },
2261};
2262
2263#endif
2264
Jay Chokshi06fa7542011-12-07 13:09:17 -08002265static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002266 .name = "rpm-regulator",
2267 .id = -1,
2268 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002269#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002270 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002271#else
David Collins86161e42012-08-20 12:17:09 -07002272 .platform_data = &msm8930_pm8038_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002273#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002274 },
2275};
2276
David Collins86161e42012-08-20 12:17:09 -07002277static struct platform_device *early_common_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002278 &msm8960_device_dmov,
2279 &msm_device_smd,
2280 &msm8960_device_uart_gsbi5,
2281 &msm_device_uart_dm6,
2282 &msm_device_saw_core0,
2283 &msm_device_saw_core1,
David Collins86161e42012-08-20 12:17:09 -07002284};
2285
2286/* ext_5v and ext_otg_sw are present when using PM8038 */
2287static struct platform_device *pmic_pm8038_devices[] __initdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002288 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002289#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002290 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002291#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002292 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002293#ifdef MSM8930_PHASE_2
2294 &msm8930_device_ext_otg_sw_vreg,
2295#endif
David Collins86161e42012-08-20 12:17:09 -07002296};
2297
2298/* ext_5v and ext_otg_sw are not present when using PM8917 */
2299static struct platform_device *pmic_pm8917_devices[] __initdata = {
2300 &msm8960_device_ssbi_pmic,
2301};
2302
2303static struct platform_device *common_devices[] __initdata = {
Stephen Boyd28d54952011-12-16 13:19:51 -08002304 &msm_8960_q6_lpass,
2305 &msm_8960_q6_mss_fw,
2306 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002307 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002308 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002309 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002310 &msm8960_device_qup_spi_gsbi1,
2311 &msm8960_device_qup_i2c_gsbi3,
2312 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002313 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002314 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002315 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002316 &msm_slim_ctrl,
2317 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002318#if defined(CONFIG_QSEECOM)
2319 &qseecom_device,
2320#endif
2321
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002322#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2323 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2324 &qcrypto_device,
2325#endif
2326
2327#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2328 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2329 &qcedev_device,
2330#endif
2331#ifdef CONFIG_MSM_ROTATOR
2332 &msm_rotator_device,
2333#endif
2334 &msm_device_sps,
2335#ifdef CONFIG_MSM_FAKE_BATTERY
2336 &fish_battery_device,
2337#endif
2338#ifdef CONFIG_ANDROID_PMEM
2339#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002340 &msm8930_android_pmem_device,
2341 &msm8930_android_pmem_adsp_device,
2342 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302343#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2344#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002345 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002346 &msm_device_bam_dmux,
2347 &msm_fm_platform_init,
2348
2349#ifdef CONFIG_HW_RANDOM_MSM
2350 &msm_device_rng,
2351#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002352 &msm8930_rpm_device,
2353 &msm8930_rpm_log_device,
Girish Mahadevan898c56d2012-06-05 16:09:19 -06002354 &msm8930_rpm_rbcpr_device,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002355 &msm8930_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302356 &msm8930_rpm_master_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002357#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002358 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002359#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002360 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002361 &coresight_tpiu_device,
2362 &coresight_etb_device,
2363 &coresight_funnel_device,
2364 &coresight_etm0_device,
2365 &coresight_etm1_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002366 &msm_device_dspcrashd_8960,
2367 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302368#ifdef MSM8930_PHASE_2
2369 &gpio_keys_8930,
2370#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002371 &msm8930_rtb_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002372 &msm_bus_8930_apps_fabric,
2373 &msm_bus_8930_sys_fabric,
2374 &msm_bus_8930_mm_fabric,
2375 &msm_bus_8930_sys_fpb,
2376 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002377 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002378 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002379 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002380 &msm8930_cache_dump_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002381};
2382
2383static struct platform_device *cdp_devices[] __initdata = {
2384 &msm8960_device_otg,
2385 &msm8960_device_gadget_peripheral,
2386 &msm_device_hsusb_host,
2387 &android_usb_device,
2388 &msm_pcm,
2389 &msm_pcm_routing,
2390 &msm_cpudai0,
2391 &msm_cpudai1,
2392 &msm_cpudai_hdmi_rx,
2393 &msm_cpudai_bt_rx,
2394 &msm_cpudai_bt_tx,
2395 &msm_cpudai_fm_rx,
2396 &msm_cpudai_fm_tx,
2397 &msm_cpudai_auxpcm_rx,
2398 &msm_cpudai_auxpcm_tx,
2399 &msm_cpu_fe,
2400 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002401#ifdef CONFIG_MSM_GEMINI
2402 &msm8960_gemini_device,
2403#endif
2404 &msm_voice,
2405 &msm_voip,
2406 &msm_lpa_pcm,
2407 &msm_cpudai_afe_01_rx,
2408 &msm_cpudai_afe_01_tx,
2409 &msm_cpudai_afe_02_rx,
2410 &msm_cpudai_afe_02_tx,
2411 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002412 &msm_compr_dsp,
2413 &msm_cpudai_incall_music_rx,
2414 &msm_cpudai_incall_record_rx,
2415 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002416 &msm_pcm_hostless,
Asish Bhattacharya705c6732012-08-14 23:22:55 +05302417 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002418 &msm_lowlatency_pcm,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002419};
2420
2421static void __init msm8930_i2c_init(void)
2422{
2423 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2424 &msm8960_i2c_qup_gsbi4_pdata;
2425
2426 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2427 &msm8960_i2c_qup_gsbi3_pdata;
2428
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002429 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2430 &msm8960_i2c_qup_gsbi9_pdata;
2431
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002432 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2433 &msm8960_i2c_qup_gsbi10_pdata;
2434
2435 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2436 &msm8960_i2c_qup_gsbi12_pdata;
2437}
2438
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002439static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2440 {
2441 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2442 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2443 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002444 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002445 },
2446
2447 {
2448 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2449 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2450 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002451 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002452 },
2453
2454 {
2455 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2456 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2457 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002458 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002459 },
2460
2461 {
2462 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002463 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2464 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002465 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002466 },
2467
2468 {
2469 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2470 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2471 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002472 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002473 },
2474
2475 {
2476 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2477 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2478 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002479 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002480 },
2481
2482 {
2483 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2484 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2485 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002486 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002487 },
2488
2489 {
2490 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2491 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2492 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002493 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002494 },
2495};
2496
Praveen Chidambaram78499012011-11-01 17:15:17 -06002497static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2498 .levels = &msm_rpmrs_levels[0],
2499 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2500 .vdd_mem_levels = {
2501 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2502 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2503 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2504 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2505 },
2506 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002507 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2508 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2509 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2510 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002511 },
2512 .vdd_mask = 0x7FFFFF,
2513 .rpmrs_target_id = {
2514 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2515 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002516 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2517 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002518 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2519 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2520 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2521 },
2522};
2523
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002524static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = {
2525 .levels = &msm_rpmrs_levels[0],
2526 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2527 .vdd_mem_levels = {
2528 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2529 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2530 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2531 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2532 },
2533 .vdd_dig_levels = {
2534 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2535 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2536 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2537 [MSM_RPMRS_VDD_DIG_MAX] = 3,
2538 },
2539 .vdd_mask = 0x7FFFFF,
2540 .rpmrs_target_id = {
2541 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2542 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2543 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2544 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
2545 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0,
2546 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1,
2547 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2548 },
2549};
2550
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002551static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2552 .mode = MSM_PM_BOOT_CONFIG_TZ,
2553};
2554
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002555#ifdef CONFIG_I2C
2556#define I2C_SURF 1
2557#define I2C_FFA (1 << 1)
2558#define I2C_RUMI (1 << 2)
2559#define I2C_SIM (1 << 3)
2560#define I2C_FLUID (1 << 4)
2561#define I2C_LIQUID (1 << 5)
2562
2563struct i2c_registry {
2564 u8 machs;
2565 int bus;
2566 struct i2c_board_info *info;
2567 int len;
2568};
2569
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002570#ifdef CONFIG_INPUT_MPU3050
2571#define MPU3050_INT_GPIO 69
2572
2573static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2574 .gpio_int = MPU3050_INT_GPIO,
2575};
2576
2577static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2578 {
2579 I2C_BOARD_INFO("mpu3050", 0x68),
Wentao Xuc7769c02012-08-03 15:06:41 -04002580 .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO),
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002581 .platform_data = &mpu3050_gyro,
2582 },
2583};
2584#endif
2585
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002586#ifdef CONFIG_ISL9519_CHARGER
2587static struct isl_platform_data isl_data __initdata = {
2588 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2589 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2590 .max_system_voltage = 4200,
2591 .min_system_voltage = 3200,
2592 .chgcurrent = 1000, /* 1900, */
2593 .term_current = 400, /* Need fine tuning */
2594 .input_current = 2048,
2595};
2596
2597static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2598 {
2599 I2C_BOARD_INFO("isl9519q", 0x9),
2600 .irq = 0, /* Not required when notify-by-pmic */
2601 .platform_data = &isl_data,
2602 },
2603};
2604#endif /* CONFIG_ISL9519_CHARGER */
2605
Wentao Xu114c0152012-06-12 11:40:38 -04002606#ifdef CONFIG_STM_LIS3DH
2607static struct lis3dh_acc_platform_data lis3dh_accel = {
2608 .poll_interval = 200,
2609 .min_interval = 10,
2610 .g_range = LIS3DH_ACC_G_2G,
2611 .axis_map_x = 1,
2612 .axis_map_y = 0,
2613 .axis_map_z = 2,
2614 .negate_x = 0,
2615 .negate_y = 0,
2616 .negate_z = 1,
2617 .init = NULL,
2618 .exit = NULL,
2619 .gpio_int1 = -EINVAL,
2620 .gpio_int2 = -EINVAL,
2621};
2622
2623static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = {
2624 {
2625 I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18),
2626 .platform_data = &lis3dh_accel,
2627 },
2628};
2629#endif /* CONFIG_STM_LIS3DH */
2630
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002631static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002632#ifdef CONFIG_ISL9519_CHARGER
2633 {
2634 I2C_LIQUID,
2635 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2636 isl_charger_i2c_info,
2637 ARRAY_SIZE(isl_charger_i2c_info),
2638 },
2639#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002640#ifdef CONFIG_INPUT_MPU3050
2641 {
2642 I2C_FFA | I2C_FLUID,
2643 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2644 mpu3050_i2c_boardinfo,
2645 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2646 },
2647#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002648 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002649 I2C_SURF | I2C_FFA | I2C_FLUID,
2650 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002651 msm_isa1200_board_info,
2652 ARRAY_SIZE(msm_isa1200_board_info),
2653 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002654 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002655 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002656 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2657 mxt_device_info_8930,
2658 ARRAY_SIZE(mxt_device_info_8930),
2659 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002660 {
2661 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2662 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2663 sii_device_info,
2664 ARRAY_SIZE(sii_device_info),
2665 },
Wentao Xu114c0152012-06-12 11:40:38 -04002666#ifdef CONFIG_STM_LIS3DH
2667 {
2668 I2C_FFA | I2C_FLUID,
2669 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2670 lis3dh_i2c_boardinfo,
2671 ARRAY_SIZE(lis3dh_i2c_boardinfo),
2672 },
2673#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002674};
2675#endif /* CONFIG_I2C */
2676
2677static void __init register_i2c_devices(void)
2678{
2679#ifdef CONFIG_I2C
2680 u8 mach_mask = 0;
2681 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002682#ifdef CONFIG_MSM_CAMERA
2683 struct i2c_registry msm8930_camera_i2c_devices = {
2684 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2685 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2686 msm8930_camera_board_info.board_info,
2687 msm8930_camera_board_info.num_i2c_board_info,
2688 };
2689#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002690
2691 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002692 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002693 mach_mask = I2C_SURF;
2694 else if (machine_is_msm8930_fluid())
2695 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002696 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002697 mach_mask = I2C_FFA;
2698 else
2699 pr_err("unmatched machine ID in register_i2c_devices\n");
2700
2701 /* Run the array and install devices as appropriate */
2702 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2703 if (msm8960_i2c_devices[i].machs & mach_mask)
2704 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2705 msm8960_i2c_devices[i].info,
2706 msm8960_i2c_devices[i].len);
2707 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002708#ifdef CONFIG_MSM_CAMERA
2709 if (msm8930_camera_i2c_devices.machs & mach_mask)
2710 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2711 msm8930_camera_i2c_devices.info,
2712 msm8930_camera_i2c_devices.len);
2713#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002714#endif
2715}
2716
David Collins04499982012-08-06 15:02:03 -07002717/* Modify platform data values to match requirements for PM8917. */
2718static void __init msm8930_pm8917_pdata_fixup(void)
2719{
Patrick Dalya3b73c42012-08-28 13:39:17 -07002720 struct acpuclk_platform_data *pdata;
2721
David Collins04499982012-08-06 15:02:03 -07002722 mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917;
2723
2724 gpio_keys_8930_pdata.buttons = keys_8930_pm8917;
2725 gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917);
David Collins86161e42012-08-20 12:17:09 -07002726
2727 msm_device_saw_core0.dev.platform_data
2728 = &msm8930_pm8038_saw_regulator_core0_pdata;
2729 msm_device_saw_core1.dev.platform_data
2730 = &msm8930_pm8038_saw_regulator_core1_pdata;
2731
2732 msm8930_device_rpm_regulator.dev.platform_data
2733 = &msm8930_pm8917_rpm_regulator_pdata;
Patrick Dalya3b73c42012-08-28 13:39:17 -07002734
2735 pdata = msm8930_device_acpuclk.dev.platform_data;
2736 pdata->uses_pm8917 = true;
David Collins04499982012-08-06 15:02:03 -07002737}
2738
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002739static void __init msm8930_cdp_init(void)
2740{
David Collins04499982012-08-06 15:02:03 -07002741 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2742 msm8930_pm8917_pdata_fixup();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002743 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2744 pr_err("meminfo_init() failed!\n");
2745
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07002746 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002747 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002748 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002749 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
2750 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2751 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
2752 } else {
2753 BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917));
2754 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917));
2755 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002756
2757 regulator_suppress_info_printing();
2758 if (msm_xo_init())
2759 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002760 platform_device_register(&msm8930_device_rpm_regulator);
Patrick Dalyb1d5f752012-08-27 16:25:07 -07002761 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2762 msm_clock_init(&msm8930_pm8917_clock_init_data);
2763 else
2764 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302765 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002766 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302767 android_usb_pdata.swfi_latency =
2768 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002769 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002770 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2771 &msm8960_qup_spi_gsbi1_pdata;
2772 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2773
Jay Chokshi06fa7542011-12-07 13:09:17 -08002774 /*
2775 * TODO: When physical 8930/PM8038 hardware becomes
2776 * available, remove this block or add the config
2777 * option.
2778 */
2779#ifndef MSM8930_PHASE_2
2780 msm8960_init_pmic();
2781#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002782 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002783#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002784 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302785 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002786 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2787 msm_spm_l2_init(msm_spm_l2_data);
2788 msm8930_init_buses();
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002789 if (cpu_is_msm8627()) {
Tianyi Gou723843b2012-06-13 15:24:56 -07002790 platform_add_devices(msm8627_footswitch,
2791 msm8627_num_footswitch);
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002792 } else {
2793 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2794 platform_add_devices(msm8930_pm8917_footswitch,
2795 msm8930_pm8917_num_footswitch);
2796 else
2797 platform_add_devices(msm8930_footswitch,
2798 msm8930_num_footswitch);
2799 }
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002800 if (cpu_is_msm8627())
Matt Wagantallab730bd2012-06-07 20:13:51 -07002801 platform_device_register(&msm8627_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002802 else if (cpu_is_msm8930())
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002803 platform_device_register(&msm8930_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002804 else if (cpu_is_msm8930aa())
2805 platform_device_register(&msm8930aa_device_acpuclk);
David Collins86161e42012-08-20 12:17:09 -07002806 platform_add_devices(early_common_devices,
2807 ARRAY_SIZE(early_common_devices));
2808 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2809 platform_add_devices(pmic_pm8038_devices,
2810 ARRAY_SIZE(pmic_pm8038_devices));
2811 else
2812 platform_add_devices(pmic_pm8917_devices,
2813 ARRAY_SIZE(pmic_pm8917_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002814 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002815 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002816 /*
2817 * TODO: When physical 8930/PM8038 hardware becomes
2818 * available, remove this block or add the config
2819 * option.
2820 */
2821#ifndef MSM8930_PHASE_2
2822 msm8960_pm8921_gpio_mpp_init();
2823#else
David Collins04499982012-08-06 15:02:03 -07002824 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2825 msm8930_pm8038_gpio_mpp_init();
2826 else
2827 msm8930_pm8917_gpio_mpp_init();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002828#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002829 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002830#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002831 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002832#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002833 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002834 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002835 register_i2c_devices();
2836 msm8930_init_fb();
2837 slim_register_board_info(msm_slim_devices,
2838 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002839 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002840 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002841
2842 if (PLATFORM_IS_CHARM25())
2843 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2844}
2845
2846MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2847 .map_io = msm8930_map_io,
2848 .reserve = msm8930_reserve,
2849 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302850 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002851 .timer = &msm_timer,
2852 .init_machine = msm8930_cdp_init,
2853 .init_early = msm8930_allocate_memory_regions,
2854 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002855 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002856MACHINE_END
2857
2858MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2859 .map_io = msm8930_map_io,
2860 .reserve = msm8930_reserve,
2861 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302862 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002863 .timer = &msm_timer,
2864 .init_machine = msm8930_cdp_init,
2865 .init_early = msm8930_allocate_memory_regions,
2866 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002867 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002868MACHINE_END
2869
2870MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2871 .map_io = msm8930_map_io,
2872 .reserve = msm8930_reserve,
2873 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302874 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002875 .timer = &msm_timer,
2876 .init_machine = msm8930_cdp_init,
2877 .init_early = msm8930_allocate_memory_regions,
2878 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002879 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002880MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002881
2882MACHINE_START(MSM8627_CDP, "QCT MSM8627 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 Moskovchenko8768eff2011-12-01 18:55:07 -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 Moskovchenko8768eff2011-12-01 18:55:07 -08002892MACHINE_END
2893
2894MACHINE_START(MSM8627_MTP, "QCT MSM8627 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 Moskovchenko8768eff2011-12-01 18:55:07 -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 Moskovchenko8768eff2011-12-01 18:55:07 -08002904MACHINE_END