blob: 7615c3c5706c6b3b3a42fb88ba94a3d3379737c4 [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,
Laura Abbottadec9c72012-12-05 11:49:59 -0800345 .is_cma = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800346};
347
Laura Abbottb93525f2012-04-12 09:57:19 -0700348static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800349 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800350 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700351 .reusable = 0,
352 .mem_is_fmem = FMEM_ENABLED,
353 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800354};
Hanumant Singheea62562012-05-14 11:32:45 -0700355
Laura Abbottb93525f2012-04-12 09:57:19 -0700356static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800357 .adjacent_mem_id = INVALID_HEAP_ID,
358 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700359 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800360};
Hanumant Singheea62562012-05-14 11:32:45 -0700361
Laura Abbottb93525f2012-04-12 09:57:19 -0700362static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800363 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
364 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700365 .mem_is_fmem = FMEM_ENABLED,
366 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800367};
368#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800369
Laura Abbott87eafac2012-09-18 11:45:43 -0700370
371static u64 msm_dmamask = DMA_BIT_MASK(32);
372
373static struct platform_device ion_mm_heap_device = {
374 .name = "ion-mm-heap-device",
375 .id = -1,
376 .dev = {
377 .dma_mask = &msm_dmamask,
378 .coherent_dma_mask = DMA_BIT_MASK(32),
379 }
380};
381
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800382/**
383 * These heaps are listed in the order they will be allocated. Due to
384 * video hardware restrictions and content protection the FW heap has to
385 * be allocated adjacent (below) the MM heap and the MFC heap has to be
386 * allocated after the MM heap to ensure MFC heap is not more than 256MB
387 * away from the base address of the FW heap.
388 * However, the order of FW heap and MM heap doesn't matter since these
389 * two heaps are taken care of by separate code to ensure they are adjacent
390 * to each other.
391 * Don't swap the order unless you know what you are doing!
392 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700393struct ion_platform_heap msm8930_heaps[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800394 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800395 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800396 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800397 .name = ION_VMALLOC_HEAP_NAME,
398 },
399#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
400 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800401 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800402 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800403 .name = ION_MM_HEAP_NAME,
404 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800405 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700406 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Laura Abbott87eafac2012-09-18 11:45:43 -0700407 .priv = &ion_mm_heap_device.dev
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800408 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800409 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800410 .id = ION_MM_FIRMWARE_HEAP_ID,
411 .type = ION_HEAP_TYPE_CARVEOUT,
412 .name = ION_MM_FIRMWARE_HEAP_NAME,
413 .size = MSM_ION_MM_FW_SIZE,
414 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700415 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800416 },
417 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800418 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800419 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800420 .name = ION_MFC_HEAP_NAME,
421 .size = MSM_ION_MFC_SIZE,
422 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700423 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800424 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700425#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800426 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800427 .id = ION_SF_HEAP_ID,
428 .type = ION_HEAP_TYPE_CARVEOUT,
429 .name = ION_SF_HEAP_NAME,
430 .size = MSM_ION_SF_SIZE,
431 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700432 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800433 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700434#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800435 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800436 .id = ION_IOMMU_HEAP_ID,
437 .type = ION_HEAP_TYPE_IOMMU,
438 .name = ION_IOMMU_HEAP_NAME,
439 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800440 {
441 .id = ION_QSECOM_HEAP_ID,
442 .type = ION_HEAP_TYPE_CARVEOUT,
443 .name = ION_QSECOM_HEAP_NAME,
444 .size = MSM_ION_QSECOM_SIZE,
445 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700446 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800447 },
Olav Haugan7355db02012-01-13 16:59:13 -0800448 {
449 .id = ION_AUDIO_HEAP_ID,
450 .type = ION_HEAP_TYPE_CARVEOUT,
451 .name = ION_AUDIO_HEAP_NAME,
452 .size = MSM_ION_AUDIO_SIZE,
453 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700454 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800455 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800456#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700457};
458
459static struct ion_platform_data msm8930_ion_pdata = {
460 .nr = MSM_ION_HEAP_NUM,
461 .heaps = msm8930_heaps,
462
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800463};
464
Laura Abbottb93525f2012-04-12 09:57:19 -0700465static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800466 .name = "ion-msm",
467 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700468 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800469};
470#endif
471
Hanumant Singheea62562012-05-14 11:32:45 -0700472struct platform_device msm8930_fmem_device = {
473 .name = "fmem",
474 .id = 1,
475 .dev = { .platform_data = &msm8930_fmem_pdata },
476};
477
478static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
479 unsigned long size)
480{
481 msm8930_reserve_table[mem_type].size += size;
482}
483
484static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
485{
486#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
487 int ret;
488
489 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
490 panic("fixed area size is larger than %dM\n",
491 MAX_FIXED_AREA_SIZE >> 20);
492
493 reserve_info->fixed_area_size = fixed_area_size;
494 reserve_info->fixed_area_start = MSM8930_FW_START;
495
496 ret = memblock_remove(reserve_info->fixed_area_start,
497 reserve_info->fixed_area_size);
498 BUG_ON(ret);
499#endif
500}
501
502/**
503 * Reserve memory for ION and calculate amount of reusable memory for fmem.
504 * We only reserve memory for heaps that are not reusable. However, we only
505 * support one reusable heap at the moment so we ignore the reusable flag for
506 * other than the first heap with reusable flag set. Also handle special case
507 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
508 * at a higher address than FW in addition to not more than 256MB away from the
509 * base address of the firmware. This means that if MM is reusable the other
510 * two heaps must be allocated in the same region as FW. This is handled by the
511 * mem_is_fmem flag in the platform data. In addition the MM heap must be
512 * adjacent to the FW heap for content protection purposes.
513 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700514static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800515{
516#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700517 unsigned int i;
Laura Abbott87eafac2012-09-18 11:45:43 -0700518 int ret;
Hanumant Singheea62562012-05-14 11:32:45 -0700519 unsigned int fixed_size = 0;
520 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
521 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700522 unsigned long cma_alignment;
523 unsigned int low_use_cma = 0;
524 unsigned int middle_use_cma = 0;
525 unsigned int high_use_cma = 0;
Hanumant Singheea62562012-05-14 11:32:45 -0700526
Hanumant Singheea62562012-05-14 11:32:45 -0700527 fixed_low_size = 0;
528 fixed_middle_size = 0;
529 fixed_high_size = 0;
530
Laura Abbott87eafac2012-09-18 11:45:43 -0700531 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
532
Hanumant Singheea62562012-05-14 11:32:45 -0700533 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
Laura Abbott87eafac2012-09-18 11:45:43 -0700534 struct ion_platform_heap *heap =
Hanumant Singheea62562012-05-14 11:32:45 -0700535 &(msm8930_ion_pdata.heaps[i]);
536
Laura Abbott87eafac2012-09-18 11:45:43 -0700537 int use_cma = 0;
538
Hanumant Singheea62562012-05-14 11:32:45 -0700539 if (heap->extra_data) {
540 int fixed_position = NOT_FIXED;
Hanumant Singheea62562012-05-14 11:32:45 -0700541
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700542 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700543 case ION_HEAP_TYPE_CP:
Laura Abbott87eafac2012-09-18 11:45:43 -0700544 if (((struct ion_cp_heap_pdata *)
545 heap->extra_data)->is_cma) {
546 heap->size = ALIGN(heap->size,
547 cma_alignment);
548 use_cma = 1;
549 }
Hanumant Singheea62562012-05-14 11:32:45 -0700550 fixed_position = ((struct ion_cp_heap_pdata *)
551 heap->extra_data)->fixed_position;
552 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700553 case ION_HEAP_TYPE_DMA:
554 use_cma = 1;
555 /* Purposely fall through here */
Hanumant Singheea62562012-05-14 11:32:45 -0700556 case ION_HEAP_TYPE_CARVEOUT:
Hanumant Singheea62562012-05-14 11:32:45 -0700557 fixed_position = ((struct ion_co_heap_pdata *)
558 heap->extra_data)->fixed_position;
559 break;
560 default:
561 break;
562 }
563
564 if (fixed_position != NOT_FIXED)
565 fixed_size += heap->size;
566 else
567 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
568
Laura Abbott87eafac2012-09-18 11:45:43 -0700569 if (fixed_position == FIXED_LOW) {
Hanumant Singheea62562012-05-14 11:32:45 -0700570 fixed_low_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700571 low_use_cma = use_cma;
572 } else if (fixed_position == FIXED_MIDDLE) {
Hanumant Singheea62562012-05-14 11:32:45 -0700573 fixed_middle_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700574 middle_use_cma = use_cma;
575 } else if (fixed_position == FIXED_HIGH) {
Hanumant Singheea62562012-05-14 11:32:45 -0700576 fixed_high_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700577 high_use_cma = use_cma;
578 } else if (use_cma) {
579 /*
580 * Heaps that use CMA but are not part of the
581 * fixed set. Create wherever.
582 */
583 dma_declare_contiguous(
584 heap->priv,
585 heap->size,
586 0,
587 0xb0000000);
588 }
Hanumant Singheea62562012-05-14 11:32:45 -0700589 }
590 }
591
592 if (!fixed_size)
593 return;
Laura Abbott87eafac2012-09-18 11:45:43 -0700594 /*
595 * Given the setup for the fixed area, we can't round up all sizes.
596 * Some sizes must be set up exactly and aligned correctly. Incorrect
597 * alignments are considered a configuration issue
Hanumant Singheea62562012-05-14 11:32:45 -0700598 */
Hanumant Singheea62562012-05-14 11:32:45 -0700599
600 fixed_low_start = MSM8930_FIXED_AREA_START;
Laura Abbott87eafac2012-09-18 11:45:43 -0700601 if (low_use_cma) {
602 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
603 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
604 } else {
605 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
606 ret = memblock_remove(fixed_low_start,
607 fixed_low_size + HOLE_SIZE);
608 BUG_ON(ret);
609 }
610
Deepak Kotur9830bf02012-06-01 15:04:29 -0700611 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott87eafac2012-09-18 11:45:43 -0700612 if (middle_use_cma) {
613 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
614 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
615 } else {
616 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
617 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
618 BUG_ON(ret);
619 }
620
Hanumant Singheea62562012-05-14 11:32:45 -0700621 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700622 if (high_use_cma) {
623 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
624 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
625 } else {
626 /* This is the end of the fixed area so it's okay to round up */
627 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
628 ret = memblock_remove(fixed_high_start, fixed_high_size);
629 BUG_ON(ret);
630 }
Hanumant Singheea62562012-05-14 11:32:45 -0700631
632 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
633 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
634
635 if (heap->extra_data) {
636 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700637 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700638
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700639 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700640 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700641 pdata =
642 (struct ion_cp_heap_pdata *)heap->extra_data;
643 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700644 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700645 case ION_HEAP_TYPE_DMA:
Hanumant Singheea62562012-05-14 11:32:45 -0700646 case ION_HEAP_TYPE_CARVEOUT:
647 fixed_position = ((struct ion_co_heap_pdata *)
648 heap->extra_data)->fixed_position;
649 break;
650 default:
651 break;
652 }
653
654 switch (fixed_position) {
655 case FIXED_LOW:
656 heap->base = fixed_low_start;
657 break;
658 case FIXED_MIDDLE:
659 heap->base = fixed_middle_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700660 if (middle_use_cma)
661 dma_declare_contiguous(
662 &ion_mm_heap_device.dev,
663 heap->size,
664 fixed_middle_start,
665 0xa0000000);
Deepak Kotur9830bf02012-06-01 15:04:29 -0700666 pdata->secure_base = fixed_middle_start
667 - HOLE_SIZE;
668 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700669 break;
670 case FIXED_HIGH:
671 heap->base = fixed_high_start;
672 break;
673 default:
674 break;
675 }
676 }
677 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800678#endif
679}
Huaibin Yanga5419422011-12-08 23:52:10 -0800680
681static void __init reserve_mdp_memory(void)
682{
683 msm8930_mdp_writeback(msm8930_reserve_table);
684}
685
Laura Abbottf3173042012-05-29 15:23:18 -0700686#ifdef CONFIG_MSM_CACHE_DUMP
687static void __init reserve_cache_dump_memory(void)
688{
689 unsigned int total;
690
691 total = msm8930_cache_dump_pdata.l1_size +
692 msm8930_cache_dump_pdata.l2_size;
693 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
694}
695#else
696static void __init reserve_cache_dump_memory(void) { }
697#endif
698
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800699static void __init msm8930_calculate_reserve_sizes(void)
700{
701 size_pmem_devices();
702 reserve_pmem_memory();
703 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800704 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800705 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700706 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800707}
708
709static struct reserve_info msm8930_reserve_info __initdata = {
710 .memtype_reserve_table = msm8930_reserve_table,
711 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700712 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800713 .paddr_to_memtype = msm8930_paddr_to_memtype,
714};
715
716static int msm8930_memory_bank_size(void)
717{
718 return 1<<29;
719}
720
721static void __init locate_unstable_memory(void)
722{
723 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
724 unsigned long bank_size;
725 unsigned long low, high;
726
727 bank_size = msm8930_memory_bank_size();
728 low = meminfo.bank[0].start;
729 high = mb->start + mb->size;
730
731 /* Check if 32 bit overflow occured */
732 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700733 high -= PAGE_SIZE;
734
735 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
736 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800737
738 low &= ~(bank_size - 1);
739
740 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700741 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800742
743 msm8930_reserve_info.bank_size = bank_size;
744#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800745 msm8930_reserve_info.low_unstable_address = mb->start -
746 MIN_MEMORY_BLOCK_SIZE + mb->size;
747 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800748 pr_info("low unstable address %lx max size %lx bank size %lx\n",
749 msm8930_reserve_info.low_unstable_address,
750 msm8930_reserve_info.max_unstable_size,
751 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700752 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800753#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700754no_dmm:
755 msm8930_reserve_info.low_unstable_address = high;
756 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800757}
758
759static void __init place_movable_zone(void)
760{
Larry Basselb8d61022012-02-24 10:49:45 -0800761#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800762 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
763 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
764 pr_info("movable zone start %lx size %lx\n",
765 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800766#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800767}
768
769static void __init msm8930_early_memory(void)
770{
771 reserve_info = &msm8930_reserve_info;
772 locate_unstable_memory();
773 place_movable_zone();
774}
775
776static void __init msm8930_reserve(void)
777{
778 msm_reserve();
779}
780
781static int msm8930_change_memory_power(u64 start, u64 size,
782 int change_type)
783{
784 return soc_change_memory_power(start, size, change_type);
785}
786
787static void __init msm8930_allocate_memory_regions(void)
788{
789 msm8930_allocate_fb_region();
790}
791
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530792#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800793
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530794#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800795
796/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
797 * 4 micbiases are used to power various analog and digital
798 * microphones operating at 1800 mV. Technically, all micbiases
799 * can source from single cfilter since all microphones operate
800 * at the same voltage level. The arrangement below is to make
801 * sure all cfilters are exercised. LDO_H regulator ouput level
802 * does not need to be as high as 2.85V. It is choosen for
803 * microphone sensitivity purpose.
804 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530805static struct wcd9xxx_pdata sitar_platform_data = {
806 .slimbus_slave_device = {
807 .name = "sitar-slave",
808 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800809 },
810 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530811 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530812 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530813 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800814 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530815 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800816 .cfilt1_mv = 1800,
817 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530818 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
819 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700820 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
821 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530822 },
823 .regulator = {
824 {
825 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700826 .min_uV = 1800000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530827 .max_uV = 2200000,
828 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
829 },
830 {
831 .name = "CDC_VDDA_RX",
832 .min_uV = 1800000,
833 .max_uV = 1800000,
834 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
835 },
836 {
837 .name = "CDC_VDDA_TX",
838 .min_uV = 1800000,
839 .max_uV = 1800000,
840 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
841 },
842 {
843 .name = "VDDIO_CDC",
844 .min_uV = 1800000,
845 .max_uV = 1800000,
846 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
847 },
848 {
849 .name = "VDDD_CDC_D",
850 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700851 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530852 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
853 },
854 {
855 .name = "CDC_VDDA_A_1P2V",
856 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700857 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530858 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
859 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800860 },
861};
862
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530863static struct slim_device msm_slim_sitar = {
864 .name = "sitar-slim",
865 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800866 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530867 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800868 },
869};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700870
871static struct wcd9xxx_pdata sitar1p1_platform_data = {
872 .slimbus_slave_device = {
873 .name = "sitar-slave",
874 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
875 },
876 .irq = MSM_GPIO_TO_INT(62),
877 .irq_base = SITAR_INTERRUPT_BASE,
878 .num_irqs = NR_WCD9XXX_IRQS,
879 .reset_gpio = 42,
880 .micbias = {
881 .ldoh_v = SITAR_LDOH_2P85_V,
882 .cfilt1_mv = 1800,
883 .cfilt2_mv = 1800,
884 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
885 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700886 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
887 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700888 },
889 .regulator = {
890 {
891 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700892 .min_uV = 1800000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700893 .max_uV = 2200000,
894 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
895 },
896 {
897 .name = "CDC_VDDA_RX",
898 .min_uV = 1800000,
899 .max_uV = 1800000,
900 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
901 },
902 {
903 .name = "CDC_VDDA_TX",
904 .min_uV = 1800000,
905 .max_uV = 1800000,
906 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
907 },
908 {
909 .name = "VDDIO_CDC",
910 .min_uV = 1800000,
911 .max_uV = 1800000,
912 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
913 },
914 {
915 .name = "VDDD_CDC_D",
916 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700917 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700918 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
919 },
920 {
921 .name = "CDC_VDDA_A_1P2V",
922 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700923 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700924 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
925 },
926 },
927};
928
929static struct slim_device msm_slim_sitar1p1 = {
930 .name = "sitar1p1-slim",
931 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
932 .dev = {
933 .platform_data = &sitar1p1_platform_data,
934 },
935};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800936#endif
937
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530938
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800939static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530940#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800941 {
942 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530943 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800944 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700945 {
946 .bus_num = 1,
947 .slim_slave = &msm_slim_sitar1p1,
948 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800949#endif
950 /* add more slimbus slaves as needed */
951};
952
953#define MSM_WCNSS_PHYS 0x03000000
954#define MSM_WCNSS_SIZE 0x280000
955
956static struct resource resources_wcnss_wlan[] = {
957 {
958 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
959 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
960 .name = "wcnss_wlanrx_irq",
961 .flags = IORESOURCE_IRQ,
962 },
963 {
964 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
965 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
966 .name = "wcnss_wlantx_irq",
967 .flags = IORESOURCE_IRQ,
968 },
969 {
970 .start = MSM_WCNSS_PHYS,
971 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
972 .name = "wcnss_mmio",
973 .flags = IORESOURCE_MEM,
974 },
975 {
976 .start = 84,
977 .end = 88,
978 .name = "wcnss_gpios_5wire",
979 .flags = IORESOURCE_IO,
980 },
981};
982
983static struct qcom_wcnss_opts qcom_wcnss_pdata = {
984 .has_48mhz_xo = 1,
985};
986
987static struct platform_device msm_device_wcnss_wlan = {
988 .name = "wcnss_wlan",
989 .id = 0,
990 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
991 .resource = resources_wcnss_wlan,
992 .dev = {.platform_data = &qcom_wcnss_pdata},
993};
994
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700995#ifdef CONFIG_QSEECOM
996/* qseecom bus scaling */
997static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
998 {
999 .src = MSM_BUS_MASTER_SPS,
1000 .dst = MSM_BUS_SLAVE_EBI_CH0,
1001 .ib = 0,
1002 .ab = 0,
1003 },
1004 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001005 .src = MSM_BUS_MASTER_SPS,
1006 .dst = MSM_BUS_SLAVE_SPS,
1007 .ib = 0,
1008 .ab = 0,
1009 },
1010 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001011 .src = MSM_BUS_MASTER_SPDM,
1012 .dst = MSM_BUS_SLAVE_SPDM,
1013 .ib = 0,
1014 .ab = 0,
1015 },
1016};
1017
1018static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1019 {
1020 .src = MSM_BUS_MASTER_SPS,
1021 .dst = MSM_BUS_SLAVE_EBI_CH0,
1022 .ib = (492 * 8) * 1000000UL,
1023 .ab = (492 * 8) * 100000UL,
1024 },
1025 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001026 .src = MSM_BUS_MASTER_SPS,
1027 .dst = MSM_BUS_SLAVE_SPS,
1028 .ib = (492 * 8) * 1000000UL,
1029 .ab = (492 * 8) * 100000UL,
1030 },
1031 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001032 .src = MSM_BUS_MASTER_SPDM,
1033 .dst = MSM_BUS_SLAVE_SPDM,
1034 .ib = 0,
1035 .ab = 0,
1036 },
1037};
1038
1039static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1040 {
1041 .src = MSM_BUS_MASTER_SPS,
1042 .dst = MSM_BUS_SLAVE_EBI_CH0,
1043 .ib = 0,
1044 .ab = 0,
1045 },
1046 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001047 .src = MSM_BUS_MASTER_SPS,
1048 .dst = MSM_BUS_SLAVE_SPS,
1049 .ib = 0,
1050 .ab = 0,
1051 },
1052 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001053 .src = MSM_BUS_MASTER_SPDM,
1054 .dst = MSM_BUS_SLAVE_SPDM,
1055 .ib = (64 * 8) * 1000000UL,
1056 .ab = (64 * 8) * 100000UL,
1057 },
1058};
1059
1060static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1061 {
1062 ARRAY_SIZE(qseecom_clks_init_vectors),
1063 qseecom_clks_init_vectors,
1064 },
1065 {
1066 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1067 qseecom_enable_sfpb_vectors,
1068 },
1069 {
1070 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1071 qseecom_enable_sfpb_vectors,
1072 },
1073};
1074
1075static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1076 qseecom_hw_bus_scale_usecases,
1077 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1078 .name = "qsee",
1079};
1080
1081static struct platform_device qseecom_device = {
1082 .name = "qseecom",
1083 .id = 0,
1084 .dev = {
1085 .platform_data = &qseecom_bus_pdata,
1086 },
1087};
1088#endif
1089
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001090#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1091 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1092 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1093 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1094
1095#define QCE_SIZE 0x10000
1096#define QCE_0_BASE 0x18500000
1097
1098#define QCE_HW_KEY_SUPPORT 0
1099#define QCE_SHA_HMAC_SUPPORT 1
1100#define QCE_SHARE_CE_RESOURCE 1
1101#define QCE_CE_SHARED 0
1102
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001103/* Begin Bus scaling definitions */
1104static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1105 {
1106 .src = MSM_BUS_MASTER_ADM_PORT0,
1107 .dst = MSM_BUS_SLAVE_EBI_CH0,
1108 .ab = 0,
1109 .ib = 0,
1110 },
1111 {
1112 .src = MSM_BUS_MASTER_ADM_PORT1,
1113 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1114 .ab = 0,
1115 .ib = 0,
1116 },
1117};
1118
1119static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1120 {
1121 .src = MSM_BUS_MASTER_ADM_PORT0,
1122 .dst = MSM_BUS_SLAVE_EBI_CH0,
1123 .ab = 70000000UL,
1124 .ib = 70000000UL,
1125 },
1126 {
1127 .src = MSM_BUS_MASTER_ADM_PORT1,
1128 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1129 .ab = 2480000000UL,
1130 .ib = 2480000000UL,
1131 },
1132};
1133
1134static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1135 {
1136 ARRAY_SIZE(crypto_hw_init_vectors),
1137 crypto_hw_init_vectors,
1138 },
1139 {
1140 ARRAY_SIZE(crypto_hw_active_vectors),
1141 crypto_hw_active_vectors,
1142 },
1143};
1144
1145static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1146 crypto_hw_bus_scale_usecases,
1147 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1148 .name = "cryptohw",
1149};
1150/* End Bus Scaling Definitions*/
1151
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001152static struct resource qcrypto_resources[] = {
1153 [0] = {
1154 .start = QCE_0_BASE,
1155 .end = QCE_0_BASE + QCE_SIZE - 1,
1156 .flags = IORESOURCE_MEM,
1157 },
1158 [1] = {
1159 .name = "crypto_channels",
1160 .start = DMOV_CE_IN_CHAN,
1161 .end = DMOV_CE_OUT_CHAN,
1162 .flags = IORESOURCE_DMA,
1163 },
1164 [2] = {
1165 .name = "crypto_crci_in",
1166 .start = DMOV_CE_IN_CRCI,
1167 .end = DMOV_CE_IN_CRCI,
1168 .flags = IORESOURCE_DMA,
1169 },
1170 [3] = {
1171 .name = "crypto_crci_out",
1172 .start = DMOV_CE_OUT_CRCI,
1173 .end = DMOV_CE_OUT_CRCI,
1174 .flags = IORESOURCE_DMA,
1175 },
1176};
1177
1178static struct resource qcedev_resources[] = {
1179 [0] = {
1180 .start = QCE_0_BASE,
1181 .end = QCE_0_BASE + QCE_SIZE - 1,
1182 .flags = IORESOURCE_MEM,
1183 },
1184 [1] = {
1185 .name = "crypto_channels",
1186 .start = DMOV_CE_IN_CHAN,
1187 .end = DMOV_CE_OUT_CHAN,
1188 .flags = IORESOURCE_DMA,
1189 },
1190 [2] = {
1191 .name = "crypto_crci_in",
1192 .start = DMOV_CE_IN_CRCI,
1193 .end = DMOV_CE_IN_CRCI,
1194 .flags = IORESOURCE_DMA,
1195 },
1196 [3] = {
1197 .name = "crypto_crci_out",
1198 .start = DMOV_CE_OUT_CRCI,
1199 .end = DMOV_CE_OUT_CRCI,
1200 .flags = IORESOURCE_DMA,
1201 },
1202};
1203
1204#endif
1205
1206#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1207 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1208
1209static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1210 .ce_shared = QCE_CE_SHARED,
1211 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1212 .hw_key_support = QCE_HW_KEY_SUPPORT,
1213 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001214 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001215};
1216
1217static struct platform_device qcrypto_device = {
1218 .name = "qcrypto",
1219 .id = 0,
1220 .num_resources = ARRAY_SIZE(qcrypto_resources),
1221 .resource = qcrypto_resources,
1222 .dev = {
1223 .coherent_dma_mask = DMA_BIT_MASK(32),
1224 .platform_data = &qcrypto_ce_hw_suppport,
1225 },
1226};
1227#endif
1228
1229#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1230 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1231
1232static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1233 .ce_shared = QCE_CE_SHARED,
1234 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1235 .hw_key_support = QCE_HW_KEY_SUPPORT,
1236 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001237 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001238};
1239
1240static struct platform_device qcedev_device = {
1241 .name = "qce",
1242 .id = 0,
1243 .num_resources = ARRAY_SIZE(qcedev_resources),
1244 .resource = qcedev_resources,
1245 .dev = {
1246 .coherent_dma_mask = DMA_BIT_MASK(32),
1247 .platform_data = &qcedev_ce_hw_suppport,
1248 },
1249};
1250#endif
1251
1252#define MDM2AP_ERRFATAL 70
1253#define AP2MDM_ERRFATAL 95
1254#define MDM2AP_STATUS 69
1255#define AP2MDM_STATUS 94
1256#define AP2MDM_PMIC_RESET_N 80
1257#define AP2MDM_KPDPWR_N 81
1258
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001259static struct resource mdm_resources[] = {
1260 {
1261 .start = MDM2AP_ERRFATAL,
1262 .end = MDM2AP_ERRFATAL,
1263 .name = "MDM2AP_ERRFATAL",
1264 .flags = IORESOURCE_IO,
1265 },
1266 {
1267 .start = AP2MDM_ERRFATAL,
1268 .end = AP2MDM_ERRFATAL,
1269 .name = "AP2MDM_ERRFATAL",
1270 .flags = IORESOURCE_IO,
1271 },
1272 {
1273 .start = MDM2AP_STATUS,
1274 .end = MDM2AP_STATUS,
1275 .name = "MDM2AP_STATUS",
1276 .flags = IORESOURCE_IO,
1277 },
1278 {
1279 .start = AP2MDM_STATUS,
1280 .end = AP2MDM_STATUS,
1281 .name = "AP2MDM_STATUS",
1282 .flags = IORESOURCE_IO,
1283 },
1284 {
1285 .start = AP2MDM_PMIC_RESET_N,
1286 .end = AP2MDM_PMIC_RESET_N,
1287 .name = "AP2MDM_PMIC_RESET_N",
1288 .flags = IORESOURCE_IO,
1289 },
1290 {
1291 .start = AP2MDM_KPDPWR_N,
1292 .end = AP2MDM_KPDPWR_N,
1293 .name = "AP2MDM_KPDPWR_N",
1294 .flags = IORESOURCE_IO,
1295 },
1296};
1297
1298static struct mdm_platform_data mdm_platform_data = {
1299 .mdm_version = "2.5",
1300};
1301
1302static struct platform_device mdm_device = {
1303 .name = "mdm2_modem",
1304 .id = -1,
1305 .num_resources = ARRAY_SIZE(mdm_resources),
1306 .resource = mdm_resources,
1307 .dev = {
1308 .platform_data = &mdm_platform_data,
1309 },
1310};
1311
1312static struct platform_device *mdm_devices[] __initdata = {
1313 &mdm_device,
1314};
1315
Praveen Chidambaram78499012011-11-01 17:15:17 -06001316#ifdef CONFIG_MSM_MPM
1317static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1318 [1] = MSM_GPIO_TO_INT(46),
1319 [2] = MSM_GPIO_TO_INT(150),
1320 [4] = MSM_GPIO_TO_INT(103),
1321 [5] = MSM_GPIO_TO_INT(104),
1322 [6] = MSM_GPIO_TO_INT(105),
1323 [7] = MSM_GPIO_TO_INT(106),
1324 [8] = MSM_GPIO_TO_INT(107),
1325 [9] = MSM_GPIO_TO_INT(7),
1326 [10] = MSM_GPIO_TO_INT(11),
1327 [11] = MSM_GPIO_TO_INT(15),
1328 [12] = MSM_GPIO_TO_INT(19),
1329 [13] = MSM_GPIO_TO_INT(23),
1330 [14] = MSM_GPIO_TO_INT(27),
1331 [15] = MSM_GPIO_TO_INT(31),
1332 [16] = MSM_GPIO_TO_INT(35),
1333 [19] = MSM_GPIO_TO_INT(90),
1334 [20] = MSM_GPIO_TO_INT(92),
1335 [23] = MSM_GPIO_TO_INT(85),
1336 [24] = MSM_GPIO_TO_INT(83),
1337 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001338 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001339 [27] = HDMI_IRQ,
1340 [29] = MSM_GPIO_TO_INT(10),
1341 [30] = MSM_GPIO_TO_INT(102),
1342 [31] = MSM_GPIO_TO_INT(81),
1343 [32] = MSM_GPIO_TO_INT(78),
1344 [33] = MSM_GPIO_TO_INT(94),
1345 [34] = MSM_GPIO_TO_INT(72),
1346 [35] = MSM_GPIO_TO_INT(39),
1347 [36] = MSM_GPIO_TO_INT(43),
1348 [37] = MSM_GPIO_TO_INT(61),
1349 [38] = MSM_GPIO_TO_INT(50),
1350 [39] = MSM_GPIO_TO_INT(42),
1351 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001352 [42] = MSM_GPIO_TO_INT(8),
1353 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001354 [44] = MSM_GPIO_TO_INT(70),
1355 [45] = MSM_GPIO_TO_INT(69),
1356 [46] = MSM_GPIO_TO_INT(67),
1357 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001358 [48] = MSM_GPIO_TO_INT(55),
1359 [49] = MSM_GPIO_TO_INT(74),
1360 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001361 [51] = MSM_GPIO_TO_INT(49),
1362 [52] = MSM_GPIO_TO_INT(40),
1363 [53] = MSM_GPIO_TO_INT(37),
1364 [54] = MSM_GPIO_TO_INT(24),
1365 [55] = MSM_GPIO_TO_INT(14),
1366};
1367
1368static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1369 TLMM_MSM_SUMMARY_IRQ,
1370 RPM_APCC_CPU0_GP_HIGH_IRQ,
1371 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1372 RPM_APCC_CPU0_GP_LOW_IRQ,
1373 RPM_APCC_CPU0_WAKE_UP_IRQ,
1374 RPM_APCC_CPU1_GP_HIGH_IRQ,
1375 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1376 RPM_APCC_CPU1_GP_LOW_IRQ,
1377 RPM_APCC_CPU1_WAKE_UP_IRQ,
1378 MSS_TO_APPS_IRQ_0,
1379 MSS_TO_APPS_IRQ_1,
1380 MSS_TO_APPS_IRQ_2,
1381 MSS_TO_APPS_IRQ_3,
1382 MSS_TO_APPS_IRQ_4,
1383 MSS_TO_APPS_IRQ_5,
1384 MSS_TO_APPS_IRQ_6,
1385 MSS_TO_APPS_IRQ_7,
1386 MSS_TO_APPS_IRQ_8,
1387 MSS_TO_APPS_IRQ_9,
1388 LPASS_SCSS_GP_LOW_IRQ,
1389 LPASS_SCSS_GP_MEDIUM_IRQ,
1390 LPASS_SCSS_GP_HIGH_IRQ,
1391 SPS_MTI_30,
1392 SPS_MTI_31,
1393 RIVA_APSS_SPARE_IRQ,
1394 RIVA_APPS_WLAN_SMSM_IRQ,
1395 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1396 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1397};
1398
1399struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1400 .irqs_m2a = msm_mpm_irqs_m2a,
1401 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1402 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1403 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1404 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1405 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1406 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1407 .mpm_apps_ipc_val = BIT(1),
1408 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1409
1410};
1411#endif
1412
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001413#define MSM_SHARED_RAM_PHYS 0x80000000
1414
1415static void __init msm8930_map_io(void)
1416{
1417 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1418 msm_map_msm8930_io();
1419
1420 if (socinfo_init() < 0)
1421 pr_err("socinfo_init() failed!\n");
1422}
1423
1424static void __init msm8930_init_irq(void)
1425{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001426 struct msm_mpm_device_data *data = NULL;
1427#ifdef CONFIG_MSM_MPM
1428 data = &msm8930_mpm_dev_data;
1429#endif
1430
1431 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001432 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1433 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001434}
1435
1436static void __init msm8930_init_buses(void)
1437{
1438#ifdef CONFIG_MSM_BUS_SCALING
1439 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001440 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1441 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1442 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1443 msm_bus_8930_apps_fabric.dev.platform_data =
1444 &msm_bus_8930_apps_fabric_pdata;
1445 msm_bus_8930_sys_fabric.dev.platform_data =
1446 &msm_bus_8930_sys_fabric_pdata;
1447 msm_bus_8930_mm_fabric.dev.platform_data =
1448 &msm_bus_8930_mm_fabric_pdata;
1449 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1450 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001451#endif
1452}
1453
1454static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1455 .max_clock_speed = 15060000,
1456};
1457
1458#ifdef CONFIG_USB_MSM_OTG_72K
1459static struct msm_otg_platform_data msm_otg_pdata;
1460#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301461#ifdef CONFIG_MSM_BUS_SCALING
1462/* Bandwidth requests (zero) if no vote placed */
1463static struct msm_bus_vectors usb_init_vectors[] = {
1464 {
1465 .src = MSM_BUS_MASTER_SPS,
1466 .dst = MSM_BUS_SLAVE_EBI_CH0,
1467 .ab = 0,
1468 .ib = 0,
1469 },
1470};
1471
1472/* Bus bandwidth requests in Bytes/sec */
1473static struct msm_bus_vectors usb_max_vectors[] = {
1474 {
1475 .src = MSM_BUS_MASTER_SPS,
1476 .dst = MSM_BUS_SLAVE_EBI_CH0,
1477 .ab = 60000000, /* At least 480Mbps on bus. */
1478 .ib = 960000000, /* MAX bursts rate */
1479 },
1480};
1481
1482static struct msm_bus_paths usb_bus_scale_usecases[] = {
1483 {
1484 ARRAY_SIZE(usb_init_vectors),
1485 usb_init_vectors,
1486 },
1487 {
1488 ARRAY_SIZE(usb_max_vectors),
1489 usb_max_vectors,
1490 },
1491};
1492
1493static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1494 usb_bus_scale_usecases,
1495 ARRAY_SIZE(usb_bus_scale_usecases),
1496 .name = "usb",
1497};
1498#endif
1499
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301500static int hsusb_phy_init_seq[] = {
1501 0x44, 0x80, /* set VBUS valid threshold
1502 and disconnect valid threshold */
1503 0x38, 0x81, /* update DC voltage level */
1504 0x24, 0x82, /* set preemphasis and rise/fall time */
1505 0x13, 0x83, /* set source impedance adjusment */
1506 -1};
1507
Jack Pham87f202f2012-08-06 00:24:22 -07001508#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1509
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001510static struct msm_otg_platform_data msm_otg_pdata = {
1511 .mode = USB_OTG,
1512 .otg_control = OTG_PMIC_CONTROL,
1513 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001514 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001515 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301516#ifdef CONFIG_MSM_BUS_SCALING
1517 .bus_scale_table = &usb_bus_scale_pdata,
1518#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301519#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1520 .mhl_dev_name = "sii8334",
1521#endif
Jack Pham87f202f2012-08-06 00:24:22 -07001522 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001523};
1524#endif
1525
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001526#define PID_MAGIC_ID 0x71432909
1527#define SERIAL_NUM_MAGIC_ID 0x61945374
1528#define SERIAL_NUMBER_LENGTH 127
1529#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1530
1531struct magic_num_struct {
1532 uint32_t pid;
1533 uint32_t serial_num;
1534};
1535
1536struct dload_struct {
1537 uint32_t reserved1;
1538 uint32_t reserved2;
1539 uint32_t reserved3;
1540 uint16_t reserved4;
1541 uint16_t pid;
1542 char serial_number[SERIAL_NUMBER_LENGTH];
1543 uint16_t reserved5;
1544 struct magic_num_struct magic_struct;
1545};
1546
1547static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1548{
1549 struct dload_struct __iomem *dload = 0;
1550
1551 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1552 if (!dload) {
1553 pr_err("%s: cannot remap I/O memory region: %08x\n",
1554 __func__, DLOAD_USB_BASE_ADD);
1555 return -ENXIO;
1556 }
1557
1558 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1559 __func__, dload, pid, snum);
1560 /* update pid */
1561 dload->magic_struct.pid = PID_MAGIC_ID;
1562 dload->pid = pid;
1563
1564 /* update serial number */
1565 dload->magic_struct.serial_num = 0;
1566 if (!snum) {
1567 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1568 goto out;
1569 }
1570
1571 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1572 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1573out:
1574 iounmap(dload);
1575 return 0;
1576}
1577
1578static struct android_usb_platform_data android_usb_pdata = {
1579 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1580};
1581
1582static struct platform_device android_usb_device = {
1583 .name = "android_usb",
1584 .id = -1,
1585 .dev = {
1586 .platform_data = &android_usb_pdata,
1587 },
1588};
1589
1590static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001591 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001592};
1593
1594static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001595 0x00, 0x24, 0x54, 0x10,
1596 0x09, 0x03, 0x01,
1597 0x10, 0x54, 0x30, 0x0C,
1598 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001599};
1600
1601static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001602 0x00, 0x24, 0x54, 0x10,
1603 0x09, 0x07, 0x01, 0x0B,
1604 0x10, 0x54, 0x30, 0x0C,
1605 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001606};
1607
1608static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1609 [0] = {
1610 .mode = MSM_SPM_MODE_CLOCK_GATING,
1611 .notify_rpm = false,
1612 .cmd = spm_wfi_cmd_sequence,
1613 },
1614 [1] = {
1615 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1616 .notify_rpm = false,
1617 .cmd = spm_power_collapse_without_rpm,
1618 },
1619 [2] = {
1620 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1621 .notify_rpm = true,
1622 .cmd = spm_power_collapse_with_rpm,
1623 },
1624};
1625
1626static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1627 [0] = {
1628 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001629 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001630#if defined(CONFIG_MSM_AVS_HW)
1631 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1632 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1633#endif
1634 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001635 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001636 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1637 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1638 .vctl_timeout_us = 50,
1639 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1640 .modes = msm_spm_seq_list,
1641 },
1642 [1] = {
1643 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001644 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001645#if defined(CONFIG_MSM_AVS_HW)
1646 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1647 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1648#endif
1649 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001650 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001651 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1652 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1653 .vctl_timeout_us = 50,
1654 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1655 .modes = msm_spm_seq_list,
1656 },
1657};
1658
1659static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001660 0x00, 0x20, 0x03, 0x20,
1661 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001662};
1663
1664static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001665 0x00, 0x20, 0x34, 0x64,
1666 0x48, 0x07, 0x48, 0x20,
1667 0x50, 0x64, 0x04, 0x34,
1668 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001669};
1670static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001671 0x00, 0x10, 0x34, 0x64,
1672 0x48, 0x07, 0x48, 0x10,
1673 0x50, 0x64, 0x04, 0x34,
1674 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001675};
1676
1677static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1678 [0] = {
1679 .mode = MSM_SPM_L2_MODE_RETENTION,
1680 .notify_rpm = false,
1681 .cmd = l2_spm_wfi_cmd_sequence,
1682 },
1683 [1] = {
1684 .mode = MSM_SPM_L2_MODE_GDHS,
1685 .notify_rpm = true,
1686 .cmd = l2_spm_gdhs_cmd_sequence,
1687 },
1688 [2] = {
1689 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1690 .notify_rpm = true,
1691 .cmd = l2_spm_power_off_cmd_sequence,
1692 },
1693};
1694
1695static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1696 [0] = {
1697 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001698 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001699 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001700 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1701 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1702 .modes = msm_spm_l2_seq_list,
1703 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1704 },
1705};
1706
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301707#define ISA1200_HAP_EN_GPIO 77
1708#define ISA1200_HAP_LEN_GPIO 78
David Collins04499982012-08-06 15:02:03 -07001709#define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7)
1710#define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001711
1712static int isa1200_power(int on)
1713{
David Collins04499982012-08-06 15:02:03 -07001714 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
1715 enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1;
Amy Malocheb20c1052012-04-11 10:36:13 -07001716 int rc = 0;
1717
David Collins04499982012-08-06 15:02:03 -07001718 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
1719 gpio = ISA1200_HAP_CLK_PM8917;
1720 clk_id = CLK_MP3_2;
1721 }
1722
1723 gpio_set_value_cansleep(gpio, !!on);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301724
Amy Malocheb20c1052012-04-11 10:36:13 -07001725 if (on)
David Collins04499982012-08-06 15:02:03 -07001726 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001727 else
David Collins04499982012-08-06 15:02:03 -07001728 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001729
1730 if (rc) {
1731 pr_err("%s: unable to write aux clock register(%d)\n",
1732 __func__, rc);
1733 }
1734
1735 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001736}
1737
1738static int isa1200_dev_setup(bool enable)
1739{
David Collins04499982012-08-06 15:02:03 -07001740 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001741 int rc = 0;
1742
David Collins04499982012-08-06 15:02:03 -07001743 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1744 gpio = ISA1200_HAP_CLK_PM8917;
1745
Amy Malocheb20c1052012-04-11 10:36:13 -07001746 if (!enable)
1747 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301748
David Collins04499982012-08-06 15:02:03 -07001749 rc = gpio_request(gpio, "haptics_clk");
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301750 if (rc) {
1751 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001752 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301753 goto fail_gpio_req;
1754 }
1755
David Collins04499982012-08-06 15:02:03 -07001756 rc = gpio_direction_output(gpio, 0);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301757 if (rc) {
1758 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001759 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301760 goto fail_gpio_dir;
1761 }
1762
1763 return 0;
1764
1765fail_gpio_dir:
David Collins04499982012-08-06 15:02:03 -07001766 gpio_free(gpio);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301767fail_gpio_req:
1768 return rc;
1769
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001770}
1771
1772static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301773 {
1774 .name = "vddp",
1775 .min_uV = ISA_I2C_VTG_MIN_UV,
1776 .max_uV = ISA_I2C_VTG_MAX_UV,
1777 .load_uA = ISA_I2C_CURR_UA,
1778 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001779 {
1780 .name = "vcc_i2c",
1781 .min_uV = ISA_I2C_VTG_MIN_UV,
1782 .max_uV = ISA_I2C_VTG_MAX_UV,
1783 .load_uA = ISA_I2C_CURR_UA,
1784 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001785};
1786
1787static struct isa1200_platform_data isa1200_1_pdata = {
1788 .name = "vibrator",
1789 .dev_setup = isa1200_dev_setup,
1790 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301791 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1792 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001793 .max_timeout = 15000,
1794 .mode_ctrl = PWM_GEN_MODE,
1795 .pwm_fd = {
1796 .pwm_div = 256,
1797 },
1798 .is_erm = false,
1799 .smart_en = true,
1800 .ext_clk_en = true,
1801 .chip_en = 1,
1802 .regulator_info = isa1200_reg_data,
1803 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1804};
1805
1806static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1807 {
1808 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1809 .platform_data = &isa1200_1_pdata,
1810 },
1811};
1812
Amy Malochef3c9db42011-12-08 15:17:35 -08001813#define MXT_TS_GPIO_IRQ 11
1814#define MXT_TS_RESET_GPIO 52
1815
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301816static const u8 mxt_config_data_8930_v1[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001817 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001818 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001819 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301820 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001821 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301822 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001823 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301824 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001825 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301826 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1827 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1828 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1829 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001830 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001831 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1832 0,
1833 /* T18 Object */
1834 0, 0,
1835 /* T19 Object */
1836 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1837 0, 0, 0, 0, 0, 0,
1838 /* T23 Object */
1839 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1840 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001841 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001842 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1843 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001844 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001845 0, 0, 0, 0, 0,
1846 /* T42 Object */
1847 0, 0, 0, 0, 0, 0, 0, 0,
1848 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301849 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001850 /* T47 Object */
1851 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1852 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301853 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1854 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1855 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001856 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1857 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1858 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001859};
1860
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301861static const u8 mxt_config_data_8930_v2[] = {
1862 /* T6 Object */
1863 0, 0, 0, 0, 0, 0,
1864 /* T38 Object */
1865 15, 4, 0, 9, 7, 12, 0, 0,
1866 /* T7 Object */
1867 32, 16, 50,
1868 /* T8 Object */
1869 30, 0, 5, 10, 0, 0, 10, 10, 0, 0,
1870 /* T9 Object */
1871 131, 0, 0, 19, 11, 0, 16, 50, 1, 3,
1872 12, 7, 2, 0, 4, 5, 2, 10, 43, 4,
1873 54, 2, -25, 29, 38, 18, 143, 40, 207, 80,
1874 17, 5, 50, 50, 0,
1875 /* T18 Object */
1876 0, 0,
1877 /* T19 Object */
1878 0, 0, 0, 0, 0, 0,
1879 /* T25 Object */
1880 0, 0, 0, 0, 0, 0,
1881 /* T42 Object */
1882 3, 60, 20, 20, 150, 0, 0, 0,
1883 /* T46 Object */
1884 0, 3, 28, 28, 0, 0, 1, 0, 0,
1885 /* T47 Object */
1886 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1887 /* T48 Object */
1888 1, 3, 82, 0, 0, 0, 0, 0, 0, 0,
1889 16, 30, 0, 6, 6, 0, 0, 124, 4, 100,
1890 0, 0, 0, 5, 0, 42, 0, 1, 0, 40,
1891 52, 20, 0, 0, 0, 50, 1, 5, 2, 1,
1892 4, 5, 3, -25, 29, 38, 18, 143, 40, 207,
1893 80, 10, 5, 2,
1894 /* T55 Object */
1895 0, 0, 0, 0,
1896};
1897
Amy Malochef3c9db42011-12-08 15:17:35 -08001898static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1899 struct kobj_attribute *attr, char *buf)
1900{
1901 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301902 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1903 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1904 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1905 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001906 "\n");
1907}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001908
Amy Malochef3c9db42011-12-08 15:17:35 -08001909static struct kobj_attribute mxt224e_vkeys_attr = {
1910 .attr = {
1911 .mode = S_IRUGO,
1912 },
1913 .show = &mxt224e_vkeys_show,
1914};
1915
1916static struct attribute *mxt224e_properties_attrs[] = {
1917 &mxt224e_vkeys_attr.attr,
1918 NULL
1919};
1920
1921static struct attribute_group mxt224e_properties_attr_group = {
1922 .attrs = mxt224e_properties_attrs,
1923};
1924
1925static void mxt_init_vkeys_8930(void)
1926{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001927 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001928 static struct kobject *mxt224e_properties_kobj;
1929
1930 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1931 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1932 NULL);
1933 if (mxt224e_properties_kobj)
1934 rc = sysfs_create_group(mxt224e_properties_kobj,
1935 &mxt224e_properties_attr_group);
1936 if (!mxt224e_properties_kobj || rc)
1937 pr_err("%s: failed to create board_properties\n",
1938 __func__);
1939
1940 return;
1941}
1942
Jing Lindc4413c2012-01-16 15:22:52 -08001943static struct mxt_config_info mxt_config_array[] = {
1944 {
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301945 .config = mxt_config_data_8930_v1,
1946 .config_length = ARRAY_SIZE(mxt_config_data_8930_v1),
Jing Lindc4413c2012-01-16 15:22:52 -08001947 .family_id = 0x81,
1948 .variant_id = 0x01,
1949 .version = 0x10,
1950 .build = 0xAA,
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301951 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1952 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1953 },
1954 {
1955 .config = mxt_config_data_8930_v2,
1956 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1957 .family_id = 0x81,
1958 .variant_id = 0x15,
1959 .version = 0x11,
1960 .build = 0xAA,
1961 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1962 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1963 },
1964 {
1965 .config = mxt_config_data_8930_v2,
1966 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1967 .family_id = 0x81,
1968 .variant_id = 0x01,
1969 .version = 0x20,
1970 .build = 0xAB,
1971 .bootldr_id = MXT_BOOTLOADER_ID_224E,
Jing Lindc4413c2012-01-16 15:22:52 -08001972 },
1973};
1974
Amy Malochef3c9db42011-12-08 15:17:35 -08001975static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001976 .config_array = mxt_config_array,
1977 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001978 .panel_minx = 0,
1979 .panel_maxx = 566,
1980 .panel_miny = 0,
1981 .panel_maxy = 1067,
1982 .disp_minx = 0,
1983 .disp_maxx = 540,
1984 .disp_miny = 0,
1985 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001986 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301987#ifdef MSM8930_PHASE_2
1988 .digital_pwr_regulator = true,
1989#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001990 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001991 .reset_gpio = MXT_TS_RESET_GPIO,
1992 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001993};
1994
Amy Malochef3c9db42011-12-08 15:17:35 -08001995static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001996 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001997 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1998 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001999 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2000 },
2001};
2002
David Collins04499982012-08-06 15:02:03 -07002003#define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
2004#define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25)
Manoj Raoc6d904c2012-06-22 00:32:14 -07002005static struct msm_mhl_platform_data mhl_platform_data = {
2006 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
2007 .gpio_mhl_int = MHL_GPIO_INT,
2008 .gpio_mhl_reset = MHL_GPIO_RESET,
David Collins04499982012-08-06 15:02:03 -07002009 .gpio_mhl_power = MHL_POWER_GPIO_PM8038,
Manoj Raoc6d904c2012-06-22 00:32:14 -07002010 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
2011};
2012
2013static struct i2c_board_info sii_device_info[] __initdata = {
2014 {
2015 /*
2016 * keeps SI 8334 as the default
2017 * MHL TX
2018 */
2019 I2C_BOARD_INFO("sii8334", 0x39),
2020 .platform_data = &mhl_platform_data,
2021 .flags = I2C_CLIENT_WAKE,
2022 },
2023};
2024
2025
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302026#ifdef MSM8930_PHASE_2
2027
David Collins04499982012-08-06 15:02:03 -07002028#define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3)
2029#define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8)
2030#define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10)
2031#define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11)
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302032
David Collins04499982012-08-06 15:02:03 -07002033#define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27)
2034#define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28)
2035#define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36)
2036#define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37)
2037
2038static struct gpio_keys_button keys_8930_pm8038[] = {
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302039 {
2040 .code = KEY_VOLUMEUP,
2041 .type = EV_KEY,
2042 .desc = "volume_up",
David Collins04499982012-08-06 15:02:03 -07002043 .gpio = GPIO_VOLUME_UP_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302044 .wakeup = 1,
2045 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002046 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302047 },
2048 {
2049 .code = KEY_VOLUMEDOWN,
2050 .type = EV_KEY,
2051 .desc = "volume_down",
David Collins04499982012-08-06 15:02:03 -07002052 .gpio = GPIO_VOLUME_DOWN_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302053 .wakeup = 1,
2054 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002055 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302056 },
2057 {
2058 .code = KEY_CAMERA_FOCUS,
2059 .type = EV_KEY,
2060 .desc = "camera_focus",
David Collins04499982012-08-06 15:02:03 -07002061 .gpio = GPIO_CAMERA_FOCUS_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302062 .wakeup = 1,
2063 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002064 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302065 },
2066 {
2067 .code = KEY_CAMERA_SNAPSHOT,
2068 .type = EV_KEY,
2069 .desc = "camera_snapshot",
David Collins04499982012-08-06 15:02:03 -07002070 .gpio = GPIO_CAMERA_SNAPSHOT_PM8038,
2071 .wakeup = 1,
2072 .active_low = 1,
2073 .debounce_interval = 15,
2074 },
2075};
2076
2077static struct gpio_keys_button keys_8930_pm8917[] = {
2078 {
2079 .code = KEY_VOLUMEUP,
2080 .type = EV_KEY,
2081 .desc = "volume_up",
2082 .gpio = GPIO_VOLUME_UP_PM8917,
2083 .wakeup = 1,
2084 .active_low = 1,
2085 .debounce_interval = 15,
2086 },
2087 {
2088 .code = KEY_VOLUMEDOWN,
2089 .type = EV_KEY,
2090 .desc = "volume_down",
2091 .gpio = GPIO_VOLUME_DOWN_PM8917,
2092 .wakeup = 1,
2093 .active_low = 1,
2094 .debounce_interval = 15,
2095 },
2096 {
2097 .code = KEY_CAMERA_FOCUS,
2098 .type = EV_KEY,
2099 .desc = "camera_focus",
2100 .gpio = GPIO_CAMERA_FOCUS_PM8917,
2101 .wakeup = 1,
2102 .active_low = 1,
2103 .debounce_interval = 15,
2104 },
2105 {
2106 .code = KEY_CAMERA_SNAPSHOT,
2107 .type = EV_KEY,
2108 .desc = "camera_snapshot",
2109 .gpio = GPIO_CAMERA_SNAPSHOT_PM8917,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302110 .wakeup = 1,
2111 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002112 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302113 },
2114};
2115
2116/* Add GPIO keys for 8930 */
2117static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
David Collins04499982012-08-06 15:02:03 -07002118 .buttons = keys_8930_pm8038,
2119 .nbuttons = ARRAY_SIZE(keys_8930_pm8038),
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302120};
2121
2122static struct platform_device gpio_keys_8930 = {
2123 .name = "gpio-keys",
2124 .id = -1,
2125 .dev = {
2126 .platform_data = &gpio_keys_8930_pdata,
2127 },
2128};
2129#endif /* MSM8930_PHASE_2 */
2130
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002131static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2132 .clk_freq = 100000,
2133 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002134};
2135
2136static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2137 .clk_freq = 100000,
2138 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002139};
2140
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002141static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
2142 .clk_freq = 100000,
2143 .src_clk_rate = 24000000,
2144};
2145
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002146static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2147 .clk_freq = 100000,
2148 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002149};
2150
2151static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2152 .clk_freq = 100000,
2153 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002154};
2155
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002156
2157static struct ks8851_pdata spi_eth_pdata = {
2158 .irq_gpio = KS8851_IRQ_GPIO,
2159 .rst_gpio = KS8851_RST_GPIO,
2160};
2161
2162static struct spi_board_info spi_board_info[] __initdata = {
2163 {
2164 .modalias = "ks8851",
2165 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2166 .max_speed_hz = 19200000,
2167 .bus_num = 0,
2168 .chip_select = 0,
2169 .mode = SPI_MODE_0,
2170 .platform_data = &spi_eth_pdata
2171 },
2172 {
2173 .modalias = "dsi_novatek_3d_panel_spi",
2174 .max_speed_hz = 10800000,
2175 .bus_num = 0,
2176 .chip_select = 1,
2177 .mode = SPI_MODE_0,
2178 },
2179};
2180
2181static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002182 .name = "saw-regulator",
2183 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002184 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002185 .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002186 },
2187};
2188
2189static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002190 .name = "saw-regulator",
2191 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002192 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002193 .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002194 },
2195};
2196
2197static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002198 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002199 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002200 .tsens_num_sensor = 10,
2201 .slope = {1132, 1135, 1137, 1135, 1157,
2202 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002203};
2204
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002205static struct platform_device msm_tsens_device = {
2206 .name = "tsens8960-tm",
2207 .id = -1,
2208};
2209
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002210static struct msm_thermal_data msm_thermal_pdata = {
2211 .sensor_id = 9,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002212 .poll_ms = 250,
2213 .limit_temp_degC = 60,
2214 .temp_hysteresis_degC = 10,
2215 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002216};
2217
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002218#ifdef CONFIG_MSM_FAKE_BATTERY
2219static struct platform_device fish_battery_device = {
2220 .name = "fish_battery",
2221};
2222#endif
2223
David Collins1d4061b2011-12-06 15:36:40 -08002224#ifndef MSM8930_PHASE_2
2225
2226/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002227static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002228 .name = GPIO_REGULATOR_DEV_NAME,
2229 .id = PM8921_MPP_PM_TO_SYS(7),
2230 .dev = {
2231 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2232 },
2233};
2234
Jay Chokshi06fa7542011-12-07 13:09:17 -08002235static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002236 .name = GPIO_REGULATOR_DEV_NAME,
2237 .id = 91,
2238 .dev = {
2239 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2240 },
2241};
2242
David Collins1d4061b2011-12-06 15:36:40 -08002243#else
2244
2245/* 8930 Phase 2 */
2246static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2247 .name = GPIO_REGULATOR_DEV_NAME,
2248 .id = 63,
2249 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002250 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2251 MSM8930_GPIO_VREG_ID_EXT_5V],
David Collins1d4061b2011-12-06 15:36:40 -08002252 },
2253};
2254
2255static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2256 .name = GPIO_REGULATOR_DEV_NAME,
2257 .id = 97,
2258 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002259 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2260 MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
David Collins1d4061b2011-12-06 15:36:40 -08002261 },
2262};
2263
2264#endif
2265
Jay Chokshi06fa7542011-12-07 13:09:17 -08002266static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002267 .name = "rpm-regulator",
2268 .id = -1,
2269 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002270#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002271 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002272#else
David Collins86161e42012-08-20 12:17:09 -07002273 .platform_data = &msm8930_pm8038_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002274#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002275 },
2276};
2277
David Collins86161e42012-08-20 12:17:09 -07002278static struct platform_device *early_common_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002279 &msm8960_device_dmov,
2280 &msm_device_smd,
2281 &msm8960_device_uart_gsbi5,
2282 &msm_device_uart_dm6,
2283 &msm_device_saw_core0,
2284 &msm_device_saw_core1,
David Collins86161e42012-08-20 12:17:09 -07002285};
2286
2287/* ext_5v and ext_otg_sw are present when using PM8038 */
2288static struct platform_device *pmic_pm8038_devices[] __initdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002289 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002290#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002291 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002292#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002293 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002294#ifdef MSM8930_PHASE_2
2295 &msm8930_device_ext_otg_sw_vreg,
2296#endif
David Collins86161e42012-08-20 12:17:09 -07002297};
2298
2299/* ext_5v and ext_otg_sw are not present when using PM8917 */
2300static struct platform_device *pmic_pm8917_devices[] __initdata = {
2301 &msm8960_device_ssbi_pmic,
2302};
2303
2304static struct platform_device *common_devices[] __initdata = {
Stephen Boyd28d54952011-12-16 13:19:51 -08002305 &msm_8960_q6_lpass,
2306 &msm_8960_q6_mss_fw,
2307 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002308 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002309 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002310 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002311 &msm8960_device_qup_spi_gsbi1,
2312 &msm8960_device_qup_i2c_gsbi3,
2313 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002314 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002315 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002316 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002317 &msm_slim_ctrl,
2318 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002319#if defined(CONFIG_QSEECOM)
2320 &qseecom_device,
2321#endif
2322
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002323#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2324 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2325 &qcrypto_device,
2326#endif
2327
2328#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2329 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2330 &qcedev_device,
2331#endif
2332#ifdef CONFIG_MSM_ROTATOR
2333 &msm_rotator_device,
2334#endif
2335 &msm_device_sps,
2336#ifdef CONFIG_MSM_FAKE_BATTERY
2337 &fish_battery_device,
2338#endif
2339#ifdef CONFIG_ANDROID_PMEM
2340#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002341 &msm8930_android_pmem_device,
2342 &msm8930_android_pmem_adsp_device,
2343 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302344#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2345#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002346 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002347 &msm_device_bam_dmux,
2348 &msm_fm_platform_init,
2349
2350#ifdef CONFIG_HW_RANDOM_MSM
2351 &msm_device_rng,
2352#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002353 &msm8930_rpm_device,
2354 &msm8930_rpm_log_device,
Girish Mahadevan898c56d2012-06-05 16:09:19 -06002355 &msm8930_rpm_rbcpr_device,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002356 &msm8930_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302357 &msm8930_rpm_master_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002358#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002359 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002360#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002361 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002362 &coresight_tpiu_device,
2363 &coresight_etb_device,
2364 &coresight_funnel_device,
2365 &coresight_etm0_device,
2366 &coresight_etm1_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002367 &msm_device_dspcrashd_8960,
2368 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302369#ifdef MSM8930_PHASE_2
2370 &gpio_keys_8930,
2371#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002372 &msm8930_rtb_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002373 &msm_bus_8930_apps_fabric,
2374 &msm_bus_8930_sys_fabric,
2375 &msm_bus_8930_mm_fabric,
2376 &msm_bus_8930_sys_fpb,
2377 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002378 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002379 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002380 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002381 &msm8930_cache_dump_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002382};
2383
2384static struct platform_device *cdp_devices[] __initdata = {
2385 &msm8960_device_otg,
2386 &msm8960_device_gadget_peripheral,
2387 &msm_device_hsusb_host,
2388 &android_usb_device,
2389 &msm_pcm,
2390 &msm_pcm_routing,
2391 &msm_cpudai0,
2392 &msm_cpudai1,
2393 &msm_cpudai_hdmi_rx,
2394 &msm_cpudai_bt_rx,
2395 &msm_cpudai_bt_tx,
2396 &msm_cpudai_fm_rx,
2397 &msm_cpudai_fm_tx,
2398 &msm_cpudai_auxpcm_rx,
2399 &msm_cpudai_auxpcm_tx,
2400 &msm_cpu_fe,
2401 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002402#ifdef CONFIG_MSM_GEMINI
2403 &msm8960_gemini_device,
2404#endif
2405 &msm_voice,
2406 &msm_voip,
2407 &msm_lpa_pcm,
2408 &msm_cpudai_afe_01_rx,
2409 &msm_cpudai_afe_01_tx,
2410 &msm_cpudai_afe_02_rx,
2411 &msm_cpudai_afe_02_tx,
2412 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002413 &msm_compr_dsp,
2414 &msm_cpudai_incall_music_rx,
2415 &msm_cpudai_incall_record_rx,
2416 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002417 &msm_pcm_hostless,
Asish Bhattacharya705c6732012-08-14 23:22:55 +05302418 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002419 &msm_lowlatency_pcm,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002420};
2421
2422static void __init msm8930_i2c_init(void)
2423{
2424 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2425 &msm8960_i2c_qup_gsbi4_pdata;
2426
2427 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2428 &msm8960_i2c_qup_gsbi3_pdata;
2429
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002430 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2431 &msm8960_i2c_qup_gsbi9_pdata;
2432
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002433 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2434 &msm8960_i2c_qup_gsbi10_pdata;
2435
2436 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2437 &msm8960_i2c_qup_gsbi12_pdata;
2438}
2439
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002440static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2441 {
2442 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2443 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2444 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002445 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002446 },
2447
2448 {
2449 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2450 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2451 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002452 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002453 },
2454
2455 {
2456 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2457 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2458 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002459 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002460 },
2461
2462 {
2463 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002464 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2465 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002466 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002467 },
2468
2469 {
2470 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2471 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2472 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002473 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002474 },
2475
2476 {
2477 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2478 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2479 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002480 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002481 },
2482
2483 {
2484 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2485 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2486 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002487 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002488 },
2489
2490 {
2491 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2492 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2493 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002494 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002495 },
2496};
2497
Praveen Chidambaram78499012011-11-01 17:15:17 -06002498static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2499 .levels = &msm_rpmrs_levels[0],
2500 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2501 .vdd_mem_levels = {
2502 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2503 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2504 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2505 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2506 },
2507 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002508 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2509 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2510 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2511 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002512 },
2513 .vdd_mask = 0x7FFFFF,
2514 .rpmrs_target_id = {
2515 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2516 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002517 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2518 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002519 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2520 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2521 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2522 },
2523};
2524
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002525static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = {
2526 .levels = &msm_rpmrs_levels[0],
2527 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2528 .vdd_mem_levels = {
2529 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2530 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2531 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2532 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2533 },
2534 .vdd_dig_levels = {
2535 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2536 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2537 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2538 [MSM_RPMRS_VDD_DIG_MAX] = 3,
2539 },
2540 .vdd_mask = 0x7FFFFF,
2541 .rpmrs_target_id = {
2542 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2543 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2544 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2545 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
2546 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0,
2547 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1,
2548 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2549 },
2550};
2551
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002552static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2553 .mode = MSM_PM_BOOT_CONFIG_TZ,
2554};
2555
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002556#ifdef CONFIG_I2C
2557#define I2C_SURF 1
2558#define I2C_FFA (1 << 1)
2559#define I2C_RUMI (1 << 2)
2560#define I2C_SIM (1 << 3)
2561#define I2C_FLUID (1 << 4)
2562#define I2C_LIQUID (1 << 5)
2563
2564struct i2c_registry {
2565 u8 machs;
2566 int bus;
2567 struct i2c_board_info *info;
2568 int len;
2569};
2570
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002571#ifdef CONFIG_INPUT_MPU3050
2572#define MPU3050_INT_GPIO 69
2573
2574static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2575 .gpio_int = MPU3050_INT_GPIO,
2576};
2577
2578static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2579 {
2580 I2C_BOARD_INFO("mpu3050", 0x68),
Wentao Xuc7769c02012-08-03 15:06:41 -04002581 .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO),
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002582 .platform_data = &mpu3050_gyro,
2583 },
2584};
2585#endif
2586
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002587#ifdef CONFIG_ISL9519_CHARGER
2588static struct isl_platform_data isl_data __initdata = {
2589 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2590 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2591 .max_system_voltage = 4200,
2592 .min_system_voltage = 3200,
2593 .chgcurrent = 1000, /* 1900, */
2594 .term_current = 400, /* Need fine tuning */
2595 .input_current = 2048,
2596};
2597
2598static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2599 {
2600 I2C_BOARD_INFO("isl9519q", 0x9),
2601 .irq = 0, /* Not required when notify-by-pmic */
2602 .platform_data = &isl_data,
2603 },
2604};
2605#endif /* CONFIG_ISL9519_CHARGER */
2606
Wentao Xu114c0152012-06-12 11:40:38 -04002607#ifdef CONFIG_STM_LIS3DH
2608static struct lis3dh_acc_platform_data lis3dh_accel = {
2609 .poll_interval = 200,
2610 .min_interval = 10,
2611 .g_range = LIS3DH_ACC_G_2G,
2612 .axis_map_x = 1,
2613 .axis_map_y = 0,
2614 .axis_map_z = 2,
2615 .negate_x = 0,
2616 .negate_y = 0,
2617 .negate_z = 1,
2618 .init = NULL,
2619 .exit = NULL,
2620 .gpio_int1 = -EINVAL,
2621 .gpio_int2 = -EINVAL,
2622};
2623
2624static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = {
2625 {
2626 I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18),
2627 .platform_data = &lis3dh_accel,
2628 },
2629};
2630#endif /* CONFIG_STM_LIS3DH */
2631
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002632static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002633#ifdef CONFIG_ISL9519_CHARGER
2634 {
2635 I2C_LIQUID,
2636 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2637 isl_charger_i2c_info,
2638 ARRAY_SIZE(isl_charger_i2c_info),
2639 },
2640#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002641#ifdef CONFIG_INPUT_MPU3050
2642 {
2643 I2C_FFA | I2C_FLUID,
2644 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2645 mpu3050_i2c_boardinfo,
2646 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2647 },
2648#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002649 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002650 I2C_SURF | I2C_FFA | I2C_FLUID,
2651 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002652 msm_isa1200_board_info,
2653 ARRAY_SIZE(msm_isa1200_board_info),
2654 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002655 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002656 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002657 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2658 mxt_device_info_8930,
2659 ARRAY_SIZE(mxt_device_info_8930),
2660 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002661 {
2662 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2663 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2664 sii_device_info,
2665 ARRAY_SIZE(sii_device_info),
2666 },
Wentao Xu114c0152012-06-12 11:40:38 -04002667#ifdef CONFIG_STM_LIS3DH
2668 {
2669 I2C_FFA | I2C_FLUID,
2670 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2671 lis3dh_i2c_boardinfo,
2672 ARRAY_SIZE(lis3dh_i2c_boardinfo),
2673 },
2674#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002675};
2676#endif /* CONFIG_I2C */
2677
2678static void __init register_i2c_devices(void)
2679{
2680#ifdef CONFIG_I2C
2681 u8 mach_mask = 0;
2682 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002683#ifdef CONFIG_MSM_CAMERA
2684 struct i2c_registry msm8930_camera_i2c_devices = {
2685 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2686 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2687 msm8930_camera_board_info.board_info,
2688 msm8930_camera_board_info.num_i2c_board_info,
2689 };
2690#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002691
2692 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002693 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002694 mach_mask = I2C_SURF;
2695 else if (machine_is_msm8930_fluid())
2696 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002697 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002698 mach_mask = I2C_FFA;
2699 else
2700 pr_err("unmatched machine ID in register_i2c_devices\n");
2701
2702 /* Run the array and install devices as appropriate */
2703 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2704 if (msm8960_i2c_devices[i].machs & mach_mask)
2705 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2706 msm8960_i2c_devices[i].info,
2707 msm8960_i2c_devices[i].len);
2708 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002709#ifdef CONFIG_MSM_CAMERA
2710 if (msm8930_camera_i2c_devices.machs & mach_mask)
2711 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2712 msm8930_camera_i2c_devices.info,
2713 msm8930_camera_i2c_devices.len);
2714#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002715#endif
2716}
2717
David Collins04499982012-08-06 15:02:03 -07002718/* Modify platform data values to match requirements for PM8917. */
2719static void __init msm8930_pm8917_pdata_fixup(void)
2720{
Patrick Dalya3b73c42012-08-28 13:39:17 -07002721 struct acpuclk_platform_data *pdata;
2722
David Collins04499982012-08-06 15:02:03 -07002723 mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917;
2724
2725 gpio_keys_8930_pdata.buttons = keys_8930_pm8917;
2726 gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917);
David Collins86161e42012-08-20 12:17:09 -07002727
2728 msm_device_saw_core0.dev.platform_data
2729 = &msm8930_pm8038_saw_regulator_core0_pdata;
2730 msm_device_saw_core1.dev.platform_data
2731 = &msm8930_pm8038_saw_regulator_core1_pdata;
2732
2733 msm8930_device_rpm_regulator.dev.platform_data
2734 = &msm8930_pm8917_rpm_regulator_pdata;
Patrick Dalya3b73c42012-08-28 13:39:17 -07002735
2736 pdata = msm8930_device_acpuclk.dev.platform_data;
2737 pdata->uses_pm8917 = true;
David Collins04499982012-08-06 15:02:03 -07002738}
2739
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002740static void __init msm8930_cdp_init(void)
2741{
David Collins04499982012-08-06 15:02:03 -07002742 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2743 msm8930_pm8917_pdata_fixup();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002744 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2745 pr_err("meminfo_init() failed!\n");
2746
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07002747 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002748 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002749 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002750 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
2751 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2752 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
2753 } else {
2754 BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917));
2755 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917));
2756 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002757
2758 regulator_suppress_info_printing();
2759 if (msm_xo_init())
2760 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002761 platform_device_register(&msm8930_device_rpm_regulator);
Patrick Dalyb1d5f752012-08-27 16:25:07 -07002762 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2763 msm_clock_init(&msm8930_pm8917_clock_init_data);
2764 else
2765 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302766 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002767 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302768 android_usb_pdata.swfi_latency =
2769 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002770 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002771 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2772 &msm8960_qup_spi_gsbi1_pdata;
2773 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2774
Jay Chokshi06fa7542011-12-07 13:09:17 -08002775 /*
2776 * TODO: When physical 8930/PM8038 hardware becomes
2777 * available, remove this block or add the config
2778 * option.
2779 */
2780#ifndef MSM8930_PHASE_2
2781 msm8960_init_pmic();
2782#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002783 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002784#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002785 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302786 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002787 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2788 msm_spm_l2_init(msm_spm_l2_data);
2789 msm8930_init_buses();
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002790 if (cpu_is_msm8627()) {
Tianyi Gou723843b2012-06-13 15:24:56 -07002791 platform_add_devices(msm8627_footswitch,
2792 msm8627_num_footswitch);
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002793 } else {
2794 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2795 platform_add_devices(msm8930_pm8917_footswitch,
2796 msm8930_pm8917_num_footswitch);
2797 else
2798 platform_add_devices(msm8930_footswitch,
2799 msm8930_num_footswitch);
2800 }
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002801 if (cpu_is_msm8627())
Matt Wagantallab730bd2012-06-07 20:13:51 -07002802 platform_device_register(&msm8627_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002803 else if (cpu_is_msm8930())
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002804 platform_device_register(&msm8930_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002805 else if (cpu_is_msm8930aa())
2806 platform_device_register(&msm8930aa_device_acpuclk);
David Collins86161e42012-08-20 12:17:09 -07002807 platform_add_devices(early_common_devices,
2808 ARRAY_SIZE(early_common_devices));
2809 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2810 platform_add_devices(pmic_pm8038_devices,
2811 ARRAY_SIZE(pmic_pm8038_devices));
2812 else
2813 platform_add_devices(pmic_pm8917_devices,
2814 ARRAY_SIZE(pmic_pm8917_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002815 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002816 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002817 /*
2818 * TODO: When physical 8930/PM8038 hardware becomes
2819 * available, remove this block or add the config
2820 * option.
2821 */
2822#ifndef MSM8930_PHASE_2
2823 msm8960_pm8921_gpio_mpp_init();
2824#else
David Collins04499982012-08-06 15:02:03 -07002825 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2826 msm8930_pm8038_gpio_mpp_init();
2827 else
2828 msm8930_pm8917_gpio_mpp_init();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002829#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002830 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002831#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002832 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002833#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002834 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002835 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002836 register_i2c_devices();
2837 msm8930_init_fb();
2838 slim_register_board_info(msm_slim_devices,
2839 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002840 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002841 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002842
2843 if (PLATFORM_IS_CHARM25())
2844 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2845}
2846
2847MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2848 .map_io = msm8930_map_io,
2849 .reserve = msm8930_reserve,
2850 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302851 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002852 .timer = &msm_timer,
2853 .init_machine = msm8930_cdp_init,
2854 .init_early = msm8930_allocate_memory_regions,
2855 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002856 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002857MACHINE_END
2858
2859MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2860 .map_io = msm8930_map_io,
2861 .reserve = msm8930_reserve,
2862 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302863 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002864 .timer = &msm_timer,
2865 .init_machine = msm8930_cdp_init,
2866 .init_early = msm8930_allocate_memory_regions,
2867 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002868 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002869MACHINE_END
2870
2871MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2872 .map_io = msm8930_map_io,
2873 .reserve = msm8930_reserve,
2874 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302875 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002876 .timer = &msm_timer,
2877 .init_machine = msm8930_cdp_init,
2878 .init_early = msm8930_allocate_memory_regions,
2879 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002880 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002881MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002882
2883MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2884 .map_io = msm8930_map_io,
2885 .reserve = msm8930_reserve,
2886 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302887 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002888 .timer = &msm_timer,
2889 .init_machine = msm8930_cdp_init,
2890 .init_early = msm8930_allocate_memory_regions,
2891 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002892 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002893MACHINE_END
2894
2895MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2896 .map_io = msm8930_map_io,
2897 .reserve = msm8930_reserve,
2898 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302899 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002900 .timer = &msm_timer,
2901 .init_machine = msm8930_cdp_init,
2902 .init_early = msm8930_allocate_memory_regions,
2903 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002904 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002905MACHINE_END