blob: 1f5ea522c1c3909bf11005e3ea06fde1d0873267 [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>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080081
Wentao Xuf59ce4e2012-05-22 17:30:13 -040082#ifdef CONFIG_INPUT_MPU3050
83#include <linux/input/mpu3050.h>
84#endif
85
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080086#include "timer.h"
87#include "devices.h"
88#include "devices-msm8x60.h"
89#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080090#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080091#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080092#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053093#include <mach/mpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080094#include "smd_private.h"
95#include "pm-boot.h"
96#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -080097#include "board-8930.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080098
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080099static struct platform_device msm_fm_platform_init = {
100 .name = "iris_fm",
101 .id = -1,
102};
103
104#define KS8851_RST_GPIO 89
105#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800106#define HAP_SHIFT_LVL_OE_GPIO 47
107
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800108#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
109
110struct sx150x_platform_data msm8930_sx150x_data[] = {
111 [SX150X_CAM] = {
112 .gpio_base = GPIO_CAM_EXPANDER_BASE,
113 .oscio_is_gpo = false,
114 .io_pullup_ena = 0x0,
115 .io_pulldn_ena = 0xc0,
116 .io_open_drain_ena = 0x0,
117 .irq_summary = -1,
118 },
119};
120
121#endif
122
Olav Haugana21169d2012-01-04 09:17:06 -0800123#define MSM_PMEM_ADSP_SIZE 0x7800000
Asish Bhattacharya9ed880f2012-04-12 08:33:37 +0530124#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800125#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
126#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
127#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800128#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800129#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700130#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800131
132#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur9830bf02012-06-01 15:04:29 -0700133#define HOLE_SIZE 0x20000
Asish Bhattacharya9ed880f2012-04-12 08:33:37 +0530134#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700135#ifdef CONFIG_MSM_IOMMU
136#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
137#define MSM_ION_SF_SIZE 0x0
Olav Haugan494e4dc2012-05-15 15:14:31 -0700138#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Hanumant Singhedfb0462012-05-15 14:49:32 -0700139#define MSM_ION_HEAP_NUM 7
140#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800141#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800142#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan494e4dc2012-05-15 15:14:31 -0700143#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Hanumant Singheea62562012-05-14 11:32:45 -0700144#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700145#endif
Deepak Kotur9830bf02012-06-01 15:04:29 -0700146#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800147#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800148#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700149
150#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
151#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
152#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
153
Deepak Kotur9830bf02012-06-01 15:04:29 -0700154#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */
155#define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
156 HOLE_SIZE))
Hanumant Singheea62562012-05-14 11:32:45 -0700157#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur9830bf02012-06-01 15:04:29 -0700158#define MSM8930_FW_START MSM8930_FIXED_AREA_START
Hanumant Singheea62562012-05-14 11:32:45 -0700159
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800160#else
161#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800162#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800163#endif
164
165#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
166static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
167static int __init pmem_kernel_ebi1_size_setup(char *p)
168{
169 pmem_kernel_ebi1_size = memparse(p, NULL);
170 return 0;
171}
172early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
173#endif
174
175#ifdef CONFIG_ANDROID_PMEM
176static unsigned pmem_size = MSM_PMEM_SIZE;
177static int __init pmem_size_setup(char *p)
178{
179 pmem_size = memparse(p, NULL);
180 return 0;
181}
182early_param("pmem_size", pmem_size_setup);
183
184static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
185
186static int __init pmem_adsp_size_setup(char *p)
187{
188 pmem_adsp_size = memparse(p, NULL);
189 return 0;
190}
191early_param("pmem_adsp_size", pmem_adsp_size_setup);
192
193static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
194
195static int __init pmem_audio_size_setup(char *p)
196{
197 pmem_audio_size = memparse(p, NULL);
198 return 0;
199}
200early_param("pmem_audio_size", pmem_audio_size_setup);
201#endif
202
203#ifdef CONFIG_ANDROID_PMEM
204#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
205static struct android_pmem_platform_data android_pmem_pdata = {
206 .name = "pmem",
207 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
208 .cached = 1,
209 .memory_type = MEMTYPE_EBI1,
210};
211
Laura Abbottb93525f2012-04-12 09:57:19 -0700212static struct platform_device msm8930_android_pmem_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800213 .name = "android_pmem",
214 .id = 0,
215 .dev = {.platform_data = &android_pmem_pdata},
216};
217
218static struct android_pmem_platform_data android_pmem_adsp_pdata = {
219 .name = "pmem_adsp",
220 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
221 .cached = 0,
222 .memory_type = MEMTYPE_EBI1,
223};
Laura Abbottb93525f2012-04-12 09:57:19 -0700224static struct platform_device msm8930_android_pmem_adsp_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800225 .name = "android_pmem",
226 .id = 2,
227 .dev = { .platform_data = &android_pmem_adsp_pdata },
228};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800229
230static struct android_pmem_platform_data android_pmem_audio_pdata = {
231 .name = "pmem_audio",
232 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
233 .cached = 0,
234 .memory_type = MEMTYPE_EBI1,
235};
236
Laura Abbottb93525f2012-04-12 09:57:19 -0700237static struct platform_device msm8930_android_pmem_audio_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800238 .name = "android_pmem",
239 .id = 4,
240 .dev = { .platform_data = &android_pmem_audio_pdata },
241};
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530242#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
243#endif /* CONFIG_ANDROID_PMEM */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800244
Hanumant Singheea62562012-05-14 11:32:45 -0700245struct fmem_platform_data msm8930_fmem_pdata = {
246};
247
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800248#define DSP_RAM_BASE_8960 0x8da00000
249#define DSP_RAM_SIZE_8960 0x1800000
250static int dspcrashd_pdata_8960 = 0xDEADDEAD;
251
252static struct resource resources_dspcrashd_8960[] = {
253 {
254 .name = "msm_dspcrashd",
255 .start = DSP_RAM_BASE_8960,
256 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
257 .flags = IORESOURCE_DMA,
258 },
259};
260
261static struct platform_device msm_device_dspcrashd_8960 = {
262 .name = "msm_dspcrashd",
263 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
264 .resource = resources_dspcrashd_8960,
265 .dev = { .platform_data = &dspcrashd_pdata_8960 },
266};
267
268static struct memtype_reserve msm8930_reserve_table[] __initdata = {
269 [MEMTYPE_SMI] = {
270 },
271 [MEMTYPE_EBI0] = {
272 .flags = MEMTYPE_FLAGS_1M_ALIGN,
273 },
274 [MEMTYPE_EBI1] = {
275 .flags = MEMTYPE_FLAGS_1M_ALIGN,
276 },
277};
278
Laura Abbottf8c03b92012-02-16 14:57:58 -0800279
280static void __init reserve_rtb_memory(void)
281{
282#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700283 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800284#endif
285}
286
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800287static void __init size_pmem_devices(void)
288{
289#ifdef CONFIG_ANDROID_PMEM
290#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
291 android_pmem_adsp_pdata.size = pmem_adsp_size;
292 android_pmem_pdata.size = pmem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800293 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530294#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
295#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800296}
297
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530298#ifdef CONFIG_ANDROID_PMEM
299#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800300static void __init reserve_memory_for(struct android_pmem_platform_data *p)
301{
302 msm8930_reserve_table[p->memory_type].size += p->size;
303}
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530304#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
305#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800306
307static void __init reserve_pmem_memory(void)
308{
309#ifdef CONFIG_ANDROID_PMEM
310#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
311 reserve_memory_for(&android_pmem_adsp_pdata);
312 reserve_memory_for(&android_pmem_pdata);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800313 reserve_memory_for(&android_pmem_audio_pdata);
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530314#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800315 msm8930_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530316#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800317}
318
319static int msm8930_paddr_to_memtype(unsigned int paddr)
320{
321 return MEMTYPE_EBI1;
322}
323
Steve Mucklef132c6c2012-06-06 18:30:57 -0700324#define FMEM_ENABLED 0
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800325#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800326#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700327static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800328 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800329 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700330 .reusable = FMEM_ENABLED,
331 .mem_is_fmem = FMEM_ENABLED,
332 .fixed_position = FIXED_MIDDLE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800333};
334
Laura Abbottb93525f2012-04-12 09:57:19 -0700335static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800336 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800337 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700338 .reusable = 0,
339 .mem_is_fmem = FMEM_ENABLED,
340 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800341};
Hanumant Singheea62562012-05-14 11:32:45 -0700342
Laura Abbottb93525f2012-04-12 09:57:19 -0700343static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800344 .adjacent_mem_id = INVALID_HEAP_ID,
345 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700346 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800347};
Hanumant Singheea62562012-05-14 11:32:45 -0700348
Laura Abbottb93525f2012-04-12 09:57:19 -0700349static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800350 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
351 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700352 .mem_is_fmem = FMEM_ENABLED,
353 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800354};
355#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800356
357/**
358 * These heaps are listed in the order they will be allocated. Due to
359 * video hardware restrictions and content protection the FW heap has to
360 * be allocated adjacent (below) the MM heap and the MFC heap has to be
361 * allocated after the MM heap to ensure MFC heap is not more than 256MB
362 * away from the base address of the FW heap.
363 * However, the order of FW heap and MM heap doesn't matter since these
364 * two heaps are taken care of by separate code to ensure they are adjacent
365 * to each other.
366 * Don't swap the order unless you know what you are doing!
367 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700368static struct ion_platform_data msm8930_ion_pdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800369 .nr = MSM_ION_HEAP_NUM,
370 .heaps = {
371 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800372 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800373 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800374 .name = ION_VMALLOC_HEAP_NAME,
375 },
376#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
377 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800378 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800379 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800380 .name = ION_MM_HEAP_NAME,
381 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800382 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700383 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800384 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800385 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800386 .id = ION_MM_FIRMWARE_HEAP_ID,
387 .type = ION_HEAP_TYPE_CARVEOUT,
388 .name = ION_MM_FIRMWARE_HEAP_NAME,
389 .size = MSM_ION_MM_FW_SIZE,
390 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700391 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800392 },
393 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800394 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800395 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800396 .name = ION_MFC_HEAP_NAME,
397 .size = MSM_ION_MFC_SIZE,
398 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700399 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800400 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700401#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800402 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800403 .id = ION_SF_HEAP_ID,
404 .type = ION_HEAP_TYPE_CARVEOUT,
405 .name = ION_SF_HEAP_NAME,
406 .size = MSM_ION_SF_SIZE,
407 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700408 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800409 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700410#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800411 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800412 .id = ION_IOMMU_HEAP_ID,
413 .type = ION_HEAP_TYPE_IOMMU,
414 .name = ION_IOMMU_HEAP_NAME,
415 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800416 {
417 .id = ION_QSECOM_HEAP_ID,
418 .type = ION_HEAP_TYPE_CARVEOUT,
419 .name = ION_QSECOM_HEAP_NAME,
420 .size = MSM_ION_QSECOM_SIZE,
421 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700422 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800423 },
Olav Haugan7355db02012-01-13 16:59:13 -0800424 {
425 .id = ION_AUDIO_HEAP_ID,
426 .type = ION_HEAP_TYPE_CARVEOUT,
427 .name = ION_AUDIO_HEAP_NAME,
428 .size = MSM_ION_AUDIO_SIZE,
429 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700430 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800431 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800432#endif
433 }
434};
435
Laura Abbottb93525f2012-04-12 09:57:19 -0700436static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800437 .name = "ion-msm",
438 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700439 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800440};
441#endif
442
Hanumant Singheea62562012-05-14 11:32:45 -0700443struct platform_device msm8930_fmem_device = {
444 .name = "fmem",
445 .id = 1,
446 .dev = { .platform_data = &msm8930_fmem_pdata },
447};
448
449static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
450 unsigned long size)
451{
452 msm8930_reserve_table[mem_type].size += size;
453}
454
455static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
456{
457#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
458 int ret;
459
460 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
461 panic("fixed area size is larger than %dM\n",
462 MAX_FIXED_AREA_SIZE >> 20);
463
464 reserve_info->fixed_area_size = fixed_area_size;
465 reserve_info->fixed_area_start = MSM8930_FW_START;
466
467 ret = memblock_remove(reserve_info->fixed_area_start,
468 reserve_info->fixed_area_size);
469 BUG_ON(ret);
470#endif
471}
472
473/**
474 * Reserve memory for ION and calculate amount of reusable memory for fmem.
475 * We only reserve memory for heaps that are not reusable. However, we only
476 * support one reusable heap at the moment so we ignore the reusable flag for
477 * other than the first heap with reusable flag set. Also handle special case
478 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
479 * at a higher address than FW in addition to not more than 256MB away from the
480 * base address of the firmware. This means that if MM is reusable the other
481 * two heaps must be allocated in the same region as FW. This is handled by the
482 * mem_is_fmem flag in the platform data. In addition the MM heap must be
483 * adjacent to the FW heap for content protection purposes.
484 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700485static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800486{
487#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700488 unsigned int i;
489 unsigned int reusable_count = 0;
490 unsigned int fixed_size = 0;
491 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
492 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
493
494 msm8930_fmem_pdata.size = 0;
495 msm8930_fmem_pdata.reserved_size_low = 0;
496 msm8930_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700497 msm8930_fmem_pdata.align = PAGE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700498 fixed_low_size = 0;
499 fixed_middle_size = 0;
500 fixed_high_size = 0;
501
502 /* We only support 1 reusable heap. Check if more than one heap
503 * is specified as reusable and set as non-reusable if found.
504 */
505 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
506 const struct ion_platform_heap *heap =
507 &(msm8930_ion_pdata.heaps[i]);
508
509 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
510 struct ion_cp_heap_pdata *data = heap->extra_data;
511
512 reusable_count += (data->reusable) ? 1 : 0;
513
514 if (data->reusable && reusable_count > 1) {
515 pr_err("%s: Too many heaps specified as "
516 "reusable. Heap %s was not configured "
517 "as reusable.\n", __func__, heap->name);
518 data->reusable = 0;
519 }
520 }
521 }
522
523 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
524 const struct ion_platform_heap *heap =
525 &(msm8930_ion_pdata.heaps[i]);
526
527 if (heap->extra_data) {
528 int fixed_position = NOT_FIXED;
529 int mem_is_fmem = 0;
530
531 switch (heap->type) {
532 case ION_HEAP_TYPE_CP:
533 mem_is_fmem = ((struct ion_cp_heap_pdata *)
534 heap->extra_data)->mem_is_fmem;
535 fixed_position = ((struct ion_cp_heap_pdata *)
536 heap->extra_data)->fixed_position;
537 break;
538 case ION_HEAP_TYPE_CARVEOUT:
539 mem_is_fmem = ((struct ion_co_heap_pdata *)
540 heap->extra_data)->mem_is_fmem;
541 fixed_position = ((struct ion_co_heap_pdata *)
542 heap->extra_data)->fixed_position;
543 break;
544 default:
545 break;
546 }
547
548 if (fixed_position != NOT_FIXED)
549 fixed_size += heap->size;
550 else
551 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
552
553 if (fixed_position == FIXED_LOW)
554 fixed_low_size += heap->size;
555 else if (fixed_position == FIXED_MIDDLE)
556 fixed_middle_size += heap->size;
557 else if (fixed_position == FIXED_HIGH)
558 fixed_high_size += heap->size;
559
560 if (mem_is_fmem)
561 msm8930_fmem_pdata.size += heap->size;
562 }
563 }
564
565 if (!fixed_size)
566 return;
567
568 if (msm8930_fmem_pdata.size) {
Deepak Kotur9830bf02012-06-01 15:04:29 -0700569 msm8930_fmem_pdata.reserved_size_low = fixed_low_size +
570 HOLE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700571 msm8930_fmem_pdata.reserved_size_high = fixed_high_size;
572 }
573
574 /* Since the fixed area may be carved out of lowmem,
575 * make sure the length is a multiple of 1M.
576 */
577 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
578 & SECTION_MASK;
579 msm8930_reserve_fixed_area(fixed_size);
580
581 fixed_low_start = MSM8930_FIXED_AREA_START;
Deepak Kotur9830bf02012-06-01 15:04:29 -0700582 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700583 fixed_high_start = fixed_middle_start + fixed_middle_size;
584
585 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
586 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
587
588 if (heap->extra_data) {
589 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700590 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700591
592 switch (heap->type) {
593 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700594 pdata =
595 (struct ion_cp_heap_pdata *)heap->extra_data;
596 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700597 break;
598 case ION_HEAP_TYPE_CARVEOUT:
599 fixed_position = ((struct ion_co_heap_pdata *)
600 heap->extra_data)->fixed_position;
601 break;
602 default:
603 break;
604 }
605
606 switch (fixed_position) {
607 case FIXED_LOW:
608 heap->base = fixed_low_start;
609 break;
610 case FIXED_MIDDLE:
611 heap->base = fixed_middle_start;
Deepak Kotur9830bf02012-06-01 15:04:29 -0700612 pdata->secure_base = fixed_middle_start
613 - HOLE_SIZE;
614 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700615 break;
616 case FIXED_HIGH:
617 heap->base = fixed_high_start;
618 break;
619 default:
620 break;
621 }
622 }
623 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800624#endif
625}
Huaibin Yanga5419422011-12-08 23:52:10 -0800626
627static void __init reserve_mdp_memory(void)
628{
629 msm8930_mdp_writeback(msm8930_reserve_table);
630}
631
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800632static void __init msm8930_calculate_reserve_sizes(void)
633{
634 size_pmem_devices();
635 reserve_pmem_memory();
636 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800637 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800638 reserve_rtb_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800639}
640
641static struct reserve_info msm8930_reserve_info __initdata = {
642 .memtype_reserve_table = msm8930_reserve_table,
643 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700644 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800645 .paddr_to_memtype = msm8930_paddr_to_memtype,
646};
647
648static int msm8930_memory_bank_size(void)
649{
650 return 1<<29;
651}
652
653static void __init locate_unstable_memory(void)
654{
655 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
656 unsigned long bank_size;
657 unsigned long low, high;
658
659 bank_size = msm8930_memory_bank_size();
660 low = meminfo.bank[0].start;
661 high = mb->start + mb->size;
662
663 /* Check if 32 bit overflow occured */
664 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700665 high -= PAGE_SIZE;
666
667 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
668 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800669
670 low &= ~(bank_size - 1);
671
672 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700673 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800674
675 msm8930_reserve_info.bank_size = bank_size;
676#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800677 msm8930_reserve_info.low_unstable_address = mb->start -
678 MIN_MEMORY_BLOCK_SIZE + mb->size;
679 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800680 pr_info("low unstable address %lx max size %lx bank size %lx\n",
681 msm8930_reserve_info.low_unstable_address,
682 msm8930_reserve_info.max_unstable_size,
683 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700684 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800685#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700686no_dmm:
687 msm8930_reserve_info.low_unstable_address = high;
688 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800689}
690
691static void __init place_movable_zone(void)
692{
Larry Basselb8d61022012-02-24 10:49:45 -0800693#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800694 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
695 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
696 pr_info("movable zone start %lx size %lx\n",
697 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800698#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800699}
700
701static void __init msm8930_early_memory(void)
702{
703 reserve_info = &msm8930_reserve_info;
704 locate_unstable_memory();
705 place_movable_zone();
706}
707
708static void __init msm8930_reserve(void)
709{
710 msm_reserve();
Hanumant Singheea62562012-05-14 11:32:45 -0700711 if (msm8930_fmem_pdata.size) {
712#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
713 if (reserve_info->fixed_area_size) {
714 msm8930_fmem_pdata.phys =
715 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
716 pr_info("mm fw at %lx (fixed) size %x\n",
717 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
718 pr_info("fmem start %lx (fixed) size %lx\n",
719 msm8930_fmem_pdata.phys, msm8930_fmem_pdata.size);
720 }
721#endif
722 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800723}
724
725static int msm8930_change_memory_power(u64 start, u64 size,
726 int change_type)
727{
728 return soc_change_memory_power(start, size, change_type);
729}
730
731static void __init msm8930_allocate_memory_regions(void)
732{
733 msm8930_allocate_fb_region();
734}
735
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530736#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800737
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530738#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800739
740/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
741 * 4 micbiases are used to power various analog and digital
742 * microphones operating at 1800 mV. Technically, all micbiases
743 * can source from single cfilter since all microphones operate
744 * at the same voltage level. The arrangement below is to make
745 * sure all cfilters are exercised. LDO_H regulator ouput level
746 * does not need to be as high as 2.85V. It is choosen for
747 * microphone sensitivity purpose.
748 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530749static struct wcd9xxx_pdata sitar_platform_data = {
750 .slimbus_slave_device = {
751 .name = "sitar-slave",
752 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800753 },
754 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530755 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530756 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530757 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800758 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530759 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800760 .cfilt1_mv = 1800,
761 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530762 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
763 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
764 },
765 .regulator = {
766 {
767 .name = "CDC_VDD_CP",
David Collins226f2512012-03-19 13:18:39 -0700768 .min_uV = 1950000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530769 .max_uV = 2200000,
770 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
771 },
772 {
773 .name = "CDC_VDDA_RX",
774 .min_uV = 1800000,
775 .max_uV = 1800000,
776 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
777 },
778 {
779 .name = "CDC_VDDA_TX",
780 .min_uV = 1800000,
781 .max_uV = 1800000,
782 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
783 },
784 {
785 .name = "VDDIO_CDC",
786 .min_uV = 1800000,
787 .max_uV = 1800000,
788 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
789 },
790 {
791 .name = "VDDD_CDC_D",
792 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700793 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530794 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
795 },
796 {
797 .name = "CDC_VDDA_A_1P2V",
798 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700799 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530800 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
801 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800802 },
803};
804
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530805static struct slim_device msm_slim_sitar = {
806 .name = "sitar-slim",
807 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800808 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530809 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800810 },
811};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700812
813static struct wcd9xxx_pdata sitar1p1_platform_data = {
814 .slimbus_slave_device = {
815 .name = "sitar-slave",
816 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
817 },
818 .irq = MSM_GPIO_TO_INT(62),
819 .irq_base = SITAR_INTERRUPT_BASE,
820 .num_irqs = NR_WCD9XXX_IRQS,
821 .reset_gpio = 42,
822 .micbias = {
823 .ldoh_v = SITAR_LDOH_2P85_V,
824 .cfilt1_mv = 1800,
825 .cfilt2_mv = 1800,
826 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
827 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
828 },
829 .regulator = {
830 {
831 .name = "CDC_VDD_CP",
832 .min_uV = 1950000,
833 .max_uV = 2200000,
834 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
835 },
836 {
837 .name = "CDC_VDDA_RX",
838 .min_uV = 1800000,
839 .max_uV = 1800000,
840 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
841 },
842 {
843 .name = "CDC_VDDA_TX",
844 .min_uV = 1800000,
845 .max_uV = 1800000,
846 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
847 },
848 {
849 .name = "VDDIO_CDC",
850 .min_uV = 1800000,
851 .max_uV = 1800000,
852 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
853 },
854 {
855 .name = "VDDD_CDC_D",
856 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700857 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700858 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
859 },
860 {
861 .name = "CDC_VDDA_A_1P2V",
862 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700863 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700864 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
865 },
866 },
867};
868
869static struct slim_device msm_slim_sitar1p1 = {
870 .name = "sitar1p1-slim",
871 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
872 .dev = {
873 .platform_data = &sitar1p1_platform_data,
874 },
875};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800876#endif
877
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530878
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800879static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530880#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800881 {
882 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530883 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800884 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700885 {
886 .bus_num = 1,
887 .slim_slave = &msm_slim_sitar1p1,
888 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800889#endif
890 /* add more slimbus slaves as needed */
891};
892
893#define MSM_WCNSS_PHYS 0x03000000
894#define MSM_WCNSS_SIZE 0x280000
895
896static struct resource resources_wcnss_wlan[] = {
897 {
898 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
899 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
900 .name = "wcnss_wlanrx_irq",
901 .flags = IORESOURCE_IRQ,
902 },
903 {
904 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
905 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
906 .name = "wcnss_wlantx_irq",
907 .flags = IORESOURCE_IRQ,
908 },
909 {
910 .start = MSM_WCNSS_PHYS,
911 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
912 .name = "wcnss_mmio",
913 .flags = IORESOURCE_MEM,
914 },
915 {
916 .start = 84,
917 .end = 88,
918 .name = "wcnss_gpios_5wire",
919 .flags = IORESOURCE_IO,
920 },
921};
922
923static struct qcom_wcnss_opts qcom_wcnss_pdata = {
924 .has_48mhz_xo = 1,
925};
926
927static struct platform_device msm_device_wcnss_wlan = {
928 .name = "wcnss_wlan",
929 .id = 0,
930 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
931 .resource = resources_wcnss_wlan,
932 .dev = {.platform_data = &qcom_wcnss_pdata},
933};
934
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700935#ifdef CONFIG_QSEECOM
936/* qseecom bus scaling */
937static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
938 {
939 .src = MSM_BUS_MASTER_SPS,
940 .dst = MSM_BUS_SLAVE_EBI_CH0,
941 .ib = 0,
942 .ab = 0,
943 },
944 {
945 .src = MSM_BUS_MASTER_SPDM,
946 .dst = MSM_BUS_SLAVE_SPDM,
947 .ib = 0,
948 .ab = 0,
949 },
950};
951
952static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
953 {
954 .src = MSM_BUS_MASTER_SPS,
955 .dst = MSM_BUS_SLAVE_EBI_CH0,
956 .ib = (492 * 8) * 1000000UL,
957 .ab = (492 * 8) * 100000UL,
958 },
959 {
960 .src = MSM_BUS_MASTER_SPDM,
961 .dst = MSM_BUS_SLAVE_SPDM,
962 .ib = 0,
963 .ab = 0,
964 },
965};
966
967static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
968 {
969 .src = MSM_BUS_MASTER_SPS,
970 .dst = MSM_BUS_SLAVE_EBI_CH0,
971 .ib = 0,
972 .ab = 0,
973 },
974 {
975 .src = MSM_BUS_MASTER_SPDM,
976 .dst = MSM_BUS_SLAVE_SPDM,
977 .ib = (64 * 8) * 1000000UL,
978 .ab = (64 * 8) * 100000UL,
979 },
980};
981
982static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
983 {
984 ARRAY_SIZE(qseecom_clks_init_vectors),
985 qseecom_clks_init_vectors,
986 },
987 {
988 ARRAY_SIZE(qseecom_enable_dfab_vectors),
989 qseecom_enable_sfpb_vectors,
990 },
991 {
992 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
993 qseecom_enable_sfpb_vectors,
994 },
995};
996
997static struct msm_bus_scale_pdata qseecom_bus_pdata = {
998 qseecom_hw_bus_scale_usecases,
999 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1000 .name = "qsee",
1001};
1002
1003static struct platform_device qseecom_device = {
1004 .name = "qseecom",
1005 .id = 0,
1006 .dev = {
1007 .platform_data = &qseecom_bus_pdata,
1008 },
1009};
1010#endif
1011
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001012#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1013 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1014 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1015 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1016
1017#define QCE_SIZE 0x10000
1018#define QCE_0_BASE 0x18500000
1019
1020#define QCE_HW_KEY_SUPPORT 0
1021#define QCE_SHA_HMAC_SUPPORT 1
1022#define QCE_SHARE_CE_RESOURCE 1
1023#define QCE_CE_SHARED 0
1024
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001025/* Begin Bus scaling definitions */
1026static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1027 {
1028 .src = MSM_BUS_MASTER_ADM_PORT0,
1029 .dst = MSM_BUS_SLAVE_EBI_CH0,
1030 .ab = 0,
1031 .ib = 0,
1032 },
1033 {
1034 .src = MSM_BUS_MASTER_ADM_PORT1,
1035 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1036 .ab = 0,
1037 .ib = 0,
1038 },
1039};
1040
1041static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1042 {
1043 .src = MSM_BUS_MASTER_ADM_PORT0,
1044 .dst = MSM_BUS_SLAVE_EBI_CH0,
1045 .ab = 70000000UL,
1046 .ib = 70000000UL,
1047 },
1048 {
1049 .src = MSM_BUS_MASTER_ADM_PORT1,
1050 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1051 .ab = 2480000000UL,
1052 .ib = 2480000000UL,
1053 },
1054};
1055
1056static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1057 {
1058 ARRAY_SIZE(crypto_hw_init_vectors),
1059 crypto_hw_init_vectors,
1060 },
1061 {
1062 ARRAY_SIZE(crypto_hw_active_vectors),
1063 crypto_hw_active_vectors,
1064 },
1065};
1066
1067static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1068 crypto_hw_bus_scale_usecases,
1069 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1070 .name = "cryptohw",
1071};
1072/* End Bus Scaling Definitions*/
1073
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001074static struct resource qcrypto_resources[] = {
1075 [0] = {
1076 .start = QCE_0_BASE,
1077 .end = QCE_0_BASE + QCE_SIZE - 1,
1078 .flags = IORESOURCE_MEM,
1079 },
1080 [1] = {
1081 .name = "crypto_channels",
1082 .start = DMOV_CE_IN_CHAN,
1083 .end = DMOV_CE_OUT_CHAN,
1084 .flags = IORESOURCE_DMA,
1085 },
1086 [2] = {
1087 .name = "crypto_crci_in",
1088 .start = DMOV_CE_IN_CRCI,
1089 .end = DMOV_CE_IN_CRCI,
1090 .flags = IORESOURCE_DMA,
1091 },
1092 [3] = {
1093 .name = "crypto_crci_out",
1094 .start = DMOV_CE_OUT_CRCI,
1095 .end = DMOV_CE_OUT_CRCI,
1096 .flags = IORESOURCE_DMA,
1097 },
1098};
1099
1100static struct resource qcedev_resources[] = {
1101 [0] = {
1102 .start = QCE_0_BASE,
1103 .end = QCE_0_BASE + QCE_SIZE - 1,
1104 .flags = IORESOURCE_MEM,
1105 },
1106 [1] = {
1107 .name = "crypto_channels",
1108 .start = DMOV_CE_IN_CHAN,
1109 .end = DMOV_CE_OUT_CHAN,
1110 .flags = IORESOURCE_DMA,
1111 },
1112 [2] = {
1113 .name = "crypto_crci_in",
1114 .start = DMOV_CE_IN_CRCI,
1115 .end = DMOV_CE_IN_CRCI,
1116 .flags = IORESOURCE_DMA,
1117 },
1118 [3] = {
1119 .name = "crypto_crci_out",
1120 .start = DMOV_CE_OUT_CRCI,
1121 .end = DMOV_CE_OUT_CRCI,
1122 .flags = IORESOURCE_DMA,
1123 },
1124};
1125
1126#endif
1127
1128#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1129 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1130
1131static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1132 .ce_shared = QCE_CE_SHARED,
1133 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1134 .hw_key_support = QCE_HW_KEY_SUPPORT,
1135 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001136 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001137};
1138
1139static struct platform_device qcrypto_device = {
1140 .name = "qcrypto",
1141 .id = 0,
1142 .num_resources = ARRAY_SIZE(qcrypto_resources),
1143 .resource = qcrypto_resources,
1144 .dev = {
1145 .coherent_dma_mask = DMA_BIT_MASK(32),
1146 .platform_data = &qcrypto_ce_hw_suppport,
1147 },
1148};
1149#endif
1150
1151#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1152 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1153
1154static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1155 .ce_shared = QCE_CE_SHARED,
1156 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1157 .hw_key_support = QCE_HW_KEY_SUPPORT,
1158 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001159 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001160};
1161
1162static struct platform_device qcedev_device = {
1163 .name = "qce",
1164 .id = 0,
1165 .num_resources = ARRAY_SIZE(qcedev_resources),
1166 .resource = qcedev_resources,
1167 .dev = {
1168 .coherent_dma_mask = DMA_BIT_MASK(32),
1169 .platform_data = &qcedev_ce_hw_suppport,
1170 },
1171};
1172#endif
1173
1174#define MDM2AP_ERRFATAL 70
1175#define AP2MDM_ERRFATAL 95
1176#define MDM2AP_STATUS 69
1177#define AP2MDM_STATUS 94
1178#define AP2MDM_PMIC_RESET_N 80
1179#define AP2MDM_KPDPWR_N 81
1180
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001181static struct resource mdm_resources[] = {
1182 {
1183 .start = MDM2AP_ERRFATAL,
1184 .end = MDM2AP_ERRFATAL,
1185 .name = "MDM2AP_ERRFATAL",
1186 .flags = IORESOURCE_IO,
1187 },
1188 {
1189 .start = AP2MDM_ERRFATAL,
1190 .end = AP2MDM_ERRFATAL,
1191 .name = "AP2MDM_ERRFATAL",
1192 .flags = IORESOURCE_IO,
1193 },
1194 {
1195 .start = MDM2AP_STATUS,
1196 .end = MDM2AP_STATUS,
1197 .name = "MDM2AP_STATUS",
1198 .flags = IORESOURCE_IO,
1199 },
1200 {
1201 .start = AP2MDM_STATUS,
1202 .end = AP2MDM_STATUS,
1203 .name = "AP2MDM_STATUS",
1204 .flags = IORESOURCE_IO,
1205 },
1206 {
1207 .start = AP2MDM_PMIC_RESET_N,
1208 .end = AP2MDM_PMIC_RESET_N,
1209 .name = "AP2MDM_PMIC_RESET_N",
1210 .flags = IORESOURCE_IO,
1211 },
1212 {
1213 .start = AP2MDM_KPDPWR_N,
1214 .end = AP2MDM_KPDPWR_N,
1215 .name = "AP2MDM_KPDPWR_N",
1216 .flags = IORESOURCE_IO,
1217 },
1218};
1219
1220static struct mdm_platform_data mdm_platform_data = {
1221 .mdm_version = "2.5",
1222};
1223
1224static struct platform_device mdm_device = {
1225 .name = "mdm2_modem",
1226 .id = -1,
1227 .num_resources = ARRAY_SIZE(mdm_resources),
1228 .resource = mdm_resources,
1229 .dev = {
1230 .platform_data = &mdm_platform_data,
1231 },
1232};
1233
1234static struct platform_device *mdm_devices[] __initdata = {
1235 &mdm_device,
1236};
1237
Praveen Chidambaram78499012011-11-01 17:15:17 -06001238#ifdef CONFIG_MSM_MPM
1239static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1240 [1] = MSM_GPIO_TO_INT(46),
1241 [2] = MSM_GPIO_TO_INT(150),
1242 [4] = MSM_GPIO_TO_INT(103),
1243 [5] = MSM_GPIO_TO_INT(104),
1244 [6] = MSM_GPIO_TO_INT(105),
1245 [7] = MSM_GPIO_TO_INT(106),
1246 [8] = MSM_GPIO_TO_INT(107),
1247 [9] = MSM_GPIO_TO_INT(7),
1248 [10] = MSM_GPIO_TO_INT(11),
1249 [11] = MSM_GPIO_TO_INT(15),
1250 [12] = MSM_GPIO_TO_INT(19),
1251 [13] = MSM_GPIO_TO_INT(23),
1252 [14] = MSM_GPIO_TO_INT(27),
1253 [15] = MSM_GPIO_TO_INT(31),
1254 [16] = MSM_GPIO_TO_INT(35),
1255 [19] = MSM_GPIO_TO_INT(90),
1256 [20] = MSM_GPIO_TO_INT(92),
1257 [23] = MSM_GPIO_TO_INT(85),
1258 [24] = MSM_GPIO_TO_INT(83),
1259 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001260 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001261 [27] = HDMI_IRQ,
1262 [29] = MSM_GPIO_TO_INT(10),
1263 [30] = MSM_GPIO_TO_INT(102),
1264 [31] = MSM_GPIO_TO_INT(81),
1265 [32] = MSM_GPIO_TO_INT(78),
1266 [33] = MSM_GPIO_TO_INT(94),
1267 [34] = MSM_GPIO_TO_INT(72),
1268 [35] = MSM_GPIO_TO_INT(39),
1269 [36] = MSM_GPIO_TO_INT(43),
1270 [37] = MSM_GPIO_TO_INT(61),
1271 [38] = MSM_GPIO_TO_INT(50),
1272 [39] = MSM_GPIO_TO_INT(42),
1273 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001274 [42] = MSM_GPIO_TO_INT(8),
1275 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001276 [44] = MSM_GPIO_TO_INT(70),
1277 [45] = MSM_GPIO_TO_INT(69),
1278 [46] = MSM_GPIO_TO_INT(67),
1279 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001280 [48] = MSM_GPIO_TO_INT(55),
1281 [49] = MSM_GPIO_TO_INT(74),
1282 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001283 [51] = MSM_GPIO_TO_INT(49),
1284 [52] = MSM_GPIO_TO_INT(40),
1285 [53] = MSM_GPIO_TO_INT(37),
1286 [54] = MSM_GPIO_TO_INT(24),
1287 [55] = MSM_GPIO_TO_INT(14),
1288};
1289
1290static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1291 TLMM_MSM_SUMMARY_IRQ,
1292 RPM_APCC_CPU0_GP_HIGH_IRQ,
1293 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1294 RPM_APCC_CPU0_GP_LOW_IRQ,
1295 RPM_APCC_CPU0_WAKE_UP_IRQ,
1296 RPM_APCC_CPU1_GP_HIGH_IRQ,
1297 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1298 RPM_APCC_CPU1_GP_LOW_IRQ,
1299 RPM_APCC_CPU1_WAKE_UP_IRQ,
1300 MSS_TO_APPS_IRQ_0,
1301 MSS_TO_APPS_IRQ_1,
1302 MSS_TO_APPS_IRQ_2,
1303 MSS_TO_APPS_IRQ_3,
1304 MSS_TO_APPS_IRQ_4,
1305 MSS_TO_APPS_IRQ_5,
1306 MSS_TO_APPS_IRQ_6,
1307 MSS_TO_APPS_IRQ_7,
1308 MSS_TO_APPS_IRQ_8,
1309 MSS_TO_APPS_IRQ_9,
1310 LPASS_SCSS_GP_LOW_IRQ,
1311 LPASS_SCSS_GP_MEDIUM_IRQ,
1312 LPASS_SCSS_GP_HIGH_IRQ,
1313 SPS_MTI_30,
1314 SPS_MTI_31,
1315 RIVA_APSS_SPARE_IRQ,
1316 RIVA_APPS_WLAN_SMSM_IRQ,
1317 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1318 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1319};
1320
1321struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1322 .irqs_m2a = msm_mpm_irqs_m2a,
1323 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1324 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1325 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1326 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1327 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1328 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1329 .mpm_apps_ipc_val = BIT(1),
1330 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1331
1332};
1333#endif
1334
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001335#define MSM_SHARED_RAM_PHYS 0x80000000
1336
1337static void __init msm8930_map_io(void)
1338{
1339 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1340 msm_map_msm8930_io();
1341
1342 if (socinfo_init() < 0)
1343 pr_err("socinfo_init() failed!\n");
1344}
1345
1346static void __init msm8930_init_irq(void)
1347{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001348 struct msm_mpm_device_data *data = NULL;
1349#ifdef CONFIG_MSM_MPM
1350 data = &msm8930_mpm_dev_data;
1351#endif
1352
1353 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001354 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1355 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001356}
1357
1358static void __init msm8930_init_buses(void)
1359{
1360#ifdef CONFIG_MSM_BUS_SCALING
1361 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001362 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1363 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1364 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1365 msm_bus_8930_apps_fabric.dev.platform_data =
1366 &msm_bus_8930_apps_fabric_pdata;
1367 msm_bus_8930_sys_fabric.dev.platform_data =
1368 &msm_bus_8930_sys_fabric_pdata;
1369 msm_bus_8930_mm_fabric.dev.platform_data =
1370 &msm_bus_8930_mm_fabric_pdata;
1371 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1372 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001373#endif
1374}
1375
1376static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1377 .max_clock_speed = 15060000,
1378};
1379
1380#ifdef CONFIG_USB_MSM_OTG_72K
1381static struct msm_otg_platform_data msm_otg_pdata;
1382#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301383#ifdef CONFIG_MSM_BUS_SCALING
1384/* Bandwidth requests (zero) if no vote placed */
1385static struct msm_bus_vectors usb_init_vectors[] = {
1386 {
1387 .src = MSM_BUS_MASTER_SPS,
1388 .dst = MSM_BUS_SLAVE_EBI_CH0,
1389 .ab = 0,
1390 .ib = 0,
1391 },
1392};
1393
1394/* Bus bandwidth requests in Bytes/sec */
1395static struct msm_bus_vectors usb_max_vectors[] = {
1396 {
1397 .src = MSM_BUS_MASTER_SPS,
1398 .dst = MSM_BUS_SLAVE_EBI_CH0,
1399 .ab = 60000000, /* At least 480Mbps on bus. */
1400 .ib = 960000000, /* MAX bursts rate */
1401 },
1402};
1403
1404static struct msm_bus_paths usb_bus_scale_usecases[] = {
1405 {
1406 ARRAY_SIZE(usb_init_vectors),
1407 usb_init_vectors,
1408 },
1409 {
1410 ARRAY_SIZE(usb_max_vectors),
1411 usb_max_vectors,
1412 },
1413};
1414
1415static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1416 usb_bus_scale_usecases,
1417 ARRAY_SIZE(usb_bus_scale_usecases),
1418 .name = "usb",
1419};
1420#endif
1421
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301422static int hsusb_phy_init_seq[] = {
1423 0x44, 0x80, /* set VBUS valid threshold
1424 and disconnect valid threshold */
1425 0x38, 0x81, /* update DC voltage level */
1426 0x24, 0x82, /* set preemphasis and rise/fall time */
1427 0x13, 0x83, /* set source impedance adjusment */
1428 -1};
1429
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001430static struct msm_otg_platform_data msm_otg_pdata = {
1431 .mode = USB_OTG,
1432 .otg_control = OTG_PMIC_CONTROL,
1433 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001434 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001435 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301436#ifdef CONFIG_MSM_BUS_SCALING
1437 .bus_scale_table = &usb_bus_scale_pdata,
1438#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001439};
1440#endif
1441
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001442#define PID_MAGIC_ID 0x71432909
1443#define SERIAL_NUM_MAGIC_ID 0x61945374
1444#define SERIAL_NUMBER_LENGTH 127
1445#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1446
1447struct magic_num_struct {
1448 uint32_t pid;
1449 uint32_t serial_num;
1450};
1451
1452struct dload_struct {
1453 uint32_t reserved1;
1454 uint32_t reserved2;
1455 uint32_t reserved3;
1456 uint16_t reserved4;
1457 uint16_t pid;
1458 char serial_number[SERIAL_NUMBER_LENGTH];
1459 uint16_t reserved5;
1460 struct magic_num_struct magic_struct;
1461};
1462
1463static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1464{
1465 struct dload_struct __iomem *dload = 0;
1466
1467 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1468 if (!dload) {
1469 pr_err("%s: cannot remap I/O memory region: %08x\n",
1470 __func__, DLOAD_USB_BASE_ADD);
1471 return -ENXIO;
1472 }
1473
1474 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1475 __func__, dload, pid, snum);
1476 /* update pid */
1477 dload->magic_struct.pid = PID_MAGIC_ID;
1478 dload->pid = pid;
1479
1480 /* update serial number */
1481 dload->magic_struct.serial_num = 0;
1482 if (!snum) {
1483 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1484 goto out;
1485 }
1486
1487 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1488 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1489out:
1490 iounmap(dload);
1491 return 0;
1492}
1493
1494static struct android_usb_platform_data android_usb_pdata = {
1495 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1496};
1497
1498static struct platform_device android_usb_device = {
1499 .name = "android_usb",
1500 .id = -1,
1501 .dev = {
1502 .platform_data = &android_usb_pdata,
1503 },
1504};
1505
1506static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001507 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001508};
1509
1510static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001511 0x00, 0x24, 0x54, 0x10,
1512 0x09, 0x03, 0x01,
1513 0x10, 0x54, 0x30, 0x0C,
1514 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001515};
1516
1517static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001518 0x00, 0x24, 0x54, 0x10,
1519 0x09, 0x07, 0x01, 0x0B,
1520 0x10, 0x54, 0x30, 0x0C,
1521 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001522};
1523
1524static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1525 [0] = {
1526 .mode = MSM_SPM_MODE_CLOCK_GATING,
1527 .notify_rpm = false,
1528 .cmd = spm_wfi_cmd_sequence,
1529 },
1530 [1] = {
1531 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1532 .notify_rpm = false,
1533 .cmd = spm_power_collapse_without_rpm,
1534 },
1535 [2] = {
1536 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1537 .notify_rpm = true,
1538 .cmd = spm_power_collapse_with_rpm,
1539 },
1540};
1541
1542static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1543 [0] = {
1544 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001545 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001546#if defined(CONFIG_MSM_AVS_HW)
1547 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1548 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1549#endif
1550 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001551 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001552 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1553 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1554 .vctl_timeout_us = 50,
1555 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1556 .modes = msm_spm_seq_list,
1557 },
1558 [1] = {
1559 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001560 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001561#if defined(CONFIG_MSM_AVS_HW)
1562 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1563 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1564#endif
1565 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001566 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001567 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1568 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1569 .vctl_timeout_us = 50,
1570 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1571 .modes = msm_spm_seq_list,
1572 },
1573};
1574
1575static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001576 0x00, 0x20, 0x03, 0x20,
1577 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001578};
1579
1580static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001581 0x00, 0x20, 0x34, 0x64,
1582 0x48, 0x07, 0x48, 0x20,
1583 0x50, 0x64, 0x04, 0x34,
1584 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001585};
1586static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001587 0x00, 0x10, 0x34, 0x64,
1588 0x48, 0x07, 0x48, 0x10,
1589 0x50, 0x64, 0x04, 0x34,
1590 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001591};
1592
1593static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1594 [0] = {
1595 .mode = MSM_SPM_L2_MODE_RETENTION,
1596 .notify_rpm = false,
1597 .cmd = l2_spm_wfi_cmd_sequence,
1598 },
1599 [1] = {
1600 .mode = MSM_SPM_L2_MODE_GDHS,
1601 .notify_rpm = true,
1602 .cmd = l2_spm_gdhs_cmd_sequence,
1603 },
1604 [2] = {
1605 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1606 .notify_rpm = true,
1607 .cmd = l2_spm_power_off_cmd_sequence,
1608 },
1609};
1610
1611static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1612 [0] = {
1613 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001614 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001615 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001616 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1617 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1618 .modes = msm_spm_l2_seq_list,
1619 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1620 },
1621};
1622
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301623#define ISA1200_HAP_EN_GPIO 77
1624#define ISA1200_HAP_LEN_GPIO 78
1625#define ISA1200_HAP_CLK PM8038_GPIO_PM_TO_SYS(7)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001626
1627static int isa1200_power(int on)
1628{
Amy Malocheb20c1052012-04-11 10:36:13 -07001629 int rc = 0;
1630
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301631 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1632
Amy Malocheb20c1052012-04-11 10:36:13 -07001633 if (on)
1634 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_1, true);
1635 else
1636 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_NONE, true);
1637
1638 if (rc) {
1639 pr_err("%s: unable to write aux clock register(%d)\n",
1640 __func__, rc);
1641 }
1642
1643 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001644}
1645
1646static int isa1200_dev_setup(bool enable)
1647{
1648 int rc = 0;
1649
Amy Malocheb20c1052012-04-11 10:36:13 -07001650 if (!enable)
1651 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301652
1653 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1654 if (rc) {
1655 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
1656 __func__, ISA1200_HAP_CLK, rc);
1657 goto fail_gpio_req;
1658 }
1659
1660 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1661 if (rc) {
1662 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
1663 __func__, ISA1200_HAP_CLK, rc);
1664 goto fail_gpio_dir;
1665 }
1666
1667 return 0;
1668
1669fail_gpio_dir:
1670 gpio_free(ISA1200_HAP_CLK);
1671fail_gpio_req:
1672 return rc;
1673
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001674}
1675
1676static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301677 {
1678 .name = "vddp",
1679 .min_uV = ISA_I2C_VTG_MIN_UV,
1680 .max_uV = ISA_I2C_VTG_MAX_UV,
1681 .load_uA = ISA_I2C_CURR_UA,
1682 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001683 {
1684 .name = "vcc_i2c",
1685 .min_uV = ISA_I2C_VTG_MIN_UV,
1686 .max_uV = ISA_I2C_VTG_MAX_UV,
1687 .load_uA = ISA_I2C_CURR_UA,
1688 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001689};
1690
1691static struct isa1200_platform_data isa1200_1_pdata = {
1692 .name = "vibrator",
1693 .dev_setup = isa1200_dev_setup,
1694 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301695 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1696 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001697 .max_timeout = 15000,
1698 .mode_ctrl = PWM_GEN_MODE,
1699 .pwm_fd = {
1700 .pwm_div = 256,
1701 },
1702 .is_erm = false,
1703 .smart_en = true,
1704 .ext_clk_en = true,
1705 .chip_en = 1,
1706 .regulator_info = isa1200_reg_data,
1707 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1708};
1709
1710static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1711 {
1712 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1713 .platform_data = &isa1200_1_pdata,
1714 },
1715};
1716
Amy Malochef3c9db42011-12-08 15:17:35 -08001717#define MXT_TS_GPIO_IRQ 11
1718#define MXT_TS_RESET_GPIO 52
1719
1720static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001721 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001722 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001723 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301724 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001725 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301726 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001727 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301728 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001729 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301730 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1731 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1732 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1733 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001734 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001735 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1736 0,
1737 /* T18 Object */
1738 0, 0,
1739 /* T19 Object */
1740 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1741 0, 0, 0, 0, 0, 0,
1742 /* T23 Object */
1743 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1744 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001745 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001746 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1747 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001748 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001749 0, 0, 0, 0, 0,
1750 /* T42 Object */
1751 0, 0, 0, 0, 0, 0, 0, 0,
1752 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301753 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001754 /* T47 Object */
1755 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1756 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301757 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1758 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1759 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001760 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1761 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1762 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001763};
1764
Amy Malochef3c9db42011-12-08 15:17:35 -08001765static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1766 struct kobj_attribute *attr, char *buf)
1767{
1768 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301769 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1770 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1771 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1772 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001773 "\n");
1774}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001775
Amy Malochef3c9db42011-12-08 15:17:35 -08001776static struct kobj_attribute mxt224e_vkeys_attr = {
1777 .attr = {
1778 .mode = S_IRUGO,
1779 },
1780 .show = &mxt224e_vkeys_show,
1781};
1782
1783static struct attribute *mxt224e_properties_attrs[] = {
1784 &mxt224e_vkeys_attr.attr,
1785 NULL
1786};
1787
1788static struct attribute_group mxt224e_properties_attr_group = {
1789 .attrs = mxt224e_properties_attrs,
1790};
1791
1792static void mxt_init_vkeys_8930(void)
1793{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001794 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001795 static struct kobject *mxt224e_properties_kobj;
1796
1797 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1798 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1799 NULL);
1800 if (mxt224e_properties_kobj)
1801 rc = sysfs_create_group(mxt224e_properties_kobj,
1802 &mxt224e_properties_attr_group);
1803 if (!mxt224e_properties_kobj || rc)
1804 pr_err("%s: failed to create board_properties\n",
1805 __func__);
1806
1807 return;
1808}
1809
Jing Lindc4413c2012-01-16 15:22:52 -08001810static struct mxt_config_info mxt_config_array[] = {
1811 {
1812 .config = mxt_config_data_8930,
1813 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1814 .family_id = 0x81,
1815 .variant_id = 0x01,
1816 .version = 0x10,
1817 .build = 0xAA,
1818 },
1819};
1820
Amy Malochef3c9db42011-12-08 15:17:35 -08001821static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001822 .config_array = mxt_config_array,
1823 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001824 .panel_minx = 0,
1825 .panel_maxx = 566,
1826 .panel_miny = 0,
1827 .panel_maxy = 1067,
1828 .disp_minx = 0,
1829 .disp_maxx = 540,
1830 .disp_miny = 0,
1831 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001832 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301833#ifdef MSM8930_PHASE_2
1834 .digital_pwr_regulator = true,
1835#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001836 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001837 .reset_gpio = MXT_TS_RESET_GPIO,
1838 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001839};
1840
Amy Malochef3c9db42011-12-08 15:17:35 -08001841static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001842 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001843 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1844 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001845 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1846 },
1847};
1848
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301849#ifdef MSM8930_PHASE_2
1850
1851#define GPIO_VOLUME_UP PM8038_GPIO_PM_TO_SYS(3)
1852#define GPIO_VOLUME_DOWN PM8038_GPIO_PM_TO_SYS(8)
1853#define GPIO_CAMERA_SNAPSHOT PM8038_GPIO_PM_TO_SYS(10)
1854#define GPIO_CAMERA_FOCUS PM8038_GPIO_PM_TO_SYS(11)
1855
1856static struct gpio_keys_button keys_8930[] = {
1857 {
1858 .code = KEY_VOLUMEUP,
1859 .type = EV_KEY,
1860 .desc = "volume_up",
1861 .gpio = GPIO_VOLUME_UP,
1862 .wakeup = 1,
1863 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001864 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301865 },
1866 {
1867 .code = KEY_VOLUMEDOWN,
1868 .type = EV_KEY,
1869 .desc = "volume_down",
1870 .gpio = GPIO_VOLUME_DOWN,
1871 .wakeup = 1,
1872 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001873 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301874 },
1875 {
1876 .code = KEY_CAMERA_FOCUS,
1877 .type = EV_KEY,
1878 .desc = "camera_focus",
1879 .gpio = GPIO_CAMERA_FOCUS,
1880 .wakeup = 1,
1881 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001882 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301883 },
1884 {
1885 .code = KEY_CAMERA_SNAPSHOT,
1886 .type = EV_KEY,
1887 .desc = "camera_snapshot",
1888 .gpio = GPIO_CAMERA_SNAPSHOT,
1889 .wakeup = 1,
1890 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001891 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301892 },
1893};
1894
1895/* Add GPIO keys for 8930 */
1896static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
1897 .buttons = keys_8930,
1898 .nbuttons = 4,
1899};
1900
1901static struct platform_device gpio_keys_8930 = {
1902 .name = "gpio-keys",
1903 .id = -1,
1904 .dev = {
1905 .platform_data = &gpio_keys_8930_pdata,
1906 },
1907};
1908#endif /* MSM8930_PHASE_2 */
1909
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001910static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1911 .clk_freq = 100000,
1912 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001913};
1914
1915static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1916 .clk_freq = 100000,
1917 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001918};
1919
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06001920static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
1921 .clk_freq = 100000,
1922 .src_clk_rate = 24000000,
1923};
1924
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001925static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1926 .clk_freq = 100000,
1927 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001928};
1929
1930static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1931 .clk_freq = 100000,
1932 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001933};
1934
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001935
1936static struct ks8851_pdata spi_eth_pdata = {
1937 .irq_gpio = KS8851_IRQ_GPIO,
1938 .rst_gpio = KS8851_RST_GPIO,
1939};
1940
1941static struct spi_board_info spi_board_info[] __initdata = {
1942 {
1943 .modalias = "ks8851",
1944 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1945 .max_speed_hz = 19200000,
1946 .bus_num = 0,
1947 .chip_select = 0,
1948 .mode = SPI_MODE_0,
1949 .platform_data = &spi_eth_pdata
1950 },
1951 {
1952 .modalias = "dsi_novatek_3d_panel_spi",
1953 .max_speed_hz = 10800000,
1954 .bus_num = 0,
1955 .chip_select = 1,
1956 .mode = SPI_MODE_0,
1957 },
1958};
1959
1960static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001961 .name = "saw-regulator",
1962 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001963 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001964 .platform_data = &msm8930_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001965 },
1966};
1967
1968static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001969 .name = "saw-regulator",
1970 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001971 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001972 .platform_data = &msm8930_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001973 },
1974};
1975
1976static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001977 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08001978 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07001979 .tsens_num_sensor = 10,
1980 .slope = {1132, 1135, 1137, 1135, 1157,
1981 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001982};
1983
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001984static struct platform_device msm_tsens_device = {
1985 .name = "tsens8960-tm",
1986 .id = -1,
1987};
1988
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001989static struct msm_thermal_data msm_thermal_pdata = {
1990 .sensor_id = 9,
1991 .poll_ms = 1000,
1992 .limit_temp = 60,
1993 .temp_hysteresis = 10,
1994 .limit_freq = 918000,
1995};
1996
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001997#ifdef CONFIG_MSM_FAKE_BATTERY
1998static struct platform_device fish_battery_device = {
1999 .name = "fish_battery",
2000};
2001#endif
2002
David Collins1d4061b2011-12-06 15:36:40 -08002003#ifndef MSM8930_PHASE_2
2004
2005/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002006static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002007 .name = GPIO_REGULATOR_DEV_NAME,
2008 .id = PM8921_MPP_PM_TO_SYS(7),
2009 .dev = {
2010 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2011 },
2012};
2013
Jay Chokshi06fa7542011-12-07 13:09:17 -08002014static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002015 .name = GPIO_REGULATOR_DEV_NAME,
2016 .id = 91,
2017 .dev = {
2018 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2019 },
2020};
2021
David Collins1d4061b2011-12-06 15:36:40 -08002022#else
2023
2024/* 8930 Phase 2 */
2025static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2026 .name = GPIO_REGULATOR_DEV_NAME,
2027 .id = 63,
2028 .dev = {
2029 .platform_data =
2030 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_5V],
2031 },
2032};
2033
2034static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2035 .name = GPIO_REGULATOR_DEV_NAME,
2036 .id = 97,
2037 .dev = {
2038 .platform_data =
2039 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
2040 },
2041};
2042
2043#endif
2044
Jay Chokshi06fa7542011-12-07 13:09:17 -08002045static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002046 .name = "rpm-regulator",
2047 .id = -1,
2048 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002049#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002050 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002051#else
2052 .platform_data = &msm8930_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002053#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002054 },
2055};
2056
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002057static struct platform_device *common_devices[] __initdata = {
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002058 &msm8960_device_acpuclk,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002059 &msm8960_device_dmov,
2060 &msm_device_smd,
2061 &msm8960_device_uart_gsbi5,
2062 &msm_device_uart_dm6,
2063 &msm_device_saw_core0,
2064 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002065 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002066#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002067 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002068#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002069 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002070#ifdef MSM8930_PHASE_2
2071 &msm8930_device_ext_otg_sw_vreg,
2072#endif
Stephen Boyd28d54952011-12-16 13:19:51 -08002073 &msm_8960_q6_lpass,
2074 &msm_8960_q6_mss_fw,
2075 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002076 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002077 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002078 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002079 &msm8960_device_qup_spi_gsbi1,
2080 &msm8960_device_qup_i2c_gsbi3,
2081 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002082 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002083 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002084 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002085 &msm_slim_ctrl,
2086 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002087#if defined(CONFIG_QSEECOM)
2088 &qseecom_device,
2089#endif
2090
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002091#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2092 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2093 &qcrypto_device,
2094#endif
2095
2096#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2097 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2098 &qcedev_device,
2099#endif
2100#ifdef CONFIG_MSM_ROTATOR
2101 &msm_rotator_device,
2102#endif
2103 &msm_device_sps,
2104#ifdef CONFIG_MSM_FAKE_BATTERY
2105 &fish_battery_device,
2106#endif
2107#ifdef CONFIG_ANDROID_PMEM
2108#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002109 &msm8930_android_pmem_device,
2110 &msm8930_android_pmem_adsp_device,
2111 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302112#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2113#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002114 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002115 &msm_device_bam_dmux,
2116 &msm_fm_platform_init,
2117
2118#ifdef CONFIG_HW_RANDOM_MSM
2119 &msm_device_rng,
2120#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002121 &msm8930_rpm_device,
2122 &msm8930_rpm_log_device,
2123 &msm8930_rpm_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002124#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002125 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002126#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002127 &msm_device_tz_log,
2128
2129#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002130 &msm_qdss_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002131 &msm_etb_device,
2132 &msm_tpiu_device,
2133 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002134 &msm_etm_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002135#endif
2136 &msm_device_dspcrashd_8960,
2137 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302138#ifdef MSM8930_PHASE_2
2139 &gpio_keys_8930,
2140#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002141 &msm8930_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002142 &msm8930_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002143 &msm8930_msm_gov_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002144 &msm_bus_8930_apps_fabric,
2145 &msm_bus_8930_sys_fabric,
2146 &msm_bus_8930_mm_fabric,
2147 &msm_bus_8930_sys_fpb,
2148 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002149 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002150 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002151 &msm_tsens_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002152};
2153
2154static struct platform_device *cdp_devices[] __initdata = {
2155 &msm8960_device_otg,
2156 &msm8960_device_gadget_peripheral,
2157 &msm_device_hsusb_host,
2158 &android_usb_device,
2159 &msm_pcm,
2160 &msm_pcm_routing,
2161 &msm_cpudai0,
2162 &msm_cpudai1,
2163 &msm_cpudai_hdmi_rx,
2164 &msm_cpudai_bt_rx,
2165 &msm_cpudai_bt_tx,
2166 &msm_cpudai_fm_rx,
2167 &msm_cpudai_fm_tx,
2168 &msm_cpudai_auxpcm_rx,
2169 &msm_cpudai_auxpcm_tx,
2170 &msm_cpu_fe,
2171 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002172#ifdef CONFIG_MSM_GEMINI
2173 &msm8960_gemini_device,
2174#endif
2175 &msm_voice,
2176 &msm_voip,
2177 &msm_lpa_pcm,
2178 &msm_cpudai_afe_01_rx,
2179 &msm_cpudai_afe_01_tx,
2180 &msm_cpudai_afe_02_rx,
2181 &msm_cpudai_afe_02_tx,
2182 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002183 &msm_compr_dsp,
2184 &msm_cpudai_incall_music_rx,
2185 &msm_cpudai_incall_record_rx,
2186 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002187 &msm_pcm_hostless,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002188};
2189
2190static void __init msm8930_i2c_init(void)
2191{
2192 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2193 &msm8960_i2c_qup_gsbi4_pdata;
2194
2195 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2196 &msm8960_i2c_qup_gsbi3_pdata;
2197
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002198 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2199 &msm8960_i2c_qup_gsbi9_pdata;
2200
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002201 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2202 &msm8960_i2c_qup_gsbi10_pdata;
2203
2204 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2205 &msm8960_i2c_qup_gsbi12_pdata;
2206}
2207
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002208static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2209 {
2210 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2211 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2212 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002213 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002214 },
2215
2216 {
2217 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2218 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2219 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002220 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002221 },
2222
2223 {
2224 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2225 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2226 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002227 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002228 },
2229
2230 {
2231 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002232 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2233 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002234 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002235 },
2236
2237 {
2238 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2239 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2240 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002241 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002242 },
2243
2244 {
2245 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2246 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2247 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002248 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002249 },
2250
2251 {
2252 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2253 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2254 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002255 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002256 },
2257
2258 {
2259 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2260 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2261 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002262 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002263 },
2264};
2265
Praveen Chidambaram78499012011-11-01 17:15:17 -06002266static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2267 .levels = &msm_rpmrs_levels[0],
2268 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2269 .vdd_mem_levels = {
2270 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2271 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2272 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2273 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2274 },
2275 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002276 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2277 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2278 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2279 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002280 },
2281 .vdd_mask = 0x7FFFFF,
2282 .rpmrs_target_id = {
2283 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2284 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002285 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2286 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002287 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2288 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2289 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2290 },
2291};
2292
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002293static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2294 .mode = MSM_PM_BOOT_CONFIG_TZ,
2295};
2296
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002297static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2298 .base_addr = MSM_ACC0_BASE + 0x08,
2299 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2300 .mask = 1UL << 13,
2301};
2302
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002303#ifdef CONFIG_I2C
2304#define I2C_SURF 1
2305#define I2C_FFA (1 << 1)
2306#define I2C_RUMI (1 << 2)
2307#define I2C_SIM (1 << 3)
2308#define I2C_FLUID (1 << 4)
2309#define I2C_LIQUID (1 << 5)
2310
2311struct i2c_registry {
2312 u8 machs;
2313 int bus;
2314 struct i2c_board_info *info;
2315 int len;
2316};
2317
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002318#ifdef CONFIG_INPUT_MPU3050
2319#define MPU3050_INT_GPIO 69
2320
2321static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2322 .gpio_int = MPU3050_INT_GPIO,
2323};
2324
2325static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2326 {
2327 I2C_BOARD_INFO("mpu3050", 0x68),
2328 .platform_data = &mpu3050_gyro,
2329 },
2330};
2331#endif
2332
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002333#ifdef CONFIG_ISL9519_CHARGER
2334static struct isl_platform_data isl_data __initdata = {
2335 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2336 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2337 .max_system_voltage = 4200,
2338 .min_system_voltage = 3200,
2339 .chgcurrent = 1000, /* 1900, */
2340 .term_current = 400, /* Need fine tuning */
2341 .input_current = 2048,
2342};
2343
2344static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2345 {
2346 I2C_BOARD_INFO("isl9519q", 0x9),
2347 .irq = 0, /* Not required when notify-by-pmic */
2348 .platform_data = &isl_data,
2349 },
2350};
2351#endif /* CONFIG_ISL9519_CHARGER */
2352
2353static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002354#ifdef CONFIG_ISL9519_CHARGER
2355 {
2356 I2C_LIQUID,
2357 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2358 isl_charger_i2c_info,
2359 ARRAY_SIZE(isl_charger_i2c_info),
2360 },
2361#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002362#ifdef CONFIG_INPUT_MPU3050
2363 {
2364 I2C_FFA | I2C_FLUID,
2365 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2366 mpu3050_i2c_boardinfo,
2367 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2368 },
2369#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002370 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002371 I2C_SURF | I2C_FFA | I2C_FLUID,
2372 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002373 msm_isa1200_board_info,
2374 ARRAY_SIZE(msm_isa1200_board_info),
2375 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002376 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002377 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002378 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2379 mxt_device_info_8930,
2380 ARRAY_SIZE(mxt_device_info_8930),
2381 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002382};
2383#endif /* CONFIG_I2C */
2384
2385static void __init register_i2c_devices(void)
2386{
2387#ifdef CONFIG_I2C
2388 u8 mach_mask = 0;
2389 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002390#ifdef CONFIG_MSM_CAMERA
2391 struct i2c_registry msm8930_camera_i2c_devices = {
2392 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2393 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2394 msm8930_camera_board_info.board_info,
2395 msm8930_camera_board_info.num_i2c_board_info,
2396 };
2397#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002398
2399 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002400 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002401 mach_mask = I2C_SURF;
2402 else if (machine_is_msm8930_fluid())
2403 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002404 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002405 mach_mask = I2C_FFA;
2406 else
2407 pr_err("unmatched machine ID in register_i2c_devices\n");
2408
2409 /* Run the array and install devices as appropriate */
2410 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2411 if (msm8960_i2c_devices[i].machs & mach_mask)
2412 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2413 msm8960_i2c_devices[i].info,
2414 msm8960_i2c_devices[i].len);
2415 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002416#ifdef CONFIG_MSM_CAMERA
2417 if (msm8930_camera_i2c_devices.machs & mach_mask)
2418 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2419 msm8930_camera_i2c_devices.info,
2420 msm8930_camera_i2c_devices.len);
2421#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002422#endif
2423}
2424
2425static void __init msm8930_cdp_init(void)
2426{
2427 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2428 pr_err("meminfo_init() failed!\n");
2429
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002430 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002431 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002432 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2433 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002434
2435 regulator_suppress_info_printing();
2436 if (msm_xo_init())
2437 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002438 platform_device_register(&msm8930_device_rpm_regulator);
Tianyi Goue3d4f542012-03-15 17:06:45 -07002439 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302440 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002441 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302442 android_usb_pdata.swfi_latency =
2443 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002444 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002445 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2446 &msm8960_qup_spi_gsbi1_pdata;
2447 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2448
Jay Chokshi06fa7542011-12-07 13:09:17 -08002449 /*
2450 * TODO: When physical 8930/PM8038 hardware becomes
2451 * available, remove this block or add the config
2452 * option.
2453 */
2454#ifndef MSM8930_PHASE_2
2455 msm8960_init_pmic();
2456#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002457 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002458#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002459 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302460 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002461 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2462 msm_spm_l2_init(msm_spm_l2_data);
2463 msm8930_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002464 platform_add_devices(msm8930_footswitch, msm8930_num_footswitch);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002465 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002466 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002467 /*
2468 * TODO: When physical 8930/PM8038 hardware becomes
2469 * available, remove this block or add the config
2470 * option.
2471 */
2472#ifndef MSM8930_PHASE_2
2473 msm8960_pm8921_gpio_mpp_init();
2474#else
2475 msm8930_pm8038_gpio_mpp_init();
2476#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002477 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002478#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002479 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002480#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002481 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002482 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002483 register_i2c_devices();
2484 msm8930_init_fb();
2485 slim_register_board_info(msm_slim_devices,
2486 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002487 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002488 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002489 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002490
2491 if (PLATFORM_IS_CHARM25())
2492 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2493}
2494
2495MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2496 .map_io = msm8930_map_io,
2497 .reserve = msm8930_reserve,
2498 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302499 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002500 .timer = &msm_timer,
2501 .init_machine = msm8930_cdp_init,
2502 .init_early = msm8930_allocate_memory_regions,
2503 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002504 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002505MACHINE_END
2506
2507MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2508 .map_io = msm8930_map_io,
2509 .reserve = msm8930_reserve,
2510 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302511 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002512 .timer = &msm_timer,
2513 .init_machine = msm8930_cdp_init,
2514 .init_early = msm8930_allocate_memory_regions,
2515 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002516 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002517MACHINE_END
2518
2519MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2520 .map_io = msm8930_map_io,
2521 .reserve = msm8930_reserve,
2522 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302523 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002524 .timer = &msm_timer,
2525 .init_machine = msm8930_cdp_init,
2526 .init_early = msm8930_allocate_memory_regions,
2527 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002528 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002529MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002530
2531MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2532 .map_io = msm8930_map_io,
2533 .reserve = msm8930_reserve,
2534 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302535 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002536 .timer = &msm_timer,
2537 .init_machine = msm8930_cdp_init,
2538 .init_early = msm8930_allocate_memory_regions,
2539 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002540 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002541MACHINE_END
2542
2543MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2544 .map_io = msm8930_map_io,
2545 .reserve = msm8930_reserve,
2546 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302547 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002548 .timer = &msm_timer,
2549 .init_machine = msm8930_cdp_init,
2550 .init_early = msm8930_allocate_memory_regions,
2551 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002552 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002553MACHINE_END