blob: 00bd500bb6d48aac3b1062b850bb71919e7d2560 [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>
Matt Wagantalld55b90f2012-02-23 23:27:44 -0800100#include "clock.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800101#include "smd_private.h"
102#include "pm-boot.h"
103#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -0800104#include "board-8930.h"
Patrick Dalya3b73c42012-08-28 13:39:17 -0700105#include "acpuclock-krait.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800106
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800107static struct platform_device msm_fm_platform_init = {
108 .name = "iris_fm",
109 .id = -1,
110};
111
112#define KS8851_RST_GPIO 89
113#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800114#define HAP_SHIFT_LVL_OE_GPIO 47
115
Manoj Raoc6d904c2012-06-22 00:32:14 -0700116#define HDMI_MHL_MUX_GPIO 73
117#define MHL_GPIO_INT 72
118#define MHL_GPIO_RESET 71
119#define MHL_GPIO_PWR_EN 5
120
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800121#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
122
123struct sx150x_platform_data msm8930_sx150x_data[] = {
124 [SX150X_CAM] = {
125 .gpio_base = GPIO_CAM_EXPANDER_BASE,
126 .oscio_is_gpo = false,
127 .io_pullup_ena = 0x0,
128 .io_pulldn_ena = 0xc0,
129 .io_open_drain_ena = 0x0,
130 .irq_summary = -1,
131 },
132};
133
134#endif
135
Olav Haugana21169d2012-01-04 09:17:06 -0800136#define MSM_PMEM_ADSP_SIZE 0x7800000
Sudhir Sharmab83b1472012-11-28 19:46:13 -0800137#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800138#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
139#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
140#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800141#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800142#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700143#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800144
145#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur9830bf02012-06-01 15:04:29 -0700146#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700147#define MSM_CONTIG_MEM_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700148#ifdef CONFIG_MSM_IOMMU
149#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
150#define MSM_ION_SF_SIZE 0x0
Olav Haugan494e4dc2012-05-15 15:14:31 -0700151#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Hanumant Singhedfb0462012-05-15 14:49:32 -0700152#define MSM_ION_HEAP_NUM 7
153#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800154#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800155#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan494e4dc2012-05-15 15:14:31 -0700156#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Hanumant Singheea62562012-05-14 11:32:45 -0700157#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700158#endif
Deepak Kotur9830bf02012-06-01 15:04:29 -0700159#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800160#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800161#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700162
163#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
164#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
165#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
166
Deepak Kotur9830bf02012-06-01 15:04:29 -0700167#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */
168#define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
169 HOLE_SIZE))
Hanumant Singheea62562012-05-14 11:32:45 -0700170#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur9830bf02012-06-01 15:04:29 -0700171#define MSM8930_FW_START MSM8930_FIXED_AREA_START
Hanumant Singheea62562012-05-14 11:32:45 -0700172
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800173#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700174#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800175#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800176#endif
177
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700178#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
179static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
180static int __init msm_contig_mem_size_setup(char *p)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800181{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700182 msm_contig_mem_size = memparse(p, NULL);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800183 return 0;
184}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700185early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800186#endif
187
188#ifdef CONFIG_ANDROID_PMEM
189static unsigned pmem_size = MSM_PMEM_SIZE;
190static int __init pmem_size_setup(char *p)
191{
192 pmem_size = memparse(p, NULL);
193 return 0;
194}
195early_param("pmem_size", pmem_size_setup);
196
197static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
198
199static int __init pmem_adsp_size_setup(char *p)
200{
201 pmem_adsp_size = memparse(p, NULL);
202 return 0;
203}
204early_param("pmem_adsp_size", pmem_adsp_size_setup);
205
206static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
207
208static int __init pmem_audio_size_setup(char *p)
209{
210 pmem_audio_size = memparse(p, NULL);
211 return 0;
212}
213early_param("pmem_audio_size", pmem_audio_size_setup);
214#endif
215
216#ifdef CONFIG_ANDROID_PMEM
217#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
218static struct android_pmem_platform_data android_pmem_pdata = {
219 .name = "pmem",
220 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
221 .cached = 1,
222 .memory_type = MEMTYPE_EBI1,
223};
224
Laura Abbottb93525f2012-04-12 09:57:19 -0700225static struct platform_device msm8930_android_pmem_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800226 .name = "android_pmem",
227 .id = 0,
228 .dev = {.platform_data = &android_pmem_pdata},
229};
230
231static struct android_pmem_platform_data android_pmem_adsp_pdata = {
232 .name = "pmem_adsp",
233 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
234 .cached = 0,
235 .memory_type = MEMTYPE_EBI1,
236};
Laura Abbottb93525f2012-04-12 09:57:19 -0700237static struct platform_device msm8930_android_pmem_adsp_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800238 .name = "android_pmem",
239 .id = 2,
240 .dev = { .platform_data = &android_pmem_adsp_pdata },
241};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800242
243static struct android_pmem_platform_data android_pmem_audio_pdata = {
244 .name = "pmem_audio",
245 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
246 .cached = 0,
247 .memory_type = MEMTYPE_EBI1,
248};
249
Laura Abbottb93525f2012-04-12 09:57:19 -0700250static struct platform_device msm8930_android_pmem_audio_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800251 .name = "android_pmem",
252 .id = 4,
253 .dev = { .platform_data = &android_pmem_audio_pdata },
254};
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530255#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
256#endif /* CONFIG_ANDROID_PMEM */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800257
Hanumant Singheea62562012-05-14 11:32:45 -0700258struct fmem_platform_data msm8930_fmem_pdata = {
259};
260
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800261#define DSP_RAM_BASE_8960 0x8da00000
262#define DSP_RAM_SIZE_8960 0x1800000
263static int dspcrashd_pdata_8960 = 0xDEADDEAD;
264
265static struct resource resources_dspcrashd_8960[] = {
266 {
267 .name = "msm_dspcrashd",
268 .start = DSP_RAM_BASE_8960,
269 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
270 .flags = IORESOURCE_DMA,
271 },
272};
273
274static struct platform_device msm_device_dspcrashd_8960 = {
275 .name = "msm_dspcrashd",
276 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
277 .resource = resources_dspcrashd_8960,
278 .dev = { .platform_data = &dspcrashd_pdata_8960 },
279};
280
281static struct memtype_reserve msm8930_reserve_table[] __initdata = {
282 [MEMTYPE_SMI] = {
283 },
284 [MEMTYPE_EBI0] = {
285 .flags = MEMTYPE_FLAGS_1M_ALIGN,
286 },
287 [MEMTYPE_EBI1] = {
288 .flags = MEMTYPE_FLAGS_1M_ALIGN,
289 },
290};
291
Laura Abbottf8c03b92012-02-16 14:57:58 -0800292
293static void __init reserve_rtb_memory(void)
294{
295#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700296 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800297#endif
298}
299
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800300static void __init size_pmem_devices(void)
301{
302#ifdef CONFIG_ANDROID_PMEM
303#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
304 android_pmem_adsp_pdata.size = pmem_adsp_size;
305 android_pmem_pdata.size = pmem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800306 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530307#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
308#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800309}
310
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530311#ifdef CONFIG_ANDROID_PMEM
312#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800313static void __init reserve_memory_for(struct android_pmem_platform_data *p)
314{
315 msm8930_reserve_table[p->memory_type].size += p->size;
316}
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530317#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
318#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800319
320static void __init reserve_pmem_memory(void)
321{
322#ifdef CONFIG_ANDROID_PMEM
323#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
324 reserve_memory_for(&android_pmem_adsp_pdata);
325 reserve_memory_for(&android_pmem_pdata);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800326 reserve_memory_for(&android_pmem_audio_pdata);
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530327#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700328 msm8930_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530329#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800330}
331
332static int msm8930_paddr_to_memtype(unsigned int paddr)
333{
334 return MEMTYPE_EBI1;
335}
336
Steve Mucklef132c6c2012-06-06 18:30:57 -0700337#define FMEM_ENABLED 0
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800338#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800339#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700340static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800341 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800342 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700343 .reusable = FMEM_ENABLED,
344 .mem_is_fmem = FMEM_ENABLED,
345 .fixed_position = FIXED_MIDDLE,
Laura Abbottadec9c72012-12-05 11:49:59 -0800346 .is_cma = 1,
Laura Abbott5249a052012-12-11 15:09:03 -0800347 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800348};
349
Laura Abbottb93525f2012-04-12 09:57:19 -0700350static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800351 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800352 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700353 .reusable = 0,
354 .mem_is_fmem = FMEM_ENABLED,
355 .fixed_position = FIXED_HIGH,
Laura Abbott5249a052012-12-11 15:09:03 -0800356 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800357};
Hanumant Singheea62562012-05-14 11:32:45 -0700358
Laura Abbottb93525f2012-04-12 09:57:19 -0700359static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800360 .adjacent_mem_id = INVALID_HEAP_ID,
361 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700362 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800363};
Hanumant Singheea62562012-05-14 11:32:45 -0700364
Laura Abbottb93525f2012-04-12 09:57:19 -0700365static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800366 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
367 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700368 .mem_is_fmem = FMEM_ENABLED,
369 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800370};
371#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800372
Laura Abbott87eafac2012-09-18 11:45:43 -0700373
374static u64 msm_dmamask = DMA_BIT_MASK(32);
375
376static struct platform_device ion_mm_heap_device = {
377 .name = "ion-mm-heap-device",
378 .id = -1,
379 .dev = {
380 .dma_mask = &msm_dmamask,
381 .coherent_dma_mask = DMA_BIT_MASK(32),
382 }
383};
384
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800385/**
386 * These heaps are listed in the order they will be allocated. Due to
387 * video hardware restrictions and content protection the FW heap has to
388 * be allocated adjacent (below) the MM heap and the MFC heap has to be
389 * allocated after the MM heap to ensure MFC heap is not more than 256MB
390 * away from the base address of the FW heap.
391 * However, the order of FW heap and MM heap doesn't matter since these
392 * two heaps are taken care of by separate code to ensure they are adjacent
393 * to each other.
394 * Don't swap the order unless you know what you are doing!
395 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700396struct ion_platform_heap msm8930_heaps[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800397 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800398 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800399 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800400 .name = ION_VMALLOC_HEAP_NAME,
401 },
402#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
403 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800404 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800405 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800406 .name = ION_MM_HEAP_NAME,
407 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800408 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700409 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Laura Abbott87eafac2012-09-18 11:45:43 -0700410 .priv = &ion_mm_heap_device.dev
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800411 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800412 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800413 .id = ION_MM_FIRMWARE_HEAP_ID,
414 .type = ION_HEAP_TYPE_CARVEOUT,
415 .name = ION_MM_FIRMWARE_HEAP_NAME,
416 .size = MSM_ION_MM_FW_SIZE,
417 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700418 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800419 },
420 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800421 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800422 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800423 .name = ION_MFC_HEAP_NAME,
424 .size = MSM_ION_MFC_SIZE,
425 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700426 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800427 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700428#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800429 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800430 .id = ION_SF_HEAP_ID,
431 .type = ION_HEAP_TYPE_CARVEOUT,
432 .name = ION_SF_HEAP_NAME,
433 .size = MSM_ION_SF_SIZE,
434 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700435 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800436 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700437#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800438 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800439 .id = ION_IOMMU_HEAP_ID,
440 .type = ION_HEAP_TYPE_IOMMU,
441 .name = ION_IOMMU_HEAP_NAME,
442 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800443 {
444 .id = ION_QSECOM_HEAP_ID,
445 .type = ION_HEAP_TYPE_CARVEOUT,
446 .name = ION_QSECOM_HEAP_NAME,
447 .size = MSM_ION_QSECOM_SIZE,
448 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700449 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800450 },
Olav Haugan7355db02012-01-13 16:59:13 -0800451 {
452 .id = ION_AUDIO_HEAP_ID,
453 .type = ION_HEAP_TYPE_CARVEOUT,
454 .name = ION_AUDIO_HEAP_NAME,
455 .size = MSM_ION_AUDIO_SIZE,
456 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700457 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800458 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800459#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700460};
461
462static struct ion_platform_data msm8930_ion_pdata = {
463 .nr = MSM_ION_HEAP_NUM,
464 .heaps = msm8930_heaps,
465
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800466};
467
Laura Abbottb93525f2012-04-12 09:57:19 -0700468static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800469 .name = "ion-msm",
470 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700471 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800472};
473#endif
474
Hanumant Singheea62562012-05-14 11:32:45 -0700475struct platform_device msm8930_fmem_device = {
476 .name = "fmem",
477 .id = 1,
478 .dev = { .platform_data = &msm8930_fmem_pdata },
479};
480
481static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
482 unsigned long size)
483{
484 msm8930_reserve_table[mem_type].size += size;
485}
486
487static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
488{
489#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
490 int ret;
491
492 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
493 panic("fixed area size is larger than %dM\n",
494 MAX_FIXED_AREA_SIZE >> 20);
495
496 reserve_info->fixed_area_size = fixed_area_size;
497 reserve_info->fixed_area_start = MSM8930_FW_START;
498
499 ret = memblock_remove(reserve_info->fixed_area_start,
500 reserve_info->fixed_area_size);
501 BUG_ON(ret);
502#endif
503}
504
505/**
506 * Reserve memory for ION and calculate amount of reusable memory for fmem.
507 * We only reserve memory for heaps that are not reusable. However, we only
508 * support one reusable heap at the moment so we ignore the reusable flag for
509 * other than the first heap with reusable flag set. Also handle special case
510 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
511 * at a higher address than FW in addition to not more than 256MB away from the
512 * base address of the firmware. This means that if MM is reusable the other
513 * two heaps must be allocated in the same region as FW. This is handled by the
514 * mem_is_fmem flag in the platform data. In addition the MM heap must be
515 * adjacent to the FW heap for content protection purposes.
516 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700517static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800518{
519#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700520 unsigned int i;
Laura Abbott87eafac2012-09-18 11:45:43 -0700521 int ret;
Hanumant Singheea62562012-05-14 11:32:45 -0700522 unsigned int fixed_size = 0;
523 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
524 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700525 unsigned long cma_alignment;
526 unsigned int low_use_cma = 0;
527 unsigned int middle_use_cma = 0;
528 unsigned int high_use_cma = 0;
Hanumant Singheea62562012-05-14 11:32:45 -0700529
Hanumant Singheea62562012-05-14 11:32:45 -0700530 fixed_low_size = 0;
531 fixed_middle_size = 0;
532 fixed_high_size = 0;
533
Laura Abbott87eafac2012-09-18 11:45:43 -0700534 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
535
Hanumant Singheea62562012-05-14 11:32:45 -0700536 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
Laura Abbott87eafac2012-09-18 11:45:43 -0700537 struct ion_platform_heap *heap =
Hanumant Singheea62562012-05-14 11:32:45 -0700538 &(msm8930_ion_pdata.heaps[i]);
539
Laura Abbott87eafac2012-09-18 11:45:43 -0700540 int use_cma = 0;
541
Hanumant Singheea62562012-05-14 11:32:45 -0700542 if (heap->extra_data) {
543 int fixed_position = NOT_FIXED;
Hanumant Singheea62562012-05-14 11:32:45 -0700544
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700545 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700546 case ION_HEAP_TYPE_CP:
Laura Abbott87eafac2012-09-18 11:45:43 -0700547 if (((struct ion_cp_heap_pdata *)
548 heap->extra_data)->is_cma) {
549 heap->size = ALIGN(heap->size,
550 cma_alignment);
551 use_cma = 1;
552 }
Hanumant Singheea62562012-05-14 11:32:45 -0700553 fixed_position = ((struct ion_cp_heap_pdata *)
554 heap->extra_data)->fixed_position;
555 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700556 case ION_HEAP_TYPE_DMA:
557 use_cma = 1;
558 /* Purposely fall through here */
Hanumant Singheea62562012-05-14 11:32:45 -0700559 case ION_HEAP_TYPE_CARVEOUT:
Hanumant Singheea62562012-05-14 11:32:45 -0700560 fixed_position = ((struct ion_co_heap_pdata *)
561 heap->extra_data)->fixed_position;
562 break;
563 default:
564 break;
565 }
566
567 if (fixed_position != NOT_FIXED)
568 fixed_size += heap->size;
569 else
570 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
571
Laura Abbott87eafac2012-09-18 11:45:43 -0700572 if (fixed_position == FIXED_LOW) {
Hanumant Singheea62562012-05-14 11:32:45 -0700573 fixed_low_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700574 low_use_cma = use_cma;
575 } else if (fixed_position == FIXED_MIDDLE) {
Hanumant Singheea62562012-05-14 11:32:45 -0700576 fixed_middle_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700577 middle_use_cma = use_cma;
578 } else if (fixed_position == FIXED_HIGH) {
Hanumant Singheea62562012-05-14 11:32:45 -0700579 fixed_high_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700580 high_use_cma = use_cma;
581 } else if (use_cma) {
582 /*
583 * Heaps that use CMA but are not part of the
584 * fixed set. Create wherever.
585 */
586 dma_declare_contiguous(
587 heap->priv,
588 heap->size,
589 0,
590 0xb0000000);
591 }
Hanumant Singheea62562012-05-14 11:32:45 -0700592 }
593 }
594
595 if (!fixed_size)
596 return;
Laura Abbott87eafac2012-09-18 11:45:43 -0700597 /*
598 * Given the setup for the fixed area, we can't round up all sizes.
599 * Some sizes must be set up exactly and aligned correctly. Incorrect
600 * alignments are considered a configuration issue
Hanumant Singheea62562012-05-14 11:32:45 -0700601 */
Hanumant Singheea62562012-05-14 11:32:45 -0700602
603 fixed_low_start = MSM8930_FIXED_AREA_START;
Laura Abbott87eafac2012-09-18 11:45:43 -0700604 if (low_use_cma) {
605 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
606 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
607 } else {
608 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
609 ret = memblock_remove(fixed_low_start,
610 fixed_low_size + HOLE_SIZE);
611 BUG_ON(ret);
612 }
613
Deepak Kotur9830bf02012-06-01 15:04:29 -0700614 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott87eafac2012-09-18 11:45:43 -0700615 if (middle_use_cma) {
616 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
617 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
618 } else {
619 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
620 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
621 BUG_ON(ret);
622 }
623
Hanumant Singheea62562012-05-14 11:32:45 -0700624 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700625 if (high_use_cma) {
626 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
627 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
628 } else {
629 /* This is the end of the fixed area so it's okay to round up */
630 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
631 ret = memblock_remove(fixed_high_start, fixed_high_size);
632 BUG_ON(ret);
633 }
Hanumant Singheea62562012-05-14 11:32:45 -0700634
635 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
636 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
637
638 if (heap->extra_data) {
639 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700640 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700641
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700642 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700643 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700644 pdata =
645 (struct ion_cp_heap_pdata *)heap->extra_data;
646 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700647 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700648 case ION_HEAP_TYPE_DMA:
Hanumant Singheea62562012-05-14 11:32:45 -0700649 case ION_HEAP_TYPE_CARVEOUT:
650 fixed_position = ((struct ion_co_heap_pdata *)
651 heap->extra_data)->fixed_position;
652 break;
653 default:
654 break;
655 }
656
657 switch (fixed_position) {
658 case FIXED_LOW:
659 heap->base = fixed_low_start;
660 break;
661 case FIXED_MIDDLE:
662 heap->base = fixed_middle_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700663 if (middle_use_cma)
664 dma_declare_contiguous(
665 &ion_mm_heap_device.dev,
666 heap->size,
667 fixed_middle_start,
668 0xa0000000);
Deepak Kotur9830bf02012-06-01 15:04:29 -0700669 pdata->secure_base = fixed_middle_start
670 - HOLE_SIZE;
671 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700672 break;
673 case FIXED_HIGH:
674 heap->base = fixed_high_start;
675 break;
676 default:
677 break;
678 }
679 }
680 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800681#endif
682}
Huaibin Yanga5419422011-12-08 23:52:10 -0800683
684static void __init reserve_mdp_memory(void)
685{
686 msm8930_mdp_writeback(msm8930_reserve_table);
687}
688
Laura Abbottf3173042012-05-29 15:23:18 -0700689#ifdef CONFIG_MSM_CACHE_DUMP
690static void __init reserve_cache_dump_memory(void)
691{
692 unsigned int total;
693
694 total = msm8930_cache_dump_pdata.l1_size +
695 msm8930_cache_dump_pdata.l2_size;
696 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
697}
698#else
699static void __init reserve_cache_dump_memory(void) { }
700#endif
701
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800702static void __init msm8930_calculate_reserve_sizes(void)
703{
704 size_pmem_devices();
705 reserve_pmem_memory();
706 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800707 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800708 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700709 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800710}
711
712static struct reserve_info msm8930_reserve_info __initdata = {
713 .memtype_reserve_table = msm8930_reserve_table,
714 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700715 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800716 .paddr_to_memtype = msm8930_paddr_to_memtype,
717};
718
719static int msm8930_memory_bank_size(void)
720{
721 return 1<<29;
722}
723
724static void __init locate_unstable_memory(void)
725{
726 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
727 unsigned long bank_size;
728 unsigned long low, high;
729
730 bank_size = msm8930_memory_bank_size();
731 low = meminfo.bank[0].start;
732 high = mb->start + mb->size;
733
734 /* Check if 32 bit overflow occured */
735 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700736 high -= PAGE_SIZE;
737
738 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
739 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800740
741 low &= ~(bank_size - 1);
742
743 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700744 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800745
746 msm8930_reserve_info.bank_size = bank_size;
747#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800748 msm8930_reserve_info.low_unstable_address = mb->start -
749 MIN_MEMORY_BLOCK_SIZE + mb->size;
750 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800751 pr_info("low unstable address %lx max size %lx bank size %lx\n",
752 msm8930_reserve_info.low_unstable_address,
753 msm8930_reserve_info.max_unstable_size,
754 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700755 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800756#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700757no_dmm:
758 msm8930_reserve_info.low_unstable_address = high;
759 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800760}
761
762static void __init place_movable_zone(void)
763{
Larry Basselb8d61022012-02-24 10:49:45 -0800764#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800765 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
766 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
767 pr_info("movable zone start %lx size %lx\n",
768 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800769#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800770}
771
772static void __init msm8930_early_memory(void)
773{
774 reserve_info = &msm8930_reserve_info;
775 locate_unstable_memory();
776 place_movable_zone();
777}
778
779static void __init msm8930_reserve(void)
780{
781 msm_reserve();
782}
783
784static int msm8930_change_memory_power(u64 start, u64 size,
785 int change_type)
786{
787 return soc_change_memory_power(start, size, change_type);
788}
789
790static void __init msm8930_allocate_memory_regions(void)
791{
792 msm8930_allocate_fb_region();
793}
794
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530795#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800796
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530797#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800798
799/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
800 * 4 micbiases are used to power various analog and digital
801 * microphones operating at 1800 mV. Technically, all micbiases
802 * can source from single cfilter since all microphones operate
803 * at the same voltage level. The arrangement below is to make
804 * sure all cfilters are exercised. LDO_H regulator ouput level
805 * does not need to be as high as 2.85V. It is choosen for
806 * microphone sensitivity purpose.
807 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530808static struct wcd9xxx_pdata sitar_platform_data = {
809 .slimbus_slave_device = {
810 .name = "sitar-slave",
811 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800812 },
813 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530814 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530815 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530816 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800817 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530818 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800819 .cfilt1_mv = 1800,
820 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530821 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
822 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700823 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
824 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530825 },
826 .regulator = {
827 {
828 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700829 .min_uV = 1800000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530830 .max_uV = 2200000,
831 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
832 },
833 {
834 .name = "CDC_VDDA_RX",
835 .min_uV = 1800000,
836 .max_uV = 1800000,
837 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
838 },
839 {
840 .name = "CDC_VDDA_TX",
841 .min_uV = 1800000,
842 .max_uV = 1800000,
843 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
844 },
845 {
846 .name = "VDDIO_CDC",
847 .min_uV = 1800000,
848 .max_uV = 1800000,
849 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
850 },
851 {
852 .name = "VDDD_CDC_D",
853 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700854 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530855 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
856 },
857 {
858 .name = "CDC_VDDA_A_1P2V",
859 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700860 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530861 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
862 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800863 },
864};
865
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530866static struct slim_device msm_slim_sitar = {
867 .name = "sitar-slim",
868 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800869 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530870 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800871 },
872};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700873
874static struct wcd9xxx_pdata sitar1p1_platform_data = {
875 .slimbus_slave_device = {
876 .name = "sitar-slave",
877 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
878 },
879 .irq = MSM_GPIO_TO_INT(62),
880 .irq_base = SITAR_INTERRUPT_BASE,
881 .num_irqs = NR_WCD9XXX_IRQS,
882 .reset_gpio = 42,
883 .micbias = {
884 .ldoh_v = SITAR_LDOH_2P85_V,
885 .cfilt1_mv = 1800,
886 .cfilt2_mv = 1800,
887 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
888 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700889 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
890 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700891 },
892 .regulator = {
893 {
894 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700895 .min_uV = 1800000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700896 .max_uV = 2200000,
897 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
898 },
899 {
900 .name = "CDC_VDDA_RX",
901 .min_uV = 1800000,
902 .max_uV = 1800000,
903 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
904 },
905 {
906 .name = "CDC_VDDA_TX",
907 .min_uV = 1800000,
908 .max_uV = 1800000,
909 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
910 },
911 {
912 .name = "VDDIO_CDC",
913 .min_uV = 1800000,
914 .max_uV = 1800000,
915 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
916 },
917 {
918 .name = "VDDD_CDC_D",
919 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700920 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700921 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
922 },
923 {
924 .name = "CDC_VDDA_A_1P2V",
925 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700926 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700927 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
928 },
929 },
930};
931
932static struct slim_device msm_slim_sitar1p1 = {
933 .name = "sitar1p1-slim",
934 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
935 .dev = {
936 .platform_data = &sitar1p1_platform_data,
937 },
938};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800939#endif
940
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530941
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800942static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530943#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800944 {
945 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530946 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800947 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700948 {
949 .bus_num = 1,
950 .slim_slave = &msm_slim_sitar1p1,
951 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800952#endif
953 /* add more slimbus slaves as needed */
954};
955
956#define MSM_WCNSS_PHYS 0x03000000
957#define MSM_WCNSS_SIZE 0x280000
958
959static struct resource resources_wcnss_wlan[] = {
960 {
961 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
962 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
963 .name = "wcnss_wlanrx_irq",
964 .flags = IORESOURCE_IRQ,
965 },
966 {
967 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
968 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
969 .name = "wcnss_wlantx_irq",
970 .flags = IORESOURCE_IRQ,
971 },
972 {
973 .start = MSM_WCNSS_PHYS,
974 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
975 .name = "wcnss_mmio",
976 .flags = IORESOURCE_MEM,
977 },
978 {
979 .start = 84,
980 .end = 88,
981 .name = "wcnss_gpios_5wire",
982 .flags = IORESOURCE_IO,
983 },
984};
985
986static struct qcom_wcnss_opts qcom_wcnss_pdata = {
987 .has_48mhz_xo = 1,
988};
989
990static struct platform_device msm_device_wcnss_wlan = {
991 .name = "wcnss_wlan",
992 .id = 0,
993 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
994 .resource = resources_wcnss_wlan,
995 .dev = {.platform_data = &qcom_wcnss_pdata},
996};
997
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700998#ifdef CONFIG_QSEECOM
999/* qseecom bus scaling */
1000static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1001 {
1002 .src = MSM_BUS_MASTER_SPS,
1003 .dst = MSM_BUS_SLAVE_EBI_CH0,
1004 .ib = 0,
1005 .ab = 0,
1006 },
1007 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001008 .src = MSM_BUS_MASTER_SPS,
1009 .dst = MSM_BUS_SLAVE_SPS,
1010 .ib = 0,
1011 .ab = 0,
1012 },
1013 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001014 .src = MSM_BUS_MASTER_SPDM,
1015 .dst = MSM_BUS_SLAVE_SPDM,
1016 .ib = 0,
1017 .ab = 0,
1018 },
1019};
1020
1021static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1022 {
1023 .src = MSM_BUS_MASTER_SPS,
1024 .dst = MSM_BUS_SLAVE_EBI_CH0,
1025 .ib = (492 * 8) * 1000000UL,
1026 .ab = (492 * 8) * 100000UL,
1027 },
1028 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001029 .src = MSM_BUS_MASTER_SPS,
1030 .dst = MSM_BUS_SLAVE_SPS,
1031 .ib = (492 * 8) * 1000000UL,
1032 .ab = (492 * 8) * 100000UL,
1033 },
1034 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001035 .src = MSM_BUS_MASTER_SPDM,
1036 .dst = MSM_BUS_SLAVE_SPDM,
1037 .ib = 0,
1038 .ab = 0,
1039 },
1040};
1041
1042static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1043 {
1044 .src = MSM_BUS_MASTER_SPS,
1045 .dst = MSM_BUS_SLAVE_EBI_CH0,
1046 .ib = 0,
1047 .ab = 0,
1048 },
1049 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001050 .src = MSM_BUS_MASTER_SPS,
1051 .dst = MSM_BUS_SLAVE_SPS,
1052 .ib = 0,
1053 .ab = 0,
1054 },
1055 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001056 .src = MSM_BUS_MASTER_SPDM,
1057 .dst = MSM_BUS_SLAVE_SPDM,
1058 .ib = (64 * 8) * 1000000UL,
1059 .ab = (64 * 8) * 100000UL,
1060 },
1061};
1062
1063static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1064 {
1065 ARRAY_SIZE(qseecom_clks_init_vectors),
1066 qseecom_clks_init_vectors,
1067 },
1068 {
1069 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1070 qseecom_enable_sfpb_vectors,
1071 },
1072 {
1073 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1074 qseecom_enable_sfpb_vectors,
1075 },
1076};
1077
1078static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1079 qseecom_hw_bus_scale_usecases,
1080 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1081 .name = "qsee",
1082};
1083
1084static struct platform_device qseecom_device = {
1085 .name = "qseecom",
1086 .id = 0,
1087 .dev = {
1088 .platform_data = &qseecom_bus_pdata,
1089 },
1090};
1091#endif
1092
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001093#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1094 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1095 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1096 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1097
1098#define QCE_SIZE 0x10000
1099#define QCE_0_BASE 0x18500000
1100
1101#define QCE_HW_KEY_SUPPORT 0
1102#define QCE_SHA_HMAC_SUPPORT 1
1103#define QCE_SHARE_CE_RESOURCE 1
1104#define QCE_CE_SHARED 0
1105
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001106/* Begin Bus scaling definitions */
1107static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1108 {
1109 .src = MSM_BUS_MASTER_ADM_PORT0,
1110 .dst = MSM_BUS_SLAVE_EBI_CH0,
1111 .ab = 0,
1112 .ib = 0,
1113 },
1114 {
1115 .src = MSM_BUS_MASTER_ADM_PORT1,
1116 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1117 .ab = 0,
1118 .ib = 0,
1119 },
1120};
1121
1122static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1123 {
1124 .src = MSM_BUS_MASTER_ADM_PORT0,
1125 .dst = MSM_BUS_SLAVE_EBI_CH0,
1126 .ab = 70000000UL,
1127 .ib = 70000000UL,
1128 },
1129 {
1130 .src = MSM_BUS_MASTER_ADM_PORT1,
1131 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1132 .ab = 2480000000UL,
1133 .ib = 2480000000UL,
1134 },
1135};
1136
1137static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1138 {
1139 ARRAY_SIZE(crypto_hw_init_vectors),
1140 crypto_hw_init_vectors,
1141 },
1142 {
1143 ARRAY_SIZE(crypto_hw_active_vectors),
1144 crypto_hw_active_vectors,
1145 },
1146};
1147
1148static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1149 crypto_hw_bus_scale_usecases,
1150 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1151 .name = "cryptohw",
1152};
1153/* End Bus Scaling Definitions*/
1154
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001155static struct resource qcrypto_resources[] = {
1156 [0] = {
1157 .start = QCE_0_BASE,
1158 .end = QCE_0_BASE + QCE_SIZE - 1,
1159 .flags = IORESOURCE_MEM,
1160 },
1161 [1] = {
1162 .name = "crypto_channels",
1163 .start = DMOV_CE_IN_CHAN,
1164 .end = DMOV_CE_OUT_CHAN,
1165 .flags = IORESOURCE_DMA,
1166 },
1167 [2] = {
1168 .name = "crypto_crci_in",
1169 .start = DMOV_CE_IN_CRCI,
1170 .end = DMOV_CE_IN_CRCI,
1171 .flags = IORESOURCE_DMA,
1172 },
1173 [3] = {
1174 .name = "crypto_crci_out",
1175 .start = DMOV_CE_OUT_CRCI,
1176 .end = DMOV_CE_OUT_CRCI,
1177 .flags = IORESOURCE_DMA,
1178 },
1179};
1180
1181static struct resource qcedev_resources[] = {
1182 [0] = {
1183 .start = QCE_0_BASE,
1184 .end = QCE_0_BASE + QCE_SIZE - 1,
1185 .flags = IORESOURCE_MEM,
1186 },
1187 [1] = {
1188 .name = "crypto_channels",
1189 .start = DMOV_CE_IN_CHAN,
1190 .end = DMOV_CE_OUT_CHAN,
1191 .flags = IORESOURCE_DMA,
1192 },
1193 [2] = {
1194 .name = "crypto_crci_in",
1195 .start = DMOV_CE_IN_CRCI,
1196 .end = DMOV_CE_IN_CRCI,
1197 .flags = IORESOURCE_DMA,
1198 },
1199 [3] = {
1200 .name = "crypto_crci_out",
1201 .start = DMOV_CE_OUT_CRCI,
1202 .end = DMOV_CE_OUT_CRCI,
1203 .flags = IORESOURCE_DMA,
1204 },
1205};
1206
1207#endif
1208
1209#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1210 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1211
1212static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1213 .ce_shared = QCE_CE_SHARED,
1214 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1215 .hw_key_support = QCE_HW_KEY_SUPPORT,
1216 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001217 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001218};
1219
1220static struct platform_device qcrypto_device = {
1221 .name = "qcrypto",
1222 .id = 0,
1223 .num_resources = ARRAY_SIZE(qcrypto_resources),
1224 .resource = qcrypto_resources,
1225 .dev = {
1226 .coherent_dma_mask = DMA_BIT_MASK(32),
1227 .platform_data = &qcrypto_ce_hw_suppport,
1228 },
1229};
1230#endif
1231
1232#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1233 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1234
1235static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1236 .ce_shared = QCE_CE_SHARED,
1237 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1238 .hw_key_support = QCE_HW_KEY_SUPPORT,
1239 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001240 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001241};
1242
1243static struct platform_device qcedev_device = {
1244 .name = "qce",
1245 .id = 0,
1246 .num_resources = ARRAY_SIZE(qcedev_resources),
1247 .resource = qcedev_resources,
1248 .dev = {
1249 .coherent_dma_mask = DMA_BIT_MASK(32),
1250 .platform_data = &qcedev_ce_hw_suppport,
1251 },
1252};
1253#endif
1254
1255#define MDM2AP_ERRFATAL 70
1256#define AP2MDM_ERRFATAL 95
1257#define MDM2AP_STATUS 69
1258#define AP2MDM_STATUS 94
1259#define AP2MDM_PMIC_RESET_N 80
1260#define AP2MDM_KPDPWR_N 81
1261
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001262static struct resource mdm_resources[] = {
1263 {
1264 .start = MDM2AP_ERRFATAL,
1265 .end = MDM2AP_ERRFATAL,
1266 .name = "MDM2AP_ERRFATAL",
1267 .flags = IORESOURCE_IO,
1268 },
1269 {
1270 .start = AP2MDM_ERRFATAL,
1271 .end = AP2MDM_ERRFATAL,
1272 .name = "AP2MDM_ERRFATAL",
1273 .flags = IORESOURCE_IO,
1274 },
1275 {
1276 .start = MDM2AP_STATUS,
1277 .end = MDM2AP_STATUS,
1278 .name = "MDM2AP_STATUS",
1279 .flags = IORESOURCE_IO,
1280 },
1281 {
1282 .start = AP2MDM_STATUS,
1283 .end = AP2MDM_STATUS,
1284 .name = "AP2MDM_STATUS",
1285 .flags = IORESOURCE_IO,
1286 },
1287 {
1288 .start = AP2MDM_PMIC_RESET_N,
1289 .end = AP2MDM_PMIC_RESET_N,
1290 .name = "AP2MDM_PMIC_RESET_N",
1291 .flags = IORESOURCE_IO,
1292 },
1293 {
1294 .start = AP2MDM_KPDPWR_N,
1295 .end = AP2MDM_KPDPWR_N,
1296 .name = "AP2MDM_KPDPWR_N",
1297 .flags = IORESOURCE_IO,
1298 },
1299};
1300
1301static struct mdm_platform_data mdm_platform_data = {
1302 .mdm_version = "2.5",
1303};
1304
1305static struct platform_device mdm_device = {
1306 .name = "mdm2_modem",
1307 .id = -1,
1308 .num_resources = ARRAY_SIZE(mdm_resources),
1309 .resource = mdm_resources,
1310 .dev = {
1311 .platform_data = &mdm_platform_data,
1312 },
1313};
1314
1315static struct platform_device *mdm_devices[] __initdata = {
1316 &mdm_device,
1317};
1318
Praveen Chidambaram78499012011-11-01 17:15:17 -06001319#ifdef CONFIG_MSM_MPM
1320static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1321 [1] = MSM_GPIO_TO_INT(46),
1322 [2] = MSM_GPIO_TO_INT(150),
1323 [4] = MSM_GPIO_TO_INT(103),
1324 [5] = MSM_GPIO_TO_INT(104),
1325 [6] = MSM_GPIO_TO_INT(105),
1326 [7] = MSM_GPIO_TO_INT(106),
1327 [8] = MSM_GPIO_TO_INT(107),
1328 [9] = MSM_GPIO_TO_INT(7),
1329 [10] = MSM_GPIO_TO_INT(11),
1330 [11] = MSM_GPIO_TO_INT(15),
1331 [12] = MSM_GPIO_TO_INT(19),
1332 [13] = MSM_GPIO_TO_INT(23),
1333 [14] = MSM_GPIO_TO_INT(27),
1334 [15] = MSM_GPIO_TO_INT(31),
1335 [16] = MSM_GPIO_TO_INT(35),
1336 [19] = MSM_GPIO_TO_INT(90),
1337 [20] = MSM_GPIO_TO_INT(92),
1338 [23] = MSM_GPIO_TO_INT(85),
1339 [24] = MSM_GPIO_TO_INT(83),
1340 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001341 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001342 [27] = HDMI_IRQ,
1343 [29] = MSM_GPIO_TO_INT(10),
1344 [30] = MSM_GPIO_TO_INT(102),
1345 [31] = MSM_GPIO_TO_INT(81),
1346 [32] = MSM_GPIO_TO_INT(78),
1347 [33] = MSM_GPIO_TO_INT(94),
1348 [34] = MSM_GPIO_TO_INT(72),
1349 [35] = MSM_GPIO_TO_INT(39),
1350 [36] = MSM_GPIO_TO_INT(43),
1351 [37] = MSM_GPIO_TO_INT(61),
1352 [38] = MSM_GPIO_TO_INT(50),
1353 [39] = MSM_GPIO_TO_INT(42),
1354 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001355 [42] = MSM_GPIO_TO_INT(8),
1356 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001357 [44] = MSM_GPIO_TO_INT(70),
1358 [45] = MSM_GPIO_TO_INT(69),
1359 [46] = MSM_GPIO_TO_INT(67),
1360 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001361 [48] = MSM_GPIO_TO_INT(55),
1362 [49] = MSM_GPIO_TO_INT(74),
1363 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001364 [51] = MSM_GPIO_TO_INT(49),
1365 [52] = MSM_GPIO_TO_INT(40),
1366 [53] = MSM_GPIO_TO_INT(37),
1367 [54] = MSM_GPIO_TO_INT(24),
1368 [55] = MSM_GPIO_TO_INT(14),
1369};
1370
1371static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1372 TLMM_MSM_SUMMARY_IRQ,
1373 RPM_APCC_CPU0_GP_HIGH_IRQ,
1374 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1375 RPM_APCC_CPU0_GP_LOW_IRQ,
1376 RPM_APCC_CPU0_WAKE_UP_IRQ,
1377 RPM_APCC_CPU1_GP_HIGH_IRQ,
1378 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1379 RPM_APCC_CPU1_GP_LOW_IRQ,
1380 RPM_APCC_CPU1_WAKE_UP_IRQ,
1381 MSS_TO_APPS_IRQ_0,
1382 MSS_TO_APPS_IRQ_1,
1383 MSS_TO_APPS_IRQ_2,
1384 MSS_TO_APPS_IRQ_3,
1385 MSS_TO_APPS_IRQ_4,
1386 MSS_TO_APPS_IRQ_5,
1387 MSS_TO_APPS_IRQ_6,
1388 MSS_TO_APPS_IRQ_7,
1389 MSS_TO_APPS_IRQ_8,
1390 MSS_TO_APPS_IRQ_9,
1391 LPASS_SCSS_GP_LOW_IRQ,
1392 LPASS_SCSS_GP_MEDIUM_IRQ,
1393 LPASS_SCSS_GP_HIGH_IRQ,
1394 SPS_MTI_30,
1395 SPS_MTI_31,
1396 RIVA_APSS_SPARE_IRQ,
1397 RIVA_APPS_WLAN_SMSM_IRQ,
1398 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1399 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1400};
1401
1402struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1403 .irqs_m2a = msm_mpm_irqs_m2a,
1404 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1405 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1406 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1407 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1408 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1409 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1410 .mpm_apps_ipc_val = BIT(1),
1411 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1412
1413};
1414#endif
1415
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001416#define MSM_SHARED_RAM_PHYS 0x80000000
1417
1418static void __init msm8930_map_io(void)
1419{
1420 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1421 msm_map_msm8930_io();
1422
1423 if (socinfo_init() < 0)
1424 pr_err("socinfo_init() failed!\n");
1425}
1426
1427static void __init msm8930_init_irq(void)
1428{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001429 struct msm_mpm_device_data *data = NULL;
1430#ifdef CONFIG_MSM_MPM
1431 data = &msm8930_mpm_dev_data;
1432#endif
1433
1434 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001435 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1436 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001437}
1438
1439static void __init msm8930_init_buses(void)
1440{
1441#ifdef CONFIG_MSM_BUS_SCALING
1442 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001443 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1444 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1445 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1446 msm_bus_8930_apps_fabric.dev.platform_data =
1447 &msm_bus_8930_apps_fabric_pdata;
1448 msm_bus_8930_sys_fabric.dev.platform_data =
1449 &msm_bus_8930_sys_fabric_pdata;
1450 msm_bus_8930_mm_fabric.dev.platform_data =
1451 &msm_bus_8930_mm_fabric_pdata;
1452 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1453 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001454#endif
1455}
1456
1457static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1458 .max_clock_speed = 15060000,
1459};
1460
1461#ifdef CONFIG_USB_MSM_OTG_72K
1462static struct msm_otg_platform_data msm_otg_pdata;
1463#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301464#ifdef CONFIG_MSM_BUS_SCALING
1465/* Bandwidth requests (zero) if no vote placed */
1466static struct msm_bus_vectors usb_init_vectors[] = {
1467 {
1468 .src = MSM_BUS_MASTER_SPS,
1469 .dst = MSM_BUS_SLAVE_EBI_CH0,
1470 .ab = 0,
1471 .ib = 0,
1472 },
1473};
1474
1475/* Bus bandwidth requests in Bytes/sec */
1476static struct msm_bus_vectors usb_max_vectors[] = {
1477 {
1478 .src = MSM_BUS_MASTER_SPS,
1479 .dst = MSM_BUS_SLAVE_EBI_CH0,
1480 .ab = 60000000, /* At least 480Mbps on bus. */
1481 .ib = 960000000, /* MAX bursts rate */
1482 },
1483};
1484
1485static struct msm_bus_paths usb_bus_scale_usecases[] = {
1486 {
1487 ARRAY_SIZE(usb_init_vectors),
1488 usb_init_vectors,
1489 },
1490 {
1491 ARRAY_SIZE(usb_max_vectors),
1492 usb_max_vectors,
1493 },
1494};
1495
1496static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1497 usb_bus_scale_usecases,
1498 ARRAY_SIZE(usb_bus_scale_usecases),
1499 .name = "usb",
1500};
1501#endif
1502
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301503static int hsusb_phy_init_seq[] = {
1504 0x44, 0x80, /* set VBUS valid threshold
1505 and disconnect valid threshold */
1506 0x38, 0x81, /* update DC voltage level */
1507 0x24, 0x82, /* set preemphasis and rise/fall time */
1508 0x13, 0x83, /* set source impedance adjusment */
1509 -1};
1510
Jack Pham87f202f2012-08-06 00:24:22 -07001511#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1512
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001513static struct msm_otg_platform_data msm_otg_pdata = {
1514 .mode = USB_OTG,
1515 .otg_control = OTG_PMIC_CONTROL,
1516 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001517 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001518 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301519#ifdef CONFIG_MSM_BUS_SCALING
1520 .bus_scale_table = &usb_bus_scale_pdata,
1521#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301522#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1523 .mhl_dev_name = "sii8334",
1524#endif
Jack Pham87f202f2012-08-06 00:24:22 -07001525 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001526};
1527#endif
1528
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001529#define PID_MAGIC_ID 0x71432909
1530#define SERIAL_NUM_MAGIC_ID 0x61945374
1531#define SERIAL_NUMBER_LENGTH 127
1532#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1533
1534struct magic_num_struct {
1535 uint32_t pid;
1536 uint32_t serial_num;
1537};
1538
1539struct dload_struct {
1540 uint32_t reserved1;
1541 uint32_t reserved2;
1542 uint32_t reserved3;
1543 uint16_t reserved4;
1544 uint16_t pid;
1545 char serial_number[SERIAL_NUMBER_LENGTH];
1546 uint16_t reserved5;
1547 struct magic_num_struct magic_struct;
1548};
1549
1550static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1551{
1552 struct dload_struct __iomem *dload = 0;
1553
1554 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1555 if (!dload) {
1556 pr_err("%s: cannot remap I/O memory region: %08x\n",
1557 __func__, DLOAD_USB_BASE_ADD);
1558 return -ENXIO;
1559 }
1560
1561 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1562 __func__, dload, pid, snum);
1563 /* update pid */
1564 dload->magic_struct.pid = PID_MAGIC_ID;
1565 dload->pid = pid;
1566
1567 /* update serial number */
1568 dload->magic_struct.serial_num = 0;
1569 if (!snum) {
1570 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1571 goto out;
1572 }
1573
1574 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1575 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1576out:
1577 iounmap(dload);
1578 return 0;
1579}
1580
1581static struct android_usb_platform_data android_usb_pdata = {
1582 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1583};
1584
1585static struct platform_device android_usb_device = {
1586 .name = "android_usb",
1587 .id = -1,
1588 .dev = {
1589 .platform_data = &android_usb_pdata,
1590 },
1591};
1592
1593static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001594 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001595};
1596
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301597static uint8_t spm_retention_cmd_sequence[] __initdata = {
1598 0x00, 0x05, 0x03, 0x0D,
1599 0x0B, 0x00, 0x0f,
1600};
1601
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001602static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001603 0x00, 0x24, 0x54, 0x10,
1604 0x09, 0x03, 0x01,
1605 0x10, 0x54, 0x30, 0x0C,
1606 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001607};
1608
1609static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001610 0x00, 0x24, 0x54, 0x10,
1611 0x09, 0x07, 0x01, 0x0B,
1612 0x10, 0x54, 0x30, 0x0C,
1613 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001614};
1615
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301616static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1617 [0] = {
1618 .mode = MSM_SPM_MODE_CLOCK_GATING,
1619 .notify_rpm = false,
1620 .cmd = spm_wfi_cmd_sequence,
1621 },
1622 [1] = {
1623 .mode = MSM_SPM_MODE_POWER_RETENTION,
1624 .notify_rpm = false,
1625 .cmd = spm_retention_cmd_sequence,
1626 },
1627 [2] = {
1628 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1629 .notify_rpm = false,
1630 .cmd = spm_power_collapse_without_rpm,
1631 },
1632 [3] = {
1633 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1634 .notify_rpm = true,
1635 .cmd = spm_power_collapse_with_rpm,
1636 },
1637};
1638
1639static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001640 [0] = {
1641 .mode = MSM_SPM_MODE_CLOCK_GATING,
1642 .notify_rpm = false,
1643 .cmd = spm_wfi_cmd_sequence,
1644 },
1645 [1] = {
1646 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1647 .notify_rpm = false,
1648 .cmd = spm_power_collapse_without_rpm,
1649 },
1650 [2] = {
1651 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1652 .notify_rpm = true,
1653 .cmd = spm_power_collapse_with_rpm,
1654 },
1655};
1656
1657static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1658 [0] = {
1659 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001660 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001661#if defined(CONFIG_MSM_AVS_HW)
1662 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1663 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1664#endif
1665 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301666 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1667 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1668 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001669 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301670 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1671 .modes = msm_spm_boot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001672 },
1673 [1] = {
1674 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001675 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001676#if defined(CONFIG_MSM_AVS_HW)
1677 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1678 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1679#endif
1680 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001681 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001682 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1683 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1684 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301685 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1686 .modes = msm_spm_nonboot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001687 },
1688};
1689
1690static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001691 0x00, 0x20, 0x03, 0x20,
1692 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001693};
1694
1695static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001696 0x00, 0x20, 0x34, 0x64,
1697 0x48, 0x07, 0x48, 0x20,
1698 0x50, 0x64, 0x04, 0x34,
1699 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001700};
1701static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001702 0x00, 0x10, 0x34, 0x64,
1703 0x48, 0x07, 0x48, 0x10,
1704 0x50, 0x64, 0x04, 0x34,
1705 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001706};
1707
1708static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1709 [0] = {
1710 .mode = MSM_SPM_L2_MODE_RETENTION,
1711 .notify_rpm = false,
1712 .cmd = l2_spm_wfi_cmd_sequence,
1713 },
1714 [1] = {
1715 .mode = MSM_SPM_L2_MODE_GDHS,
1716 .notify_rpm = true,
1717 .cmd = l2_spm_gdhs_cmd_sequence,
1718 },
1719 [2] = {
1720 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1721 .notify_rpm = true,
1722 .cmd = l2_spm_power_off_cmd_sequence,
1723 },
1724};
1725
1726static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1727 [0] = {
1728 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001729 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001730 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001731 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1732 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1733 .modes = msm_spm_l2_seq_list,
1734 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1735 },
1736};
1737
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301738#define ISA1200_HAP_EN_GPIO 77
1739#define ISA1200_HAP_LEN_GPIO 78
David Collins04499982012-08-06 15:02:03 -07001740#define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7)
1741#define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001742
1743static int isa1200_power(int on)
1744{
David Collins04499982012-08-06 15:02:03 -07001745 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
1746 enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1;
Amy Malocheb20c1052012-04-11 10:36:13 -07001747 int rc = 0;
1748
David Collins04499982012-08-06 15:02:03 -07001749 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
1750 gpio = ISA1200_HAP_CLK_PM8917;
1751 clk_id = CLK_MP3_2;
1752 }
1753
1754 gpio_set_value_cansleep(gpio, !!on);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301755
Amy Malocheb20c1052012-04-11 10:36:13 -07001756 if (on)
David Collins04499982012-08-06 15:02:03 -07001757 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001758 else
David Collins04499982012-08-06 15:02:03 -07001759 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001760
1761 if (rc) {
1762 pr_err("%s: unable to write aux clock register(%d)\n",
1763 __func__, rc);
1764 }
1765
1766 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001767}
1768
1769static int isa1200_dev_setup(bool enable)
1770{
David Collins04499982012-08-06 15:02:03 -07001771 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001772 int rc = 0;
1773
David Collins04499982012-08-06 15:02:03 -07001774 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1775 gpio = ISA1200_HAP_CLK_PM8917;
1776
Amy Malocheb20c1052012-04-11 10:36:13 -07001777 if (!enable)
1778 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301779
David Collins04499982012-08-06 15:02:03 -07001780 rc = gpio_request(gpio, "haptics_clk");
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301781 if (rc) {
1782 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001783 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301784 goto fail_gpio_req;
1785 }
1786
David Collins04499982012-08-06 15:02:03 -07001787 rc = gpio_direction_output(gpio, 0);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301788 if (rc) {
1789 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001790 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301791 goto fail_gpio_dir;
1792 }
1793
1794 return 0;
1795
1796fail_gpio_dir:
David Collins04499982012-08-06 15:02:03 -07001797 gpio_free(gpio);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301798fail_gpio_req:
1799 return rc;
1800
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001801}
1802
1803static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301804 {
1805 .name = "vddp",
1806 .min_uV = ISA_I2C_VTG_MIN_UV,
1807 .max_uV = ISA_I2C_VTG_MAX_UV,
1808 .load_uA = ISA_I2C_CURR_UA,
1809 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001810 {
1811 .name = "vcc_i2c",
1812 .min_uV = ISA_I2C_VTG_MIN_UV,
1813 .max_uV = ISA_I2C_VTG_MAX_UV,
1814 .load_uA = ISA_I2C_CURR_UA,
1815 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001816};
1817
1818static struct isa1200_platform_data isa1200_1_pdata = {
1819 .name = "vibrator",
1820 .dev_setup = isa1200_dev_setup,
1821 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301822 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1823 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001824 .max_timeout = 15000,
1825 .mode_ctrl = PWM_GEN_MODE,
1826 .pwm_fd = {
1827 .pwm_div = 256,
1828 },
1829 .is_erm = false,
1830 .smart_en = true,
1831 .ext_clk_en = true,
1832 .chip_en = 1,
1833 .regulator_info = isa1200_reg_data,
1834 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1835};
1836
1837static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1838 {
1839 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1840 .platform_data = &isa1200_1_pdata,
1841 },
1842};
1843
Amy Malochef3c9db42011-12-08 15:17:35 -08001844#define MXT_TS_GPIO_IRQ 11
1845#define MXT_TS_RESET_GPIO 52
1846
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301847static const u8 mxt_config_data_8930_v1[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001848 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001849 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001850 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301851 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001852 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301853 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001854 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301855 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001856 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301857 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1858 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1859 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1860 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001861 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001862 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1863 0,
1864 /* T18 Object */
1865 0, 0,
1866 /* T19 Object */
1867 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1868 0, 0, 0, 0, 0, 0,
1869 /* T23 Object */
1870 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1871 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001872 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001873 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1874 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001875 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001876 0, 0, 0, 0, 0,
1877 /* T42 Object */
1878 0, 0, 0, 0, 0, 0, 0, 0,
1879 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301880 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001881 /* T47 Object */
1882 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1883 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301884 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1885 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1886 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001887 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1888 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1889 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001890};
1891
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301892static const u8 mxt_config_data_8930_v2[] = {
1893 /* T6 Object */
1894 0, 0, 0, 0, 0, 0,
1895 /* T38 Object */
1896 15, 4, 0, 9, 7, 12, 0, 0,
1897 /* T7 Object */
1898 32, 16, 50,
1899 /* T8 Object */
1900 30, 0, 5, 10, 0, 0, 10, 10, 0, 0,
1901 /* T9 Object */
1902 131, 0, 0, 19, 11, 0, 16, 50, 1, 3,
1903 12, 7, 2, 0, 4, 5, 2, 10, 43, 4,
1904 54, 2, -25, 29, 38, 18, 143, 40, 207, 80,
1905 17, 5, 50, 50, 0,
1906 /* T18 Object */
1907 0, 0,
1908 /* T19 Object */
1909 0, 0, 0, 0, 0, 0,
1910 /* T25 Object */
1911 0, 0, 0, 0, 0, 0,
1912 /* T42 Object */
1913 3, 60, 20, 20, 150, 0, 0, 0,
1914 /* T46 Object */
1915 0, 3, 28, 28, 0, 0, 1, 0, 0,
1916 /* T47 Object */
1917 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1918 /* T48 Object */
1919 1, 3, 82, 0, 0, 0, 0, 0, 0, 0,
1920 16, 30, 0, 6, 6, 0, 0, 124, 4, 100,
1921 0, 0, 0, 5, 0, 42, 0, 1, 0, 40,
1922 52, 20, 0, 0, 0, 50, 1, 5, 2, 1,
1923 4, 5, 3, -25, 29, 38, 18, 143, 40, 207,
1924 80, 10, 5, 2,
1925 /* T55 Object */
1926 0, 0, 0, 0,
1927};
1928
Amy Malochef3c9db42011-12-08 15:17:35 -08001929static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1930 struct kobj_attribute *attr, char *buf)
1931{
1932 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301933 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1934 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1935 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1936 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001937 "\n");
1938}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001939
Amy Malochef3c9db42011-12-08 15:17:35 -08001940static struct kobj_attribute mxt224e_vkeys_attr = {
1941 .attr = {
1942 .mode = S_IRUGO,
1943 },
1944 .show = &mxt224e_vkeys_show,
1945};
1946
1947static struct attribute *mxt224e_properties_attrs[] = {
1948 &mxt224e_vkeys_attr.attr,
1949 NULL
1950};
1951
1952static struct attribute_group mxt224e_properties_attr_group = {
1953 .attrs = mxt224e_properties_attrs,
1954};
1955
1956static void mxt_init_vkeys_8930(void)
1957{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001958 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001959 static struct kobject *mxt224e_properties_kobj;
1960
1961 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1962 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1963 NULL);
1964 if (mxt224e_properties_kobj)
1965 rc = sysfs_create_group(mxt224e_properties_kobj,
1966 &mxt224e_properties_attr_group);
1967 if (!mxt224e_properties_kobj || rc)
1968 pr_err("%s: failed to create board_properties\n",
1969 __func__);
1970
1971 return;
1972}
1973
Jing Lindc4413c2012-01-16 15:22:52 -08001974static struct mxt_config_info mxt_config_array[] = {
1975 {
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301976 .config = mxt_config_data_8930_v1,
1977 .config_length = ARRAY_SIZE(mxt_config_data_8930_v1),
Jing Lindc4413c2012-01-16 15:22:52 -08001978 .family_id = 0x81,
1979 .variant_id = 0x01,
1980 .version = 0x10,
1981 .build = 0xAA,
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301982 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1983 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1984 },
1985 {
1986 .config = mxt_config_data_8930_v2,
1987 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1988 .family_id = 0x81,
1989 .variant_id = 0x15,
1990 .version = 0x11,
1991 .build = 0xAA,
1992 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1993 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1994 },
1995 {
1996 .config = mxt_config_data_8930_v2,
1997 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1998 .family_id = 0x81,
1999 .variant_id = 0x01,
2000 .version = 0x20,
2001 .build = 0xAB,
2002 .bootldr_id = MXT_BOOTLOADER_ID_224E,
Jing Lindc4413c2012-01-16 15:22:52 -08002003 },
2004};
2005
Amy Malochef3c9db42011-12-08 15:17:35 -08002006static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08002007 .config_array = mxt_config_array,
2008 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002009 .panel_minx = 0,
2010 .panel_maxx = 566,
2011 .panel_miny = 0,
2012 .panel_maxy = 1067,
2013 .disp_minx = 0,
2014 .disp_maxx = 540,
2015 .disp_miny = 0,
2016 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002017 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05302018#ifdef MSM8930_PHASE_2
2019 .digital_pwr_regulator = true,
2020#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002021 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08002022 .reset_gpio = MXT_TS_RESET_GPIO,
2023 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002024};
2025
Amy Malochef3c9db42011-12-08 15:17:35 -08002026static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002027 {
Amy Malochef3c9db42011-12-08 15:17:35 -08002028 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
2029 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002030 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2031 },
2032};
2033
David Collins04499982012-08-06 15:02:03 -07002034#define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
2035#define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25)
Manoj Raoc6d904c2012-06-22 00:32:14 -07002036static struct msm_mhl_platform_data mhl_platform_data = {
2037 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
2038 .gpio_mhl_int = MHL_GPIO_INT,
2039 .gpio_mhl_reset = MHL_GPIO_RESET,
David Collins04499982012-08-06 15:02:03 -07002040 .gpio_mhl_power = MHL_POWER_GPIO_PM8038,
Manoj Raoc6d904c2012-06-22 00:32:14 -07002041 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
2042};
2043
2044static struct i2c_board_info sii_device_info[] __initdata = {
2045 {
2046 /*
2047 * keeps SI 8334 as the default
2048 * MHL TX
2049 */
2050 I2C_BOARD_INFO("sii8334", 0x39),
2051 .platform_data = &mhl_platform_data,
2052 .flags = I2C_CLIENT_WAKE,
2053 },
2054};
2055
2056
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302057#ifdef MSM8930_PHASE_2
2058
David Collins04499982012-08-06 15:02:03 -07002059#define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3)
2060#define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8)
2061#define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10)
2062#define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11)
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302063
David Collins04499982012-08-06 15:02:03 -07002064#define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27)
2065#define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28)
2066#define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36)
2067#define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37)
2068
2069static struct gpio_keys_button keys_8930_pm8038[] = {
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302070 {
2071 .code = KEY_VOLUMEUP,
2072 .type = EV_KEY,
2073 .desc = "volume_up",
David Collins04499982012-08-06 15:02:03 -07002074 .gpio = GPIO_VOLUME_UP_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302075 .wakeup = 1,
2076 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002077 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302078 },
2079 {
2080 .code = KEY_VOLUMEDOWN,
2081 .type = EV_KEY,
2082 .desc = "volume_down",
David Collins04499982012-08-06 15:02:03 -07002083 .gpio = GPIO_VOLUME_DOWN_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302084 .wakeup = 1,
2085 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002086 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302087 },
2088 {
2089 .code = KEY_CAMERA_FOCUS,
2090 .type = EV_KEY,
2091 .desc = "camera_focus",
David Collins04499982012-08-06 15:02:03 -07002092 .gpio = GPIO_CAMERA_FOCUS_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302093 .wakeup = 1,
2094 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002095 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302096 },
2097 {
2098 .code = KEY_CAMERA_SNAPSHOT,
2099 .type = EV_KEY,
2100 .desc = "camera_snapshot",
David Collins04499982012-08-06 15:02:03 -07002101 .gpio = GPIO_CAMERA_SNAPSHOT_PM8038,
2102 .wakeup = 1,
2103 .active_low = 1,
2104 .debounce_interval = 15,
2105 },
2106};
2107
2108static struct gpio_keys_button keys_8930_pm8917[] = {
2109 {
2110 .code = KEY_VOLUMEUP,
2111 .type = EV_KEY,
2112 .desc = "volume_up",
2113 .gpio = GPIO_VOLUME_UP_PM8917,
2114 .wakeup = 1,
2115 .active_low = 1,
2116 .debounce_interval = 15,
2117 },
2118 {
2119 .code = KEY_VOLUMEDOWN,
2120 .type = EV_KEY,
2121 .desc = "volume_down",
2122 .gpio = GPIO_VOLUME_DOWN_PM8917,
2123 .wakeup = 1,
2124 .active_low = 1,
2125 .debounce_interval = 15,
2126 },
2127 {
2128 .code = KEY_CAMERA_FOCUS,
2129 .type = EV_KEY,
2130 .desc = "camera_focus",
2131 .gpio = GPIO_CAMERA_FOCUS_PM8917,
2132 .wakeup = 1,
2133 .active_low = 1,
2134 .debounce_interval = 15,
2135 },
2136 {
2137 .code = KEY_CAMERA_SNAPSHOT,
2138 .type = EV_KEY,
2139 .desc = "camera_snapshot",
2140 .gpio = GPIO_CAMERA_SNAPSHOT_PM8917,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302141 .wakeup = 1,
2142 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002143 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302144 },
2145};
2146
2147/* Add GPIO keys for 8930 */
2148static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
David Collins04499982012-08-06 15:02:03 -07002149 .buttons = keys_8930_pm8038,
2150 .nbuttons = ARRAY_SIZE(keys_8930_pm8038),
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302151};
2152
2153static struct platform_device gpio_keys_8930 = {
2154 .name = "gpio-keys",
2155 .id = -1,
2156 .dev = {
2157 .platform_data = &gpio_keys_8930_pdata,
2158 },
2159};
2160#endif /* MSM8930_PHASE_2 */
2161
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002162static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2163 .clk_freq = 100000,
2164 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002165};
2166
2167static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2168 .clk_freq = 100000,
2169 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002170};
2171
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002172static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
2173 .clk_freq = 100000,
2174 .src_clk_rate = 24000000,
2175};
2176
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002177static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2178 .clk_freq = 100000,
2179 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002180};
2181
2182static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2183 .clk_freq = 100000,
2184 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002185};
2186
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002187
2188static struct ks8851_pdata spi_eth_pdata = {
2189 .irq_gpio = KS8851_IRQ_GPIO,
2190 .rst_gpio = KS8851_RST_GPIO,
2191};
2192
2193static struct spi_board_info spi_board_info[] __initdata = {
2194 {
2195 .modalias = "ks8851",
2196 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2197 .max_speed_hz = 19200000,
2198 .bus_num = 0,
2199 .chip_select = 0,
2200 .mode = SPI_MODE_0,
2201 .platform_data = &spi_eth_pdata
2202 },
2203 {
2204 .modalias = "dsi_novatek_3d_panel_spi",
2205 .max_speed_hz = 10800000,
2206 .bus_num = 0,
2207 .chip_select = 1,
2208 .mode = SPI_MODE_0,
2209 },
2210};
2211
2212static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002213 .name = "saw-regulator",
2214 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002215 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002216 .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002217 },
2218};
2219
2220static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002221 .name = "saw-regulator",
2222 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002223 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002224 .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002225 },
2226};
2227
2228static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002229 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002230 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002231 .tsens_num_sensor = 10,
2232 .slope = {1132, 1135, 1137, 1135, 1157,
2233 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002234};
2235
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002236static struct platform_device msm_tsens_device = {
2237 .name = "tsens8960-tm",
2238 .id = -1,
2239};
2240
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002241static struct msm_thermal_data msm_thermal_pdata = {
2242 .sensor_id = 9,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002243 .poll_ms = 250,
2244 .limit_temp_degC = 60,
2245 .temp_hysteresis_degC = 10,
2246 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002247};
2248
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002249#ifdef CONFIG_MSM_FAKE_BATTERY
2250static struct platform_device fish_battery_device = {
2251 .name = "fish_battery",
2252};
2253#endif
2254
David Collins1d4061b2011-12-06 15:36:40 -08002255#ifndef MSM8930_PHASE_2
2256
2257/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002258static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002259 .name = GPIO_REGULATOR_DEV_NAME,
2260 .id = PM8921_MPP_PM_TO_SYS(7),
2261 .dev = {
2262 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2263 },
2264};
2265
Jay Chokshi06fa7542011-12-07 13:09:17 -08002266static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002267 .name = GPIO_REGULATOR_DEV_NAME,
2268 .id = 91,
2269 .dev = {
2270 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2271 },
2272};
2273
David Collins1d4061b2011-12-06 15:36:40 -08002274#else
2275
2276/* 8930 Phase 2 */
2277static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2278 .name = GPIO_REGULATOR_DEV_NAME,
2279 .id = 63,
2280 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002281 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2282 MSM8930_GPIO_VREG_ID_EXT_5V],
David Collins1d4061b2011-12-06 15:36:40 -08002283 },
2284};
2285
2286static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2287 .name = GPIO_REGULATOR_DEV_NAME,
2288 .id = 97,
2289 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002290 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2291 MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
David Collins1d4061b2011-12-06 15:36:40 -08002292 },
2293};
2294
2295#endif
2296
Jay Chokshi06fa7542011-12-07 13:09:17 -08002297static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002298 .name = "rpm-regulator",
2299 .id = -1,
2300 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002301#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002302 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002303#else
David Collins86161e42012-08-20 12:17:09 -07002304 .platform_data = &msm8930_pm8038_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002305#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002306 },
2307};
2308
David Collins86161e42012-08-20 12:17:09 -07002309static struct platform_device *early_common_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002310 &msm8960_device_dmov,
2311 &msm_device_smd,
2312 &msm8960_device_uart_gsbi5,
2313 &msm_device_uart_dm6,
2314 &msm_device_saw_core0,
2315 &msm_device_saw_core1,
David Collins86161e42012-08-20 12:17:09 -07002316};
2317
2318/* ext_5v and ext_otg_sw are present when using PM8038 */
2319static struct platform_device *pmic_pm8038_devices[] __initdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002320 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002321#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002322 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002323#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002324 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002325#ifdef MSM8930_PHASE_2
2326 &msm8930_device_ext_otg_sw_vreg,
2327#endif
David Collins86161e42012-08-20 12:17:09 -07002328};
2329
2330/* ext_5v and ext_otg_sw are not present when using PM8917 */
2331static struct platform_device *pmic_pm8917_devices[] __initdata = {
2332 &msm8960_device_ssbi_pmic,
2333};
2334
2335static struct platform_device *common_devices[] __initdata = {
Stephen Boyd28d54952011-12-16 13:19:51 -08002336 &msm_8960_q6_lpass,
2337 &msm_8960_q6_mss_fw,
2338 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002339 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002340 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002341 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002342 &msm8960_device_qup_spi_gsbi1,
2343 &msm8960_device_qup_i2c_gsbi3,
2344 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002345 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002346 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002347 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002348 &msm_slim_ctrl,
2349 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002350#if defined(CONFIG_QSEECOM)
2351 &qseecom_device,
2352#endif
2353
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002354#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2355 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2356 &qcrypto_device,
2357#endif
2358
2359#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2360 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2361 &qcedev_device,
2362#endif
2363#ifdef CONFIG_MSM_ROTATOR
2364 &msm_rotator_device,
2365#endif
2366 &msm_device_sps,
2367#ifdef CONFIG_MSM_FAKE_BATTERY
2368 &fish_battery_device,
2369#endif
2370#ifdef CONFIG_ANDROID_PMEM
2371#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002372 &msm8930_android_pmem_device,
2373 &msm8930_android_pmem_adsp_device,
2374 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302375#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2376#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002377 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002378 &msm_device_bam_dmux,
2379 &msm_fm_platform_init,
2380
2381#ifdef CONFIG_HW_RANDOM_MSM
2382 &msm_device_rng,
2383#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002384 &msm8930_rpm_device,
2385 &msm8930_rpm_log_device,
Girish Mahadevan898c56d2012-06-05 16:09:19 -06002386 &msm8930_rpm_rbcpr_device,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002387 &msm8930_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302388 &msm8930_rpm_master_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002389#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002390 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002391#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002392 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002393 &coresight_tpiu_device,
2394 &coresight_etb_device,
2395 &coresight_funnel_device,
2396 &coresight_etm0_device,
2397 &coresight_etm1_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002398 &msm_device_dspcrashd_8960,
2399 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302400#ifdef MSM8930_PHASE_2
2401 &gpio_keys_8930,
2402#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002403 &msm8930_rtb_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002404 &msm_bus_8930_apps_fabric,
2405 &msm_bus_8930_sys_fabric,
2406 &msm_bus_8930_mm_fabric,
2407 &msm_bus_8930_sys_fpb,
2408 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002409 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002410 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002411 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002412 &msm8930_cache_dump_device,
Anji Jonnalae84292b2012-09-21 13:34:44 +05302413 &msm8930_pc_cntr,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002414};
2415
2416static struct platform_device *cdp_devices[] __initdata = {
2417 &msm8960_device_otg,
2418 &msm8960_device_gadget_peripheral,
2419 &msm_device_hsusb_host,
2420 &android_usb_device,
2421 &msm_pcm,
2422 &msm_pcm_routing,
2423 &msm_cpudai0,
2424 &msm_cpudai1,
2425 &msm_cpudai_hdmi_rx,
2426 &msm_cpudai_bt_rx,
2427 &msm_cpudai_bt_tx,
2428 &msm_cpudai_fm_rx,
2429 &msm_cpudai_fm_tx,
2430 &msm_cpudai_auxpcm_rx,
2431 &msm_cpudai_auxpcm_tx,
2432 &msm_cpu_fe,
2433 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002434#ifdef CONFIG_MSM_GEMINI
2435 &msm8960_gemini_device,
2436#endif
2437 &msm_voice,
2438 &msm_voip,
2439 &msm_lpa_pcm,
2440 &msm_cpudai_afe_01_rx,
2441 &msm_cpudai_afe_01_tx,
2442 &msm_cpudai_afe_02_rx,
2443 &msm_cpudai_afe_02_tx,
2444 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002445 &msm_compr_dsp,
2446 &msm_cpudai_incall_music_rx,
2447 &msm_cpudai_incall_record_rx,
2448 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002449 &msm_pcm_hostless,
Asish Bhattacharya705c6732012-08-14 23:22:55 +05302450 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002451 &msm_lowlatency_pcm,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002452};
2453
2454static void __init msm8930_i2c_init(void)
2455{
2456 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2457 &msm8960_i2c_qup_gsbi4_pdata;
2458
2459 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2460 &msm8960_i2c_qup_gsbi3_pdata;
2461
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002462 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2463 &msm8960_i2c_qup_gsbi9_pdata;
2464
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002465 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2466 &msm8960_i2c_qup_gsbi10_pdata;
2467
2468 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2469 &msm8960_i2c_qup_gsbi12_pdata;
2470}
2471
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002472static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2473 {
2474 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2475 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2476 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002477 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002478 },
2479
2480 {
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302481 MSM_PM_SLEEP_MODE_RETENTION,
2482 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2483 true,
2484 415, 715, 340827, 475,
2485 },
2486
2487 {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002488 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2489 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2490 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002491 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002492 },
2493
2494 {
2495 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2496 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2497 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002498 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002499 },
2500
2501 {
2502 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002503 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2504 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002505 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002506 },
2507
2508 {
2509 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2510 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2511 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002512 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002513 },
2514
2515 {
2516 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2517 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2518 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002519 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002520 },
2521
2522 {
2523 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2524 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2525 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002526 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002527 },
2528
2529 {
2530 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2531 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2532 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002533 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002534 },
2535};
2536
Praveen Chidambaram78499012011-11-01 17:15:17 -06002537static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2538 .levels = &msm_rpmrs_levels[0],
2539 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2540 .vdd_mem_levels = {
2541 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2542 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2543 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2544 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2545 },
2546 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002547 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2548 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2549 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2550 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002551 },
2552 .vdd_mask = 0x7FFFFF,
2553 .rpmrs_target_id = {
2554 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2555 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002556 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2557 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002558 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2559 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2560 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2561 },
2562};
2563
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002564static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = {
2565 .levels = &msm_rpmrs_levels[0],
2566 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2567 .vdd_mem_levels = {
2568 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2569 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2570 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2571 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2572 },
2573 .vdd_dig_levels = {
2574 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2575 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2576 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2577 [MSM_RPMRS_VDD_DIG_MAX] = 3,
2578 },
2579 .vdd_mask = 0x7FFFFF,
2580 .rpmrs_target_id = {
2581 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2582 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2583 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2584 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
2585 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0,
2586 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1,
2587 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2588 },
2589};
2590
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002591static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2592 .mode = MSM_PM_BOOT_CONFIG_TZ,
2593};
2594
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002595#ifdef CONFIG_I2C
2596#define I2C_SURF 1
2597#define I2C_FFA (1 << 1)
2598#define I2C_RUMI (1 << 2)
2599#define I2C_SIM (1 << 3)
2600#define I2C_FLUID (1 << 4)
2601#define I2C_LIQUID (1 << 5)
2602
2603struct i2c_registry {
2604 u8 machs;
2605 int bus;
2606 struct i2c_board_info *info;
2607 int len;
2608};
2609
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002610#ifdef CONFIG_INPUT_MPU3050
2611#define MPU3050_INT_GPIO 69
2612
2613static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2614 .gpio_int = MPU3050_INT_GPIO,
2615};
2616
2617static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2618 {
2619 I2C_BOARD_INFO("mpu3050", 0x68),
Wentao Xuc7769c02012-08-03 15:06:41 -04002620 .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO),
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002621 .platform_data = &mpu3050_gyro,
2622 },
2623};
2624#endif
2625
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002626#ifdef CONFIG_ISL9519_CHARGER
2627static struct isl_platform_data isl_data __initdata = {
2628 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2629 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2630 .max_system_voltage = 4200,
2631 .min_system_voltage = 3200,
2632 .chgcurrent = 1000, /* 1900, */
2633 .term_current = 400, /* Need fine tuning */
2634 .input_current = 2048,
2635};
2636
2637static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2638 {
2639 I2C_BOARD_INFO("isl9519q", 0x9),
2640 .irq = 0, /* Not required when notify-by-pmic */
2641 .platform_data = &isl_data,
2642 },
2643};
2644#endif /* CONFIG_ISL9519_CHARGER */
2645
Wentao Xu114c0152012-06-12 11:40:38 -04002646#ifdef CONFIG_STM_LIS3DH
2647static struct lis3dh_acc_platform_data lis3dh_accel = {
2648 .poll_interval = 200,
2649 .min_interval = 10,
2650 .g_range = LIS3DH_ACC_G_2G,
2651 .axis_map_x = 1,
2652 .axis_map_y = 0,
2653 .axis_map_z = 2,
2654 .negate_x = 0,
2655 .negate_y = 0,
2656 .negate_z = 1,
2657 .init = NULL,
2658 .exit = NULL,
2659 .gpio_int1 = -EINVAL,
2660 .gpio_int2 = -EINVAL,
2661};
2662
2663static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = {
2664 {
2665 I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18),
2666 .platform_data = &lis3dh_accel,
2667 },
2668};
2669#endif /* CONFIG_STM_LIS3DH */
2670
Orkhan Karimov4e7999f2013-02-13 17:52:11 -05002671#ifdef CONFIG_BMP18X_I2C
2672static struct i2c_board_info __initdata bmp18x_i2c_boardinfo[] = {
2673 {
2674 I2C_BOARD_INFO("bmp18x", 0x77),
2675 },
2676};
2677#endif
2678
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002679static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002680#ifdef CONFIG_ISL9519_CHARGER
2681 {
2682 I2C_LIQUID,
2683 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2684 isl_charger_i2c_info,
2685 ARRAY_SIZE(isl_charger_i2c_info),
2686 },
2687#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002688#ifdef CONFIG_INPUT_MPU3050
2689 {
2690 I2C_FFA | I2C_FLUID,
2691 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2692 mpu3050_i2c_boardinfo,
2693 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2694 },
2695#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002696 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002697 I2C_SURF | I2C_FFA | I2C_FLUID,
2698 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002699 msm_isa1200_board_info,
2700 ARRAY_SIZE(msm_isa1200_board_info),
2701 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002702 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002703 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002704 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2705 mxt_device_info_8930,
2706 ARRAY_SIZE(mxt_device_info_8930),
2707 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002708 {
2709 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2710 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2711 sii_device_info,
2712 ARRAY_SIZE(sii_device_info),
2713 },
Wentao Xu114c0152012-06-12 11:40:38 -04002714#ifdef CONFIG_STM_LIS3DH
2715 {
2716 I2C_FFA | I2C_FLUID,
2717 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2718 lis3dh_i2c_boardinfo,
2719 ARRAY_SIZE(lis3dh_i2c_boardinfo),
2720 },
2721#endif
Orkhan Karimov4e7999f2013-02-13 17:52:11 -05002722#ifdef CONFIG_BMP18X_I2C
2723 {
2724 I2C_FFA | I2C_FLUID,
2725 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2726 bmp18x_i2c_boardinfo,
2727 ARRAY_SIZE(bmp18x_i2c_boardinfo),
2728 },
2729#endif
2730
2731
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002732};
2733#endif /* CONFIG_I2C */
2734
2735static void __init register_i2c_devices(void)
2736{
2737#ifdef CONFIG_I2C
2738 u8 mach_mask = 0;
2739 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002740#ifdef CONFIG_MSM_CAMERA
2741 struct i2c_registry msm8930_camera_i2c_devices = {
2742 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2743 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2744 msm8930_camera_board_info.board_info,
2745 msm8930_camera_board_info.num_i2c_board_info,
2746 };
2747#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002748
2749 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002750 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002751 mach_mask = I2C_SURF;
2752 else if (machine_is_msm8930_fluid())
2753 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002754 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002755 mach_mask = I2C_FFA;
2756 else
2757 pr_err("unmatched machine ID in register_i2c_devices\n");
2758
2759 /* Run the array and install devices as appropriate */
2760 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2761 if (msm8960_i2c_devices[i].machs & mach_mask)
2762 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2763 msm8960_i2c_devices[i].info,
2764 msm8960_i2c_devices[i].len);
2765 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002766#ifdef CONFIG_MSM_CAMERA
2767 if (msm8930_camera_i2c_devices.machs & mach_mask)
2768 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2769 msm8930_camera_i2c_devices.info,
2770 msm8930_camera_i2c_devices.len);
2771#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002772#endif
2773}
2774
David Collins04499982012-08-06 15:02:03 -07002775/* Modify platform data values to match requirements for PM8917. */
2776static void __init msm8930_pm8917_pdata_fixup(void)
2777{
Patrick Dalya3b73c42012-08-28 13:39:17 -07002778 struct acpuclk_platform_data *pdata;
2779
David Collins04499982012-08-06 15:02:03 -07002780 mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917;
2781
2782 gpio_keys_8930_pdata.buttons = keys_8930_pm8917;
2783 gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917);
David Collins86161e42012-08-20 12:17:09 -07002784
2785 msm_device_saw_core0.dev.platform_data
2786 = &msm8930_pm8038_saw_regulator_core0_pdata;
2787 msm_device_saw_core1.dev.platform_data
2788 = &msm8930_pm8038_saw_regulator_core1_pdata;
2789
2790 msm8930_device_rpm_regulator.dev.platform_data
2791 = &msm8930_pm8917_rpm_regulator_pdata;
Patrick Dalya3b73c42012-08-28 13:39:17 -07002792
2793 pdata = msm8930_device_acpuclk.dev.platform_data;
2794 pdata->uses_pm8917 = true;
Tianyi Gou01c27a32012-10-29 19:13:53 -07002795
2796 pdata = msm8930ab_device_acpuclk.dev.platform_data;
2797 pdata->uses_pm8917 = true;
David Collins04499982012-08-06 15:02:03 -07002798}
2799
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002800static void __init msm8930_cdp_init(void)
2801{
David Collins04499982012-08-06 15:02:03 -07002802 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2803 msm8930_pm8917_pdata_fixup();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002804 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2805 pr_err("meminfo_init() failed!\n");
2806
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07002807 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002808 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002809 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002810 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
2811 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2812 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
2813 } else {
2814 BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917));
2815 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917));
2816 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002817
2818 regulator_suppress_info_printing();
2819 if (msm_xo_init())
2820 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002821 platform_device_register(&msm8930_device_rpm_regulator);
Patrick Dalyb1d5f752012-08-27 16:25:07 -07002822 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2823 msm_clock_init(&msm8930_pm8917_clock_init_data);
2824 else
2825 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302826 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002827 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302828 android_usb_pdata.swfi_latency =
2829 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002830 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002831 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2832 &msm8960_qup_spi_gsbi1_pdata;
2833 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2834
Jay Chokshi06fa7542011-12-07 13:09:17 -08002835 /*
2836 * TODO: When physical 8930/PM8038 hardware becomes
2837 * available, remove this block or add the config
2838 * option.
2839 */
2840#ifndef MSM8930_PHASE_2
2841 msm8960_init_pmic();
2842#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002843 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002844#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002845 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302846 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002847 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2848 msm_spm_l2_init(msm_spm_l2_data);
2849 msm8930_init_buses();
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002850 if (cpu_is_msm8627()) {
Tianyi Gou723843b2012-06-13 15:24:56 -07002851 platform_add_devices(msm8627_footswitch,
2852 msm8627_num_footswitch);
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002853 } else {
2854 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2855 platform_add_devices(msm8930_pm8917_footswitch,
2856 msm8930_pm8917_num_footswitch);
2857 else
2858 platform_add_devices(msm8930_footswitch,
2859 msm8930_num_footswitch);
2860 }
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002861 if (cpu_is_msm8627())
Matt Wagantallab730bd2012-06-07 20:13:51 -07002862 platform_device_register(&msm8627_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002863 else if (cpu_is_msm8930())
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002864 platform_device_register(&msm8930_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002865 else if (cpu_is_msm8930aa())
2866 platform_device_register(&msm8930aa_device_acpuclk);
Tianyi Gou01c27a32012-10-29 19:13:53 -07002867 else if (cpu_is_msm8930ab())
2868 platform_device_register(&msm8930ab_device_acpuclk);
David Collins86161e42012-08-20 12:17:09 -07002869 platform_add_devices(early_common_devices,
2870 ARRAY_SIZE(early_common_devices));
2871 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2872 platform_add_devices(pmic_pm8038_devices,
2873 ARRAY_SIZE(pmic_pm8038_devices));
2874 else
2875 platform_add_devices(pmic_pm8917_devices,
2876 ARRAY_SIZE(pmic_pm8917_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002877 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002878 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002879 /*
2880 * TODO: When physical 8930/PM8038 hardware becomes
2881 * available, remove this block or add the config
2882 * option.
2883 */
2884#ifndef MSM8930_PHASE_2
2885 msm8960_pm8921_gpio_mpp_init();
2886#else
David Collins04499982012-08-06 15:02:03 -07002887 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2888 msm8930_pm8038_gpio_mpp_init();
2889 else
2890 msm8930_pm8917_gpio_mpp_init();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002891#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002892 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002893#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002894 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002895#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002896 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002897 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002898 register_i2c_devices();
2899 msm8930_init_fb();
2900 slim_register_board_info(msm_slim_devices,
2901 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002902 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002903 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302904 msm_pm_set_tz_retention_flag(1);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002905
2906 if (PLATFORM_IS_CHARM25())
2907 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2908}
2909
2910MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2911 .map_io = msm8930_map_io,
2912 .reserve = msm8930_reserve,
2913 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302914 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002915 .timer = &msm_timer,
2916 .init_machine = msm8930_cdp_init,
2917 .init_early = msm8930_allocate_memory_regions,
2918 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002919 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002920MACHINE_END
2921
2922MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2923 .map_io = msm8930_map_io,
2924 .reserve = msm8930_reserve,
2925 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302926 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002927 .timer = &msm_timer,
2928 .init_machine = msm8930_cdp_init,
2929 .init_early = msm8930_allocate_memory_regions,
2930 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002931 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002932MACHINE_END
2933
2934MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2935 .map_io = msm8930_map_io,
2936 .reserve = msm8930_reserve,
2937 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302938 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002939 .timer = &msm_timer,
2940 .init_machine = msm8930_cdp_init,
2941 .init_early = msm8930_allocate_memory_regions,
2942 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002943 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002944MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002945
2946MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2947 .map_io = msm8930_map_io,
2948 .reserve = msm8930_reserve,
2949 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302950 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002951 .timer = &msm_timer,
2952 .init_machine = msm8930_cdp_init,
2953 .init_early = msm8930_allocate_memory_regions,
2954 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002955 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002956MACHINE_END
2957
2958MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2959 .map_io = msm8930_map_io,
2960 .reserve = msm8930_reserve,
2961 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302962 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002963 .timer = &msm_timer,
2964 .init_machine = msm8930_cdp_init,
2965 .init_early = msm8930_allocate_memory_regions,
2966 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002967 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002968MACHINE_END