blob: f63b4901d27297eb5e740f85c24bf0aade316029 [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,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700784 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
785 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530786 },
787 .regulator = {
788 {
789 .name = "CDC_VDD_CP",
David Collins226f2512012-03-19 13:18:39 -0700790 .min_uV = 1950000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530791 .max_uV = 2200000,
792 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
793 },
794 {
795 .name = "CDC_VDDA_RX",
796 .min_uV = 1800000,
797 .max_uV = 1800000,
798 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
799 },
800 {
801 .name = "CDC_VDDA_TX",
802 .min_uV = 1800000,
803 .max_uV = 1800000,
804 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
805 },
806 {
807 .name = "VDDIO_CDC",
808 .min_uV = 1800000,
809 .max_uV = 1800000,
810 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
811 },
812 {
813 .name = "VDDD_CDC_D",
814 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700815 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530816 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
817 },
818 {
819 .name = "CDC_VDDA_A_1P2V",
820 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700821 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530822 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
823 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800824 },
825};
826
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530827static struct slim_device msm_slim_sitar = {
828 .name = "sitar-slim",
829 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800830 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530831 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800832 },
833};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700834
835static struct wcd9xxx_pdata sitar1p1_platform_data = {
836 .slimbus_slave_device = {
837 .name = "sitar-slave",
838 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
839 },
840 .irq = MSM_GPIO_TO_INT(62),
841 .irq_base = SITAR_INTERRUPT_BASE,
842 .num_irqs = NR_WCD9XXX_IRQS,
843 .reset_gpio = 42,
844 .micbias = {
845 .ldoh_v = SITAR_LDOH_2P85_V,
846 .cfilt1_mv = 1800,
847 .cfilt2_mv = 1800,
848 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
849 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700850 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
851 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700852 },
853 .regulator = {
854 {
855 .name = "CDC_VDD_CP",
856 .min_uV = 1950000,
857 .max_uV = 2200000,
858 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
859 },
860 {
861 .name = "CDC_VDDA_RX",
862 .min_uV = 1800000,
863 .max_uV = 1800000,
864 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
865 },
866 {
867 .name = "CDC_VDDA_TX",
868 .min_uV = 1800000,
869 .max_uV = 1800000,
870 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
871 },
872 {
873 .name = "VDDIO_CDC",
874 .min_uV = 1800000,
875 .max_uV = 1800000,
876 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
877 },
878 {
879 .name = "VDDD_CDC_D",
880 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700881 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700882 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
883 },
884 {
885 .name = "CDC_VDDA_A_1P2V",
886 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700887 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700888 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
889 },
890 },
891};
892
893static struct slim_device msm_slim_sitar1p1 = {
894 .name = "sitar1p1-slim",
895 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
896 .dev = {
897 .platform_data = &sitar1p1_platform_data,
898 },
899};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800900#endif
901
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530902
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800903static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530904#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800905 {
906 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530907 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800908 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700909 {
910 .bus_num = 1,
911 .slim_slave = &msm_slim_sitar1p1,
912 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800913#endif
914 /* add more slimbus slaves as needed */
915};
916
917#define MSM_WCNSS_PHYS 0x03000000
918#define MSM_WCNSS_SIZE 0x280000
919
920static struct resource resources_wcnss_wlan[] = {
921 {
922 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
923 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
924 .name = "wcnss_wlanrx_irq",
925 .flags = IORESOURCE_IRQ,
926 },
927 {
928 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
929 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
930 .name = "wcnss_wlantx_irq",
931 .flags = IORESOURCE_IRQ,
932 },
933 {
934 .start = MSM_WCNSS_PHYS,
935 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
936 .name = "wcnss_mmio",
937 .flags = IORESOURCE_MEM,
938 },
939 {
940 .start = 84,
941 .end = 88,
942 .name = "wcnss_gpios_5wire",
943 .flags = IORESOURCE_IO,
944 },
945};
946
947static struct qcom_wcnss_opts qcom_wcnss_pdata = {
948 .has_48mhz_xo = 1,
949};
950
951static struct platform_device msm_device_wcnss_wlan = {
952 .name = "wcnss_wlan",
953 .id = 0,
954 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
955 .resource = resources_wcnss_wlan,
956 .dev = {.platform_data = &qcom_wcnss_pdata},
957};
958
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700959#ifdef CONFIG_QSEECOM
960/* qseecom bus scaling */
961static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
962 {
963 .src = MSM_BUS_MASTER_SPS,
964 .dst = MSM_BUS_SLAVE_EBI_CH0,
965 .ib = 0,
966 .ab = 0,
967 },
968 {
969 .src = MSM_BUS_MASTER_SPDM,
970 .dst = MSM_BUS_SLAVE_SPDM,
971 .ib = 0,
972 .ab = 0,
973 },
974};
975
976static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
977 {
978 .src = MSM_BUS_MASTER_SPS,
979 .dst = MSM_BUS_SLAVE_EBI_CH0,
980 .ib = (492 * 8) * 1000000UL,
981 .ab = (492 * 8) * 100000UL,
982 },
983 {
984 .src = MSM_BUS_MASTER_SPDM,
985 .dst = MSM_BUS_SLAVE_SPDM,
986 .ib = 0,
987 .ab = 0,
988 },
989};
990
991static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
992 {
993 .src = MSM_BUS_MASTER_SPS,
994 .dst = MSM_BUS_SLAVE_EBI_CH0,
995 .ib = 0,
996 .ab = 0,
997 },
998 {
999 .src = MSM_BUS_MASTER_SPDM,
1000 .dst = MSM_BUS_SLAVE_SPDM,
1001 .ib = (64 * 8) * 1000000UL,
1002 .ab = (64 * 8) * 100000UL,
1003 },
1004};
1005
1006static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1007 {
1008 ARRAY_SIZE(qseecom_clks_init_vectors),
1009 qseecom_clks_init_vectors,
1010 },
1011 {
1012 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1013 qseecom_enable_sfpb_vectors,
1014 },
1015 {
1016 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1017 qseecom_enable_sfpb_vectors,
1018 },
1019};
1020
1021static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1022 qseecom_hw_bus_scale_usecases,
1023 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1024 .name = "qsee",
1025};
1026
1027static struct platform_device qseecom_device = {
1028 .name = "qseecom",
1029 .id = 0,
1030 .dev = {
1031 .platform_data = &qseecom_bus_pdata,
1032 },
1033};
1034#endif
1035
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001036#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1037 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1038 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1039 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1040
1041#define QCE_SIZE 0x10000
1042#define QCE_0_BASE 0x18500000
1043
1044#define QCE_HW_KEY_SUPPORT 0
1045#define QCE_SHA_HMAC_SUPPORT 1
1046#define QCE_SHARE_CE_RESOURCE 1
1047#define QCE_CE_SHARED 0
1048
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001049/* Begin Bus scaling definitions */
1050static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1051 {
1052 .src = MSM_BUS_MASTER_ADM_PORT0,
1053 .dst = MSM_BUS_SLAVE_EBI_CH0,
1054 .ab = 0,
1055 .ib = 0,
1056 },
1057 {
1058 .src = MSM_BUS_MASTER_ADM_PORT1,
1059 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1060 .ab = 0,
1061 .ib = 0,
1062 },
1063};
1064
1065static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1066 {
1067 .src = MSM_BUS_MASTER_ADM_PORT0,
1068 .dst = MSM_BUS_SLAVE_EBI_CH0,
1069 .ab = 70000000UL,
1070 .ib = 70000000UL,
1071 },
1072 {
1073 .src = MSM_BUS_MASTER_ADM_PORT1,
1074 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1075 .ab = 2480000000UL,
1076 .ib = 2480000000UL,
1077 },
1078};
1079
1080static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1081 {
1082 ARRAY_SIZE(crypto_hw_init_vectors),
1083 crypto_hw_init_vectors,
1084 },
1085 {
1086 ARRAY_SIZE(crypto_hw_active_vectors),
1087 crypto_hw_active_vectors,
1088 },
1089};
1090
1091static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1092 crypto_hw_bus_scale_usecases,
1093 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1094 .name = "cryptohw",
1095};
1096/* End Bus Scaling Definitions*/
1097
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001098static struct resource qcrypto_resources[] = {
1099 [0] = {
1100 .start = QCE_0_BASE,
1101 .end = QCE_0_BASE + QCE_SIZE - 1,
1102 .flags = IORESOURCE_MEM,
1103 },
1104 [1] = {
1105 .name = "crypto_channels",
1106 .start = DMOV_CE_IN_CHAN,
1107 .end = DMOV_CE_OUT_CHAN,
1108 .flags = IORESOURCE_DMA,
1109 },
1110 [2] = {
1111 .name = "crypto_crci_in",
1112 .start = DMOV_CE_IN_CRCI,
1113 .end = DMOV_CE_IN_CRCI,
1114 .flags = IORESOURCE_DMA,
1115 },
1116 [3] = {
1117 .name = "crypto_crci_out",
1118 .start = DMOV_CE_OUT_CRCI,
1119 .end = DMOV_CE_OUT_CRCI,
1120 .flags = IORESOURCE_DMA,
1121 },
1122};
1123
1124static struct resource qcedev_resources[] = {
1125 [0] = {
1126 .start = QCE_0_BASE,
1127 .end = QCE_0_BASE + QCE_SIZE - 1,
1128 .flags = IORESOURCE_MEM,
1129 },
1130 [1] = {
1131 .name = "crypto_channels",
1132 .start = DMOV_CE_IN_CHAN,
1133 .end = DMOV_CE_OUT_CHAN,
1134 .flags = IORESOURCE_DMA,
1135 },
1136 [2] = {
1137 .name = "crypto_crci_in",
1138 .start = DMOV_CE_IN_CRCI,
1139 .end = DMOV_CE_IN_CRCI,
1140 .flags = IORESOURCE_DMA,
1141 },
1142 [3] = {
1143 .name = "crypto_crci_out",
1144 .start = DMOV_CE_OUT_CRCI,
1145 .end = DMOV_CE_OUT_CRCI,
1146 .flags = IORESOURCE_DMA,
1147 },
1148};
1149
1150#endif
1151
1152#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1153 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1154
1155static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1156 .ce_shared = QCE_CE_SHARED,
1157 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1158 .hw_key_support = QCE_HW_KEY_SUPPORT,
1159 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001160 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001161};
1162
1163static struct platform_device qcrypto_device = {
1164 .name = "qcrypto",
1165 .id = 0,
1166 .num_resources = ARRAY_SIZE(qcrypto_resources),
1167 .resource = qcrypto_resources,
1168 .dev = {
1169 .coherent_dma_mask = DMA_BIT_MASK(32),
1170 .platform_data = &qcrypto_ce_hw_suppport,
1171 },
1172};
1173#endif
1174
1175#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1176 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1177
1178static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1179 .ce_shared = QCE_CE_SHARED,
1180 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1181 .hw_key_support = QCE_HW_KEY_SUPPORT,
1182 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001183 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001184};
1185
1186static struct platform_device qcedev_device = {
1187 .name = "qce",
1188 .id = 0,
1189 .num_resources = ARRAY_SIZE(qcedev_resources),
1190 .resource = qcedev_resources,
1191 .dev = {
1192 .coherent_dma_mask = DMA_BIT_MASK(32),
1193 .platform_data = &qcedev_ce_hw_suppport,
1194 },
1195};
1196#endif
1197
1198#define MDM2AP_ERRFATAL 70
1199#define AP2MDM_ERRFATAL 95
1200#define MDM2AP_STATUS 69
1201#define AP2MDM_STATUS 94
1202#define AP2MDM_PMIC_RESET_N 80
1203#define AP2MDM_KPDPWR_N 81
1204
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001205static struct resource mdm_resources[] = {
1206 {
1207 .start = MDM2AP_ERRFATAL,
1208 .end = MDM2AP_ERRFATAL,
1209 .name = "MDM2AP_ERRFATAL",
1210 .flags = IORESOURCE_IO,
1211 },
1212 {
1213 .start = AP2MDM_ERRFATAL,
1214 .end = AP2MDM_ERRFATAL,
1215 .name = "AP2MDM_ERRFATAL",
1216 .flags = IORESOURCE_IO,
1217 },
1218 {
1219 .start = MDM2AP_STATUS,
1220 .end = MDM2AP_STATUS,
1221 .name = "MDM2AP_STATUS",
1222 .flags = IORESOURCE_IO,
1223 },
1224 {
1225 .start = AP2MDM_STATUS,
1226 .end = AP2MDM_STATUS,
1227 .name = "AP2MDM_STATUS",
1228 .flags = IORESOURCE_IO,
1229 },
1230 {
1231 .start = AP2MDM_PMIC_RESET_N,
1232 .end = AP2MDM_PMIC_RESET_N,
1233 .name = "AP2MDM_PMIC_RESET_N",
1234 .flags = IORESOURCE_IO,
1235 },
1236 {
1237 .start = AP2MDM_KPDPWR_N,
1238 .end = AP2MDM_KPDPWR_N,
1239 .name = "AP2MDM_KPDPWR_N",
1240 .flags = IORESOURCE_IO,
1241 },
1242};
1243
1244static struct mdm_platform_data mdm_platform_data = {
1245 .mdm_version = "2.5",
1246};
1247
1248static struct platform_device mdm_device = {
1249 .name = "mdm2_modem",
1250 .id = -1,
1251 .num_resources = ARRAY_SIZE(mdm_resources),
1252 .resource = mdm_resources,
1253 .dev = {
1254 .platform_data = &mdm_platform_data,
1255 },
1256};
1257
1258static struct platform_device *mdm_devices[] __initdata = {
1259 &mdm_device,
1260};
1261
Praveen Chidambaram78499012011-11-01 17:15:17 -06001262#ifdef CONFIG_MSM_MPM
1263static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1264 [1] = MSM_GPIO_TO_INT(46),
1265 [2] = MSM_GPIO_TO_INT(150),
1266 [4] = MSM_GPIO_TO_INT(103),
1267 [5] = MSM_GPIO_TO_INT(104),
1268 [6] = MSM_GPIO_TO_INT(105),
1269 [7] = MSM_GPIO_TO_INT(106),
1270 [8] = MSM_GPIO_TO_INT(107),
1271 [9] = MSM_GPIO_TO_INT(7),
1272 [10] = MSM_GPIO_TO_INT(11),
1273 [11] = MSM_GPIO_TO_INT(15),
1274 [12] = MSM_GPIO_TO_INT(19),
1275 [13] = MSM_GPIO_TO_INT(23),
1276 [14] = MSM_GPIO_TO_INT(27),
1277 [15] = MSM_GPIO_TO_INT(31),
1278 [16] = MSM_GPIO_TO_INT(35),
1279 [19] = MSM_GPIO_TO_INT(90),
1280 [20] = MSM_GPIO_TO_INT(92),
1281 [23] = MSM_GPIO_TO_INT(85),
1282 [24] = MSM_GPIO_TO_INT(83),
1283 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001284 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001285 [27] = HDMI_IRQ,
1286 [29] = MSM_GPIO_TO_INT(10),
1287 [30] = MSM_GPIO_TO_INT(102),
1288 [31] = MSM_GPIO_TO_INT(81),
1289 [32] = MSM_GPIO_TO_INT(78),
1290 [33] = MSM_GPIO_TO_INT(94),
1291 [34] = MSM_GPIO_TO_INT(72),
1292 [35] = MSM_GPIO_TO_INT(39),
1293 [36] = MSM_GPIO_TO_INT(43),
1294 [37] = MSM_GPIO_TO_INT(61),
1295 [38] = MSM_GPIO_TO_INT(50),
1296 [39] = MSM_GPIO_TO_INT(42),
1297 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001298 [42] = MSM_GPIO_TO_INT(8),
1299 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001300 [44] = MSM_GPIO_TO_INT(70),
1301 [45] = MSM_GPIO_TO_INT(69),
1302 [46] = MSM_GPIO_TO_INT(67),
1303 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001304 [48] = MSM_GPIO_TO_INT(55),
1305 [49] = MSM_GPIO_TO_INT(74),
1306 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001307 [51] = MSM_GPIO_TO_INT(49),
1308 [52] = MSM_GPIO_TO_INT(40),
1309 [53] = MSM_GPIO_TO_INT(37),
1310 [54] = MSM_GPIO_TO_INT(24),
1311 [55] = MSM_GPIO_TO_INT(14),
1312};
1313
1314static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1315 TLMM_MSM_SUMMARY_IRQ,
1316 RPM_APCC_CPU0_GP_HIGH_IRQ,
1317 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1318 RPM_APCC_CPU0_GP_LOW_IRQ,
1319 RPM_APCC_CPU0_WAKE_UP_IRQ,
1320 RPM_APCC_CPU1_GP_HIGH_IRQ,
1321 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1322 RPM_APCC_CPU1_GP_LOW_IRQ,
1323 RPM_APCC_CPU1_WAKE_UP_IRQ,
1324 MSS_TO_APPS_IRQ_0,
1325 MSS_TO_APPS_IRQ_1,
1326 MSS_TO_APPS_IRQ_2,
1327 MSS_TO_APPS_IRQ_3,
1328 MSS_TO_APPS_IRQ_4,
1329 MSS_TO_APPS_IRQ_5,
1330 MSS_TO_APPS_IRQ_6,
1331 MSS_TO_APPS_IRQ_7,
1332 MSS_TO_APPS_IRQ_8,
1333 MSS_TO_APPS_IRQ_9,
1334 LPASS_SCSS_GP_LOW_IRQ,
1335 LPASS_SCSS_GP_MEDIUM_IRQ,
1336 LPASS_SCSS_GP_HIGH_IRQ,
1337 SPS_MTI_30,
1338 SPS_MTI_31,
1339 RIVA_APSS_SPARE_IRQ,
1340 RIVA_APPS_WLAN_SMSM_IRQ,
1341 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1342 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1343};
1344
1345struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1346 .irqs_m2a = msm_mpm_irqs_m2a,
1347 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1348 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1349 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1350 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1351 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1352 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1353 .mpm_apps_ipc_val = BIT(1),
1354 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1355
1356};
1357#endif
1358
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001359#define MSM_SHARED_RAM_PHYS 0x80000000
1360
1361static void __init msm8930_map_io(void)
1362{
1363 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1364 msm_map_msm8930_io();
1365
1366 if (socinfo_init() < 0)
1367 pr_err("socinfo_init() failed!\n");
1368}
1369
1370static void __init msm8930_init_irq(void)
1371{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001372 struct msm_mpm_device_data *data = NULL;
1373#ifdef CONFIG_MSM_MPM
1374 data = &msm8930_mpm_dev_data;
1375#endif
1376
1377 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001378 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1379 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001380}
1381
1382static void __init msm8930_init_buses(void)
1383{
1384#ifdef CONFIG_MSM_BUS_SCALING
1385 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001386 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1387 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1388 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1389 msm_bus_8930_apps_fabric.dev.platform_data =
1390 &msm_bus_8930_apps_fabric_pdata;
1391 msm_bus_8930_sys_fabric.dev.platform_data =
1392 &msm_bus_8930_sys_fabric_pdata;
1393 msm_bus_8930_mm_fabric.dev.platform_data =
1394 &msm_bus_8930_mm_fabric_pdata;
1395 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1396 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001397#endif
1398}
1399
1400static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1401 .max_clock_speed = 15060000,
1402};
1403
1404#ifdef CONFIG_USB_MSM_OTG_72K
1405static struct msm_otg_platform_data msm_otg_pdata;
1406#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301407#ifdef CONFIG_MSM_BUS_SCALING
1408/* Bandwidth requests (zero) if no vote placed */
1409static struct msm_bus_vectors usb_init_vectors[] = {
1410 {
1411 .src = MSM_BUS_MASTER_SPS,
1412 .dst = MSM_BUS_SLAVE_EBI_CH0,
1413 .ab = 0,
1414 .ib = 0,
1415 },
1416};
1417
1418/* Bus bandwidth requests in Bytes/sec */
1419static struct msm_bus_vectors usb_max_vectors[] = {
1420 {
1421 .src = MSM_BUS_MASTER_SPS,
1422 .dst = MSM_BUS_SLAVE_EBI_CH0,
1423 .ab = 60000000, /* At least 480Mbps on bus. */
1424 .ib = 960000000, /* MAX bursts rate */
1425 },
1426};
1427
1428static struct msm_bus_paths usb_bus_scale_usecases[] = {
1429 {
1430 ARRAY_SIZE(usb_init_vectors),
1431 usb_init_vectors,
1432 },
1433 {
1434 ARRAY_SIZE(usb_max_vectors),
1435 usb_max_vectors,
1436 },
1437};
1438
1439static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1440 usb_bus_scale_usecases,
1441 ARRAY_SIZE(usb_bus_scale_usecases),
1442 .name = "usb",
1443};
1444#endif
1445
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301446static int hsusb_phy_init_seq[] = {
1447 0x44, 0x80, /* set VBUS valid threshold
1448 and disconnect valid threshold */
1449 0x38, 0x81, /* update DC voltage level */
1450 0x24, 0x82, /* set preemphasis and rise/fall time */
1451 0x13, 0x83, /* set source impedance adjusment */
1452 -1};
1453
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001454static struct msm_otg_platform_data msm_otg_pdata = {
1455 .mode = USB_OTG,
1456 .otg_control = OTG_PMIC_CONTROL,
1457 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001458 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001459 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301460#ifdef CONFIG_MSM_BUS_SCALING
1461 .bus_scale_table = &usb_bus_scale_pdata,
1462#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001463};
1464#endif
1465
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001466#define PID_MAGIC_ID 0x71432909
1467#define SERIAL_NUM_MAGIC_ID 0x61945374
1468#define SERIAL_NUMBER_LENGTH 127
1469#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1470
1471struct magic_num_struct {
1472 uint32_t pid;
1473 uint32_t serial_num;
1474};
1475
1476struct dload_struct {
1477 uint32_t reserved1;
1478 uint32_t reserved2;
1479 uint32_t reserved3;
1480 uint16_t reserved4;
1481 uint16_t pid;
1482 char serial_number[SERIAL_NUMBER_LENGTH];
1483 uint16_t reserved5;
1484 struct magic_num_struct magic_struct;
1485};
1486
1487static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1488{
1489 struct dload_struct __iomem *dload = 0;
1490
1491 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1492 if (!dload) {
1493 pr_err("%s: cannot remap I/O memory region: %08x\n",
1494 __func__, DLOAD_USB_BASE_ADD);
1495 return -ENXIO;
1496 }
1497
1498 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1499 __func__, dload, pid, snum);
1500 /* update pid */
1501 dload->magic_struct.pid = PID_MAGIC_ID;
1502 dload->pid = pid;
1503
1504 /* update serial number */
1505 dload->magic_struct.serial_num = 0;
1506 if (!snum) {
1507 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1508 goto out;
1509 }
1510
1511 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1512 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1513out:
1514 iounmap(dload);
1515 return 0;
1516}
1517
1518static struct android_usb_platform_data android_usb_pdata = {
1519 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1520};
1521
1522static struct platform_device android_usb_device = {
1523 .name = "android_usb",
1524 .id = -1,
1525 .dev = {
1526 .platform_data = &android_usb_pdata,
1527 },
1528};
1529
1530static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001531 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001532};
1533
1534static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001535 0x00, 0x24, 0x54, 0x10,
1536 0x09, 0x03, 0x01,
1537 0x10, 0x54, 0x30, 0x0C,
1538 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001539};
1540
1541static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001542 0x00, 0x24, 0x54, 0x10,
1543 0x09, 0x07, 0x01, 0x0B,
1544 0x10, 0x54, 0x30, 0x0C,
1545 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001546};
1547
1548static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1549 [0] = {
1550 .mode = MSM_SPM_MODE_CLOCK_GATING,
1551 .notify_rpm = false,
1552 .cmd = spm_wfi_cmd_sequence,
1553 },
1554 [1] = {
1555 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1556 .notify_rpm = false,
1557 .cmd = spm_power_collapse_without_rpm,
1558 },
1559 [2] = {
1560 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1561 .notify_rpm = true,
1562 .cmd = spm_power_collapse_with_rpm,
1563 },
1564};
1565
1566static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1567 [0] = {
1568 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001569 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001570#if defined(CONFIG_MSM_AVS_HW)
1571 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1572 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1573#endif
1574 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001575 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001576 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1577 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1578 .vctl_timeout_us = 50,
1579 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1580 .modes = msm_spm_seq_list,
1581 },
1582 [1] = {
1583 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001584 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001585#if defined(CONFIG_MSM_AVS_HW)
1586 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1587 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1588#endif
1589 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001590 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001591 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1592 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1593 .vctl_timeout_us = 50,
1594 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1595 .modes = msm_spm_seq_list,
1596 },
1597};
1598
1599static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001600 0x00, 0x20, 0x03, 0x20,
1601 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001602};
1603
1604static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001605 0x00, 0x20, 0x34, 0x64,
1606 0x48, 0x07, 0x48, 0x20,
1607 0x50, 0x64, 0x04, 0x34,
1608 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001609};
1610static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001611 0x00, 0x10, 0x34, 0x64,
1612 0x48, 0x07, 0x48, 0x10,
1613 0x50, 0x64, 0x04, 0x34,
1614 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001615};
1616
1617static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1618 [0] = {
1619 .mode = MSM_SPM_L2_MODE_RETENTION,
1620 .notify_rpm = false,
1621 .cmd = l2_spm_wfi_cmd_sequence,
1622 },
1623 [1] = {
1624 .mode = MSM_SPM_L2_MODE_GDHS,
1625 .notify_rpm = true,
1626 .cmd = l2_spm_gdhs_cmd_sequence,
1627 },
1628 [2] = {
1629 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1630 .notify_rpm = true,
1631 .cmd = l2_spm_power_off_cmd_sequence,
1632 },
1633};
1634
1635static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1636 [0] = {
1637 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001638 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001639 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001640 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1641 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1642 .modes = msm_spm_l2_seq_list,
1643 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1644 },
1645};
1646
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301647#define ISA1200_HAP_EN_GPIO 77
1648#define ISA1200_HAP_LEN_GPIO 78
1649#define ISA1200_HAP_CLK PM8038_GPIO_PM_TO_SYS(7)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001650
1651static int isa1200_power(int on)
1652{
Amy Malocheb20c1052012-04-11 10:36:13 -07001653 int rc = 0;
1654
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301655 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1656
Amy Malocheb20c1052012-04-11 10:36:13 -07001657 if (on)
1658 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_1, true);
1659 else
1660 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_NONE, true);
1661
1662 if (rc) {
1663 pr_err("%s: unable to write aux clock register(%d)\n",
1664 __func__, rc);
1665 }
1666
1667 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001668}
1669
1670static int isa1200_dev_setup(bool enable)
1671{
1672 int rc = 0;
1673
Amy Malocheb20c1052012-04-11 10:36:13 -07001674 if (!enable)
1675 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301676
1677 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1678 if (rc) {
1679 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
1680 __func__, ISA1200_HAP_CLK, rc);
1681 goto fail_gpio_req;
1682 }
1683
1684 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1685 if (rc) {
1686 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
1687 __func__, ISA1200_HAP_CLK, rc);
1688 goto fail_gpio_dir;
1689 }
1690
1691 return 0;
1692
1693fail_gpio_dir:
1694 gpio_free(ISA1200_HAP_CLK);
1695fail_gpio_req:
1696 return rc;
1697
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001698}
1699
1700static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301701 {
1702 .name = "vddp",
1703 .min_uV = ISA_I2C_VTG_MIN_UV,
1704 .max_uV = ISA_I2C_VTG_MAX_UV,
1705 .load_uA = ISA_I2C_CURR_UA,
1706 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001707 {
1708 .name = "vcc_i2c",
1709 .min_uV = ISA_I2C_VTG_MIN_UV,
1710 .max_uV = ISA_I2C_VTG_MAX_UV,
1711 .load_uA = ISA_I2C_CURR_UA,
1712 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001713};
1714
1715static struct isa1200_platform_data isa1200_1_pdata = {
1716 .name = "vibrator",
1717 .dev_setup = isa1200_dev_setup,
1718 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301719 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1720 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001721 .max_timeout = 15000,
1722 .mode_ctrl = PWM_GEN_MODE,
1723 .pwm_fd = {
1724 .pwm_div = 256,
1725 },
1726 .is_erm = false,
1727 .smart_en = true,
1728 .ext_clk_en = true,
1729 .chip_en = 1,
1730 .regulator_info = isa1200_reg_data,
1731 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1732};
1733
1734static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1735 {
1736 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1737 .platform_data = &isa1200_1_pdata,
1738 },
1739};
1740
Amy Malochef3c9db42011-12-08 15:17:35 -08001741#define MXT_TS_GPIO_IRQ 11
1742#define MXT_TS_RESET_GPIO 52
1743
1744static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001745 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001746 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001747 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301748 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001749 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301750 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001751 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301752 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001753 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301754 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1755 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1756 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1757 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001758 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001759 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1760 0,
1761 /* T18 Object */
1762 0, 0,
1763 /* T19 Object */
1764 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1765 0, 0, 0, 0, 0, 0,
1766 /* T23 Object */
1767 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1768 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001769 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001770 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1771 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001772 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001773 0, 0, 0, 0, 0,
1774 /* T42 Object */
1775 0, 0, 0, 0, 0, 0, 0, 0,
1776 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301777 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001778 /* T47 Object */
1779 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1780 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301781 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1782 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1783 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001784 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1785 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1786 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001787};
1788
Amy Malochef3c9db42011-12-08 15:17:35 -08001789static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1790 struct kobj_attribute *attr, char *buf)
1791{
1792 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301793 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1794 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1795 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1796 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001797 "\n");
1798}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001799
Amy Malochef3c9db42011-12-08 15:17:35 -08001800static struct kobj_attribute mxt224e_vkeys_attr = {
1801 .attr = {
1802 .mode = S_IRUGO,
1803 },
1804 .show = &mxt224e_vkeys_show,
1805};
1806
1807static struct attribute *mxt224e_properties_attrs[] = {
1808 &mxt224e_vkeys_attr.attr,
1809 NULL
1810};
1811
1812static struct attribute_group mxt224e_properties_attr_group = {
1813 .attrs = mxt224e_properties_attrs,
1814};
1815
1816static void mxt_init_vkeys_8930(void)
1817{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001818 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001819 static struct kobject *mxt224e_properties_kobj;
1820
1821 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1822 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1823 NULL);
1824 if (mxt224e_properties_kobj)
1825 rc = sysfs_create_group(mxt224e_properties_kobj,
1826 &mxt224e_properties_attr_group);
1827 if (!mxt224e_properties_kobj || rc)
1828 pr_err("%s: failed to create board_properties\n",
1829 __func__);
1830
1831 return;
1832}
1833
Jing Lindc4413c2012-01-16 15:22:52 -08001834static struct mxt_config_info mxt_config_array[] = {
1835 {
1836 .config = mxt_config_data_8930,
1837 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1838 .family_id = 0x81,
1839 .variant_id = 0x01,
1840 .version = 0x10,
1841 .build = 0xAA,
1842 },
1843};
1844
Amy Malochef3c9db42011-12-08 15:17:35 -08001845static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001846 .config_array = mxt_config_array,
1847 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001848 .panel_minx = 0,
1849 .panel_maxx = 566,
1850 .panel_miny = 0,
1851 .panel_maxy = 1067,
1852 .disp_minx = 0,
1853 .disp_maxx = 540,
1854 .disp_miny = 0,
1855 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001856 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301857#ifdef MSM8930_PHASE_2
1858 .digital_pwr_regulator = true,
1859#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001860 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001861 .reset_gpio = MXT_TS_RESET_GPIO,
1862 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001863};
1864
Amy Malochef3c9db42011-12-08 15:17:35 -08001865static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001866 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001867 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1868 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001869 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1870 },
1871};
1872
Manoj Raoc6d904c2012-06-22 00:32:14 -07001873#define MHL_POWER_GPIO PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
1874static struct msm_mhl_platform_data mhl_platform_data = {
1875 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
1876 .gpio_mhl_int = MHL_GPIO_INT,
1877 .gpio_mhl_reset = MHL_GPIO_RESET,
1878 .gpio_mhl_power = MHL_POWER_GPIO,
1879 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
1880};
1881
1882static struct i2c_board_info sii_device_info[] __initdata = {
1883 {
1884 /*
1885 * keeps SI 8334 as the default
1886 * MHL TX
1887 */
1888 I2C_BOARD_INFO("sii8334", 0x39),
1889 .platform_data = &mhl_platform_data,
1890 .flags = I2C_CLIENT_WAKE,
1891 },
1892};
1893
1894
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301895#ifdef MSM8930_PHASE_2
1896
1897#define GPIO_VOLUME_UP PM8038_GPIO_PM_TO_SYS(3)
1898#define GPIO_VOLUME_DOWN PM8038_GPIO_PM_TO_SYS(8)
1899#define GPIO_CAMERA_SNAPSHOT PM8038_GPIO_PM_TO_SYS(10)
1900#define GPIO_CAMERA_FOCUS PM8038_GPIO_PM_TO_SYS(11)
1901
1902static struct gpio_keys_button keys_8930[] = {
1903 {
1904 .code = KEY_VOLUMEUP,
1905 .type = EV_KEY,
1906 .desc = "volume_up",
1907 .gpio = GPIO_VOLUME_UP,
1908 .wakeup = 1,
1909 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001910 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301911 },
1912 {
1913 .code = KEY_VOLUMEDOWN,
1914 .type = EV_KEY,
1915 .desc = "volume_down",
1916 .gpio = GPIO_VOLUME_DOWN,
1917 .wakeup = 1,
1918 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001919 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301920 },
1921 {
1922 .code = KEY_CAMERA_FOCUS,
1923 .type = EV_KEY,
1924 .desc = "camera_focus",
1925 .gpio = GPIO_CAMERA_FOCUS,
1926 .wakeup = 1,
1927 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001928 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301929 },
1930 {
1931 .code = KEY_CAMERA_SNAPSHOT,
1932 .type = EV_KEY,
1933 .desc = "camera_snapshot",
1934 .gpio = GPIO_CAMERA_SNAPSHOT,
1935 .wakeup = 1,
1936 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001937 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301938 },
1939};
1940
1941/* Add GPIO keys for 8930 */
1942static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
1943 .buttons = keys_8930,
1944 .nbuttons = 4,
1945};
1946
1947static struct platform_device gpio_keys_8930 = {
1948 .name = "gpio-keys",
1949 .id = -1,
1950 .dev = {
1951 .platform_data = &gpio_keys_8930_pdata,
1952 },
1953};
1954#endif /* MSM8930_PHASE_2 */
1955
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001956static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1957 .clk_freq = 100000,
1958 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001959};
1960
1961static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1962 .clk_freq = 100000,
1963 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001964};
1965
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06001966static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
1967 .clk_freq = 100000,
1968 .src_clk_rate = 24000000,
1969};
1970
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001971static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1972 .clk_freq = 100000,
1973 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001974};
1975
1976static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1977 .clk_freq = 100000,
1978 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001979};
1980
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001981
1982static struct ks8851_pdata spi_eth_pdata = {
1983 .irq_gpio = KS8851_IRQ_GPIO,
1984 .rst_gpio = KS8851_RST_GPIO,
1985};
1986
1987static struct spi_board_info spi_board_info[] __initdata = {
1988 {
1989 .modalias = "ks8851",
1990 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1991 .max_speed_hz = 19200000,
1992 .bus_num = 0,
1993 .chip_select = 0,
1994 .mode = SPI_MODE_0,
1995 .platform_data = &spi_eth_pdata
1996 },
1997 {
1998 .modalias = "dsi_novatek_3d_panel_spi",
1999 .max_speed_hz = 10800000,
2000 .bus_num = 0,
2001 .chip_select = 1,
2002 .mode = SPI_MODE_0,
2003 },
2004};
2005
2006static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002007 .name = "saw-regulator",
2008 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002009 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08002010 .platform_data = &msm8930_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002011 },
2012};
2013
2014static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002015 .name = "saw-regulator",
2016 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002017 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08002018 .platform_data = &msm8930_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002019 },
2020};
2021
2022static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002023 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002024 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002025 .tsens_num_sensor = 10,
2026 .slope = {1132, 1135, 1137, 1135, 1157,
2027 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002028};
2029
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002030static struct platform_device msm_tsens_device = {
2031 .name = "tsens8960-tm",
2032 .id = -1,
2033};
2034
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002035static struct msm_thermal_data msm_thermal_pdata = {
2036 .sensor_id = 9,
2037 .poll_ms = 1000,
2038 .limit_temp = 60,
2039 .temp_hysteresis = 10,
2040 .limit_freq = 918000,
2041};
2042
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002043#ifdef CONFIG_MSM_FAKE_BATTERY
2044static struct platform_device fish_battery_device = {
2045 .name = "fish_battery",
2046};
2047#endif
2048
David Collins1d4061b2011-12-06 15:36:40 -08002049#ifndef MSM8930_PHASE_2
2050
2051/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002052static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002053 .name = GPIO_REGULATOR_DEV_NAME,
2054 .id = PM8921_MPP_PM_TO_SYS(7),
2055 .dev = {
2056 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2057 },
2058};
2059
Jay Chokshi06fa7542011-12-07 13:09:17 -08002060static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002061 .name = GPIO_REGULATOR_DEV_NAME,
2062 .id = 91,
2063 .dev = {
2064 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2065 },
2066};
2067
David Collins1d4061b2011-12-06 15:36:40 -08002068#else
2069
2070/* 8930 Phase 2 */
2071static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2072 .name = GPIO_REGULATOR_DEV_NAME,
2073 .id = 63,
2074 .dev = {
2075 .platform_data =
2076 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_5V],
2077 },
2078};
2079
2080static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2081 .name = GPIO_REGULATOR_DEV_NAME,
2082 .id = 97,
2083 .dev = {
2084 .platform_data =
2085 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
2086 },
2087};
2088
2089#endif
2090
Jay Chokshi06fa7542011-12-07 13:09:17 -08002091static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002092 .name = "rpm-regulator",
2093 .id = -1,
2094 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002095#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002096 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002097#else
2098 .platform_data = &msm8930_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002099#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002100 },
2101};
2102
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002103static struct platform_device *common_devices[] __initdata = {
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002104 &msm8960_device_acpuclk,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002105 &msm8960_device_dmov,
2106 &msm_device_smd,
2107 &msm8960_device_uart_gsbi5,
2108 &msm_device_uart_dm6,
2109 &msm_device_saw_core0,
2110 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002111 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002112#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002113 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002114#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002115 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002116#ifdef MSM8930_PHASE_2
2117 &msm8930_device_ext_otg_sw_vreg,
2118#endif
Stephen Boyd28d54952011-12-16 13:19:51 -08002119 &msm_8960_q6_lpass,
2120 &msm_8960_q6_mss_fw,
2121 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002122 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002123 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002124 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002125 &msm8960_device_qup_spi_gsbi1,
2126 &msm8960_device_qup_i2c_gsbi3,
2127 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002128 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002129 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002130 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002131 &msm_slim_ctrl,
2132 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002133#if defined(CONFIG_QSEECOM)
2134 &qseecom_device,
2135#endif
2136
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002137#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2138 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2139 &qcrypto_device,
2140#endif
2141
2142#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2143 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2144 &qcedev_device,
2145#endif
2146#ifdef CONFIG_MSM_ROTATOR
2147 &msm_rotator_device,
2148#endif
2149 &msm_device_sps,
2150#ifdef CONFIG_MSM_FAKE_BATTERY
2151 &fish_battery_device,
2152#endif
2153#ifdef CONFIG_ANDROID_PMEM
2154#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002155 &msm8930_android_pmem_device,
2156 &msm8930_android_pmem_adsp_device,
2157 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302158#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2159#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002160 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002161 &msm_device_bam_dmux,
2162 &msm_fm_platform_init,
2163
2164#ifdef CONFIG_HW_RANDOM_MSM
2165 &msm_device_rng,
2166#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002167 &msm8930_rpm_device,
2168 &msm8930_rpm_log_device,
2169 &msm8930_rpm_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002170#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002171 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002172#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002173 &msm_device_tz_log,
2174
2175#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002176 &msm_qdss_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002177 &msm_etb_device,
2178 &msm_tpiu_device,
2179 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002180 &msm_etm_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002181#endif
2182 &msm_device_dspcrashd_8960,
2183 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302184#ifdef MSM8930_PHASE_2
2185 &gpio_keys_8930,
2186#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002187 &msm8930_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002188 &msm8930_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002189 &msm8930_msm_gov_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002190 &msm_bus_8930_apps_fabric,
2191 &msm_bus_8930_sys_fabric,
2192 &msm_bus_8930_mm_fabric,
2193 &msm_bus_8930_sys_fpb,
2194 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002195 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002196 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002197 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002198 &msm8930_cache_dump_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002199};
2200
2201static struct platform_device *cdp_devices[] __initdata = {
2202 &msm8960_device_otg,
2203 &msm8960_device_gadget_peripheral,
2204 &msm_device_hsusb_host,
2205 &android_usb_device,
2206 &msm_pcm,
2207 &msm_pcm_routing,
2208 &msm_cpudai0,
2209 &msm_cpudai1,
2210 &msm_cpudai_hdmi_rx,
2211 &msm_cpudai_bt_rx,
2212 &msm_cpudai_bt_tx,
2213 &msm_cpudai_fm_rx,
2214 &msm_cpudai_fm_tx,
2215 &msm_cpudai_auxpcm_rx,
2216 &msm_cpudai_auxpcm_tx,
2217 &msm_cpu_fe,
2218 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002219#ifdef CONFIG_MSM_GEMINI
2220 &msm8960_gemini_device,
2221#endif
2222 &msm_voice,
2223 &msm_voip,
2224 &msm_lpa_pcm,
2225 &msm_cpudai_afe_01_rx,
2226 &msm_cpudai_afe_01_tx,
2227 &msm_cpudai_afe_02_rx,
2228 &msm_cpudai_afe_02_tx,
2229 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002230 &msm_compr_dsp,
2231 &msm_cpudai_incall_music_rx,
2232 &msm_cpudai_incall_record_rx,
2233 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002234 &msm_pcm_hostless,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002235};
2236
2237static void __init msm8930_i2c_init(void)
2238{
2239 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2240 &msm8960_i2c_qup_gsbi4_pdata;
2241
2242 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2243 &msm8960_i2c_qup_gsbi3_pdata;
2244
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002245 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2246 &msm8960_i2c_qup_gsbi9_pdata;
2247
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002248 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2249 &msm8960_i2c_qup_gsbi10_pdata;
2250
2251 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2252 &msm8960_i2c_qup_gsbi12_pdata;
2253}
2254
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002255static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2256 {
2257 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2258 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2259 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002260 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002261 },
2262
2263 {
2264 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2265 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2266 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002267 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002268 },
2269
2270 {
2271 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2272 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2273 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002274 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002275 },
2276
2277 {
2278 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002279 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2280 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002281 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002282 },
2283
2284 {
2285 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2286 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2287 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002288 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002289 },
2290
2291 {
2292 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2293 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2294 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002295 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002296 },
2297
2298 {
2299 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2300 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2301 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002302 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002303 },
2304
2305 {
2306 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2307 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2308 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002309 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002310 },
2311};
2312
Praveen Chidambaram78499012011-11-01 17:15:17 -06002313static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2314 .levels = &msm_rpmrs_levels[0],
2315 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2316 .vdd_mem_levels = {
2317 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2318 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2319 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2320 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2321 },
2322 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002323 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2324 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2325 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2326 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002327 },
2328 .vdd_mask = 0x7FFFFF,
2329 .rpmrs_target_id = {
2330 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2331 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002332 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2333 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002334 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2335 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2336 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2337 },
2338};
2339
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002340static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2341 .mode = MSM_PM_BOOT_CONFIG_TZ,
2342};
2343
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002344static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2345 .base_addr = MSM_ACC0_BASE + 0x08,
2346 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2347 .mask = 1UL << 13,
2348};
2349
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002350#ifdef CONFIG_I2C
2351#define I2C_SURF 1
2352#define I2C_FFA (1 << 1)
2353#define I2C_RUMI (1 << 2)
2354#define I2C_SIM (1 << 3)
2355#define I2C_FLUID (1 << 4)
2356#define I2C_LIQUID (1 << 5)
2357
2358struct i2c_registry {
2359 u8 machs;
2360 int bus;
2361 struct i2c_board_info *info;
2362 int len;
2363};
2364
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002365#ifdef CONFIG_INPUT_MPU3050
2366#define MPU3050_INT_GPIO 69
2367
2368static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2369 .gpio_int = MPU3050_INT_GPIO,
2370};
2371
2372static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2373 {
2374 I2C_BOARD_INFO("mpu3050", 0x68),
2375 .platform_data = &mpu3050_gyro,
2376 },
2377};
2378#endif
2379
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002380#ifdef CONFIG_ISL9519_CHARGER
2381static struct isl_platform_data isl_data __initdata = {
2382 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2383 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2384 .max_system_voltage = 4200,
2385 .min_system_voltage = 3200,
2386 .chgcurrent = 1000, /* 1900, */
2387 .term_current = 400, /* Need fine tuning */
2388 .input_current = 2048,
2389};
2390
2391static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2392 {
2393 I2C_BOARD_INFO("isl9519q", 0x9),
2394 .irq = 0, /* Not required when notify-by-pmic */
2395 .platform_data = &isl_data,
2396 },
2397};
2398#endif /* CONFIG_ISL9519_CHARGER */
2399
2400static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002401#ifdef CONFIG_ISL9519_CHARGER
2402 {
2403 I2C_LIQUID,
2404 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2405 isl_charger_i2c_info,
2406 ARRAY_SIZE(isl_charger_i2c_info),
2407 },
2408#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002409#ifdef CONFIG_INPUT_MPU3050
2410 {
2411 I2C_FFA | I2C_FLUID,
2412 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2413 mpu3050_i2c_boardinfo,
2414 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2415 },
2416#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002417 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002418 I2C_SURF | I2C_FFA | I2C_FLUID,
2419 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002420 msm_isa1200_board_info,
2421 ARRAY_SIZE(msm_isa1200_board_info),
2422 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002423 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002424 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002425 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2426 mxt_device_info_8930,
2427 ARRAY_SIZE(mxt_device_info_8930),
2428 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002429 {
2430 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2431 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2432 sii_device_info,
2433 ARRAY_SIZE(sii_device_info),
2434 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002435};
2436#endif /* CONFIG_I2C */
2437
2438static void __init register_i2c_devices(void)
2439{
2440#ifdef CONFIG_I2C
2441 u8 mach_mask = 0;
2442 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002443#ifdef CONFIG_MSM_CAMERA
2444 struct i2c_registry msm8930_camera_i2c_devices = {
2445 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2446 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2447 msm8930_camera_board_info.board_info,
2448 msm8930_camera_board_info.num_i2c_board_info,
2449 };
2450#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002451
2452 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002453 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002454 mach_mask = I2C_SURF;
2455 else if (machine_is_msm8930_fluid())
2456 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002457 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002458 mach_mask = I2C_FFA;
2459 else
2460 pr_err("unmatched machine ID in register_i2c_devices\n");
2461
2462 /* Run the array and install devices as appropriate */
2463 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2464 if (msm8960_i2c_devices[i].machs & mach_mask)
2465 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2466 msm8960_i2c_devices[i].info,
2467 msm8960_i2c_devices[i].len);
2468 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002469#ifdef CONFIG_MSM_CAMERA
2470 if (msm8930_camera_i2c_devices.machs & mach_mask)
2471 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2472 msm8930_camera_i2c_devices.info,
2473 msm8930_camera_i2c_devices.len);
2474#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002475#endif
2476}
2477
2478static void __init msm8930_cdp_init(void)
2479{
2480 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2481 pr_err("meminfo_init() failed!\n");
2482
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002483 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002484 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002485 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2486 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002487
2488 regulator_suppress_info_printing();
2489 if (msm_xo_init())
2490 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002491 platform_device_register(&msm8930_device_rpm_regulator);
Tianyi Goue3d4f542012-03-15 17:06:45 -07002492 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302493 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002494 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302495 android_usb_pdata.swfi_latency =
2496 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002497 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002498 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2499 &msm8960_qup_spi_gsbi1_pdata;
2500 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2501
Jay Chokshi06fa7542011-12-07 13:09:17 -08002502 /*
2503 * TODO: When physical 8930/PM8038 hardware becomes
2504 * available, remove this block or add the config
2505 * option.
2506 */
2507#ifndef MSM8930_PHASE_2
2508 msm8960_init_pmic();
2509#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002510 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002511#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002512 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302513 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002514 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2515 msm_spm_l2_init(msm_spm_l2_data);
2516 msm8930_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002517 platform_add_devices(msm8930_footswitch, msm8930_num_footswitch);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002518 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002519 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002520 /*
2521 * TODO: When physical 8930/PM8038 hardware becomes
2522 * available, remove this block or add the config
2523 * option.
2524 */
2525#ifndef MSM8930_PHASE_2
2526 msm8960_pm8921_gpio_mpp_init();
2527#else
2528 msm8930_pm8038_gpio_mpp_init();
2529#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002530 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002531#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002532 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002533#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002534 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002535 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002536 register_i2c_devices();
2537 msm8930_init_fb();
2538 slim_register_board_info(msm_slim_devices,
2539 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002540 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002541 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002542 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002543
2544 if (PLATFORM_IS_CHARM25())
2545 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2546}
2547
2548MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2549 .map_io = msm8930_map_io,
2550 .reserve = msm8930_reserve,
2551 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302552 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002553 .timer = &msm_timer,
2554 .init_machine = msm8930_cdp_init,
2555 .init_early = msm8930_allocate_memory_regions,
2556 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002557 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002558MACHINE_END
2559
2560MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2561 .map_io = msm8930_map_io,
2562 .reserve = msm8930_reserve,
2563 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302564 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002565 .timer = &msm_timer,
2566 .init_machine = msm8930_cdp_init,
2567 .init_early = msm8930_allocate_memory_regions,
2568 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002569 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002570MACHINE_END
2571
2572MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2573 .map_io = msm8930_map_io,
2574 .reserve = msm8930_reserve,
2575 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302576 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002577 .timer = &msm_timer,
2578 .init_machine = msm8930_cdp_init,
2579 .init_early = msm8930_allocate_memory_regions,
2580 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002581 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002582MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002583
2584MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2585 .map_io = msm8930_map_io,
2586 .reserve = msm8930_reserve,
2587 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302588 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002589 .timer = &msm_timer,
2590 .init_machine = msm8930_cdp_init,
2591 .init_early = msm8930_allocate_memory_regions,
2592 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002593 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002594MACHINE_END
2595
2596MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2597 .map_io = msm8930_map_io,
2598 .reserve = msm8930_reserve,
2599 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302600 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002601 .timer = &msm_timer,
2602 .init_machine = msm8930_cdp_init,
2603 .init_early = msm8930_allocate_memory_regions,
2604 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002605 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002606MACHINE_END