blob: ffec6481acfd513d8bfe0c38a86e66a0a649195d [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,
Laura Abbott5249a052012-12-11 15:09:03 -0800346 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800347};
348
Laura Abbottb93525f2012-04-12 09:57:19 -0700349static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800350 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800351 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700352 .reusable = 0,
353 .mem_is_fmem = FMEM_ENABLED,
354 .fixed_position = FIXED_HIGH,
Laura Abbott5249a052012-12-11 15:09:03 -0800355 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800356};
Hanumant Singheea62562012-05-14 11:32:45 -0700357
Laura Abbottb93525f2012-04-12 09:57:19 -0700358static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800359 .adjacent_mem_id = INVALID_HEAP_ID,
360 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700361 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800362};
Hanumant Singheea62562012-05-14 11:32:45 -0700363
Laura Abbottb93525f2012-04-12 09:57:19 -0700364static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800365 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
366 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700367 .mem_is_fmem = FMEM_ENABLED,
368 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800369};
370#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800371
Laura Abbott87eafac2012-09-18 11:45:43 -0700372
373static u64 msm_dmamask = DMA_BIT_MASK(32);
374
375static struct platform_device ion_mm_heap_device = {
376 .name = "ion-mm-heap-device",
377 .id = -1,
378 .dev = {
379 .dma_mask = &msm_dmamask,
380 .coherent_dma_mask = DMA_BIT_MASK(32),
381 }
382};
383
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800384/**
385 * These heaps are listed in the order they will be allocated. Due to
386 * video hardware restrictions and content protection the FW heap has to
387 * be allocated adjacent (below) the MM heap and the MFC heap has to be
388 * allocated after the MM heap to ensure MFC heap is not more than 256MB
389 * away from the base address of the FW heap.
390 * However, the order of FW heap and MM heap doesn't matter since these
391 * two heaps are taken care of by separate code to ensure they are adjacent
392 * to each other.
393 * Don't swap the order unless you know what you are doing!
394 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700395struct ion_platform_heap msm8930_heaps[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800396 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800397 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800398 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800399 .name = ION_VMALLOC_HEAP_NAME,
400 },
401#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
402 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800403 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800404 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800405 .name = ION_MM_HEAP_NAME,
406 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800407 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700408 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Laura Abbott87eafac2012-09-18 11:45:43 -0700409 .priv = &ion_mm_heap_device.dev
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800410 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800411 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800412 .id = ION_MM_FIRMWARE_HEAP_ID,
413 .type = ION_HEAP_TYPE_CARVEOUT,
414 .name = ION_MM_FIRMWARE_HEAP_NAME,
415 .size = MSM_ION_MM_FW_SIZE,
416 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700417 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800418 },
419 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800420 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800421 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800422 .name = ION_MFC_HEAP_NAME,
423 .size = MSM_ION_MFC_SIZE,
424 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700425 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800426 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700427#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800428 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800429 .id = ION_SF_HEAP_ID,
430 .type = ION_HEAP_TYPE_CARVEOUT,
431 .name = ION_SF_HEAP_NAME,
432 .size = MSM_ION_SF_SIZE,
433 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700434 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800435 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700436#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800437 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800438 .id = ION_IOMMU_HEAP_ID,
439 .type = ION_HEAP_TYPE_IOMMU,
440 .name = ION_IOMMU_HEAP_NAME,
441 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800442 {
443 .id = ION_QSECOM_HEAP_ID,
444 .type = ION_HEAP_TYPE_CARVEOUT,
445 .name = ION_QSECOM_HEAP_NAME,
446 .size = MSM_ION_QSECOM_SIZE,
447 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700448 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800449 },
Olav Haugan7355db02012-01-13 16:59:13 -0800450 {
451 .id = ION_AUDIO_HEAP_ID,
452 .type = ION_HEAP_TYPE_CARVEOUT,
453 .name = ION_AUDIO_HEAP_NAME,
454 .size = MSM_ION_AUDIO_SIZE,
455 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700456 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800457 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800458#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700459};
460
461static struct ion_platform_data msm8930_ion_pdata = {
462 .nr = MSM_ION_HEAP_NUM,
463 .heaps = msm8930_heaps,
464
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800465};
466
Laura Abbottb93525f2012-04-12 09:57:19 -0700467static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800468 .name = "ion-msm",
469 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700470 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800471};
472#endif
473
Hanumant Singheea62562012-05-14 11:32:45 -0700474struct platform_device msm8930_fmem_device = {
475 .name = "fmem",
476 .id = 1,
477 .dev = { .platform_data = &msm8930_fmem_pdata },
478};
479
480static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
481 unsigned long size)
482{
483 msm8930_reserve_table[mem_type].size += size;
484}
485
486static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
487{
488#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
489 int ret;
490
491 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
492 panic("fixed area size is larger than %dM\n",
493 MAX_FIXED_AREA_SIZE >> 20);
494
495 reserve_info->fixed_area_size = fixed_area_size;
496 reserve_info->fixed_area_start = MSM8930_FW_START;
497
498 ret = memblock_remove(reserve_info->fixed_area_start,
499 reserve_info->fixed_area_size);
500 BUG_ON(ret);
501#endif
502}
503
504/**
505 * Reserve memory for ION and calculate amount of reusable memory for fmem.
506 * We only reserve memory for heaps that are not reusable. However, we only
507 * support one reusable heap at the moment so we ignore the reusable flag for
508 * other than the first heap with reusable flag set. Also handle special case
509 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
510 * at a higher address than FW in addition to not more than 256MB away from the
511 * base address of the firmware. This means that if MM is reusable the other
512 * two heaps must be allocated in the same region as FW. This is handled by the
513 * mem_is_fmem flag in the platform data. In addition the MM heap must be
514 * adjacent to the FW heap for content protection purposes.
515 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700516static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800517{
518#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700519 unsigned int i;
Laura Abbott87eafac2012-09-18 11:45:43 -0700520 int ret;
Hanumant Singheea62562012-05-14 11:32:45 -0700521 unsigned int fixed_size = 0;
522 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
523 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700524 unsigned long cma_alignment;
525 unsigned int low_use_cma = 0;
526 unsigned int middle_use_cma = 0;
527 unsigned int high_use_cma = 0;
Hanumant Singheea62562012-05-14 11:32:45 -0700528
Hanumant Singheea62562012-05-14 11:32:45 -0700529 fixed_low_size = 0;
530 fixed_middle_size = 0;
531 fixed_high_size = 0;
532
Laura Abbott87eafac2012-09-18 11:45:43 -0700533 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
534
Hanumant Singheea62562012-05-14 11:32:45 -0700535 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
Laura Abbott87eafac2012-09-18 11:45:43 -0700536 struct ion_platform_heap *heap =
Hanumant Singheea62562012-05-14 11:32:45 -0700537 &(msm8930_ion_pdata.heaps[i]);
538
Laura Abbott87eafac2012-09-18 11:45:43 -0700539 int use_cma = 0;
540
Hanumant Singheea62562012-05-14 11:32:45 -0700541 if (heap->extra_data) {
542 int fixed_position = NOT_FIXED;
Hanumant Singheea62562012-05-14 11:32:45 -0700543
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700544 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700545 case ION_HEAP_TYPE_CP:
Laura Abbott87eafac2012-09-18 11:45:43 -0700546 if (((struct ion_cp_heap_pdata *)
547 heap->extra_data)->is_cma) {
548 heap->size = ALIGN(heap->size,
549 cma_alignment);
550 use_cma = 1;
551 }
Hanumant Singheea62562012-05-14 11:32:45 -0700552 fixed_position = ((struct ion_cp_heap_pdata *)
553 heap->extra_data)->fixed_position;
554 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700555 case ION_HEAP_TYPE_DMA:
556 use_cma = 1;
557 /* Purposely fall through here */
Hanumant Singheea62562012-05-14 11:32:45 -0700558 case ION_HEAP_TYPE_CARVEOUT:
Hanumant Singheea62562012-05-14 11:32:45 -0700559 fixed_position = ((struct ion_co_heap_pdata *)
560 heap->extra_data)->fixed_position;
561 break;
562 default:
563 break;
564 }
565
566 if (fixed_position != NOT_FIXED)
567 fixed_size += heap->size;
568 else
569 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
570
Laura Abbott87eafac2012-09-18 11:45:43 -0700571 if (fixed_position == FIXED_LOW) {
Hanumant Singheea62562012-05-14 11:32:45 -0700572 fixed_low_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700573 low_use_cma = use_cma;
574 } else if (fixed_position == FIXED_MIDDLE) {
Hanumant Singheea62562012-05-14 11:32:45 -0700575 fixed_middle_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700576 middle_use_cma = use_cma;
577 } else if (fixed_position == FIXED_HIGH) {
Hanumant Singheea62562012-05-14 11:32:45 -0700578 fixed_high_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700579 high_use_cma = use_cma;
580 } else if (use_cma) {
581 /*
582 * Heaps that use CMA but are not part of the
583 * fixed set. Create wherever.
584 */
585 dma_declare_contiguous(
586 heap->priv,
587 heap->size,
588 0,
589 0xb0000000);
590 }
Hanumant Singheea62562012-05-14 11:32:45 -0700591 }
592 }
593
594 if (!fixed_size)
595 return;
Laura Abbott87eafac2012-09-18 11:45:43 -0700596 /*
597 * Given the setup for the fixed area, we can't round up all sizes.
598 * Some sizes must be set up exactly and aligned correctly. Incorrect
599 * alignments are considered a configuration issue
Hanumant Singheea62562012-05-14 11:32:45 -0700600 */
Hanumant Singheea62562012-05-14 11:32:45 -0700601
602 fixed_low_start = MSM8930_FIXED_AREA_START;
Laura Abbott87eafac2012-09-18 11:45:43 -0700603 if (low_use_cma) {
604 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
605 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
606 } else {
607 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
608 ret = memblock_remove(fixed_low_start,
609 fixed_low_size + HOLE_SIZE);
610 BUG_ON(ret);
611 }
612
Deepak Kotur9830bf02012-06-01 15:04:29 -0700613 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott87eafac2012-09-18 11:45:43 -0700614 if (middle_use_cma) {
615 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
616 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
617 } else {
618 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
619 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
620 BUG_ON(ret);
621 }
622
Hanumant Singheea62562012-05-14 11:32:45 -0700623 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700624 if (high_use_cma) {
625 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
626 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
627 } else {
628 /* This is the end of the fixed area so it's okay to round up */
629 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
630 ret = memblock_remove(fixed_high_start, fixed_high_size);
631 BUG_ON(ret);
632 }
Hanumant Singheea62562012-05-14 11:32:45 -0700633
634 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
635 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
636
637 if (heap->extra_data) {
638 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700639 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700640
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700641 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700642 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700643 pdata =
644 (struct ion_cp_heap_pdata *)heap->extra_data;
645 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700646 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700647 case ION_HEAP_TYPE_DMA:
Hanumant Singheea62562012-05-14 11:32:45 -0700648 case ION_HEAP_TYPE_CARVEOUT:
649 fixed_position = ((struct ion_co_heap_pdata *)
650 heap->extra_data)->fixed_position;
651 break;
652 default:
653 break;
654 }
655
656 switch (fixed_position) {
657 case FIXED_LOW:
658 heap->base = fixed_low_start;
659 break;
660 case FIXED_MIDDLE:
661 heap->base = fixed_middle_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700662 if (middle_use_cma)
663 dma_declare_contiguous(
664 &ion_mm_heap_device.dev,
665 heap->size,
666 fixed_middle_start,
667 0xa0000000);
Deepak Kotur9830bf02012-06-01 15:04:29 -0700668 pdata->secure_base = fixed_middle_start
669 - HOLE_SIZE;
670 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700671 break;
672 case FIXED_HIGH:
673 heap->base = fixed_high_start;
674 break;
675 default:
676 break;
677 }
678 }
679 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800680#endif
681}
Huaibin Yanga5419422011-12-08 23:52:10 -0800682
683static void __init reserve_mdp_memory(void)
684{
685 msm8930_mdp_writeback(msm8930_reserve_table);
686}
687
Laura Abbottf3173042012-05-29 15:23:18 -0700688#ifdef CONFIG_MSM_CACHE_DUMP
689static void __init reserve_cache_dump_memory(void)
690{
691 unsigned int total;
692
693 total = msm8930_cache_dump_pdata.l1_size +
694 msm8930_cache_dump_pdata.l2_size;
695 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
696}
697#else
698static void __init reserve_cache_dump_memory(void) { }
699#endif
700
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800701static void __init msm8930_calculate_reserve_sizes(void)
702{
703 size_pmem_devices();
704 reserve_pmem_memory();
705 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800706 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800707 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700708 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800709}
710
711static struct reserve_info msm8930_reserve_info __initdata = {
712 .memtype_reserve_table = msm8930_reserve_table,
713 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700714 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800715 .paddr_to_memtype = msm8930_paddr_to_memtype,
716};
717
718static int msm8930_memory_bank_size(void)
719{
720 return 1<<29;
721}
722
723static void __init locate_unstable_memory(void)
724{
725 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
726 unsigned long bank_size;
727 unsigned long low, high;
728
729 bank_size = msm8930_memory_bank_size();
730 low = meminfo.bank[0].start;
731 high = mb->start + mb->size;
732
733 /* Check if 32 bit overflow occured */
734 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700735 high -= PAGE_SIZE;
736
737 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
738 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800739
740 low &= ~(bank_size - 1);
741
742 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700743 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800744
745 msm8930_reserve_info.bank_size = bank_size;
746#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800747 msm8930_reserve_info.low_unstable_address = mb->start -
748 MIN_MEMORY_BLOCK_SIZE + mb->size;
749 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800750 pr_info("low unstable address %lx max size %lx bank size %lx\n",
751 msm8930_reserve_info.low_unstable_address,
752 msm8930_reserve_info.max_unstable_size,
753 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700754 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800755#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700756no_dmm:
757 msm8930_reserve_info.low_unstable_address = high;
758 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800759}
760
761static void __init place_movable_zone(void)
762{
Larry Basselb8d61022012-02-24 10:49:45 -0800763#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800764 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
765 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
766 pr_info("movable zone start %lx size %lx\n",
767 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800768#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800769}
770
771static void __init msm8930_early_memory(void)
772{
773 reserve_info = &msm8930_reserve_info;
774 locate_unstable_memory();
775 place_movable_zone();
776}
777
778static void __init msm8930_reserve(void)
779{
780 msm_reserve();
781}
782
783static int msm8930_change_memory_power(u64 start, u64 size,
784 int change_type)
785{
786 return soc_change_memory_power(start, size, change_type);
787}
788
789static void __init msm8930_allocate_memory_regions(void)
790{
791 msm8930_allocate_fb_region();
792}
793
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530794#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800795
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530796#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800797
798/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
799 * 4 micbiases are used to power various analog and digital
800 * microphones operating at 1800 mV. Technically, all micbiases
801 * can source from single cfilter since all microphones operate
802 * at the same voltage level. The arrangement below is to make
803 * sure all cfilters are exercised. LDO_H regulator ouput level
804 * does not need to be as high as 2.85V. It is choosen for
805 * microphone sensitivity purpose.
806 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530807static struct wcd9xxx_pdata sitar_platform_data = {
808 .slimbus_slave_device = {
809 .name = "sitar-slave",
810 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800811 },
812 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530813 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530814 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530815 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800816 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530817 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800818 .cfilt1_mv = 1800,
819 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530820 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
821 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700822 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
823 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530824 },
825 .regulator = {
826 {
827 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700828 .min_uV = 1800000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530829 .max_uV = 2200000,
830 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
831 },
832 {
833 .name = "CDC_VDDA_RX",
834 .min_uV = 1800000,
835 .max_uV = 1800000,
836 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
837 },
838 {
839 .name = "CDC_VDDA_TX",
840 .min_uV = 1800000,
841 .max_uV = 1800000,
842 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
843 },
844 {
845 .name = "VDDIO_CDC",
846 .min_uV = 1800000,
847 .max_uV = 1800000,
848 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
849 },
850 {
851 .name = "VDDD_CDC_D",
852 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700853 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530854 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
855 },
856 {
857 .name = "CDC_VDDA_A_1P2V",
858 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700859 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530860 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
861 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800862 },
863};
864
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530865static struct slim_device msm_slim_sitar = {
866 .name = "sitar-slim",
867 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800868 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530869 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800870 },
871};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700872
873static struct wcd9xxx_pdata sitar1p1_platform_data = {
874 .slimbus_slave_device = {
875 .name = "sitar-slave",
876 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
877 },
878 .irq = MSM_GPIO_TO_INT(62),
879 .irq_base = SITAR_INTERRUPT_BASE,
880 .num_irqs = NR_WCD9XXX_IRQS,
881 .reset_gpio = 42,
882 .micbias = {
883 .ldoh_v = SITAR_LDOH_2P85_V,
884 .cfilt1_mv = 1800,
885 .cfilt2_mv = 1800,
886 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
887 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700888 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
889 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700890 },
891 .regulator = {
892 {
893 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700894 .min_uV = 1800000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700895 .max_uV = 2200000,
896 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
897 },
898 {
899 .name = "CDC_VDDA_RX",
900 .min_uV = 1800000,
901 .max_uV = 1800000,
902 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
903 },
904 {
905 .name = "CDC_VDDA_TX",
906 .min_uV = 1800000,
907 .max_uV = 1800000,
908 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
909 },
910 {
911 .name = "VDDIO_CDC",
912 .min_uV = 1800000,
913 .max_uV = 1800000,
914 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
915 },
916 {
917 .name = "VDDD_CDC_D",
918 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700919 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700920 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
921 },
922 {
923 .name = "CDC_VDDA_A_1P2V",
924 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700925 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700926 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
927 },
928 },
929};
930
931static struct slim_device msm_slim_sitar1p1 = {
932 .name = "sitar1p1-slim",
933 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
934 .dev = {
935 .platform_data = &sitar1p1_platform_data,
936 },
937};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800938#endif
939
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530940
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800941static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530942#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800943 {
944 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530945 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800946 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700947 {
948 .bus_num = 1,
949 .slim_slave = &msm_slim_sitar1p1,
950 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800951#endif
952 /* add more slimbus slaves as needed */
953};
954
955#define MSM_WCNSS_PHYS 0x03000000
956#define MSM_WCNSS_SIZE 0x280000
957
958static struct resource resources_wcnss_wlan[] = {
959 {
960 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
961 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
962 .name = "wcnss_wlanrx_irq",
963 .flags = IORESOURCE_IRQ,
964 },
965 {
966 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
967 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
968 .name = "wcnss_wlantx_irq",
969 .flags = IORESOURCE_IRQ,
970 },
971 {
972 .start = MSM_WCNSS_PHYS,
973 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
974 .name = "wcnss_mmio",
975 .flags = IORESOURCE_MEM,
976 },
977 {
978 .start = 84,
979 .end = 88,
980 .name = "wcnss_gpios_5wire",
981 .flags = IORESOURCE_IO,
982 },
983};
984
985static struct qcom_wcnss_opts qcom_wcnss_pdata = {
986 .has_48mhz_xo = 1,
987};
988
989static struct platform_device msm_device_wcnss_wlan = {
990 .name = "wcnss_wlan",
991 .id = 0,
992 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
993 .resource = resources_wcnss_wlan,
994 .dev = {.platform_data = &qcom_wcnss_pdata},
995};
996
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700997#ifdef CONFIG_QSEECOM
998/* qseecom bus scaling */
999static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1000 {
1001 .src = MSM_BUS_MASTER_SPS,
1002 .dst = MSM_BUS_SLAVE_EBI_CH0,
1003 .ib = 0,
1004 .ab = 0,
1005 },
1006 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001007 .src = MSM_BUS_MASTER_SPS,
1008 .dst = MSM_BUS_SLAVE_SPS,
1009 .ib = 0,
1010 .ab = 0,
1011 },
1012 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001013 .src = MSM_BUS_MASTER_SPDM,
1014 .dst = MSM_BUS_SLAVE_SPDM,
1015 .ib = 0,
1016 .ab = 0,
1017 },
1018};
1019
1020static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1021 {
1022 .src = MSM_BUS_MASTER_SPS,
1023 .dst = MSM_BUS_SLAVE_EBI_CH0,
1024 .ib = (492 * 8) * 1000000UL,
1025 .ab = (492 * 8) * 100000UL,
1026 },
1027 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001028 .src = MSM_BUS_MASTER_SPS,
1029 .dst = MSM_BUS_SLAVE_SPS,
1030 .ib = (492 * 8) * 1000000UL,
1031 .ab = (492 * 8) * 100000UL,
1032 },
1033 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001034 .src = MSM_BUS_MASTER_SPDM,
1035 .dst = MSM_BUS_SLAVE_SPDM,
1036 .ib = 0,
1037 .ab = 0,
1038 },
1039};
1040
1041static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1042 {
1043 .src = MSM_BUS_MASTER_SPS,
1044 .dst = MSM_BUS_SLAVE_EBI_CH0,
1045 .ib = 0,
1046 .ab = 0,
1047 },
1048 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001049 .src = MSM_BUS_MASTER_SPS,
1050 .dst = MSM_BUS_SLAVE_SPS,
1051 .ib = 0,
1052 .ab = 0,
1053 },
1054 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001055 .src = MSM_BUS_MASTER_SPDM,
1056 .dst = MSM_BUS_SLAVE_SPDM,
1057 .ib = (64 * 8) * 1000000UL,
1058 .ab = (64 * 8) * 100000UL,
1059 },
1060};
1061
1062static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1063 {
1064 ARRAY_SIZE(qseecom_clks_init_vectors),
1065 qseecom_clks_init_vectors,
1066 },
1067 {
1068 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1069 qseecom_enable_sfpb_vectors,
1070 },
1071 {
1072 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1073 qseecom_enable_sfpb_vectors,
1074 },
1075};
1076
1077static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1078 qseecom_hw_bus_scale_usecases,
1079 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1080 .name = "qsee",
1081};
1082
1083static struct platform_device qseecom_device = {
1084 .name = "qseecom",
1085 .id = 0,
1086 .dev = {
1087 .platform_data = &qseecom_bus_pdata,
1088 },
1089};
1090#endif
1091
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001092#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1093 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1094 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1095 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1096
1097#define QCE_SIZE 0x10000
1098#define QCE_0_BASE 0x18500000
1099
1100#define QCE_HW_KEY_SUPPORT 0
1101#define QCE_SHA_HMAC_SUPPORT 1
1102#define QCE_SHARE_CE_RESOURCE 1
1103#define QCE_CE_SHARED 0
1104
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001105/* Begin Bus scaling definitions */
1106static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1107 {
1108 .src = MSM_BUS_MASTER_ADM_PORT0,
1109 .dst = MSM_BUS_SLAVE_EBI_CH0,
1110 .ab = 0,
1111 .ib = 0,
1112 },
1113 {
1114 .src = MSM_BUS_MASTER_ADM_PORT1,
1115 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1116 .ab = 0,
1117 .ib = 0,
1118 },
1119};
1120
1121static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1122 {
1123 .src = MSM_BUS_MASTER_ADM_PORT0,
1124 .dst = MSM_BUS_SLAVE_EBI_CH0,
1125 .ab = 70000000UL,
1126 .ib = 70000000UL,
1127 },
1128 {
1129 .src = MSM_BUS_MASTER_ADM_PORT1,
1130 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1131 .ab = 2480000000UL,
1132 .ib = 2480000000UL,
1133 },
1134};
1135
1136static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1137 {
1138 ARRAY_SIZE(crypto_hw_init_vectors),
1139 crypto_hw_init_vectors,
1140 },
1141 {
1142 ARRAY_SIZE(crypto_hw_active_vectors),
1143 crypto_hw_active_vectors,
1144 },
1145};
1146
1147static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1148 crypto_hw_bus_scale_usecases,
1149 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1150 .name = "cryptohw",
1151};
1152/* End Bus Scaling Definitions*/
1153
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001154static struct resource qcrypto_resources[] = {
1155 [0] = {
1156 .start = QCE_0_BASE,
1157 .end = QCE_0_BASE + QCE_SIZE - 1,
1158 .flags = IORESOURCE_MEM,
1159 },
1160 [1] = {
1161 .name = "crypto_channels",
1162 .start = DMOV_CE_IN_CHAN,
1163 .end = DMOV_CE_OUT_CHAN,
1164 .flags = IORESOURCE_DMA,
1165 },
1166 [2] = {
1167 .name = "crypto_crci_in",
1168 .start = DMOV_CE_IN_CRCI,
1169 .end = DMOV_CE_IN_CRCI,
1170 .flags = IORESOURCE_DMA,
1171 },
1172 [3] = {
1173 .name = "crypto_crci_out",
1174 .start = DMOV_CE_OUT_CRCI,
1175 .end = DMOV_CE_OUT_CRCI,
1176 .flags = IORESOURCE_DMA,
1177 },
1178};
1179
1180static struct resource qcedev_resources[] = {
1181 [0] = {
1182 .start = QCE_0_BASE,
1183 .end = QCE_0_BASE + QCE_SIZE - 1,
1184 .flags = IORESOURCE_MEM,
1185 },
1186 [1] = {
1187 .name = "crypto_channels",
1188 .start = DMOV_CE_IN_CHAN,
1189 .end = DMOV_CE_OUT_CHAN,
1190 .flags = IORESOURCE_DMA,
1191 },
1192 [2] = {
1193 .name = "crypto_crci_in",
1194 .start = DMOV_CE_IN_CRCI,
1195 .end = DMOV_CE_IN_CRCI,
1196 .flags = IORESOURCE_DMA,
1197 },
1198 [3] = {
1199 .name = "crypto_crci_out",
1200 .start = DMOV_CE_OUT_CRCI,
1201 .end = DMOV_CE_OUT_CRCI,
1202 .flags = IORESOURCE_DMA,
1203 },
1204};
1205
1206#endif
1207
1208#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1209 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1210
1211static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1212 .ce_shared = QCE_CE_SHARED,
1213 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1214 .hw_key_support = QCE_HW_KEY_SUPPORT,
1215 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001216 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001217};
1218
1219static struct platform_device qcrypto_device = {
1220 .name = "qcrypto",
1221 .id = 0,
1222 .num_resources = ARRAY_SIZE(qcrypto_resources),
1223 .resource = qcrypto_resources,
1224 .dev = {
1225 .coherent_dma_mask = DMA_BIT_MASK(32),
1226 .platform_data = &qcrypto_ce_hw_suppport,
1227 },
1228};
1229#endif
1230
1231#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1232 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1233
1234static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1235 .ce_shared = QCE_CE_SHARED,
1236 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1237 .hw_key_support = QCE_HW_KEY_SUPPORT,
1238 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001239 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001240};
1241
1242static struct platform_device qcedev_device = {
1243 .name = "qce",
1244 .id = 0,
1245 .num_resources = ARRAY_SIZE(qcedev_resources),
1246 .resource = qcedev_resources,
1247 .dev = {
1248 .coherent_dma_mask = DMA_BIT_MASK(32),
1249 .platform_data = &qcedev_ce_hw_suppport,
1250 },
1251};
1252#endif
1253
1254#define MDM2AP_ERRFATAL 70
1255#define AP2MDM_ERRFATAL 95
1256#define MDM2AP_STATUS 69
1257#define AP2MDM_STATUS 94
1258#define AP2MDM_PMIC_RESET_N 80
1259#define AP2MDM_KPDPWR_N 81
1260
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001261static struct resource mdm_resources[] = {
1262 {
1263 .start = MDM2AP_ERRFATAL,
1264 .end = MDM2AP_ERRFATAL,
1265 .name = "MDM2AP_ERRFATAL",
1266 .flags = IORESOURCE_IO,
1267 },
1268 {
1269 .start = AP2MDM_ERRFATAL,
1270 .end = AP2MDM_ERRFATAL,
1271 .name = "AP2MDM_ERRFATAL",
1272 .flags = IORESOURCE_IO,
1273 },
1274 {
1275 .start = MDM2AP_STATUS,
1276 .end = MDM2AP_STATUS,
1277 .name = "MDM2AP_STATUS",
1278 .flags = IORESOURCE_IO,
1279 },
1280 {
1281 .start = AP2MDM_STATUS,
1282 .end = AP2MDM_STATUS,
1283 .name = "AP2MDM_STATUS",
1284 .flags = IORESOURCE_IO,
1285 },
1286 {
1287 .start = AP2MDM_PMIC_RESET_N,
1288 .end = AP2MDM_PMIC_RESET_N,
1289 .name = "AP2MDM_PMIC_RESET_N",
1290 .flags = IORESOURCE_IO,
1291 },
1292 {
1293 .start = AP2MDM_KPDPWR_N,
1294 .end = AP2MDM_KPDPWR_N,
1295 .name = "AP2MDM_KPDPWR_N",
1296 .flags = IORESOURCE_IO,
1297 },
1298};
1299
1300static struct mdm_platform_data mdm_platform_data = {
1301 .mdm_version = "2.5",
1302};
1303
1304static struct platform_device mdm_device = {
1305 .name = "mdm2_modem",
1306 .id = -1,
1307 .num_resources = ARRAY_SIZE(mdm_resources),
1308 .resource = mdm_resources,
1309 .dev = {
1310 .platform_data = &mdm_platform_data,
1311 },
1312};
1313
1314static struct platform_device *mdm_devices[] __initdata = {
1315 &mdm_device,
1316};
1317
Praveen Chidambaram78499012011-11-01 17:15:17 -06001318#ifdef CONFIG_MSM_MPM
1319static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1320 [1] = MSM_GPIO_TO_INT(46),
1321 [2] = MSM_GPIO_TO_INT(150),
1322 [4] = MSM_GPIO_TO_INT(103),
1323 [5] = MSM_GPIO_TO_INT(104),
1324 [6] = MSM_GPIO_TO_INT(105),
1325 [7] = MSM_GPIO_TO_INT(106),
1326 [8] = MSM_GPIO_TO_INT(107),
1327 [9] = MSM_GPIO_TO_INT(7),
1328 [10] = MSM_GPIO_TO_INT(11),
1329 [11] = MSM_GPIO_TO_INT(15),
1330 [12] = MSM_GPIO_TO_INT(19),
1331 [13] = MSM_GPIO_TO_INT(23),
1332 [14] = MSM_GPIO_TO_INT(27),
1333 [15] = MSM_GPIO_TO_INT(31),
1334 [16] = MSM_GPIO_TO_INT(35),
1335 [19] = MSM_GPIO_TO_INT(90),
1336 [20] = MSM_GPIO_TO_INT(92),
1337 [23] = MSM_GPIO_TO_INT(85),
1338 [24] = MSM_GPIO_TO_INT(83),
1339 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001340 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001341 [27] = HDMI_IRQ,
1342 [29] = MSM_GPIO_TO_INT(10),
1343 [30] = MSM_GPIO_TO_INT(102),
1344 [31] = MSM_GPIO_TO_INT(81),
1345 [32] = MSM_GPIO_TO_INT(78),
1346 [33] = MSM_GPIO_TO_INT(94),
1347 [34] = MSM_GPIO_TO_INT(72),
1348 [35] = MSM_GPIO_TO_INT(39),
1349 [36] = MSM_GPIO_TO_INT(43),
1350 [37] = MSM_GPIO_TO_INT(61),
1351 [38] = MSM_GPIO_TO_INT(50),
1352 [39] = MSM_GPIO_TO_INT(42),
1353 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001354 [42] = MSM_GPIO_TO_INT(8),
1355 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001356 [44] = MSM_GPIO_TO_INT(70),
1357 [45] = MSM_GPIO_TO_INT(69),
1358 [46] = MSM_GPIO_TO_INT(67),
1359 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001360 [48] = MSM_GPIO_TO_INT(55),
1361 [49] = MSM_GPIO_TO_INT(74),
1362 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001363 [51] = MSM_GPIO_TO_INT(49),
1364 [52] = MSM_GPIO_TO_INT(40),
1365 [53] = MSM_GPIO_TO_INT(37),
1366 [54] = MSM_GPIO_TO_INT(24),
1367 [55] = MSM_GPIO_TO_INT(14),
1368};
1369
1370static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1371 TLMM_MSM_SUMMARY_IRQ,
1372 RPM_APCC_CPU0_GP_HIGH_IRQ,
1373 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1374 RPM_APCC_CPU0_GP_LOW_IRQ,
1375 RPM_APCC_CPU0_WAKE_UP_IRQ,
1376 RPM_APCC_CPU1_GP_HIGH_IRQ,
1377 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1378 RPM_APCC_CPU1_GP_LOW_IRQ,
1379 RPM_APCC_CPU1_WAKE_UP_IRQ,
1380 MSS_TO_APPS_IRQ_0,
1381 MSS_TO_APPS_IRQ_1,
1382 MSS_TO_APPS_IRQ_2,
1383 MSS_TO_APPS_IRQ_3,
1384 MSS_TO_APPS_IRQ_4,
1385 MSS_TO_APPS_IRQ_5,
1386 MSS_TO_APPS_IRQ_6,
1387 MSS_TO_APPS_IRQ_7,
1388 MSS_TO_APPS_IRQ_8,
1389 MSS_TO_APPS_IRQ_9,
1390 LPASS_SCSS_GP_LOW_IRQ,
1391 LPASS_SCSS_GP_MEDIUM_IRQ,
1392 LPASS_SCSS_GP_HIGH_IRQ,
1393 SPS_MTI_30,
1394 SPS_MTI_31,
1395 RIVA_APSS_SPARE_IRQ,
1396 RIVA_APPS_WLAN_SMSM_IRQ,
1397 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1398 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1399};
1400
1401struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1402 .irqs_m2a = msm_mpm_irqs_m2a,
1403 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1404 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1405 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1406 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1407 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1408 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1409 .mpm_apps_ipc_val = BIT(1),
1410 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1411
1412};
1413#endif
1414
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001415#define MSM_SHARED_RAM_PHYS 0x80000000
1416
1417static void __init msm8930_map_io(void)
1418{
1419 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1420 msm_map_msm8930_io();
1421
1422 if (socinfo_init() < 0)
1423 pr_err("socinfo_init() failed!\n");
1424}
1425
1426static void __init msm8930_init_irq(void)
1427{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001428 struct msm_mpm_device_data *data = NULL;
1429#ifdef CONFIG_MSM_MPM
1430 data = &msm8930_mpm_dev_data;
1431#endif
1432
1433 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001434 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1435 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001436}
1437
1438static void __init msm8930_init_buses(void)
1439{
1440#ifdef CONFIG_MSM_BUS_SCALING
1441 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001442 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1443 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1444 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1445 msm_bus_8930_apps_fabric.dev.platform_data =
1446 &msm_bus_8930_apps_fabric_pdata;
1447 msm_bus_8930_sys_fabric.dev.platform_data =
1448 &msm_bus_8930_sys_fabric_pdata;
1449 msm_bus_8930_mm_fabric.dev.platform_data =
1450 &msm_bus_8930_mm_fabric_pdata;
1451 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1452 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001453#endif
1454}
1455
1456static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1457 .max_clock_speed = 15060000,
1458};
1459
1460#ifdef CONFIG_USB_MSM_OTG_72K
1461static struct msm_otg_platform_data msm_otg_pdata;
1462#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301463#ifdef CONFIG_MSM_BUS_SCALING
1464/* Bandwidth requests (zero) if no vote placed */
1465static struct msm_bus_vectors usb_init_vectors[] = {
1466 {
1467 .src = MSM_BUS_MASTER_SPS,
1468 .dst = MSM_BUS_SLAVE_EBI_CH0,
1469 .ab = 0,
1470 .ib = 0,
1471 },
1472};
1473
1474/* Bus bandwidth requests in Bytes/sec */
1475static struct msm_bus_vectors usb_max_vectors[] = {
1476 {
1477 .src = MSM_BUS_MASTER_SPS,
1478 .dst = MSM_BUS_SLAVE_EBI_CH0,
1479 .ab = 60000000, /* At least 480Mbps on bus. */
1480 .ib = 960000000, /* MAX bursts rate */
1481 },
1482};
1483
1484static struct msm_bus_paths usb_bus_scale_usecases[] = {
1485 {
1486 ARRAY_SIZE(usb_init_vectors),
1487 usb_init_vectors,
1488 },
1489 {
1490 ARRAY_SIZE(usb_max_vectors),
1491 usb_max_vectors,
1492 },
1493};
1494
1495static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1496 usb_bus_scale_usecases,
1497 ARRAY_SIZE(usb_bus_scale_usecases),
1498 .name = "usb",
1499};
1500#endif
1501
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301502static int hsusb_phy_init_seq[] = {
1503 0x44, 0x80, /* set VBUS valid threshold
1504 and disconnect valid threshold */
1505 0x38, 0x81, /* update DC voltage level */
1506 0x24, 0x82, /* set preemphasis and rise/fall time */
1507 0x13, 0x83, /* set source impedance adjusment */
1508 -1};
1509
Jack Pham87f202f2012-08-06 00:24:22 -07001510#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1511
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001512static struct msm_otg_platform_data msm_otg_pdata = {
1513 .mode = USB_OTG,
1514 .otg_control = OTG_PMIC_CONTROL,
1515 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001516 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001517 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301518#ifdef CONFIG_MSM_BUS_SCALING
1519 .bus_scale_table = &usb_bus_scale_pdata,
1520#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301521#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1522 .mhl_dev_name = "sii8334",
1523#endif
Jack Pham87f202f2012-08-06 00:24:22 -07001524 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001525};
1526#endif
1527
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001528#define PID_MAGIC_ID 0x71432909
1529#define SERIAL_NUM_MAGIC_ID 0x61945374
1530#define SERIAL_NUMBER_LENGTH 127
1531#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1532
1533struct magic_num_struct {
1534 uint32_t pid;
1535 uint32_t serial_num;
1536};
1537
1538struct dload_struct {
1539 uint32_t reserved1;
1540 uint32_t reserved2;
1541 uint32_t reserved3;
1542 uint16_t reserved4;
1543 uint16_t pid;
1544 char serial_number[SERIAL_NUMBER_LENGTH];
1545 uint16_t reserved5;
1546 struct magic_num_struct magic_struct;
1547};
1548
1549static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1550{
1551 struct dload_struct __iomem *dload = 0;
1552
1553 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1554 if (!dload) {
1555 pr_err("%s: cannot remap I/O memory region: %08x\n",
1556 __func__, DLOAD_USB_BASE_ADD);
1557 return -ENXIO;
1558 }
1559
1560 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1561 __func__, dload, pid, snum);
1562 /* update pid */
1563 dload->magic_struct.pid = PID_MAGIC_ID;
1564 dload->pid = pid;
1565
1566 /* update serial number */
1567 dload->magic_struct.serial_num = 0;
1568 if (!snum) {
1569 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1570 goto out;
1571 }
1572
1573 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1574 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1575out:
1576 iounmap(dload);
1577 return 0;
1578}
1579
1580static struct android_usb_platform_data android_usb_pdata = {
1581 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1582};
1583
1584static struct platform_device android_usb_device = {
1585 .name = "android_usb",
1586 .id = -1,
1587 .dev = {
1588 .platform_data = &android_usb_pdata,
1589 },
1590};
1591
1592static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001593 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001594};
1595
1596static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001597 0x00, 0x24, 0x54, 0x10,
1598 0x09, 0x03, 0x01,
1599 0x10, 0x54, 0x30, 0x0C,
1600 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001601};
1602
1603static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001604 0x00, 0x24, 0x54, 0x10,
1605 0x09, 0x07, 0x01, 0x0B,
1606 0x10, 0x54, 0x30, 0x0C,
1607 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001608};
1609
1610static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1611 [0] = {
1612 .mode = MSM_SPM_MODE_CLOCK_GATING,
1613 .notify_rpm = false,
1614 .cmd = spm_wfi_cmd_sequence,
1615 },
1616 [1] = {
1617 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1618 .notify_rpm = false,
1619 .cmd = spm_power_collapse_without_rpm,
1620 },
1621 [2] = {
1622 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1623 .notify_rpm = true,
1624 .cmd = spm_power_collapse_with_rpm,
1625 },
1626};
1627
1628static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1629 [0] = {
1630 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001631 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001632#if defined(CONFIG_MSM_AVS_HW)
1633 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1634 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1635#endif
1636 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001637 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001638 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1639 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1640 .vctl_timeout_us = 50,
1641 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1642 .modes = msm_spm_seq_list,
1643 },
1644 [1] = {
1645 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001646 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001647#if defined(CONFIG_MSM_AVS_HW)
1648 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1649 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1650#endif
1651 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001652 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001653 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1654 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1655 .vctl_timeout_us = 50,
1656 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1657 .modes = msm_spm_seq_list,
1658 },
1659};
1660
1661static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001662 0x00, 0x20, 0x03, 0x20,
1663 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001664};
1665
1666static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001667 0x00, 0x20, 0x34, 0x64,
1668 0x48, 0x07, 0x48, 0x20,
1669 0x50, 0x64, 0x04, 0x34,
1670 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001671};
1672static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001673 0x00, 0x10, 0x34, 0x64,
1674 0x48, 0x07, 0x48, 0x10,
1675 0x50, 0x64, 0x04, 0x34,
1676 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001677};
1678
1679static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1680 [0] = {
1681 .mode = MSM_SPM_L2_MODE_RETENTION,
1682 .notify_rpm = false,
1683 .cmd = l2_spm_wfi_cmd_sequence,
1684 },
1685 [1] = {
1686 .mode = MSM_SPM_L2_MODE_GDHS,
1687 .notify_rpm = true,
1688 .cmd = l2_spm_gdhs_cmd_sequence,
1689 },
1690 [2] = {
1691 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1692 .notify_rpm = true,
1693 .cmd = l2_spm_power_off_cmd_sequence,
1694 },
1695};
1696
1697static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1698 [0] = {
1699 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001700 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001701 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001702 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1703 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1704 .modes = msm_spm_l2_seq_list,
1705 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1706 },
1707};
1708
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301709#define ISA1200_HAP_EN_GPIO 77
1710#define ISA1200_HAP_LEN_GPIO 78
David Collins04499982012-08-06 15:02:03 -07001711#define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7)
1712#define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001713
1714static int isa1200_power(int on)
1715{
David Collins04499982012-08-06 15:02:03 -07001716 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
1717 enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1;
Amy Malocheb20c1052012-04-11 10:36:13 -07001718 int rc = 0;
1719
David Collins04499982012-08-06 15:02:03 -07001720 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
1721 gpio = ISA1200_HAP_CLK_PM8917;
1722 clk_id = CLK_MP3_2;
1723 }
1724
1725 gpio_set_value_cansleep(gpio, !!on);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301726
Amy Malocheb20c1052012-04-11 10:36:13 -07001727 if (on)
David Collins04499982012-08-06 15:02:03 -07001728 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001729 else
David Collins04499982012-08-06 15:02:03 -07001730 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001731
1732 if (rc) {
1733 pr_err("%s: unable to write aux clock register(%d)\n",
1734 __func__, rc);
1735 }
1736
1737 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001738}
1739
1740static int isa1200_dev_setup(bool enable)
1741{
David Collins04499982012-08-06 15:02:03 -07001742 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001743 int rc = 0;
1744
David Collins04499982012-08-06 15:02:03 -07001745 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1746 gpio = ISA1200_HAP_CLK_PM8917;
1747
Amy Malocheb20c1052012-04-11 10:36:13 -07001748 if (!enable)
1749 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301750
David Collins04499982012-08-06 15:02:03 -07001751 rc = gpio_request(gpio, "haptics_clk");
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301752 if (rc) {
1753 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001754 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301755 goto fail_gpio_req;
1756 }
1757
David Collins04499982012-08-06 15:02:03 -07001758 rc = gpio_direction_output(gpio, 0);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301759 if (rc) {
1760 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001761 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301762 goto fail_gpio_dir;
1763 }
1764
1765 return 0;
1766
1767fail_gpio_dir:
David Collins04499982012-08-06 15:02:03 -07001768 gpio_free(gpio);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301769fail_gpio_req:
1770 return rc;
1771
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001772}
1773
1774static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301775 {
1776 .name = "vddp",
1777 .min_uV = ISA_I2C_VTG_MIN_UV,
1778 .max_uV = ISA_I2C_VTG_MAX_UV,
1779 .load_uA = ISA_I2C_CURR_UA,
1780 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001781 {
1782 .name = "vcc_i2c",
1783 .min_uV = ISA_I2C_VTG_MIN_UV,
1784 .max_uV = ISA_I2C_VTG_MAX_UV,
1785 .load_uA = ISA_I2C_CURR_UA,
1786 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001787};
1788
1789static struct isa1200_platform_data isa1200_1_pdata = {
1790 .name = "vibrator",
1791 .dev_setup = isa1200_dev_setup,
1792 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301793 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1794 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001795 .max_timeout = 15000,
1796 .mode_ctrl = PWM_GEN_MODE,
1797 .pwm_fd = {
1798 .pwm_div = 256,
1799 },
1800 .is_erm = false,
1801 .smart_en = true,
1802 .ext_clk_en = true,
1803 .chip_en = 1,
1804 .regulator_info = isa1200_reg_data,
1805 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1806};
1807
1808static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1809 {
1810 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1811 .platform_data = &isa1200_1_pdata,
1812 },
1813};
1814
Amy Malochef3c9db42011-12-08 15:17:35 -08001815#define MXT_TS_GPIO_IRQ 11
1816#define MXT_TS_RESET_GPIO 52
1817
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301818static const u8 mxt_config_data_8930_v1[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001819 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001820 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001821 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301822 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001823 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301824 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001825 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301826 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001827 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301828 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1829 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1830 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1831 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001832 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001833 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1834 0,
1835 /* T18 Object */
1836 0, 0,
1837 /* T19 Object */
1838 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1839 0, 0, 0, 0, 0, 0,
1840 /* T23 Object */
1841 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1842 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001843 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001844 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1845 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001846 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001847 0, 0, 0, 0, 0,
1848 /* T42 Object */
1849 0, 0, 0, 0, 0, 0, 0, 0,
1850 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301851 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001852 /* T47 Object */
1853 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1854 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301855 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1856 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1857 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001858 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1859 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1860 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001861};
1862
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301863static const u8 mxt_config_data_8930_v2[] = {
1864 /* T6 Object */
1865 0, 0, 0, 0, 0, 0,
1866 /* T38 Object */
1867 15, 4, 0, 9, 7, 12, 0, 0,
1868 /* T7 Object */
1869 32, 16, 50,
1870 /* T8 Object */
1871 30, 0, 5, 10, 0, 0, 10, 10, 0, 0,
1872 /* T9 Object */
1873 131, 0, 0, 19, 11, 0, 16, 50, 1, 3,
1874 12, 7, 2, 0, 4, 5, 2, 10, 43, 4,
1875 54, 2, -25, 29, 38, 18, 143, 40, 207, 80,
1876 17, 5, 50, 50, 0,
1877 /* T18 Object */
1878 0, 0,
1879 /* T19 Object */
1880 0, 0, 0, 0, 0, 0,
1881 /* T25 Object */
1882 0, 0, 0, 0, 0, 0,
1883 /* T42 Object */
1884 3, 60, 20, 20, 150, 0, 0, 0,
1885 /* T46 Object */
1886 0, 3, 28, 28, 0, 0, 1, 0, 0,
1887 /* T47 Object */
1888 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1889 /* T48 Object */
1890 1, 3, 82, 0, 0, 0, 0, 0, 0, 0,
1891 16, 30, 0, 6, 6, 0, 0, 124, 4, 100,
1892 0, 0, 0, 5, 0, 42, 0, 1, 0, 40,
1893 52, 20, 0, 0, 0, 50, 1, 5, 2, 1,
1894 4, 5, 3, -25, 29, 38, 18, 143, 40, 207,
1895 80, 10, 5, 2,
1896 /* T55 Object */
1897 0, 0, 0, 0,
1898};
1899
Amy Malochef3c9db42011-12-08 15:17:35 -08001900static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1901 struct kobj_attribute *attr, char *buf)
1902{
1903 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301904 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1905 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1906 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1907 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001908 "\n");
1909}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001910
Amy Malochef3c9db42011-12-08 15:17:35 -08001911static struct kobj_attribute mxt224e_vkeys_attr = {
1912 .attr = {
1913 .mode = S_IRUGO,
1914 },
1915 .show = &mxt224e_vkeys_show,
1916};
1917
1918static struct attribute *mxt224e_properties_attrs[] = {
1919 &mxt224e_vkeys_attr.attr,
1920 NULL
1921};
1922
1923static struct attribute_group mxt224e_properties_attr_group = {
1924 .attrs = mxt224e_properties_attrs,
1925};
1926
1927static void mxt_init_vkeys_8930(void)
1928{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001929 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001930 static struct kobject *mxt224e_properties_kobj;
1931
1932 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1933 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1934 NULL);
1935 if (mxt224e_properties_kobj)
1936 rc = sysfs_create_group(mxt224e_properties_kobj,
1937 &mxt224e_properties_attr_group);
1938 if (!mxt224e_properties_kobj || rc)
1939 pr_err("%s: failed to create board_properties\n",
1940 __func__);
1941
1942 return;
1943}
1944
Jing Lindc4413c2012-01-16 15:22:52 -08001945static struct mxt_config_info mxt_config_array[] = {
1946 {
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301947 .config = mxt_config_data_8930_v1,
1948 .config_length = ARRAY_SIZE(mxt_config_data_8930_v1),
Jing Lindc4413c2012-01-16 15:22:52 -08001949 .family_id = 0x81,
1950 .variant_id = 0x01,
1951 .version = 0x10,
1952 .build = 0xAA,
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301953 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1954 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1955 },
1956 {
1957 .config = mxt_config_data_8930_v2,
1958 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1959 .family_id = 0x81,
1960 .variant_id = 0x15,
1961 .version = 0x11,
1962 .build = 0xAA,
1963 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1964 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1965 },
1966 {
1967 .config = mxt_config_data_8930_v2,
1968 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1969 .family_id = 0x81,
1970 .variant_id = 0x01,
1971 .version = 0x20,
1972 .build = 0xAB,
1973 .bootldr_id = MXT_BOOTLOADER_ID_224E,
Jing Lindc4413c2012-01-16 15:22:52 -08001974 },
1975};
1976
Amy Malochef3c9db42011-12-08 15:17:35 -08001977static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001978 .config_array = mxt_config_array,
1979 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001980 .panel_minx = 0,
1981 .panel_maxx = 566,
1982 .panel_miny = 0,
1983 .panel_maxy = 1067,
1984 .disp_minx = 0,
1985 .disp_maxx = 540,
1986 .disp_miny = 0,
1987 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001988 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301989#ifdef MSM8930_PHASE_2
1990 .digital_pwr_regulator = true,
1991#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001992 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001993 .reset_gpio = MXT_TS_RESET_GPIO,
1994 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001995};
1996
Amy Malochef3c9db42011-12-08 15:17:35 -08001997static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001998 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001999 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
2000 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002001 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2002 },
2003};
2004
David Collins04499982012-08-06 15:02:03 -07002005#define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
2006#define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25)
Manoj Raoc6d904c2012-06-22 00:32:14 -07002007static struct msm_mhl_platform_data mhl_platform_data = {
2008 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
2009 .gpio_mhl_int = MHL_GPIO_INT,
2010 .gpio_mhl_reset = MHL_GPIO_RESET,
David Collins04499982012-08-06 15:02:03 -07002011 .gpio_mhl_power = MHL_POWER_GPIO_PM8038,
Manoj Raoc6d904c2012-06-22 00:32:14 -07002012 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
2013};
2014
2015static struct i2c_board_info sii_device_info[] __initdata = {
2016 {
2017 /*
2018 * keeps SI 8334 as the default
2019 * MHL TX
2020 */
2021 I2C_BOARD_INFO("sii8334", 0x39),
2022 .platform_data = &mhl_platform_data,
2023 .flags = I2C_CLIENT_WAKE,
2024 },
2025};
2026
2027
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302028#ifdef MSM8930_PHASE_2
2029
David Collins04499982012-08-06 15:02:03 -07002030#define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3)
2031#define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8)
2032#define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10)
2033#define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11)
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302034
David Collins04499982012-08-06 15:02:03 -07002035#define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27)
2036#define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28)
2037#define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36)
2038#define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37)
2039
2040static struct gpio_keys_button keys_8930_pm8038[] = {
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302041 {
2042 .code = KEY_VOLUMEUP,
2043 .type = EV_KEY,
2044 .desc = "volume_up",
David Collins04499982012-08-06 15:02:03 -07002045 .gpio = GPIO_VOLUME_UP_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302046 .wakeup = 1,
2047 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002048 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302049 },
2050 {
2051 .code = KEY_VOLUMEDOWN,
2052 .type = EV_KEY,
2053 .desc = "volume_down",
David Collins04499982012-08-06 15:02:03 -07002054 .gpio = GPIO_VOLUME_DOWN_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302055 .wakeup = 1,
2056 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002057 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302058 },
2059 {
2060 .code = KEY_CAMERA_FOCUS,
2061 .type = EV_KEY,
2062 .desc = "camera_focus",
David Collins04499982012-08-06 15:02:03 -07002063 .gpio = GPIO_CAMERA_FOCUS_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302064 .wakeup = 1,
2065 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002066 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302067 },
2068 {
2069 .code = KEY_CAMERA_SNAPSHOT,
2070 .type = EV_KEY,
2071 .desc = "camera_snapshot",
David Collins04499982012-08-06 15:02:03 -07002072 .gpio = GPIO_CAMERA_SNAPSHOT_PM8038,
2073 .wakeup = 1,
2074 .active_low = 1,
2075 .debounce_interval = 15,
2076 },
2077};
2078
2079static struct gpio_keys_button keys_8930_pm8917[] = {
2080 {
2081 .code = KEY_VOLUMEUP,
2082 .type = EV_KEY,
2083 .desc = "volume_up",
2084 .gpio = GPIO_VOLUME_UP_PM8917,
2085 .wakeup = 1,
2086 .active_low = 1,
2087 .debounce_interval = 15,
2088 },
2089 {
2090 .code = KEY_VOLUMEDOWN,
2091 .type = EV_KEY,
2092 .desc = "volume_down",
2093 .gpio = GPIO_VOLUME_DOWN_PM8917,
2094 .wakeup = 1,
2095 .active_low = 1,
2096 .debounce_interval = 15,
2097 },
2098 {
2099 .code = KEY_CAMERA_FOCUS,
2100 .type = EV_KEY,
2101 .desc = "camera_focus",
2102 .gpio = GPIO_CAMERA_FOCUS_PM8917,
2103 .wakeup = 1,
2104 .active_low = 1,
2105 .debounce_interval = 15,
2106 },
2107 {
2108 .code = KEY_CAMERA_SNAPSHOT,
2109 .type = EV_KEY,
2110 .desc = "camera_snapshot",
2111 .gpio = GPIO_CAMERA_SNAPSHOT_PM8917,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302112 .wakeup = 1,
2113 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002114 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302115 },
2116};
2117
2118/* Add GPIO keys for 8930 */
2119static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
David Collins04499982012-08-06 15:02:03 -07002120 .buttons = keys_8930_pm8038,
2121 .nbuttons = ARRAY_SIZE(keys_8930_pm8038),
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302122};
2123
2124static struct platform_device gpio_keys_8930 = {
2125 .name = "gpio-keys",
2126 .id = -1,
2127 .dev = {
2128 .platform_data = &gpio_keys_8930_pdata,
2129 },
2130};
2131#endif /* MSM8930_PHASE_2 */
2132
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002133static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2134 .clk_freq = 100000,
2135 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002136};
2137
2138static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2139 .clk_freq = 100000,
2140 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002141};
2142
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002143static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
2144 .clk_freq = 100000,
2145 .src_clk_rate = 24000000,
2146};
2147
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002148static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2149 .clk_freq = 100000,
2150 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002151};
2152
2153static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2154 .clk_freq = 100000,
2155 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002156};
2157
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002158
2159static struct ks8851_pdata spi_eth_pdata = {
2160 .irq_gpio = KS8851_IRQ_GPIO,
2161 .rst_gpio = KS8851_RST_GPIO,
2162};
2163
2164static struct spi_board_info spi_board_info[] __initdata = {
2165 {
2166 .modalias = "ks8851",
2167 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2168 .max_speed_hz = 19200000,
2169 .bus_num = 0,
2170 .chip_select = 0,
2171 .mode = SPI_MODE_0,
2172 .platform_data = &spi_eth_pdata
2173 },
2174 {
2175 .modalias = "dsi_novatek_3d_panel_spi",
2176 .max_speed_hz = 10800000,
2177 .bus_num = 0,
2178 .chip_select = 1,
2179 .mode = SPI_MODE_0,
2180 },
2181};
2182
2183static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002184 .name = "saw-regulator",
2185 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002186 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002187 .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002188 },
2189};
2190
2191static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002192 .name = "saw-regulator",
2193 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002194 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002195 .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002196 },
2197};
2198
2199static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002200 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002201 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002202 .tsens_num_sensor = 10,
2203 .slope = {1132, 1135, 1137, 1135, 1157,
2204 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002205};
2206
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002207static struct platform_device msm_tsens_device = {
2208 .name = "tsens8960-tm",
2209 .id = -1,
2210};
2211
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002212static struct msm_thermal_data msm_thermal_pdata = {
2213 .sensor_id = 9,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002214 .poll_ms = 250,
2215 .limit_temp_degC = 60,
2216 .temp_hysteresis_degC = 10,
2217 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002218};
2219
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002220#ifdef CONFIG_MSM_FAKE_BATTERY
2221static struct platform_device fish_battery_device = {
2222 .name = "fish_battery",
2223};
2224#endif
2225
David Collins1d4061b2011-12-06 15:36:40 -08002226#ifndef MSM8930_PHASE_2
2227
2228/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002229static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002230 .name = GPIO_REGULATOR_DEV_NAME,
2231 .id = PM8921_MPP_PM_TO_SYS(7),
2232 .dev = {
2233 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2234 },
2235};
2236
Jay Chokshi06fa7542011-12-07 13:09:17 -08002237static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002238 .name = GPIO_REGULATOR_DEV_NAME,
2239 .id = 91,
2240 .dev = {
2241 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2242 },
2243};
2244
David Collins1d4061b2011-12-06 15:36:40 -08002245#else
2246
2247/* 8930 Phase 2 */
2248static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2249 .name = GPIO_REGULATOR_DEV_NAME,
2250 .id = 63,
2251 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002252 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2253 MSM8930_GPIO_VREG_ID_EXT_5V],
David Collins1d4061b2011-12-06 15:36:40 -08002254 },
2255};
2256
2257static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2258 .name = GPIO_REGULATOR_DEV_NAME,
2259 .id = 97,
2260 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002261 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2262 MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
David Collins1d4061b2011-12-06 15:36:40 -08002263 },
2264};
2265
2266#endif
2267
Jay Chokshi06fa7542011-12-07 13:09:17 -08002268static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002269 .name = "rpm-regulator",
2270 .id = -1,
2271 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002272#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002273 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002274#else
David Collins86161e42012-08-20 12:17:09 -07002275 .platform_data = &msm8930_pm8038_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002276#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002277 },
2278};
2279
David Collins86161e42012-08-20 12:17:09 -07002280static struct platform_device *early_common_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002281 &msm8960_device_dmov,
2282 &msm_device_smd,
2283 &msm8960_device_uart_gsbi5,
2284 &msm_device_uart_dm6,
2285 &msm_device_saw_core0,
2286 &msm_device_saw_core1,
David Collins86161e42012-08-20 12:17:09 -07002287};
2288
2289/* ext_5v and ext_otg_sw are present when using PM8038 */
2290static struct platform_device *pmic_pm8038_devices[] __initdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002291 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002292#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002293 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002294#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002295 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002296#ifdef MSM8930_PHASE_2
2297 &msm8930_device_ext_otg_sw_vreg,
2298#endif
David Collins86161e42012-08-20 12:17:09 -07002299};
2300
2301/* ext_5v and ext_otg_sw are not present when using PM8917 */
2302static struct platform_device *pmic_pm8917_devices[] __initdata = {
2303 &msm8960_device_ssbi_pmic,
2304};
2305
2306static struct platform_device *common_devices[] __initdata = {
Stephen Boyd28d54952011-12-16 13:19:51 -08002307 &msm_8960_q6_lpass,
2308 &msm_8960_q6_mss_fw,
2309 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002310 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002311 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002312 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002313 &msm8960_device_qup_spi_gsbi1,
2314 &msm8960_device_qup_i2c_gsbi3,
2315 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002316 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002317 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002318 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002319 &msm_slim_ctrl,
2320 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002321#if defined(CONFIG_QSEECOM)
2322 &qseecom_device,
2323#endif
2324
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002325#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2326 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2327 &qcrypto_device,
2328#endif
2329
2330#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2331 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2332 &qcedev_device,
2333#endif
2334#ifdef CONFIG_MSM_ROTATOR
2335 &msm_rotator_device,
2336#endif
2337 &msm_device_sps,
2338#ifdef CONFIG_MSM_FAKE_BATTERY
2339 &fish_battery_device,
2340#endif
2341#ifdef CONFIG_ANDROID_PMEM
2342#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002343 &msm8930_android_pmem_device,
2344 &msm8930_android_pmem_adsp_device,
2345 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302346#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2347#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002348 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002349 &msm_device_bam_dmux,
2350 &msm_fm_platform_init,
2351
2352#ifdef CONFIG_HW_RANDOM_MSM
2353 &msm_device_rng,
2354#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002355 &msm8930_rpm_device,
2356 &msm8930_rpm_log_device,
Girish Mahadevan898c56d2012-06-05 16:09:19 -06002357 &msm8930_rpm_rbcpr_device,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002358 &msm8930_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302359 &msm8930_rpm_master_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002360#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002361 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002362#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002363 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002364 &coresight_tpiu_device,
2365 &coresight_etb_device,
2366 &coresight_funnel_device,
2367 &coresight_etm0_device,
2368 &coresight_etm1_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002369 &msm_device_dspcrashd_8960,
2370 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302371#ifdef MSM8930_PHASE_2
2372 &gpio_keys_8930,
2373#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002374 &msm8930_rtb_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002375 &msm_bus_8930_apps_fabric,
2376 &msm_bus_8930_sys_fabric,
2377 &msm_bus_8930_mm_fabric,
2378 &msm_bus_8930_sys_fpb,
2379 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002380 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002381 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002382 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002383 &msm8930_cache_dump_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002384};
2385
2386static struct platform_device *cdp_devices[] __initdata = {
2387 &msm8960_device_otg,
2388 &msm8960_device_gadget_peripheral,
2389 &msm_device_hsusb_host,
2390 &android_usb_device,
2391 &msm_pcm,
2392 &msm_pcm_routing,
2393 &msm_cpudai0,
2394 &msm_cpudai1,
2395 &msm_cpudai_hdmi_rx,
2396 &msm_cpudai_bt_rx,
2397 &msm_cpudai_bt_tx,
2398 &msm_cpudai_fm_rx,
2399 &msm_cpudai_fm_tx,
2400 &msm_cpudai_auxpcm_rx,
2401 &msm_cpudai_auxpcm_tx,
2402 &msm_cpu_fe,
2403 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002404#ifdef CONFIG_MSM_GEMINI
2405 &msm8960_gemini_device,
2406#endif
2407 &msm_voice,
2408 &msm_voip,
2409 &msm_lpa_pcm,
2410 &msm_cpudai_afe_01_rx,
2411 &msm_cpudai_afe_01_tx,
2412 &msm_cpudai_afe_02_rx,
2413 &msm_cpudai_afe_02_tx,
2414 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002415 &msm_compr_dsp,
2416 &msm_cpudai_incall_music_rx,
2417 &msm_cpudai_incall_record_rx,
2418 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002419 &msm_pcm_hostless,
Asish Bhattacharya705c6732012-08-14 23:22:55 +05302420 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002421 &msm_lowlatency_pcm,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002422};
2423
2424static void __init msm8930_i2c_init(void)
2425{
2426 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2427 &msm8960_i2c_qup_gsbi4_pdata;
2428
2429 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2430 &msm8960_i2c_qup_gsbi3_pdata;
2431
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002432 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2433 &msm8960_i2c_qup_gsbi9_pdata;
2434
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002435 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2436 &msm8960_i2c_qup_gsbi10_pdata;
2437
2438 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2439 &msm8960_i2c_qup_gsbi12_pdata;
2440}
2441
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002442static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2443 {
2444 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2445 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2446 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002447 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002448 },
2449
2450 {
2451 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2452 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2453 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002454 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002455 },
2456
2457 {
2458 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2459 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2460 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002461 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002462 },
2463
2464 {
2465 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002466 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2467 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002468 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002469 },
2470
2471 {
2472 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2473 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2474 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002475 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002476 },
2477
2478 {
2479 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2480 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2481 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002482 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002483 },
2484
2485 {
2486 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2487 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2488 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002489 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002490 },
2491
2492 {
2493 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2494 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2495 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002496 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002497 },
2498};
2499
Praveen Chidambaram78499012011-11-01 17:15:17 -06002500static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2501 .levels = &msm_rpmrs_levels[0],
2502 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2503 .vdd_mem_levels = {
2504 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2505 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2506 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2507 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2508 },
2509 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002510 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2511 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2512 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2513 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002514 },
2515 .vdd_mask = 0x7FFFFF,
2516 .rpmrs_target_id = {
2517 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2518 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002519 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2520 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002521 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2522 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2523 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2524 },
2525};
2526
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002527static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = {
2528 .levels = &msm_rpmrs_levels[0],
2529 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2530 .vdd_mem_levels = {
2531 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2532 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2533 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2534 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2535 },
2536 .vdd_dig_levels = {
2537 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2538 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2539 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2540 [MSM_RPMRS_VDD_DIG_MAX] = 3,
2541 },
2542 .vdd_mask = 0x7FFFFF,
2543 .rpmrs_target_id = {
2544 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2545 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2546 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2547 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
2548 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0,
2549 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1,
2550 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2551 },
2552};
2553
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002554static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2555 .mode = MSM_PM_BOOT_CONFIG_TZ,
2556};
2557
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002558#ifdef CONFIG_I2C
2559#define I2C_SURF 1
2560#define I2C_FFA (1 << 1)
2561#define I2C_RUMI (1 << 2)
2562#define I2C_SIM (1 << 3)
2563#define I2C_FLUID (1 << 4)
2564#define I2C_LIQUID (1 << 5)
2565
2566struct i2c_registry {
2567 u8 machs;
2568 int bus;
2569 struct i2c_board_info *info;
2570 int len;
2571};
2572
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002573#ifdef CONFIG_INPUT_MPU3050
2574#define MPU3050_INT_GPIO 69
2575
2576static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2577 .gpio_int = MPU3050_INT_GPIO,
2578};
2579
2580static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2581 {
2582 I2C_BOARD_INFO("mpu3050", 0x68),
Wentao Xuc7769c02012-08-03 15:06:41 -04002583 .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO),
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002584 .platform_data = &mpu3050_gyro,
2585 },
2586};
2587#endif
2588
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002589#ifdef CONFIG_ISL9519_CHARGER
2590static struct isl_platform_data isl_data __initdata = {
2591 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2592 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2593 .max_system_voltage = 4200,
2594 .min_system_voltage = 3200,
2595 .chgcurrent = 1000, /* 1900, */
2596 .term_current = 400, /* Need fine tuning */
2597 .input_current = 2048,
2598};
2599
2600static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2601 {
2602 I2C_BOARD_INFO("isl9519q", 0x9),
2603 .irq = 0, /* Not required when notify-by-pmic */
2604 .platform_data = &isl_data,
2605 },
2606};
2607#endif /* CONFIG_ISL9519_CHARGER */
2608
Wentao Xu114c0152012-06-12 11:40:38 -04002609#ifdef CONFIG_STM_LIS3DH
2610static struct lis3dh_acc_platform_data lis3dh_accel = {
2611 .poll_interval = 200,
2612 .min_interval = 10,
2613 .g_range = LIS3DH_ACC_G_2G,
2614 .axis_map_x = 1,
2615 .axis_map_y = 0,
2616 .axis_map_z = 2,
2617 .negate_x = 0,
2618 .negate_y = 0,
2619 .negate_z = 1,
2620 .init = NULL,
2621 .exit = NULL,
2622 .gpio_int1 = -EINVAL,
2623 .gpio_int2 = -EINVAL,
2624};
2625
2626static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = {
2627 {
2628 I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18),
2629 .platform_data = &lis3dh_accel,
2630 },
2631};
2632#endif /* CONFIG_STM_LIS3DH */
2633
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002634static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002635#ifdef CONFIG_ISL9519_CHARGER
2636 {
2637 I2C_LIQUID,
2638 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2639 isl_charger_i2c_info,
2640 ARRAY_SIZE(isl_charger_i2c_info),
2641 },
2642#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002643#ifdef CONFIG_INPUT_MPU3050
2644 {
2645 I2C_FFA | I2C_FLUID,
2646 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2647 mpu3050_i2c_boardinfo,
2648 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2649 },
2650#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002651 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002652 I2C_SURF | I2C_FFA | I2C_FLUID,
2653 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002654 msm_isa1200_board_info,
2655 ARRAY_SIZE(msm_isa1200_board_info),
2656 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002657 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002658 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002659 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2660 mxt_device_info_8930,
2661 ARRAY_SIZE(mxt_device_info_8930),
2662 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002663 {
2664 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2665 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2666 sii_device_info,
2667 ARRAY_SIZE(sii_device_info),
2668 },
Wentao Xu114c0152012-06-12 11:40:38 -04002669#ifdef CONFIG_STM_LIS3DH
2670 {
2671 I2C_FFA | I2C_FLUID,
2672 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2673 lis3dh_i2c_boardinfo,
2674 ARRAY_SIZE(lis3dh_i2c_boardinfo),
2675 },
2676#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002677};
2678#endif /* CONFIG_I2C */
2679
2680static void __init register_i2c_devices(void)
2681{
2682#ifdef CONFIG_I2C
2683 u8 mach_mask = 0;
2684 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002685#ifdef CONFIG_MSM_CAMERA
2686 struct i2c_registry msm8930_camera_i2c_devices = {
2687 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2688 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2689 msm8930_camera_board_info.board_info,
2690 msm8930_camera_board_info.num_i2c_board_info,
2691 };
2692#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002693
2694 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002695 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002696 mach_mask = I2C_SURF;
2697 else if (machine_is_msm8930_fluid())
2698 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002699 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002700 mach_mask = I2C_FFA;
2701 else
2702 pr_err("unmatched machine ID in register_i2c_devices\n");
2703
2704 /* Run the array and install devices as appropriate */
2705 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2706 if (msm8960_i2c_devices[i].machs & mach_mask)
2707 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2708 msm8960_i2c_devices[i].info,
2709 msm8960_i2c_devices[i].len);
2710 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002711#ifdef CONFIG_MSM_CAMERA
2712 if (msm8930_camera_i2c_devices.machs & mach_mask)
2713 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2714 msm8930_camera_i2c_devices.info,
2715 msm8930_camera_i2c_devices.len);
2716#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002717#endif
2718}
2719
David Collins04499982012-08-06 15:02:03 -07002720/* Modify platform data values to match requirements for PM8917. */
2721static void __init msm8930_pm8917_pdata_fixup(void)
2722{
Patrick Dalya3b73c42012-08-28 13:39:17 -07002723 struct acpuclk_platform_data *pdata;
2724
David Collins04499982012-08-06 15:02:03 -07002725 mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917;
2726
2727 gpio_keys_8930_pdata.buttons = keys_8930_pm8917;
2728 gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917);
David Collins86161e42012-08-20 12:17:09 -07002729
2730 msm_device_saw_core0.dev.platform_data
2731 = &msm8930_pm8038_saw_regulator_core0_pdata;
2732 msm_device_saw_core1.dev.platform_data
2733 = &msm8930_pm8038_saw_regulator_core1_pdata;
2734
2735 msm8930_device_rpm_regulator.dev.platform_data
2736 = &msm8930_pm8917_rpm_regulator_pdata;
Patrick Dalya3b73c42012-08-28 13:39:17 -07002737
2738 pdata = msm8930_device_acpuclk.dev.platform_data;
2739 pdata->uses_pm8917 = true;
David Collins04499982012-08-06 15:02:03 -07002740}
2741
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002742static void __init msm8930_cdp_init(void)
2743{
David Collins04499982012-08-06 15:02:03 -07002744 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2745 msm8930_pm8917_pdata_fixup();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002746 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2747 pr_err("meminfo_init() failed!\n");
2748
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07002749 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002750 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002751 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002752 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
2753 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2754 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
2755 } else {
2756 BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917));
2757 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917));
2758 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002759
2760 regulator_suppress_info_printing();
2761 if (msm_xo_init())
2762 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002763 platform_device_register(&msm8930_device_rpm_regulator);
Patrick Dalyb1d5f752012-08-27 16:25:07 -07002764 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2765 msm_clock_init(&msm8930_pm8917_clock_init_data);
2766 else
2767 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302768 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002769 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302770 android_usb_pdata.swfi_latency =
2771 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002772 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002773 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2774 &msm8960_qup_spi_gsbi1_pdata;
2775 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2776
Jay Chokshi06fa7542011-12-07 13:09:17 -08002777 /*
2778 * TODO: When physical 8930/PM8038 hardware becomes
2779 * available, remove this block or add the config
2780 * option.
2781 */
2782#ifndef MSM8930_PHASE_2
2783 msm8960_init_pmic();
2784#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002785 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002786#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002787 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302788 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002789 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2790 msm_spm_l2_init(msm_spm_l2_data);
2791 msm8930_init_buses();
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002792 if (cpu_is_msm8627()) {
Tianyi Gou723843b2012-06-13 15:24:56 -07002793 platform_add_devices(msm8627_footswitch,
2794 msm8627_num_footswitch);
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002795 } else {
2796 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2797 platform_add_devices(msm8930_pm8917_footswitch,
2798 msm8930_pm8917_num_footswitch);
2799 else
2800 platform_add_devices(msm8930_footswitch,
2801 msm8930_num_footswitch);
2802 }
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002803 if (cpu_is_msm8627())
Matt Wagantallab730bd2012-06-07 20:13:51 -07002804 platform_device_register(&msm8627_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002805 else if (cpu_is_msm8930())
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002806 platform_device_register(&msm8930_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002807 else if (cpu_is_msm8930aa())
2808 platform_device_register(&msm8930aa_device_acpuclk);
David Collins86161e42012-08-20 12:17:09 -07002809 platform_add_devices(early_common_devices,
2810 ARRAY_SIZE(early_common_devices));
2811 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2812 platform_add_devices(pmic_pm8038_devices,
2813 ARRAY_SIZE(pmic_pm8038_devices));
2814 else
2815 platform_add_devices(pmic_pm8917_devices,
2816 ARRAY_SIZE(pmic_pm8917_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002817 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002818 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002819 /*
2820 * TODO: When physical 8930/PM8038 hardware becomes
2821 * available, remove this block or add the config
2822 * option.
2823 */
2824#ifndef MSM8930_PHASE_2
2825 msm8960_pm8921_gpio_mpp_init();
2826#else
David Collins04499982012-08-06 15:02:03 -07002827 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2828 msm8930_pm8038_gpio_mpp_init();
2829 else
2830 msm8930_pm8917_gpio_mpp_init();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002831#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002832 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002833#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002834 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002835#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002836 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002837 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002838 register_i2c_devices();
2839 msm8930_init_fb();
2840 slim_register_board_info(msm_slim_devices,
2841 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002842 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002843 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002844
2845 if (PLATFORM_IS_CHARM25())
2846 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2847}
2848
2849MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2850 .map_io = msm8930_map_io,
2851 .reserve = msm8930_reserve,
2852 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302853 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002854 .timer = &msm_timer,
2855 .init_machine = msm8930_cdp_init,
2856 .init_early = msm8930_allocate_memory_regions,
2857 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002858 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002859MACHINE_END
2860
2861MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2862 .map_io = msm8930_map_io,
2863 .reserve = msm8930_reserve,
2864 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302865 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002866 .timer = &msm_timer,
2867 .init_machine = msm8930_cdp_init,
2868 .init_early = msm8930_allocate_memory_regions,
2869 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002870 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002871MACHINE_END
2872
2873MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2874 .map_io = msm8930_map_io,
2875 .reserve = msm8930_reserve,
2876 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302877 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002878 .timer = &msm_timer,
2879 .init_machine = msm8930_cdp_init,
2880 .init_early = msm8930_allocate_memory_regions,
2881 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002882 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002883MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002884
2885MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2886 .map_io = msm8930_map_io,
2887 .reserve = msm8930_reserve,
2888 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302889 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002890 .timer = &msm_timer,
2891 .init_machine = msm8930_cdp_init,
2892 .init_early = msm8930_allocate_memory_regions,
2893 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002894 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002895MACHINE_END
2896
2897MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2898 .map_io = msm8930_map_io,
2899 .reserve = msm8930_reserve,
2900 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302901 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002902 .timer = &msm_timer,
2903 .init_machine = msm8930_cdp_init,
2904 .init_early = msm8930_allocate_memory_regions,
2905 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002906 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002907MACHINE_END