blob: 19530e3ad10e0a06df3fc64709fae90a1e0701e9 [file] [log] [blame]
David Collinsb4558422012-01-05 10:50:49 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. 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>
29#include <linux/msm_kgsl.h>
30#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
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
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080051#include <asm/mach-types.h>
52#include <asm/mach/arch.h>
53#include <asm/setup.h>
54#include <asm/hardware/gic.h>
55#include <asm/mach/mmc.h>
56
57#include <mach/board.h>
58#include <mach/msm_iomap.h>
59#include <mach/msm_spi.h>
60#ifdef CONFIG_USB_MSM_OTG_72K
61#include <mach/msm_hsusb.h>
62#else
63#include <linux/usb/msm_hsusb.h>
64#endif
65#include <linux/usb/android.h>
66#include <mach/usbdiag.h>
67#include <mach/socinfo.h>
68#include <mach/rpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080069#include <mach/gpiomux.h>
70#include <mach/msm_bus_board.h>
71#include <mach/msm_memtypes.h>
72#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080073#include <mach/msm_xo.h>
74#include <mach/restart.h>
75
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080076#include <linux/ion.h>
77#include <mach/ion.h>
78#include <mach/mdm2.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080079#include <mach/msm_rtb.h>
Hanumant Singheea62562012-05-14 11:32:45 -070080#include <linux/fmem.h>
Laura Abbottf3173042012-05-29 15:23:18 -070081#include <mach/msm_cache_dump.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080082
Wentao Xuf59ce4e2012-05-22 17:30:13 -040083#ifdef CONFIG_INPUT_MPU3050
84#include <linux/input/mpu3050.h>
85#endif
86
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080087#include "timer.h"
88#include "devices.h"
89#include "devices-msm8x60.h"
90#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080091#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080092#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080093#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053094#include <mach/mpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080095#include "smd_private.h"
96#include "pm-boot.h"
97#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -080098#include "board-8930.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080099
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800100static struct platform_device msm_fm_platform_init = {
101 .name = "iris_fm",
102 .id = -1,
103};
104
105#define KS8851_RST_GPIO 89
106#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800107#define HAP_SHIFT_LVL_OE_GPIO 47
108
Manoj Raoc6d904c2012-06-22 00:32:14 -0700109#define HDMI_MHL_MUX_GPIO 73
110#define MHL_GPIO_INT 72
111#define MHL_GPIO_RESET 71
112#define MHL_GPIO_PWR_EN 5
113
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800114#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
115
116struct sx150x_platform_data msm8930_sx150x_data[] = {
117 [SX150X_CAM] = {
118 .gpio_base = GPIO_CAM_EXPANDER_BASE,
119 .oscio_is_gpo = false,
120 .io_pullup_ena = 0x0,
121 .io_pulldn_ena = 0xc0,
122 .io_open_drain_ena = 0x0,
123 .irq_summary = -1,
124 },
125};
126
127#endif
128
Olav Haugana21169d2012-01-04 09:17:06 -0800129#define MSM_PMEM_ADSP_SIZE 0x7800000
Asish Bhattacharya9ed880f2012-04-12 08:33:37 +0530130#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800131#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
132#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
133#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800134#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800135#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700136#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800137
138#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur9830bf02012-06-01 15:04:29 -0700139#define HOLE_SIZE 0x20000
Asish Bhattacharya9ed880f2012-04-12 08:33:37 +0530140#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700141#ifdef CONFIG_MSM_IOMMU
142#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
143#define MSM_ION_SF_SIZE 0x0
Olav Haugan494e4dc2012-05-15 15:14:31 -0700144#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Hanumant Singhedfb0462012-05-15 14:49:32 -0700145#define MSM_ION_HEAP_NUM 7
146#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800147#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800148#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan494e4dc2012-05-15 15:14:31 -0700149#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Hanumant Singheea62562012-05-14 11:32:45 -0700150#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700151#endif
Deepak Kotur9830bf02012-06-01 15:04:29 -0700152#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800153#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800154#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700155
156#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
157#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
158#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
159
Deepak Kotur9830bf02012-06-01 15:04:29 -0700160#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */
161#define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
162 HOLE_SIZE))
Hanumant Singheea62562012-05-14 11:32:45 -0700163#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur9830bf02012-06-01 15:04:29 -0700164#define MSM8930_FW_START MSM8930_FIXED_AREA_START
Hanumant Singheea62562012-05-14 11:32:45 -0700165
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800166#else
167#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800168#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800169#endif
170
171#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
172static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
173static int __init pmem_kernel_ebi1_size_setup(char *p)
174{
175 pmem_kernel_ebi1_size = memparse(p, NULL);
176 return 0;
177}
178early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
179#endif
180
181#ifdef CONFIG_ANDROID_PMEM
182static unsigned pmem_size = MSM_PMEM_SIZE;
183static int __init pmem_size_setup(char *p)
184{
185 pmem_size = memparse(p, NULL);
186 return 0;
187}
188early_param("pmem_size", pmem_size_setup);
189
190static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
191
192static int __init pmem_adsp_size_setup(char *p)
193{
194 pmem_adsp_size = memparse(p, NULL);
195 return 0;
196}
197early_param("pmem_adsp_size", pmem_adsp_size_setup);
198
199static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
200
201static int __init pmem_audio_size_setup(char *p)
202{
203 pmem_audio_size = memparse(p, NULL);
204 return 0;
205}
206early_param("pmem_audio_size", pmem_audio_size_setup);
207#endif
208
209#ifdef CONFIG_ANDROID_PMEM
210#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
211static struct android_pmem_platform_data android_pmem_pdata = {
212 .name = "pmem",
213 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
214 .cached = 1,
215 .memory_type = MEMTYPE_EBI1,
216};
217
Laura Abbottb93525f2012-04-12 09:57:19 -0700218static struct platform_device msm8930_android_pmem_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800219 .name = "android_pmem",
220 .id = 0,
221 .dev = {.platform_data = &android_pmem_pdata},
222};
223
224static struct android_pmem_platform_data android_pmem_adsp_pdata = {
225 .name = "pmem_adsp",
226 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
227 .cached = 0,
228 .memory_type = MEMTYPE_EBI1,
229};
Laura Abbottb93525f2012-04-12 09:57:19 -0700230static struct platform_device msm8930_android_pmem_adsp_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800231 .name = "android_pmem",
232 .id = 2,
233 .dev = { .platform_data = &android_pmem_adsp_pdata },
234};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800235
236static struct android_pmem_platform_data android_pmem_audio_pdata = {
237 .name = "pmem_audio",
238 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
239 .cached = 0,
240 .memory_type = MEMTYPE_EBI1,
241};
242
Laura Abbottb93525f2012-04-12 09:57:19 -0700243static struct platform_device msm8930_android_pmem_audio_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800244 .name = "android_pmem",
245 .id = 4,
246 .dev = { .platform_data = &android_pmem_audio_pdata },
247};
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530248#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
249#endif /* CONFIG_ANDROID_PMEM */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800250
Hanumant Singheea62562012-05-14 11:32:45 -0700251struct fmem_platform_data msm8930_fmem_pdata = {
252};
253
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800254#define DSP_RAM_BASE_8960 0x8da00000
255#define DSP_RAM_SIZE_8960 0x1800000
256static int dspcrashd_pdata_8960 = 0xDEADDEAD;
257
258static struct resource resources_dspcrashd_8960[] = {
259 {
260 .name = "msm_dspcrashd",
261 .start = DSP_RAM_BASE_8960,
262 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
263 .flags = IORESOURCE_DMA,
264 },
265};
266
267static struct platform_device msm_device_dspcrashd_8960 = {
268 .name = "msm_dspcrashd",
269 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
270 .resource = resources_dspcrashd_8960,
271 .dev = { .platform_data = &dspcrashd_pdata_8960 },
272};
273
274static struct memtype_reserve msm8930_reserve_table[] __initdata = {
275 [MEMTYPE_SMI] = {
276 },
277 [MEMTYPE_EBI0] = {
278 .flags = MEMTYPE_FLAGS_1M_ALIGN,
279 },
280 [MEMTYPE_EBI1] = {
281 .flags = MEMTYPE_FLAGS_1M_ALIGN,
282 },
283};
284
Laura Abbottf8c03b92012-02-16 14:57:58 -0800285
286static void __init reserve_rtb_memory(void)
287{
288#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700289 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800290#endif
291}
292
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800293static void __init size_pmem_devices(void)
294{
295#ifdef CONFIG_ANDROID_PMEM
296#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
297 android_pmem_adsp_pdata.size = pmem_adsp_size;
298 android_pmem_pdata.size = pmem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800299 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530300#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
301#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800302}
303
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530304#ifdef CONFIG_ANDROID_PMEM
305#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800306static void __init reserve_memory_for(struct android_pmem_platform_data *p)
307{
308 msm8930_reserve_table[p->memory_type].size += p->size;
309}
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530310#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
311#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800312
313static void __init reserve_pmem_memory(void)
314{
315#ifdef CONFIG_ANDROID_PMEM
316#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
317 reserve_memory_for(&android_pmem_adsp_pdata);
318 reserve_memory_for(&android_pmem_pdata);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800319 reserve_memory_for(&android_pmem_audio_pdata);
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530320#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800321 msm8930_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530322#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800323}
324
325static int msm8930_paddr_to_memtype(unsigned int paddr)
326{
327 return MEMTYPE_EBI1;
328}
329
Steve Mucklef132c6c2012-06-06 18:30:57 -0700330#define FMEM_ENABLED 0
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800331#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800332#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700333static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800334 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800335 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700336 .reusable = FMEM_ENABLED,
337 .mem_is_fmem = FMEM_ENABLED,
338 .fixed_position = FIXED_MIDDLE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800339};
340
Laura Abbottb93525f2012-04-12 09:57:19 -0700341static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800342 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800343 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700344 .reusable = 0,
345 .mem_is_fmem = FMEM_ENABLED,
346 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800347};
Hanumant Singheea62562012-05-14 11:32:45 -0700348
Laura Abbottb93525f2012-04-12 09:57:19 -0700349static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800350 .adjacent_mem_id = INVALID_HEAP_ID,
351 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700352 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800353};
Hanumant Singheea62562012-05-14 11:32:45 -0700354
Laura Abbottb93525f2012-04-12 09:57:19 -0700355static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800356 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
357 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700358 .mem_is_fmem = FMEM_ENABLED,
359 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800360};
361#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800362
363/**
364 * These heaps are listed in the order they will be allocated. Due to
365 * video hardware restrictions and content protection the FW heap has to
366 * be allocated adjacent (below) the MM heap and the MFC heap has to be
367 * allocated after the MM heap to ensure MFC heap is not more than 256MB
368 * away from the base address of the FW heap.
369 * However, the order of FW heap and MM heap doesn't matter since these
370 * two heaps are taken care of by separate code to ensure they are adjacent
371 * to each other.
372 * Don't swap the order unless you know what you are doing!
373 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700374static struct ion_platform_data msm8930_ion_pdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800375 .nr = MSM_ION_HEAP_NUM,
376 .heaps = {
377 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800378 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800379 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800380 .name = ION_VMALLOC_HEAP_NAME,
381 },
382#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
383 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800384 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800385 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800386 .name = ION_MM_HEAP_NAME,
387 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800388 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700389 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800390 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800391 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800392 .id = ION_MM_FIRMWARE_HEAP_ID,
393 .type = ION_HEAP_TYPE_CARVEOUT,
394 .name = ION_MM_FIRMWARE_HEAP_NAME,
395 .size = MSM_ION_MM_FW_SIZE,
396 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700397 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800398 },
399 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800400 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800401 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800402 .name = ION_MFC_HEAP_NAME,
403 .size = MSM_ION_MFC_SIZE,
404 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700405 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800406 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700407#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800408 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800409 .id = ION_SF_HEAP_ID,
410 .type = ION_HEAP_TYPE_CARVEOUT,
411 .name = ION_SF_HEAP_NAME,
412 .size = MSM_ION_SF_SIZE,
413 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700414 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800415 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700416#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800417 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800418 .id = ION_IOMMU_HEAP_ID,
419 .type = ION_HEAP_TYPE_IOMMU,
420 .name = ION_IOMMU_HEAP_NAME,
421 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800422 {
423 .id = ION_QSECOM_HEAP_ID,
424 .type = ION_HEAP_TYPE_CARVEOUT,
425 .name = ION_QSECOM_HEAP_NAME,
426 .size = MSM_ION_QSECOM_SIZE,
427 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700428 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800429 },
Olav Haugan7355db02012-01-13 16:59:13 -0800430 {
431 .id = ION_AUDIO_HEAP_ID,
432 .type = ION_HEAP_TYPE_CARVEOUT,
433 .name = ION_AUDIO_HEAP_NAME,
434 .size = MSM_ION_AUDIO_SIZE,
435 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700436 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800437 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800438#endif
439 }
440};
441
Laura Abbottb93525f2012-04-12 09:57:19 -0700442static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800443 .name = "ion-msm",
444 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700445 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800446};
447#endif
448
Hanumant Singheea62562012-05-14 11:32:45 -0700449struct platform_device msm8930_fmem_device = {
450 .name = "fmem",
451 .id = 1,
452 .dev = { .platform_data = &msm8930_fmem_pdata },
453};
454
455static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
456 unsigned long size)
457{
458 msm8930_reserve_table[mem_type].size += size;
459}
460
461static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
462{
463#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
464 int ret;
465
466 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
467 panic("fixed area size is larger than %dM\n",
468 MAX_FIXED_AREA_SIZE >> 20);
469
470 reserve_info->fixed_area_size = fixed_area_size;
471 reserve_info->fixed_area_start = MSM8930_FW_START;
472
473 ret = memblock_remove(reserve_info->fixed_area_start,
474 reserve_info->fixed_area_size);
475 BUG_ON(ret);
476#endif
477}
478
479/**
480 * Reserve memory for ION and calculate amount of reusable memory for fmem.
481 * We only reserve memory for heaps that are not reusable. However, we only
482 * support one reusable heap at the moment so we ignore the reusable flag for
483 * other than the first heap with reusable flag set. Also handle special case
484 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
485 * at a higher address than FW in addition to not more than 256MB away from the
486 * base address of the firmware. This means that if MM is reusable the other
487 * two heaps must be allocated in the same region as FW. This is handled by the
488 * mem_is_fmem flag in the platform data. In addition the MM heap must be
489 * adjacent to the FW heap for content protection purposes.
490 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700491static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800492{
493#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700494 unsigned int i;
495 unsigned int reusable_count = 0;
496 unsigned int fixed_size = 0;
497 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
498 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
499
500 msm8930_fmem_pdata.size = 0;
501 msm8930_fmem_pdata.reserved_size_low = 0;
502 msm8930_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700503 msm8930_fmem_pdata.align = PAGE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700504 fixed_low_size = 0;
505 fixed_middle_size = 0;
506 fixed_high_size = 0;
507
508 /* We only support 1 reusable heap. Check if more than one heap
509 * is specified as reusable and set as non-reusable if found.
510 */
511 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
512 const struct ion_platform_heap *heap =
513 &(msm8930_ion_pdata.heaps[i]);
514
515 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
516 struct ion_cp_heap_pdata *data = heap->extra_data;
517
518 reusable_count += (data->reusable) ? 1 : 0;
519
520 if (data->reusable && reusable_count > 1) {
521 pr_err("%s: Too many heaps specified as "
522 "reusable. Heap %s was not configured "
523 "as reusable.\n", __func__, heap->name);
524 data->reusable = 0;
525 }
526 }
527 }
528
529 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
530 const struct ion_platform_heap *heap =
531 &(msm8930_ion_pdata.heaps[i]);
532
533 if (heap->extra_data) {
534 int fixed_position = NOT_FIXED;
535 int mem_is_fmem = 0;
536
537 switch (heap->type) {
538 case ION_HEAP_TYPE_CP:
539 mem_is_fmem = ((struct ion_cp_heap_pdata *)
540 heap->extra_data)->mem_is_fmem;
541 fixed_position = ((struct ion_cp_heap_pdata *)
542 heap->extra_data)->fixed_position;
543 break;
544 case ION_HEAP_TYPE_CARVEOUT:
545 mem_is_fmem = ((struct ion_co_heap_pdata *)
546 heap->extra_data)->mem_is_fmem;
547 fixed_position = ((struct ion_co_heap_pdata *)
548 heap->extra_data)->fixed_position;
549 break;
550 default:
551 break;
552 }
553
554 if (fixed_position != NOT_FIXED)
555 fixed_size += heap->size;
556 else
557 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
558
559 if (fixed_position == FIXED_LOW)
560 fixed_low_size += heap->size;
561 else if (fixed_position == FIXED_MIDDLE)
562 fixed_middle_size += heap->size;
563 else if (fixed_position == FIXED_HIGH)
564 fixed_high_size += heap->size;
565
566 if (mem_is_fmem)
567 msm8930_fmem_pdata.size += heap->size;
568 }
569 }
570
571 if (!fixed_size)
572 return;
573
574 if (msm8930_fmem_pdata.size) {
Deepak Kotur9830bf02012-06-01 15:04:29 -0700575 msm8930_fmem_pdata.reserved_size_low = fixed_low_size +
576 HOLE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700577 msm8930_fmem_pdata.reserved_size_high = fixed_high_size;
578 }
579
580 /* Since the fixed area may be carved out of lowmem,
581 * make sure the length is a multiple of 1M.
582 */
583 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
584 & SECTION_MASK;
585 msm8930_reserve_fixed_area(fixed_size);
586
587 fixed_low_start = MSM8930_FIXED_AREA_START;
Deepak Kotur9830bf02012-06-01 15:04:29 -0700588 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700589 fixed_high_start = fixed_middle_start + fixed_middle_size;
590
591 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
592 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
593
594 if (heap->extra_data) {
595 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700596 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700597
598 switch (heap->type) {
599 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700600 pdata =
601 (struct ion_cp_heap_pdata *)heap->extra_data;
602 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700603 break;
604 case ION_HEAP_TYPE_CARVEOUT:
605 fixed_position = ((struct ion_co_heap_pdata *)
606 heap->extra_data)->fixed_position;
607 break;
608 default:
609 break;
610 }
611
612 switch (fixed_position) {
613 case FIXED_LOW:
614 heap->base = fixed_low_start;
615 break;
616 case FIXED_MIDDLE:
617 heap->base = fixed_middle_start;
Deepak Kotur9830bf02012-06-01 15:04:29 -0700618 pdata->secure_base = fixed_middle_start
619 - HOLE_SIZE;
620 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700621 break;
622 case FIXED_HIGH:
623 heap->base = fixed_high_start;
624 break;
625 default:
626 break;
627 }
628 }
629 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800630#endif
631}
Huaibin Yanga5419422011-12-08 23:52:10 -0800632
633static void __init reserve_mdp_memory(void)
634{
635 msm8930_mdp_writeback(msm8930_reserve_table);
636}
637
Laura Abbottf3173042012-05-29 15:23:18 -0700638#ifdef CONFIG_MSM_CACHE_DUMP
639static void __init reserve_cache_dump_memory(void)
640{
641 unsigned int total;
642
643 total = msm8930_cache_dump_pdata.l1_size +
644 msm8930_cache_dump_pdata.l2_size;
645 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
646}
647#else
648static void __init reserve_cache_dump_memory(void) { }
649#endif
650
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800651static void __init msm8930_calculate_reserve_sizes(void)
652{
653 size_pmem_devices();
654 reserve_pmem_memory();
655 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800656 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800657 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700658 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800659}
660
661static struct reserve_info msm8930_reserve_info __initdata = {
662 .memtype_reserve_table = msm8930_reserve_table,
663 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700664 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800665 .paddr_to_memtype = msm8930_paddr_to_memtype,
666};
667
668static int msm8930_memory_bank_size(void)
669{
670 return 1<<29;
671}
672
673static void __init locate_unstable_memory(void)
674{
675 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
676 unsigned long bank_size;
677 unsigned long low, high;
678
679 bank_size = msm8930_memory_bank_size();
680 low = meminfo.bank[0].start;
681 high = mb->start + mb->size;
682
683 /* Check if 32 bit overflow occured */
684 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700685 high -= PAGE_SIZE;
686
687 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
688 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800689
690 low &= ~(bank_size - 1);
691
692 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700693 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800694
695 msm8930_reserve_info.bank_size = bank_size;
696#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800697 msm8930_reserve_info.low_unstable_address = mb->start -
698 MIN_MEMORY_BLOCK_SIZE + mb->size;
699 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800700 pr_info("low unstable address %lx max size %lx bank size %lx\n",
701 msm8930_reserve_info.low_unstable_address,
702 msm8930_reserve_info.max_unstable_size,
703 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700704 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800705#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700706no_dmm:
707 msm8930_reserve_info.low_unstable_address = high;
708 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800709}
710
711static void __init place_movable_zone(void)
712{
Larry Basselb8d61022012-02-24 10:49:45 -0800713#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800714 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
715 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
716 pr_info("movable zone start %lx size %lx\n",
717 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800718#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800719}
720
721static void __init msm8930_early_memory(void)
722{
723 reserve_info = &msm8930_reserve_info;
724 locate_unstable_memory();
725 place_movable_zone();
726}
727
728static void __init msm8930_reserve(void)
729{
730 msm_reserve();
Hanumant Singheea62562012-05-14 11:32:45 -0700731 if (msm8930_fmem_pdata.size) {
732#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
733 if (reserve_info->fixed_area_size) {
734 msm8930_fmem_pdata.phys =
735 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
736 pr_info("mm fw at %lx (fixed) size %x\n",
737 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
738 pr_info("fmem start %lx (fixed) size %lx\n",
739 msm8930_fmem_pdata.phys, msm8930_fmem_pdata.size);
740 }
741#endif
742 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800743}
744
745static int msm8930_change_memory_power(u64 start, u64 size,
746 int change_type)
747{
748 return soc_change_memory_power(start, size, change_type);
749}
750
751static void __init msm8930_allocate_memory_regions(void)
752{
753 msm8930_allocate_fb_region();
754}
755
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530756#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800757
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530758#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800759
760/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
761 * 4 micbiases are used to power various analog and digital
762 * microphones operating at 1800 mV. Technically, all micbiases
763 * can source from single cfilter since all microphones operate
764 * at the same voltage level. The arrangement below is to make
765 * sure all cfilters are exercised. LDO_H regulator ouput level
766 * does not need to be as high as 2.85V. It is choosen for
767 * microphone sensitivity purpose.
768 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530769static struct wcd9xxx_pdata sitar_platform_data = {
770 .slimbus_slave_device = {
771 .name = "sitar-slave",
772 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800773 },
774 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530775 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530776 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530777 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800778 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530779 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800780 .cfilt1_mv = 1800,
781 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530782 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
783 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
784 },
785 .regulator = {
786 {
787 .name = "CDC_VDD_CP",
David Collins226f2512012-03-19 13:18:39 -0700788 .min_uV = 1950000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530789 .max_uV = 2200000,
790 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
791 },
792 {
793 .name = "CDC_VDDA_RX",
794 .min_uV = 1800000,
795 .max_uV = 1800000,
796 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
797 },
798 {
799 .name = "CDC_VDDA_TX",
800 .min_uV = 1800000,
801 .max_uV = 1800000,
802 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
803 },
804 {
805 .name = "VDDIO_CDC",
806 .min_uV = 1800000,
807 .max_uV = 1800000,
808 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
809 },
810 {
811 .name = "VDDD_CDC_D",
812 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700813 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530814 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
815 },
816 {
817 .name = "CDC_VDDA_A_1P2V",
818 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700819 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530820 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
821 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800822 },
823};
824
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530825static struct slim_device msm_slim_sitar = {
826 .name = "sitar-slim",
827 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800828 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530829 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800830 },
831};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700832
833static struct wcd9xxx_pdata sitar1p1_platform_data = {
834 .slimbus_slave_device = {
835 .name = "sitar-slave",
836 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
837 },
838 .irq = MSM_GPIO_TO_INT(62),
839 .irq_base = SITAR_INTERRUPT_BASE,
840 .num_irqs = NR_WCD9XXX_IRQS,
841 .reset_gpio = 42,
842 .micbias = {
843 .ldoh_v = SITAR_LDOH_2P85_V,
844 .cfilt1_mv = 1800,
845 .cfilt2_mv = 1800,
846 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
847 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
848 },
849 .regulator = {
850 {
851 .name = "CDC_VDD_CP",
852 .min_uV = 1950000,
853 .max_uV = 2200000,
854 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
855 },
856 {
857 .name = "CDC_VDDA_RX",
858 .min_uV = 1800000,
859 .max_uV = 1800000,
860 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
861 },
862 {
863 .name = "CDC_VDDA_TX",
864 .min_uV = 1800000,
865 .max_uV = 1800000,
866 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
867 },
868 {
869 .name = "VDDIO_CDC",
870 .min_uV = 1800000,
871 .max_uV = 1800000,
872 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
873 },
874 {
875 .name = "VDDD_CDC_D",
876 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700877 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700878 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
879 },
880 {
881 .name = "CDC_VDDA_A_1P2V",
882 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700883 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700884 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
885 },
886 },
887};
888
889static struct slim_device msm_slim_sitar1p1 = {
890 .name = "sitar1p1-slim",
891 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
892 .dev = {
893 .platform_data = &sitar1p1_platform_data,
894 },
895};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800896#endif
897
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530898
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800899static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530900#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800901 {
902 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530903 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800904 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700905 {
906 .bus_num = 1,
907 .slim_slave = &msm_slim_sitar1p1,
908 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800909#endif
910 /* add more slimbus slaves as needed */
911};
912
913#define MSM_WCNSS_PHYS 0x03000000
914#define MSM_WCNSS_SIZE 0x280000
915
916static struct resource resources_wcnss_wlan[] = {
917 {
918 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
919 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
920 .name = "wcnss_wlanrx_irq",
921 .flags = IORESOURCE_IRQ,
922 },
923 {
924 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
925 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
926 .name = "wcnss_wlantx_irq",
927 .flags = IORESOURCE_IRQ,
928 },
929 {
930 .start = MSM_WCNSS_PHYS,
931 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
932 .name = "wcnss_mmio",
933 .flags = IORESOURCE_MEM,
934 },
935 {
936 .start = 84,
937 .end = 88,
938 .name = "wcnss_gpios_5wire",
939 .flags = IORESOURCE_IO,
940 },
941};
942
943static struct qcom_wcnss_opts qcom_wcnss_pdata = {
944 .has_48mhz_xo = 1,
945};
946
947static struct platform_device msm_device_wcnss_wlan = {
948 .name = "wcnss_wlan",
949 .id = 0,
950 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
951 .resource = resources_wcnss_wlan,
952 .dev = {.platform_data = &qcom_wcnss_pdata},
953};
954
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700955#ifdef CONFIG_QSEECOM
956/* qseecom bus scaling */
957static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
958 {
959 .src = MSM_BUS_MASTER_SPS,
960 .dst = MSM_BUS_SLAVE_EBI_CH0,
961 .ib = 0,
962 .ab = 0,
963 },
964 {
965 .src = MSM_BUS_MASTER_SPDM,
966 .dst = MSM_BUS_SLAVE_SPDM,
967 .ib = 0,
968 .ab = 0,
969 },
970};
971
972static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
973 {
974 .src = MSM_BUS_MASTER_SPS,
975 .dst = MSM_BUS_SLAVE_EBI_CH0,
976 .ib = (492 * 8) * 1000000UL,
977 .ab = (492 * 8) * 100000UL,
978 },
979 {
980 .src = MSM_BUS_MASTER_SPDM,
981 .dst = MSM_BUS_SLAVE_SPDM,
982 .ib = 0,
983 .ab = 0,
984 },
985};
986
987static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
988 {
989 .src = MSM_BUS_MASTER_SPS,
990 .dst = MSM_BUS_SLAVE_EBI_CH0,
991 .ib = 0,
992 .ab = 0,
993 },
994 {
995 .src = MSM_BUS_MASTER_SPDM,
996 .dst = MSM_BUS_SLAVE_SPDM,
997 .ib = (64 * 8) * 1000000UL,
998 .ab = (64 * 8) * 100000UL,
999 },
1000};
1001
1002static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1003 {
1004 ARRAY_SIZE(qseecom_clks_init_vectors),
1005 qseecom_clks_init_vectors,
1006 },
1007 {
1008 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1009 qseecom_enable_sfpb_vectors,
1010 },
1011 {
1012 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1013 qseecom_enable_sfpb_vectors,
1014 },
1015};
1016
1017static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1018 qseecom_hw_bus_scale_usecases,
1019 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1020 .name = "qsee",
1021};
1022
1023static struct platform_device qseecom_device = {
1024 .name = "qseecom",
1025 .id = 0,
1026 .dev = {
1027 .platform_data = &qseecom_bus_pdata,
1028 },
1029};
1030#endif
1031
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001032#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1033 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1034 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1035 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1036
1037#define QCE_SIZE 0x10000
1038#define QCE_0_BASE 0x18500000
1039
1040#define QCE_HW_KEY_SUPPORT 0
1041#define QCE_SHA_HMAC_SUPPORT 1
1042#define QCE_SHARE_CE_RESOURCE 1
1043#define QCE_CE_SHARED 0
1044
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001045/* Begin Bus scaling definitions */
1046static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1047 {
1048 .src = MSM_BUS_MASTER_ADM_PORT0,
1049 .dst = MSM_BUS_SLAVE_EBI_CH0,
1050 .ab = 0,
1051 .ib = 0,
1052 },
1053 {
1054 .src = MSM_BUS_MASTER_ADM_PORT1,
1055 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1056 .ab = 0,
1057 .ib = 0,
1058 },
1059};
1060
1061static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1062 {
1063 .src = MSM_BUS_MASTER_ADM_PORT0,
1064 .dst = MSM_BUS_SLAVE_EBI_CH0,
1065 .ab = 70000000UL,
1066 .ib = 70000000UL,
1067 },
1068 {
1069 .src = MSM_BUS_MASTER_ADM_PORT1,
1070 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1071 .ab = 2480000000UL,
1072 .ib = 2480000000UL,
1073 },
1074};
1075
1076static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1077 {
1078 ARRAY_SIZE(crypto_hw_init_vectors),
1079 crypto_hw_init_vectors,
1080 },
1081 {
1082 ARRAY_SIZE(crypto_hw_active_vectors),
1083 crypto_hw_active_vectors,
1084 },
1085};
1086
1087static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1088 crypto_hw_bus_scale_usecases,
1089 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1090 .name = "cryptohw",
1091};
1092/* End Bus Scaling Definitions*/
1093
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001094static struct resource qcrypto_resources[] = {
1095 [0] = {
1096 .start = QCE_0_BASE,
1097 .end = QCE_0_BASE + QCE_SIZE - 1,
1098 .flags = IORESOURCE_MEM,
1099 },
1100 [1] = {
1101 .name = "crypto_channels",
1102 .start = DMOV_CE_IN_CHAN,
1103 .end = DMOV_CE_OUT_CHAN,
1104 .flags = IORESOURCE_DMA,
1105 },
1106 [2] = {
1107 .name = "crypto_crci_in",
1108 .start = DMOV_CE_IN_CRCI,
1109 .end = DMOV_CE_IN_CRCI,
1110 .flags = IORESOURCE_DMA,
1111 },
1112 [3] = {
1113 .name = "crypto_crci_out",
1114 .start = DMOV_CE_OUT_CRCI,
1115 .end = DMOV_CE_OUT_CRCI,
1116 .flags = IORESOURCE_DMA,
1117 },
1118};
1119
1120static struct resource qcedev_resources[] = {
1121 [0] = {
1122 .start = QCE_0_BASE,
1123 .end = QCE_0_BASE + QCE_SIZE - 1,
1124 .flags = IORESOURCE_MEM,
1125 },
1126 [1] = {
1127 .name = "crypto_channels",
1128 .start = DMOV_CE_IN_CHAN,
1129 .end = DMOV_CE_OUT_CHAN,
1130 .flags = IORESOURCE_DMA,
1131 },
1132 [2] = {
1133 .name = "crypto_crci_in",
1134 .start = DMOV_CE_IN_CRCI,
1135 .end = DMOV_CE_IN_CRCI,
1136 .flags = IORESOURCE_DMA,
1137 },
1138 [3] = {
1139 .name = "crypto_crci_out",
1140 .start = DMOV_CE_OUT_CRCI,
1141 .end = DMOV_CE_OUT_CRCI,
1142 .flags = IORESOURCE_DMA,
1143 },
1144};
1145
1146#endif
1147
1148#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1149 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1150
1151static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1152 .ce_shared = QCE_CE_SHARED,
1153 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1154 .hw_key_support = QCE_HW_KEY_SUPPORT,
1155 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001156 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001157};
1158
1159static struct platform_device qcrypto_device = {
1160 .name = "qcrypto",
1161 .id = 0,
1162 .num_resources = ARRAY_SIZE(qcrypto_resources),
1163 .resource = qcrypto_resources,
1164 .dev = {
1165 .coherent_dma_mask = DMA_BIT_MASK(32),
1166 .platform_data = &qcrypto_ce_hw_suppport,
1167 },
1168};
1169#endif
1170
1171#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1172 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1173
1174static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1175 .ce_shared = QCE_CE_SHARED,
1176 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1177 .hw_key_support = QCE_HW_KEY_SUPPORT,
1178 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001179 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001180};
1181
1182static struct platform_device qcedev_device = {
1183 .name = "qce",
1184 .id = 0,
1185 .num_resources = ARRAY_SIZE(qcedev_resources),
1186 .resource = qcedev_resources,
1187 .dev = {
1188 .coherent_dma_mask = DMA_BIT_MASK(32),
1189 .platform_data = &qcedev_ce_hw_suppport,
1190 },
1191};
1192#endif
1193
1194#define MDM2AP_ERRFATAL 70
1195#define AP2MDM_ERRFATAL 95
1196#define MDM2AP_STATUS 69
1197#define AP2MDM_STATUS 94
1198#define AP2MDM_PMIC_RESET_N 80
1199#define AP2MDM_KPDPWR_N 81
1200
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001201static struct resource mdm_resources[] = {
1202 {
1203 .start = MDM2AP_ERRFATAL,
1204 .end = MDM2AP_ERRFATAL,
1205 .name = "MDM2AP_ERRFATAL",
1206 .flags = IORESOURCE_IO,
1207 },
1208 {
1209 .start = AP2MDM_ERRFATAL,
1210 .end = AP2MDM_ERRFATAL,
1211 .name = "AP2MDM_ERRFATAL",
1212 .flags = IORESOURCE_IO,
1213 },
1214 {
1215 .start = MDM2AP_STATUS,
1216 .end = MDM2AP_STATUS,
1217 .name = "MDM2AP_STATUS",
1218 .flags = IORESOURCE_IO,
1219 },
1220 {
1221 .start = AP2MDM_STATUS,
1222 .end = AP2MDM_STATUS,
1223 .name = "AP2MDM_STATUS",
1224 .flags = IORESOURCE_IO,
1225 },
1226 {
1227 .start = AP2MDM_PMIC_RESET_N,
1228 .end = AP2MDM_PMIC_RESET_N,
1229 .name = "AP2MDM_PMIC_RESET_N",
1230 .flags = IORESOURCE_IO,
1231 },
1232 {
1233 .start = AP2MDM_KPDPWR_N,
1234 .end = AP2MDM_KPDPWR_N,
1235 .name = "AP2MDM_KPDPWR_N",
1236 .flags = IORESOURCE_IO,
1237 },
1238};
1239
1240static struct mdm_platform_data mdm_platform_data = {
1241 .mdm_version = "2.5",
1242};
1243
1244static struct platform_device mdm_device = {
1245 .name = "mdm2_modem",
1246 .id = -1,
1247 .num_resources = ARRAY_SIZE(mdm_resources),
1248 .resource = mdm_resources,
1249 .dev = {
1250 .platform_data = &mdm_platform_data,
1251 },
1252};
1253
1254static struct platform_device *mdm_devices[] __initdata = {
1255 &mdm_device,
1256};
1257
Praveen Chidambaram78499012011-11-01 17:15:17 -06001258#ifdef CONFIG_MSM_MPM
1259static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1260 [1] = MSM_GPIO_TO_INT(46),
1261 [2] = MSM_GPIO_TO_INT(150),
1262 [4] = MSM_GPIO_TO_INT(103),
1263 [5] = MSM_GPIO_TO_INT(104),
1264 [6] = MSM_GPIO_TO_INT(105),
1265 [7] = MSM_GPIO_TO_INT(106),
1266 [8] = MSM_GPIO_TO_INT(107),
1267 [9] = MSM_GPIO_TO_INT(7),
1268 [10] = MSM_GPIO_TO_INT(11),
1269 [11] = MSM_GPIO_TO_INT(15),
1270 [12] = MSM_GPIO_TO_INT(19),
1271 [13] = MSM_GPIO_TO_INT(23),
1272 [14] = MSM_GPIO_TO_INT(27),
1273 [15] = MSM_GPIO_TO_INT(31),
1274 [16] = MSM_GPIO_TO_INT(35),
1275 [19] = MSM_GPIO_TO_INT(90),
1276 [20] = MSM_GPIO_TO_INT(92),
1277 [23] = MSM_GPIO_TO_INT(85),
1278 [24] = MSM_GPIO_TO_INT(83),
1279 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001280 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001281 [27] = HDMI_IRQ,
1282 [29] = MSM_GPIO_TO_INT(10),
1283 [30] = MSM_GPIO_TO_INT(102),
1284 [31] = MSM_GPIO_TO_INT(81),
1285 [32] = MSM_GPIO_TO_INT(78),
1286 [33] = MSM_GPIO_TO_INT(94),
1287 [34] = MSM_GPIO_TO_INT(72),
1288 [35] = MSM_GPIO_TO_INT(39),
1289 [36] = MSM_GPIO_TO_INT(43),
1290 [37] = MSM_GPIO_TO_INT(61),
1291 [38] = MSM_GPIO_TO_INT(50),
1292 [39] = MSM_GPIO_TO_INT(42),
1293 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001294 [42] = MSM_GPIO_TO_INT(8),
1295 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001296 [44] = MSM_GPIO_TO_INT(70),
1297 [45] = MSM_GPIO_TO_INT(69),
1298 [46] = MSM_GPIO_TO_INT(67),
1299 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001300 [48] = MSM_GPIO_TO_INT(55),
1301 [49] = MSM_GPIO_TO_INT(74),
1302 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001303 [51] = MSM_GPIO_TO_INT(49),
1304 [52] = MSM_GPIO_TO_INT(40),
1305 [53] = MSM_GPIO_TO_INT(37),
1306 [54] = MSM_GPIO_TO_INT(24),
1307 [55] = MSM_GPIO_TO_INT(14),
1308};
1309
1310static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1311 TLMM_MSM_SUMMARY_IRQ,
1312 RPM_APCC_CPU0_GP_HIGH_IRQ,
1313 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1314 RPM_APCC_CPU0_GP_LOW_IRQ,
1315 RPM_APCC_CPU0_WAKE_UP_IRQ,
1316 RPM_APCC_CPU1_GP_HIGH_IRQ,
1317 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1318 RPM_APCC_CPU1_GP_LOW_IRQ,
1319 RPM_APCC_CPU1_WAKE_UP_IRQ,
1320 MSS_TO_APPS_IRQ_0,
1321 MSS_TO_APPS_IRQ_1,
1322 MSS_TO_APPS_IRQ_2,
1323 MSS_TO_APPS_IRQ_3,
1324 MSS_TO_APPS_IRQ_4,
1325 MSS_TO_APPS_IRQ_5,
1326 MSS_TO_APPS_IRQ_6,
1327 MSS_TO_APPS_IRQ_7,
1328 MSS_TO_APPS_IRQ_8,
1329 MSS_TO_APPS_IRQ_9,
1330 LPASS_SCSS_GP_LOW_IRQ,
1331 LPASS_SCSS_GP_MEDIUM_IRQ,
1332 LPASS_SCSS_GP_HIGH_IRQ,
1333 SPS_MTI_30,
1334 SPS_MTI_31,
1335 RIVA_APSS_SPARE_IRQ,
1336 RIVA_APPS_WLAN_SMSM_IRQ,
1337 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1338 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1339};
1340
1341struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1342 .irqs_m2a = msm_mpm_irqs_m2a,
1343 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1344 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1345 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1346 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1347 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1348 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1349 .mpm_apps_ipc_val = BIT(1),
1350 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1351
1352};
1353#endif
1354
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001355#define MSM_SHARED_RAM_PHYS 0x80000000
1356
1357static void __init msm8930_map_io(void)
1358{
1359 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1360 msm_map_msm8930_io();
1361
1362 if (socinfo_init() < 0)
1363 pr_err("socinfo_init() failed!\n");
1364}
1365
1366static void __init msm8930_init_irq(void)
1367{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001368 struct msm_mpm_device_data *data = NULL;
1369#ifdef CONFIG_MSM_MPM
1370 data = &msm8930_mpm_dev_data;
1371#endif
1372
1373 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001374 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1375 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001376}
1377
1378static void __init msm8930_init_buses(void)
1379{
1380#ifdef CONFIG_MSM_BUS_SCALING
1381 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001382 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1383 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1384 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1385 msm_bus_8930_apps_fabric.dev.platform_data =
1386 &msm_bus_8930_apps_fabric_pdata;
1387 msm_bus_8930_sys_fabric.dev.platform_data =
1388 &msm_bus_8930_sys_fabric_pdata;
1389 msm_bus_8930_mm_fabric.dev.platform_data =
1390 &msm_bus_8930_mm_fabric_pdata;
1391 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1392 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001393#endif
1394}
1395
1396static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1397 .max_clock_speed = 15060000,
1398};
1399
1400#ifdef CONFIG_USB_MSM_OTG_72K
1401static struct msm_otg_platform_data msm_otg_pdata;
1402#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301403#ifdef CONFIG_MSM_BUS_SCALING
1404/* Bandwidth requests (zero) if no vote placed */
1405static struct msm_bus_vectors usb_init_vectors[] = {
1406 {
1407 .src = MSM_BUS_MASTER_SPS,
1408 .dst = MSM_BUS_SLAVE_EBI_CH0,
1409 .ab = 0,
1410 .ib = 0,
1411 },
1412};
1413
1414/* Bus bandwidth requests in Bytes/sec */
1415static struct msm_bus_vectors usb_max_vectors[] = {
1416 {
1417 .src = MSM_BUS_MASTER_SPS,
1418 .dst = MSM_BUS_SLAVE_EBI_CH0,
1419 .ab = 60000000, /* At least 480Mbps on bus. */
1420 .ib = 960000000, /* MAX bursts rate */
1421 },
1422};
1423
1424static struct msm_bus_paths usb_bus_scale_usecases[] = {
1425 {
1426 ARRAY_SIZE(usb_init_vectors),
1427 usb_init_vectors,
1428 },
1429 {
1430 ARRAY_SIZE(usb_max_vectors),
1431 usb_max_vectors,
1432 },
1433};
1434
1435static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1436 usb_bus_scale_usecases,
1437 ARRAY_SIZE(usb_bus_scale_usecases),
1438 .name = "usb",
1439};
1440#endif
1441
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301442static int hsusb_phy_init_seq[] = {
1443 0x44, 0x80, /* set VBUS valid threshold
1444 and disconnect valid threshold */
1445 0x38, 0x81, /* update DC voltage level */
1446 0x24, 0x82, /* set preemphasis and rise/fall time */
1447 0x13, 0x83, /* set source impedance adjusment */
1448 -1};
1449
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001450static struct msm_otg_platform_data msm_otg_pdata = {
1451 .mode = USB_OTG,
1452 .otg_control = OTG_PMIC_CONTROL,
1453 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001454 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001455 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301456#ifdef CONFIG_MSM_BUS_SCALING
1457 .bus_scale_table = &usb_bus_scale_pdata,
1458#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001459};
1460#endif
1461
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001462#define PID_MAGIC_ID 0x71432909
1463#define SERIAL_NUM_MAGIC_ID 0x61945374
1464#define SERIAL_NUMBER_LENGTH 127
1465#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1466
1467struct magic_num_struct {
1468 uint32_t pid;
1469 uint32_t serial_num;
1470};
1471
1472struct dload_struct {
1473 uint32_t reserved1;
1474 uint32_t reserved2;
1475 uint32_t reserved3;
1476 uint16_t reserved4;
1477 uint16_t pid;
1478 char serial_number[SERIAL_NUMBER_LENGTH];
1479 uint16_t reserved5;
1480 struct magic_num_struct magic_struct;
1481};
1482
1483static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1484{
1485 struct dload_struct __iomem *dload = 0;
1486
1487 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1488 if (!dload) {
1489 pr_err("%s: cannot remap I/O memory region: %08x\n",
1490 __func__, DLOAD_USB_BASE_ADD);
1491 return -ENXIO;
1492 }
1493
1494 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1495 __func__, dload, pid, snum);
1496 /* update pid */
1497 dload->magic_struct.pid = PID_MAGIC_ID;
1498 dload->pid = pid;
1499
1500 /* update serial number */
1501 dload->magic_struct.serial_num = 0;
1502 if (!snum) {
1503 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1504 goto out;
1505 }
1506
1507 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1508 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1509out:
1510 iounmap(dload);
1511 return 0;
1512}
1513
1514static struct android_usb_platform_data android_usb_pdata = {
1515 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1516};
1517
1518static struct platform_device android_usb_device = {
1519 .name = "android_usb",
1520 .id = -1,
1521 .dev = {
1522 .platform_data = &android_usb_pdata,
1523 },
1524};
1525
1526static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001527 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001528};
1529
1530static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001531 0x00, 0x24, 0x54, 0x10,
1532 0x09, 0x03, 0x01,
1533 0x10, 0x54, 0x30, 0x0C,
1534 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001535};
1536
1537static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001538 0x00, 0x24, 0x54, 0x10,
1539 0x09, 0x07, 0x01, 0x0B,
1540 0x10, 0x54, 0x30, 0x0C,
1541 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001542};
1543
1544static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1545 [0] = {
1546 .mode = MSM_SPM_MODE_CLOCK_GATING,
1547 .notify_rpm = false,
1548 .cmd = spm_wfi_cmd_sequence,
1549 },
1550 [1] = {
1551 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1552 .notify_rpm = false,
1553 .cmd = spm_power_collapse_without_rpm,
1554 },
1555 [2] = {
1556 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1557 .notify_rpm = true,
1558 .cmd = spm_power_collapse_with_rpm,
1559 },
1560};
1561
1562static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1563 [0] = {
1564 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001565 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001566#if defined(CONFIG_MSM_AVS_HW)
1567 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1568 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1569#endif
1570 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001571 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001572 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1573 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1574 .vctl_timeout_us = 50,
1575 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1576 .modes = msm_spm_seq_list,
1577 },
1578 [1] = {
1579 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001580 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001581#if defined(CONFIG_MSM_AVS_HW)
1582 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1583 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1584#endif
1585 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001586 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001587 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1588 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1589 .vctl_timeout_us = 50,
1590 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1591 .modes = msm_spm_seq_list,
1592 },
1593};
1594
1595static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001596 0x00, 0x20, 0x03, 0x20,
1597 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001598};
1599
1600static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001601 0x00, 0x20, 0x34, 0x64,
1602 0x48, 0x07, 0x48, 0x20,
1603 0x50, 0x64, 0x04, 0x34,
1604 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001605};
1606static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001607 0x00, 0x10, 0x34, 0x64,
1608 0x48, 0x07, 0x48, 0x10,
1609 0x50, 0x64, 0x04, 0x34,
1610 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001611};
1612
1613static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1614 [0] = {
1615 .mode = MSM_SPM_L2_MODE_RETENTION,
1616 .notify_rpm = false,
1617 .cmd = l2_spm_wfi_cmd_sequence,
1618 },
1619 [1] = {
1620 .mode = MSM_SPM_L2_MODE_GDHS,
1621 .notify_rpm = true,
1622 .cmd = l2_spm_gdhs_cmd_sequence,
1623 },
1624 [2] = {
1625 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1626 .notify_rpm = true,
1627 .cmd = l2_spm_power_off_cmd_sequence,
1628 },
1629};
1630
1631static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1632 [0] = {
1633 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001634 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001635 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001636 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1637 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1638 .modes = msm_spm_l2_seq_list,
1639 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1640 },
1641};
1642
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301643#define ISA1200_HAP_EN_GPIO 77
1644#define ISA1200_HAP_LEN_GPIO 78
1645#define ISA1200_HAP_CLK PM8038_GPIO_PM_TO_SYS(7)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001646
1647static int isa1200_power(int on)
1648{
Amy Malocheb20c1052012-04-11 10:36:13 -07001649 int rc = 0;
1650
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301651 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1652
Amy Malocheb20c1052012-04-11 10:36:13 -07001653 if (on)
1654 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_1, true);
1655 else
1656 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_NONE, true);
1657
1658 if (rc) {
1659 pr_err("%s: unable to write aux clock register(%d)\n",
1660 __func__, rc);
1661 }
1662
1663 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001664}
1665
1666static int isa1200_dev_setup(bool enable)
1667{
1668 int rc = 0;
1669
Amy Malocheb20c1052012-04-11 10:36:13 -07001670 if (!enable)
1671 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301672
1673 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1674 if (rc) {
1675 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
1676 __func__, ISA1200_HAP_CLK, rc);
1677 goto fail_gpio_req;
1678 }
1679
1680 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1681 if (rc) {
1682 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
1683 __func__, ISA1200_HAP_CLK, rc);
1684 goto fail_gpio_dir;
1685 }
1686
1687 return 0;
1688
1689fail_gpio_dir:
1690 gpio_free(ISA1200_HAP_CLK);
1691fail_gpio_req:
1692 return rc;
1693
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001694}
1695
1696static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301697 {
1698 .name = "vddp",
1699 .min_uV = ISA_I2C_VTG_MIN_UV,
1700 .max_uV = ISA_I2C_VTG_MAX_UV,
1701 .load_uA = ISA_I2C_CURR_UA,
1702 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001703 {
1704 .name = "vcc_i2c",
1705 .min_uV = ISA_I2C_VTG_MIN_UV,
1706 .max_uV = ISA_I2C_VTG_MAX_UV,
1707 .load_uA = ISA_I2C_CURR_UA,
1708 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001709};
1710
1711static struct isa1200_platform_data isa1200_1_pdata = {
1712 .name = "vibrator",
1713 .dev_setup = isa1200_dev_setup,
1714 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301715 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1716 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001717 .max_timeout = 15000,
1718 .mode_ctrl = PWM_GEN_MODE,
1719 .pwm_fd = {
1720 .pwm_div = 256,
1721 },
1722 .is_erm = false,
1723 .smart_en = true,
1724 .ext_clk_en = true,
1725 .chip_en = 1,
1726 .regulator_info = isa1200_reg_data,
1727 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1728};
1729
1730static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1731 {
1732 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1733 .platform_data = &isa1200_1_pdata,
1734 },
1735};
1736
Amy Malochef3c9db42011-12-08 15:17:35 -08001737#define MXT_TS_GPIO_IRQ 11
1738#define MXT_TS_RESET_GPIO 52
1739
1740static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001741 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001742 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001743 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301744 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001745 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301746 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001747 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301748 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001749 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301750 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1751 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1752 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1753 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001754 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001755 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1756 0,
1757 /* T18 Object */
1758 0, 0,
1759 /* T19 Object */
1760 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1761 0, 0, 0, 0, 0, 0,
1762 /* T23 Object */
1763 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1764 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001765 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001766 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1767 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001768 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001769 0, 0, 0, 0, 0,
1770 /* T42 Object */
1771 0, 0, 0, 0, 0, 0, 0, 0,
1772 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301773 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001774 /* T47 Object */
1775 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1776 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301777 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1778 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1779 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001780 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1781 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1782 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001783};
1784
Amy Malochef3c9db42011-12-08 15:17:35 -08001785static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1786 struct kobj_attribute *attr, char *buf)
1787{
1788 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301789 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1790 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1791 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1792 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001793 "\n");
1794}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001795
Amy Malochef3c9db42011-12-08 15:17:35 -08001796static struct kobj_attribute mxt224e_vkeys_attr = {
1797 .attr = {
1798 .mode = S_IRUGO,
1799 },
1800 .show = &mxt224e_vkeys_show,
1801};
1802
1803static struct attribute *mxt224e_properties_attrs[] = {
1804 &mxt224e_vkeys_attr.attr,
1805 NULL
1806};
1807
1808static struct attribute_group mxt224e_properties_attr_group = {
1809 .attrs = mxt224e_properties_attrs,
1810};
1811
1812static void mxt_init_vkeys_8930(void)
1813{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001814 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001815 static struct kobject *mxt224e_properties_kobj;
1816
1817 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1818 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1819 NULL);
1820 if (mxt224e_properties_kobj)
1821 rc = sysfs_create_group(mxt224e_properties_kobj,
1822 &mxt224e_properties_attr_group);
1823 if (!mxt224e_properties_kobj || rc)
1824 pr_err("%s: failed to create board_properties\n",
1825 __func__);
1826
1827 return;
1828}
1829
Jing Lindc4413c2012-01-16 15:22:52 -08001830static struct mxt_config_info mxt_config_array[] = {
1831 {
1832 .config = mxt_config_data_8930,
1833 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1834 .family_id = 0x81,
1835 .variant_id = 0x01,
1836 .version = 0x10,
1837 .build = 0xAA,
1838 },
1839};
1840
Amy Malochef3c9db42011-12-08 15:17:35 -08001841static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001842 .config_array = mxt_config_array,
1843 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001844 .panel_minx = 0,
1845 .panel_maxx = 566,
1846 .panel_miny = 0,
1847 .panel_maxy = 1067,
1848 .disp_minx = 0,
1849 .disp_maxx = 540,
1850 .disp_miny = 0,
1851 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001852 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301853#ifdef MSM8930_PHASE_2
1854 .digital_pwr_regulator = true,
1855#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001856 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001857 .reset_gpio = MXT_TS_RESET_GPIO,
1858 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001859};
1860
Amy Malochef3c9db42011-12-08 15:17:35 -08001861static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001862 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001863 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1864 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001865 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1866 },
1867};
1868
Manoj Raoc6d904c2012-06-22 00:32:14 -07001869#define MHL_POWER_GPIO PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
1870static struct msm_mhl_platform_data mhl_platform_data = {
1871 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
1872 .gpio_mhl_int = MHL_GPIO_INT,
1873 .gpio_mhl_reset = MHL_GPIO_RESET,
1874 .gpio_mhl_power = MHL_POWER_GPIO,
1875 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
1876};
1877
1878static struct i2c_board_info sii_device_info[] __initdata = {
1879 {
1880 /*
1881 * keeps SI 8334 as the default
1882 * MHL TX
1883 */
1884 I2C_BOARD_INFO("sii8334", 0x39),
1885 .platform_data = &mhl_platform_data,
1886 .flags = I2C_CLIENT_WAKE,
1887 },
1888};
1889
1890
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301891#ifdef MSM8930_PHASE_2
1892
1893#define GPIO_VOLUME_UP PM8038_GPIO_PM_TO_SYS(3)
1894#define GPIO_VOLUME_DOWN PM8038_GPIO_PM_TO_SYS(8)
1895#define GPIO_CAMERA_SNAPSHOT PM8038_GPIO_PM_TO_SYS(10)
1896#define GPIO_CAMERA_FOCUS PM8038_GPIO_PM_TO_SYS(11)
1897
1898static struct gpio_keys_button keys_8930[] = {
1899 {
1900 .code = KEY_VOLUMEUP,
1901 .type = EV_KEY,
1902 .desc = "volume_up",
1903 .gpio = GPIO_VOLUME_UP,
1904 .wakeup = 1,
1905 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001906 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301907 },
1908 {
1909 .code = KEY_VOLUMEDOWN,
1910 .type = EV_KEY,
1911 .desc = "volume_down",
1912 .gpio = GPIO_VOLUME_DOWN,
1913 .wakeup = 1,
1914 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001915 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301916 },
1917 {
1918 .code = KEY_CAMERA_FOCUS,
1919 .type = EV_KEY,
1920 .desc = "camera_focus",
1921 .gpio = GPIO_CAMERA_FOCUS,
1922 .wakeup = 1,
1923 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001924 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301925 },
1926 {
1927 .code = KEY_CAMERA_SNAPSHOT,
1928 .type = EV_KEY,
1929 .desc = "camera_snapshot",
1930 .gpio = GPIO_CAMERA_SNAPSHOT,
1931 .wakeup = 1,
1932 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001933 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301934 },
1935};
1936
1937/* Add GPIO keys for 8930 */
1938static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
1939 .buttons = keys_8930,
1940 .nbuttons = 4,
1941};
1942
1943static struct platform_device gpio_keys_8930 = {
1944 .name = "gpio-keys",
1945 .id = -1,
1946 .dev = {
1947 .platform_data = &gpio_keys_8930_pdata,
1948 },
1949};
1950#endif /* MSM8930_PHASE_2 */
1951
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001952static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1953 .clk_freq = 100000,
1954 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001955};
1956
1957static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1958 .clk_freq = 100000,
1959 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001960};
1961
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06001962static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
1963 .clk_freq = 100000,
1964 .src_clk_rate = 24000000,
1965};
1966
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001967static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1968 .clk_freq = 100000,
1969 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001970};
1971
1972static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1973 .clk_freq = 100000,
1974 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001975};
1976
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001977
1978static struct ks8851_pdata spi_eth_pdata = {
1979 .irq_gpio = KS8851_IRQ_GPIO,
1980 .rst_gpio = KS8851_RST_GPIO,
1981};
1982
1983static struct spi_board_info spi_board_info[] __initdata = {
1984 {
1985 .modalias = "ks8851",
1986 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1987 .max_speed_hz = 19200000,
1988 .bus_num = 0,
1989 .chip_select = 0,
1990 .mode = SPI_MODE_0,
1991 .platform_data = &spi_eth_pdata
1992 },
1993 {
1994 .modalias = "dsi_novatek_3d_panel_spi",
1995 .max_speed_hz = 10800000,
1996 .bus_num = 0,
1997 .chip_select = 1,
1998 .mode = SPI_MODE_0,
1999 },
2000};
2001
2002static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002003 .name = "saw-regulator",
2004 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002005 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08002006 .platform_data = &msm8930_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002007 },
2008};
2009
2010static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002011 .name = "saw-regulator",
2012 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002013 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08002014 .platform_data = &msm8930_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002015 },
2016};
2017
2018static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002019 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002020 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002021 .tsens_num_sensor = 10,
2022 .slope = {1132, 1135, 1137, 1135, 1157,
2023 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002024};
2025
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002026static struct platform_device msm_tsens_device = {
2027 .name = "tsens8960-tm",
2028 .id = -1,
2029};
2030
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002031static struct msm_thermal_data msm_thermal_pdata = {
2032 .sensor_id = 9,
2033 .poll_ms = 1000,
2034 .limit_temp = 60,
2035 .temp_hysteresis = 10,
2036 .limit_freq = 918000,
2037};
2038
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002039#ifdef CONFIG_MSM_FAKE_BATTERY
2040static struct platform_device fish_battery_device = {
2041 .name = "fish_battery",
2042};
2043#endif
2044
David Collins1d4061b2011-12-06 15:36:40 -08002045#ifndef MSM8930_PHASE_2
2046
2047/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002048static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002049 .name = GPIO_REGULATOR_DEV_NAME,
2050 .id = PM8921_MPP_PM_TO_SYS(7),
2051 .dev = {
2052 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2053 },
2054};
2055
Jay Chokshi06fa7542011-12-07 13:09:17 -08002056static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002057 .name = GPIO_REGULATOR_DEV_NAME,
2058 .id = 91,
2059 .dev = {
2060 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2061 },
2062};
2063
David Collins1d4061b2011-12-06 15:36:40 -08002064#else
2065
2066/* 8930 Phase 2 */
2067static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2068 .name = GPIO_REGULATOR_DEV_NAME,
2069 .id = 63,
2070 .dev = {
2071 .platform_data =
2072 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_5V],
2073 },
2074};
2075
2076static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2077 .name = GPIO_REGULATOR_DEV_NAME,
2078 .id = 97,
2079 .dev = {
2080 .platform_data =
2081 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
2082 },
2083};
2084
2085#endif
2086
Jay Chokshi06fa7542011-12-07 13:09:17 -08002087static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002088 .name = "rpm-regulator",
2089 .id = -1,
2090 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002091#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002092 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002093#else
2094 .platform_data = &msm8930_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002095#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002096 },
2097};
2098
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002099static struct platform_device *common_devices[] __initdata = {
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002100 &msm8960_device_acpuclk,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002101 &msm8960_device_dmov,
2102 &msm_device_smd,
2103 &msm8960_device_uart_gsbi5,
2104 &msm_device_uart_dm6,
2105 &msm_device_saw_core0,
2106 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002107 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002108#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002109 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002110#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002111 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002112#ifdef MSM8930_PHASE_2
2113 &msm8930_device_ext_otg_sw_vreg,
2114#endif
Stephen Boyd28d54952011-12-16 13:19:51 -08002115 &msm_8960_q6_lpass,
2116 &msm_8960_q6_mss_fw,
2117 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002118 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002119 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002120 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002121 &msm8960_device_qup_spi_gsbi1,
2122 &msm8960_device_qup_i2c_gsbi3,
2123 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002124 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002125 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002126 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002127 &msm_slim_ctrl,
2128 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002129#if defined(CONFIG_QSEECOM)
2130 &qseecom_device,
2131#endif
2132
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002133#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2134 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2135 &qcrypto_device,
2136#endif
2137
2138#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2139 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2140 &qcedev_device,
2141#endif
2142#ifdef CONFIG_MSM_ROTATOR
2143 &msm_rotator_device,
2144#endif
2145 &msm_device_sps,
2146#ifdef CONFIG_MSM_FAKE_BATTERY
2147 &fish_battery_device,
2148#endif
2149#ifdef CONFIG_ANDROID_PMEM
2150#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002151 &msm8930_android_pmem_device,
2152 &msm8930_android_pmem_adsp_device,
2153 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302154#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2155#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002156 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002157 &msm_device_bam_dmux,
2158 &msm_fm_platform_init,
2159
2160#ifdef CONFIG_HW_RANDOM_MSM
2161 &msm_device_rng,
2162#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002163 &msm8930_rpm_device,
2164 &msm8930_rpm_log_device,
2165 &msm8930_rpm_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002166#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002167 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002168#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002169 &msm_device_tz_log,
2170
2171#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002172 &msm_qdss_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002173 &msm_etb_device,
2174 &msm_tpiu_device,
2175 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002176 &msm_etm_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002177#endif
2178 &msm_device_dspcrashd_8960,
2179 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302180#ifdef MSM8930_PHASE_2
2181 &gpio_keys_8930,
2182#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002183 &msm8930_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002184 &msm8930_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002185 &msm8930_msm_gov_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002186 &msm_bus_8930_apps_fabric,
2187 &msm_bus_8930_sys_fabric,
2188 &msm_bus_8930_mm_fabric,
2189 &msm_bus_8930_sys_fpb,
2190 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002191 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002192 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002193 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002194 &msm8930_cache_dump_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002195};
2196
2197static struct platform_device *cdp_devices[] __initdata = {
2198 &msm8960_device_otg,
2199 &msm8960_device_gadget_peripheral,
2200 &msm_device_hsusb_host,
2201 &android_usb_device,
2202 &msm_pcm,
2203 &msm_pcm_routing,
2204 &msm_cpudai0,
2205 &msm_cpudai1,
2206 &msm_cpudai_hdmi_rx,
2207 &msm_cpudai_bt_rx,
2208 &msm_cpudai_bt_tx,
2209 &msm_cpudai_fm_rx,
2210 &msm_cpudai_fm_tx,
2211 &msm_cpudai_auxpcm_rx,
2212 &msm_cpudai_auxpcm_tx,
2213 &msm_cpu_fe,
2214 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002215#ifdef CONFIG_MSM_GEMINI
2216 &msm8960_gemini_device,
2217#endif
2218 &msm_voice,
2219 &msm_voip,
2220 &msm_lpa_pcm,
2221 &msm_cpudai_afe_01_rx,
2222 &msm_cpudai_afe_01_tx,
2223 &msm_cpudai_afe_02_rx,
2224 &msm_cpudai_afe_02_tx,
2225 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002226 &msm_compr_dsp,
2227 &msm_cpudai_incall_music_rx,
2228 &msm_cpudai_incall_record_rx,
2229 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002230 &msm_pcm_hostless,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002231};
2232
2233static void __init msm8930_i2c_init(void)
2234{
2235 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2236 &msm8960_i2c_qup_gsbi4_pdata;
2237
2238 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2239 &msm8960_i2c_qup_gsbi3_pdata;
2240
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002241 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2242 &msm8960_i2c_qup_gsbi9_pdata;
2243
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002244 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2245 &msm8960_i2c_qup_gsbi10_pdata;
2246
2247 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2248 &msm8960_i2c_qup_gsbi12_pdata;
2249}
2250
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002251static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2252 {
2253 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2254 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2255 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002256 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002257 },
2258
2259 {
2260 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2261 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2262 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002263 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002264 },
2265
2266 {
2267 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2268 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2269 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002270 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002271 },
2272
2273 {
2274 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002275 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2276 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002277 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002278 },
2279
2280 {
2281 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2282 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2283 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002284 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002285 },
2286
2287 {
2288 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2289 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2290 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002291 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002292 },
2293
2294 {
2295 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2296 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2297 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002298 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002299 },
2300
2301 {
2302 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2303 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2304 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002305 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002306 },
2307};
2308
Praveen Chidambaram78499012011-11-01 17:15:17 -06002309static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2310 .levels = &msm_rpmrs_levels[0],
2311 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2312 .vdd_mem_levels = {
2313 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2314 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2315 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2316 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2317 },
2318 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002319 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2320 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2321 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2322 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002323 },
2324 .vdd_mask = 0x7FFFFF,
2325 .rpmrs_target_id = {
2326 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2327 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002328 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2329 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002330 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2331 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2332 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2333 },
2334};
2335
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002336static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2337 .mode = MSM_PM_BOOT_CONFIG_TZ,
2338};
2339
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002340static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2341 .base_addr = MSM_ACC0_BASE + 0x08,
2342 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2343 .mask = 1UL << 13,
2344};
2345
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002346#ifdef CONFIG_I2C
2347#define I2C_SURF 1
2348#define I2C_FFA (1 << 1)
2349#define I2C_RUMI (1 << 2)
2350#define I2C_SIM (1 << 3)
2351#define I2C_FLUID (1 << 4)
2352#define I2C_LIQUID (1 << 5)
2353
2354struct i2c_registry {
2355 u8 machs;
2356 int bus;
2357 struct i2c_board_info *info;
2358 int len;
2359};
2360
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002361#ifdef CONFIG_INPUT_MPU3050
2362#define MPU3050_INT_GPIO 69
2363
2364static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2365 .gpio_int = MPU3050_INT_GPIO,
2366};
2367
2368static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2369 {
2370 I2C_BOARD_INFO("mpu3050", 0x68),
2371 .platform_data = &mpu3050_gyro,
2372 },
2373};
2374#endif
2375
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002376#ifdef CONFIG_ISL9519_CHARGER
2377static struct isl_platform_data isl_data __initdata = {
2378 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2379 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2380 .max_system_voltage = 4200,
2381 .min_system_voltage = 3200,
2382 .chgcurrent = 1000, /* 1900, */
2383 .term_current = 400, /* Need fine tuning */
2384 .input_current = 2048,
2385};
2386
2387static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2388 {
2389 I2C_BOARD_INFO("isl9519q", 0x9),
2390 .irq = 0, /* Not required when notify-by-pmic */
2391 .platform_data = &isl_data,
2392 },
2393};
2394#endif /* CONFIG_ISL9519_CHARGER */
2395
2396static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002397#ifdef CONFIG_ISL9519_CHARGER
2398 {
2399 I2C_LIQUID,
2400 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2401 isl_charger_i2c_info,
2402 ARRAY_SIZE(isl_charger_i2c_info),
2403 },
2404#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002405#ifdef CONFIG_INPUT_MPU3050
2406 {
2407 I2C_FFA | I2C_FLUID,
2408 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2409 mpu3050_i2c_boardinfo,
2410 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2411 },
2412#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002413 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002414 I2C_SURF | I2C_FFA | I2C_FLUID,
2415 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002416 msm_isa1200_board_info,
2417 ARRAY_SIZE(msm_isa1200_board_info),
2418 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002419 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002420 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002421 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2422 mxt_device_info_8930,
2423 ARRAY_SIZE(mxt_device_info_8930),
2424 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002425 {
2426 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2427 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2428 sii_device_info,
2429 ARRAY_SIZE(sii_device_info),
2430 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002431};
2432#endif /* CONFIG_I2C */
2433
2434static void __init register_i2c_devices(void)
2435{
2436#ifdef CONFIG_I2C
2437 u8 mach_mask = 0;
2438 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002439#ifdef CONFIG_MSM_CAMERA
2440 struct i2c_registry msm8930_camera_i2c_devices = {
2441 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2442 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2443 msm8930_camera_board_info.board_info,
2444 msm8930_camera_board_info.num_i2c_board_info,
2445 };
2446#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002447
2448 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002449 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002450 mach_mask = I2C_SURF;
2451 else if (machine_is_msm8930_fluid())
2452 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002453 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002454 mach_mask = I2C_FFA;
2455 else
2456 pr_err("unmatched machine ID in register_i2c_devices\n");
2457
2458 /* Run the array and install devices as appropriate */
2459 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2460 if (msm8960_i2c_devices[i].machs & mach_mask)
2461 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2462 msm8960_i2c_devices[i].info,
2463 msm8960_i2c_devices[i].len);
2464 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002465#ifdef CONFIG_MSM_CAMERA
2466 if (msm8930_camera_i2c_devices.machs & mach_mask)
2467 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2468 msm8930_camera_i2c_devices.info,
2469 msm8930_camera_i2c_devices.len);
2470#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002471#endif
2472}
2473
2474static void __init msm8930_cdp_init(void)
2475{
2476 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2477 pr_err("meminfo_init() failed!\n");
2478
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002479 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002480 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002481 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2482 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002483
2484 regulator_suppress_info_printing();
2485 if (msm_xo_init())
2486 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002487 platform_device_register(&msm8930_device_rpm_regulator);
Tianyi Goue3d4f542012-03-15 17:06:45 -07002488 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302489 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002490 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302491 android_usb_pdata.swfi_latency =
2492 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002493 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002494 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2495 &msm8960_qup_spi_gsbi1_pdata;
2496 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2497
Jay Chokshi06fa7542011-12-07 13:09:17 -08002498 /*
2499 * TODO: When physical 8930/PM8038 hardware becomes
2500 * available, remove this block or add the config
2501 * option.
2502 */
2503#ifndef MSM8930_PHASE_2
2504 msm8960_init_pmic();
2505#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002506 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002507#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002508 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302509 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002510 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2511 msm_spm_l2_init(msm_spm_l2_data);
2512 msm8930_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002513 platform_add_devices(msm8930_footswitch, msm8930_num_footswitch);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002514 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002515 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002516 /*
2517 * TODO: When physical 8930/PM8038 hardware becomes
2518 * available, remove this block or add the config
2519 * option.
2520 */
2521#ifndef MSM8930_PHASE_2
2522 msm8960_pm8921_gpio_mpp_init();
2523#else
2524 msm8930_pm8038_gpio_mpp_init();
2525#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002526 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002527#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002528 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002529#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002530 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002531 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002532 register_i2c_devices();
2533 msm8930_init_fb();
2534 slim_register_board_info(msm_slim_devices,
2535 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002536 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002537 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002538 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002539
2540 if (PLATFORM_IS_CHARM25())
2541 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2542}
2543
2544MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2545 .map_io = msm8930_map_io,
2546 .reserve = msm8930_reserve,
2547 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302548 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002549 .timer = &msm_timer,
2550 .init_machine = msm8930_cdp_init,
2551 .init_early = msm8930_allocate_memory_regions,
2552 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002553 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002554MACHINE_END
2555
2556MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2557 .map_io = msm8930_map_io,
2558 .reserve = msm8930_reserve,
2559 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302560 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002561 .timer = &msm_timer,
2562 .init_machine = msm8930_cdp_init,
2563 .init_early = msm8930_allocate_memory_regions,
2564 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002565 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002566MACHINE_END
2567
2568MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2569 .map_io = msm8930_map_io,
2570 .reserve = msm8930_reserve,
2571 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302572 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002573 .timer = &msm_timer,
2574 .init_machine = msm8930_cdp_init,
2575 .init_early = msm8930_allocate_memory_regions,
2576 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002577 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002578MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002579
2580MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2581 .map_io = msm8930_map_io,
2582 .reserve = msm8930_reserve,
2583 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302584 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002585 .timer = &msm_timer,
2586 .init_machine = msm8930_cdp_init,
2587 .init_early = msm8930_allocate_memory_regions,
2588 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002589 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002590MACHINE_END
2591
2592MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2593 .map_io = msm8930_map_io,
2594 .reserve = msm8930_reserve,
2595 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302596 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002597 .timer = &msm_timer,
2598 .init_machine = msm8930_cdp_init,
2599 .init_early = msm8930_allocate_memory_regions,
2600 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002601 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002602MACHINE_END