blob: 1a61dbb55ccccec358e81270f36c3888ad3785be [file] [log] [blame]
David Collinsb4558422012-01-05 10:50:49 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/i2c.h>
18#include <linux/i2c/sx150x.h>
19#include <linux/i2c/isl9519.h>
20#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070022#include <linux/regulator/msm-gpio-regulator.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080023#include <linux/mfd/pm8xxx/pm8921.h>
24#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
25#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
29#include <linux/msm_kgsl.h>
30#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080033#include <linux/dma-mapping.h>
34#include <linux/platform_data/qcom_crypto_device.h>
35#include <linux/platform_data/qcom_wcnss_device.h>
36#include <linux/leds.h>
37#include <linux/leds-pm8xxx.h>
38#include <linux/i2c/atmel_mxt_ts.h>
39#include <linux/msm_tsens.h>
40#include <linux/ks8851.h>
41#include <linux/i2c/isa1200.h>
Anirudh Ghayaleb3af972011-12-13 17:29:06 +053042#include <linux/gpio_keys.h>
Jack Cheung6ce8f682012-01-17 10:35:42 -080043#include <linux/memory.h>
Hanumant Singheea62562012-05-14 11:32:45 -070044#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060045#include <linux/msm_thermal.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080046
Asish Bhattacharyab86c3472012-02-15 08:31:52 +053047#include <linux/slimbus/slimbus.h>
48#include <linux/mfd/wcd9xxx/core.h>
49#include <linux/mfd/wcd9xxx/pdata.h>
50
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080051#include <asm/mach-types.h>
52#include <asm/mach/arch.h>
53#include <asm/setup.h>
54#include <asm/hardware/gic.h>
55#include <asm/mach/mmc.h>
56
57#include <mach/board.h>
58#include <mach/msm_iomap.h>
59#include <mach/msm_spi.h>
60#ifdef CONFIG_USB_MSM_OTG_72K
61#include <mach/msm_hsusb.h>
62#else
63#include <linux/usb/msm_hsusb.h>
64#endif
65#include <linux/usb/android.h>
66#include <mach/usbdiag.h>
67#include <mach/socinfo.h>
68#include <mach/rpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080069#include <mach/gpiomux.h>
70#include <mach/msm_bus_board.h>
71#include <mach/msm_memtypes.h>
72#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080073#include <mach/msm_xo.h>
74#include <mach/restart.h>
75
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080076#include <linux/ion.h>
77#include <mach/ion.h>
78#include <mach/mdm2.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080079#include <mach/msm_rtb.h>
Hanumant Singheea62562012-05-14 11:32:45 -070080#include <linux/fmem.h>
Laura Abbottf3173042012-05-29 15:23:18 -070081#include <mach/msm_cache_dump.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080082
Wentao Xuf59ce4e2012-05-22 17:30:13 -040083#ifdef CONFIG_INPUT_MPU3050
84#include <linux/input/mpu3050.h>
85#endif
86
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080087#include "timer.h"
88#include "devices.h"
89#include "devices-msm8x60.h"
90#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080091#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080092#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080093#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053094#include <mach/mpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080095#include "smd_private.h"
96#include "pm-boot.h"
97#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -080098#include "board-8930.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080099
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800100static struct platform_device msm_fm_platform_init = {
101 .name = "iris_fm",
102 .id = -1,
103};
104
105#define KS8851_RST_GPIO 89
106#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800107#define HAP_SHIFT_LVL_OE_GPIO 47
108
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800109#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
110
111struct sx150x_platform_data msm8930_sx150x_data[] = {
112 [SX150X_CAM] = {
113 .gpio_base = GPIO_CAM_EXPANDER_BASE,
114 .oscio_is_gpo = false,
115 .io_pullup_ena = 0x0,
116 .io_pulldn_ena = 0xc0,
117 .io_open_drain_ena = 0x0,
118 .irq_summary = -1,
119 },
120};
121
122#endif
123
Olav Haugana21169d2012-01-04 09:17:06 -0800124#define MSM_PMEM_ADSP_SIZE 0x7800000
Asish Bhattacharya9ed880f2012-04-12 08:33:37 +0530125#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800126#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
127#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
128#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800129#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800130#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700131#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800132
133#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur9830bf02012-06-01 15:04:29 -0700134#define HOLE_SIZE 0x20000
Asish Bhattacharya9ed880f2012-04-12 08:33:37 +0530135#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700136#ifdef CONFIG_MSM_IOMMU
137#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
138#define MSM_ION_SF_SIZE 0x0
Olav Haugan494e4dc2012-05-15 15:14:31 -0700139#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Hanumant Singhedfb0462012-05-15 14:49:32 -0700140#define MSM_ION_HEAP_NUM 7
141#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800142#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800143#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan494e4dc2012-05-15 15:14:31 -0700144#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Hanumant Singheea62562012-05-14 11:32:45 -0700145#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700146#endif
Deepak Kotur9830bf02012-06-01 15:04:29 -0700147#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800148#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800149#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700150
151#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
152#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
153#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
154
Deepak Kotur9830bf02012-06-01 15:04:29 -0700155#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */
156#define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
157 HOLE_SIZE))
Hanumant Singheea62562012-05-14 11:32:45 -0700158#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur9830bf02012-06-01 15:04:29 -0700159#define MSM8930_FW_START MSM8930_FIXED_AREA_START
Hanumant Singheea62562012-05-14 11:32:45 -0700160
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800161#else
162#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800163#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800164#endif
165
166#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
167static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
168static int __init pmem_kernel_ebi1_size_setup(char *p)
169{
170 pmem_kernel_ebi1_size = memparse(p, NULL);
171 return 0;
172}
173early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
174#endif
175
176#ifdef CONFIG_ANDROID_PMEM
177static unsigned pmem_size = MSM_PMEM_SIZE;
178static int __init pmem_size_setup(char *p)
179{
180 pmem_size = memparse(p, NULL);
181 return 0;
182}
183early_param("pmem_size", pmem_size_setup);
184
185static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
186
187static int __init pmem_adsp_size_setup(char *p)
188{
189 pmem_adsp_size = memparse(p, NULL);
190 return 0;
191}
192early_param("pmem_adsp_size", pmem_adsp_size_setup);
193
194static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
195
196static int __init pmem_audio_size_setup(char *p)
197{
198 pmem_audio_size = memparse(p, NULL);
199 return 0;
200}
201early_param("pmem_audio_size", pmem_audio_size_setup);
202#endif
203
204#ifdef CONFIG_ANDROID_PMEM
205#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
206static struct android_pmem_platform_data android_pmem_pdata = {
207 .name = "pmem",
208 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
209 .cached = 1,
210 .memory_type = MEMTYPE_EBI1,
211};
212
Laura Abbottb93525f2012-04-12 09:57:19 -0700213static struct platform_device msm8930_android_pmem_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800214 .name = "android_pmem",
215 .id = 0,
216 .dev = {.platform_data = &android_pmem_pdata},
217};
218
219static struct android_pmem_platform_data android_pmem_adsp_pdata = {
220 .name = "pmem_adsp",
221 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
222 .cached = 0,
223 .memory_type = MEMTYPE_EBI1,
224};
Laura Abbottb93525f2012-04-12 09:57:19 -0700225static struct platform_device msm8930_android_pmem_adsp_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800226 .name = "android_pmem",
227 .id = 2,
228 .dev = { .platform_data = &android_pmem_adsp_pdata },
229};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800230
231static struct android_pmem_platform_data android_pmem_audio_pdata = {
232 .name = "pmem_audio",
233 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
234 .cached = 0,
235 .memory_type = MEMTYPE_EBI1,
236};
237
Laura Abbottb93525f2012-04-12 09:57:19 -0700238static struct platform_device msm8930_android_pmem_audio_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800239 .name = "android_pmem",
240 .id = 4,
241 .dev = { .platform_data = &android_pmem_audio_pdata },
242};
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530243#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
244#endif /* CONFIG_ANDROID_PMEM */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800245
Hanumant Singheea62562012-05-14 11:32:45 -0700246struct fmem_platform_data msm8930_fmem_pdata = {
247};
248
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800249#define DSP_RAM_BASE_8960 0x8da00000
250#define DSP_RAM_SIZE_8960 0x1800000
251static int dspcrashd_pdata_8960 = 0xDEADDEAD;
252
253static struct resource resources_dspcrashd_8960[] = {
254 {
255 .name = "msm_dspcrashd",
256 .start = DSP_RAM_BASE_8960,
257 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
258 .flags = IORESOURCE_DMA,
259 },
260};
261
262static struct platform_device msm_device_dspcrashd_8960 = {
263 .name = "msm_dspcrashd",
264 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
265 .resource = resources_dspcrashd_8960,
266 .dev = { .platform_data = &dspcrashd_pdata_8960 },
267};
268
269static struct memtype_reserve msm8930_reserve_table[] __initdata = {
270 [MEMTYPE_SMI] = {
271 },
272 [MEMTYPE_EBI0] = {
273 .flags = MEMTYPE_FLAGS_1M_ALIGN,
274 },
275 [MEMTYPE_EBI1] = {
276 .flags = MEMTYPE_FLAGS_1M_ALIGN,
277 },
278};
279
Laura Abbottf8c03b92012-02-16 14:57:58 -0800280
281static void __init reserve_rtb_memory(void)
282{
283#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700284 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800285#endif
286}
287
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800288static void __init size_pmem_devices(void)
289{
290#ifdef CONFIG_ANDROID_PMEM
291#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
292 android_pmem_adsp_pdata.size = pmem_adsp_size;
293 android_pmem_pdata.size = pmem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800294 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530295#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
296#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800297}
298
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530299#ifdef CONFIG_ANDROID_PMEM
300#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800301static void __init reserve_memory_for(struct android_pmem_platform_data *p)
302{
303 msm8930_reserve_table[p->memory_type].size += p->size;
304}
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530305#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
306#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800307
308static void __init reserve_pmem_memory(void)
309{
310#ifdef CONFIG_ANDROID_PMEM
311#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
312 reserve_memory_for(&android_pmem_adsp_pdata);
313 reserve_memory_for(&android_pmem_pdata);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800314 reserve_memory_for(&android_pmem_audio_pdata);
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530315#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800316 msm8930_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530317#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800318}
319
320static int msm8930_paddr_to_memtype(unsigned int paddr)
321{
322 return MEMTYPE_EBI1;
323}
324
Steve Mucklef132c6c2012-06-06 18:30:57 -0700325#define FMEM_ENABLED 0
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800326#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800327#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700328static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800329 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800330 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700331 .reusable = FMEM_ENABLED,
332 .mem_is_fmem = FMEM_ENABLED,
333 .fixed_position = FIXED_MIDDLE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800334};
335
Laura Abbottb93525f2012-04-12 09:57:19 -0700336static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800337 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800338 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700339 .reusable = 0,
340 .mem_is_fmem = FMEM_ENABLED,
341 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800342};
Hanumant Singheea62562012-05-14 11:32:45 -0700343
Laura Abbottb93525f2012-04-12 09:57:19 -0700344static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800345 .adjacent_mem_id = INVALID_HEAP_ID,
346 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700347 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800348};
Hanumant Singheea62562012-05-14 11:32:45 -0700349
Laura Abbottb93525f2012-04-12 09:57:19 -0700350static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800351 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
352 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700353 .mem_is_fmem = FMEM_ENABLED,
354 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800355};
356#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800357
358/**
359 * These heaps are listed in the order they will be allocated. Due to
360 * video hardware restrictions and content protection the FW heap has to
361 * be allocated adjacent (below) the MM heap and the MFC heap has to be
362 * allocated after the MM heap to ensure MFC heap is not more than 256MB
363 * away from the base address of the FW heap.
364 * However, the order of FW heap and MM heap doesn't matter since these
365 * two heaps are taken care of by separate code to ensure they are adjacent
366 * to each other.
367 * Don't swap the order unless you know what you are doing!
368 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700369static struct ion_platform_data msm8930_ion_pdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800370 .nr = MSM_ION_HEAP_NUM,
371 .heaps = {
372 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800373 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800374 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800375 .name = ION_VMALLOC_HEAP_NAME,
376 },
377#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
378 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800379 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800380 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800381 .name = ION_MM_HEAP_NAME,
382 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800383 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700384 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800385 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800386 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800387 .id = ION_MM_FIRMWARE_HEAP_ID,
388 .type = ION_HEAP_TYPE_CARVEOUT,
389 .name = ION_MM_FIRMWARE_HEAP_NAME,
390 .size = MSM_ION_MM_FW_SIZE,
391 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700392 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800393 },
394 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800395 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800396 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800397 .name = ION_MFC_HEAP_NAME,
398 .size = MSM_ION_MFC_SIZE,
399 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700400 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800401 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700402#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800403 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800404 .id = ION_SF_HEAP_ID,
405 .type = ION_HEAP_TYPE_CARVEOUT,
406 .name = ION_SF_HEAP_NAME,
407 .size = MSM_ION_SF_SIZE,
408 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700409 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800410 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700411#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800412 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800413 .id = ION_IOMMU_HEAP_ID,
414 .type = ION_HEAP_TYPE_IOMMU,
415 .name = ION_IOMMU_HEAP_NAME,
416 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800417 {
418 .id = ION_QSECOM_HEAP_ID,
419 .type = ION_HEAP_TYPE_CARVEOUT,
420 .name = ION_QSECOM_HEAP_NAME,
421 .size = MSM_ION_QSECOM_SIZE,
422 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700423 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800424 },
Olav Haugan7355db02012-01-13 16:59:13 -0800425 {
426 .id = ION_AUDIO_HEAP_ID,
427 .type = ION_HEAP_TYPE_CARVEOUT,
428 .name = ION_AUDIO_HEAP_NAME,
429 .size = MSM_ION_AUDIO_SIZE,
430 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700431 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800432 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800433#endif
434 }
435};
436
Laura Abbottb93525f2012-04-12 09:57:19 -0700437static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800438 .name = "ion-msm",
439 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700440 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800441};
442#endif
443
Hanumant Singheea62562012-05-14 11:32:45 -0700444struct platform_device msm8930_fmem_device = {
445 .name = "fmem",
446 .id = 1,
447 .dev = { .platform_data = &msm8930_fmem_pdata },
448};
449
450static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
451 unsigned long size)
452{
453 msm8930_reserve_table[mem_type].size += size;
454}
455
456static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
457{
458#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
459 int ret;
460
461 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
462 panic("fixed area size is larger than %dM\n",
463 MAX_FIXED_AREA_SIZE >> 20);
464
465 reserve_info->fixed_area_size = fixed_area_size;
466 reserve_info->fixed_area_start = MSM8930_FW_START;
467
468 ret = memblock_remove(reserve_info->fixed_area_start,
469 reserve_info->fixed_area_size);
470 BUG_ON(ret);
471#endif
472}
473
474/**
475 * Reserve memory for ION and calculate amount of reusable memory for fmem.
476 * We only reserve memory for heaps that are not reusable. However, we only
477 * support one reusable heap at the moment so we ignore the reusable flag for
478 * other than the first heap with reusable flag set. Also handle special case
479 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
480 * at a higher address than FW in addition to not more than 256MB away from the
481 * base address of the firmware. This means that if MM is reusable the other
482 * two heaps must be allocated in the same region as FW. This is handled by the
483 * mem_is_fmem flag in the platform data. In addition the MM heap must be
484 * adjacent to the FW heap for content protection purposes.
485 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700486static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800487{
488#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700489 unsigned int i;
490 unsigned int reusable_count = 0;
491 unsigned int fixed_size = 0;
492 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
493 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
494
495 msm8930_fmem_pdata.size = 0;
496 msm8930_fmem_pdata.reserved_size_low = 0;
497 msm8930_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700498 msm8930_fmem_pdata.align = PAGE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700499 fixed_low_size = 0;
500 fixed_middle_size = 0;
501 fixed_high_size = 0;
502
503 /* We only support 1 reusable heap. Check if more than one heap
504 * is specified as reusable and set as non-reusable if found.
505 */
506 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
507 const struct ion_platform_heap *heap =
508 &(msm8930_ion_pdata.heaps[i]);
509
510 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
511 struct ion_cp_heap_pdata *data = heap->extra_data;
512
513 reusable_count += (data->reusable) ? 1 : 0;
514
515 if (data->reusable && reusable_count > 1) {
516 pr_err("%s: Too many heaps specified as "
517 "reusable. Heap %s was not configured "
518 "as reusable.\n", __func__, heap->name);
519 data->reusable = 0;
520 }
521 }
522 }
523
524 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
525 const struct ion_platform_heap *heap =
526 &(msm8930_ion_pdata.heaps[i]);
527
528 if (heap->extra_data) {
529 int fixed_position = NOT_FIXED;
530 int mem_is_fmem = 0;
531
532 switch (heap->type) {
533 case ION_HEAP_TYPE_CP:
534 mem_is_fmem = ((struct ion_cp_heap_pdata *)
535 heap->extra_data)->mem_is_fmem;
536 fixed_position = ((struct ion_cp_heap_pdata *)
537 heap->extra_data)->fixed_position;
538 break;
539 case ION_HEAP_TYPE_CARVEOUT:
540 mem_is_fmem = ((struct ion_co_heap_pdata *)
541 heap->extra_data)->mem_is_fmem;
542 fixed_position = ((struct ion_co_heap_pdata *)
543 heap->extra_data)->fixed_position;
544 break;
545 default:
546 break;
547 }
548
549 if (fixed_position != NOT_FIXED)
550 fixed_size += heap->size;
551 else
552 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
553
554 if (fixed_position == FIXED_LOW)
555 fixed_low_size += heap->size;
556 else if (fixed_position == FIXED_MIDDLE)
557 fixed_middle_size += heap->size;
558 else if (fixed_position == FIXED_HIGH)
559 fixed_high_size += heap->size;
560
561 if (mem_is_fmem)
562 msm8930_fmem_pdata.size += heap->size;
563 }
564 }
565
566 if (!fixed_size)
567 return;
568
569 if (msm8930_fmem_pdata.size) {
Deepak Kotur9830bf02012-06-01 15:04:29 -0700570 msm8930_fmem_pdata.reserved_size_low = fixed_low_size +
571 HOLE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700572 msm8930_fmem_pdata.reserved_size_high = fixed_high_size;
573 }
574
575 /* Since the fixed area may be carved out of lowmem,
576 * make sure the length is a multiple of 1M.
577 */
578 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
579 & SECTION_MASK;
580 msm8930_reserve_fixed_area(fixed_size);
581
582 fixed_low_start = MSM8930_FIXED_AREA_START;
Deepak Kotur9830bf02012-06-01 15:04:29 -0700583 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700584 fixed_high_start = fixed_middle_start + fixed_middle_size;
585
586 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
587 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
588
589 if (heap->extra_data) {
590 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700591 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700592
593 switch (heap->type) {
594 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700595 pdata =
596 (struct ion_cp_heap_pdata *)heap->extra_data;
597 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700598 break;
599 case ION_HEAP_TYPE_CARVEOUT:
600 fixed_position = ((struct ion_co_heap_pdata *)
601 heap->extra_data)->fixed_position;
602 break;
603 default:
604 break;
605 }
606
607 switch (fixed_position) {
608 case FIXED_LOW:
609 heap->base = fixed_low_start;
610 break;
611 case FIXED_MIDDLE:
612 heap->base = fixed_middle_start;
Deepak Kotur9830bf02012-06-01 15:04:29 -0700613 pdata->secure_base = fixed_middle_start
614 - HOLE_SIZE;
615 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700616 break;
617 case FIXED_HIGH:
618 heap->base = fixed_high_start;
619 break;
620 default:
621 break;
622 }
623 }
624 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800625#endif
626}
Huaibin Yanga5419422011-12-08 23:52:10 -0800627
628static void __init reserve_mdp_memory(void)
629{
630 msm8930_mdp_writeback(msm8930_reserve_table);
631}
632
Laura Abbottf3173042012-05-29 15:23:18 -0700633#ifdef CONFIG_MSM_CACHE_DUMP
634static void __init reserve_cache_dump_memory(void)
635{
636 unsigned int total;
637
638 total = msm8930_cache_dump_pdata.l1_size +
639 msm8930_cache_dump_pdata.l2_size;
640 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
641}
642#else
643static void __init reserve_cache_dump_memory(void) { }
644#endif
645
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800646static void __init msm8930_calculate_reserve_sizes(void)
647{
648 size_pmem_devices();
649 reserve_pmem_memory();
650 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800651 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800652 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700653 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800654}
655
656static struct reserve_info msm8930_reserve_info __initdata = {
657 .memtype_reserve_table = msm8930_reserve_table,
658 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700659 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800660 .paddr_to_memtype = msm8930_paddr_to_memtype,
661};
662
663static int msm8930_memory_bank_size(void)
664{
665 return 1<<29;
666}
667
668static void __init locate_unstable_memory(void)
669{
670 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
671 unsigned long bank_size;
672 unsigned long low, high;
673
674 bank_size = msm8930_memory_bank_size();
675 low = meminfo.bank[0].start;
676 high = mb->start + mb->size;
677
678 /* Check if 32 bit overflow occured */
679 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700680 high -= PAGE_SIZE;
681
682 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
683 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800684
685 low &= ~(bank_size - 1);
686
687 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700688 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800689
690 msm8930_reserve_info.bank_size = bank_size;
691#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800692 msm8930_reserve_info.low_unstable_address = mb->start -
693 MIN_MEMORY_BLOCK_SIZE + mb->size;
694 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800695 pr_info("low unstable address %lx max size %lx bank size %lx\n",
696 msm8930_reserve_info.low_unstable_address,
697 msm8930_reserve_info.max_unstable_size,
698 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700699 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800700#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700701no_dmm:
702 msm8930_reserve_info.low_unstable_address = high;
703 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800704}
705
706static void __init place_movable_zone(void)
707{
Larry Basselb8d61022012-02-24 10:49:45 -0800708#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800709 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
710 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
711 pr_info("movable zone start %lx size %lx\n",
712 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800713#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800714}
715
716static void __init msm8930_early_memory(void)
717{
718 reserve_info = &msm8930_reserve_info;
719 locate_unstable_memory();
720 place_movable_zone();
721}
722
723static void __init msm8930_reserve(void)
724{
725 msm_reserve();
Hanumant Singheea62562012-05-14 11:32:45 -0700726 if (msm8930_fmem_pdata.size) {
727#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
728 if (reserve_info->fixed_area_size) {
729 msm8930_fmem_pdata.phys =
730 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
731 pr_info("mm fw at %lx (fixed) size %x\n",
732 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
733 pr_info("fmem start %lx (fixed) size %lx\n",
734 msm8930_fmem_pdata.phys, msm8930_fmem_pdata.size);
735 }
736#endif
737 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800738}
739
740static int msm8930_change_memory_power(u64 start, u64 size,
741 int change_type)
742{
743 return soc_change_memory_power(start, size, change_type);
744}
745
746static void __init msm8930_allocate_memory_regions(void)
747{
748 msm8930_allocate_fb_region();
749}
750
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530751#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800752
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530753#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800754
755/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
756 * 4 micbiases are used to power various analog and digital
757 * microphones operating at 1800 mV. Technically, all micbiases
758 * can source from single cfilter since all microphones operate
759 * at the same voltage level. The arrangement below is to make
760 * sure all cfilters are exercised. LDO_H regulator ouput level
761 * does not need to be as high as 2.85V. It is choosen for
762 * microphone sensitivity purpose.
763 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530764static struct wcd9xxx_pdata sitar_platform_data = {
765 .slimbus_slave_device = {
766 .name = "sitar-slave",
767 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800768 },
769 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530770 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530771 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530772 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800773 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530774 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800775 .cfilt1_mv = 1800,
776 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530777 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
778 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
779 },
780 .regulator = {
781 {
782 .name = "CDC_VDD_CP",
David Collins226f2512012-03-19 13:18:39 -0700783 .min_uV = 1950000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530784 .max_uV = 2200000,
785 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
786 },
787 {
788 .name = "CDC_VDDA_RX",
789 .min_uV = 1800000,
790 .max_uV = 1800000,
791 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
792 },
793 {
794 .name = "CDC_VDDA_TX",
795 .min_uV = 1800000,
796 .max_uV = 1800000,
797 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
798 },
799 {
800 .name = "VDDIO_CDC",
801 .min_uV = 1800000,
802 .max_uV = 1800000,
803 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
804 },
805 {
806 .name = "VDDD_CDC_D",
807 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700808 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530809 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
810 },
811 {
812 .name = "CDC_VDDA_A_1P2V",
813 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700814 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530815 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
816 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800817 },
818};
819
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530820static struct slim_device msm_slim_sitar = {
821 .name = "sitar-slim",
822 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800823 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530824 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800825 },
826};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700827
828static struct wcd9xxx_pdata sitar1p1_platform_data = {
829 .slimbus_slave_device = {
830 .name = "sitar-slave",
831 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
832 },
833 .irq = MSM_GPIO_TO_INT(62),
834 .irq_base = SITAR_INTERRUPT_BASE,
835 .num_irqs = NR_WCD9XXX_IRQS,
836 .reset_gpio = 42,
837 .micbias = {
838 .ldoh_v = SITAR_LDOH_2P85_V,
839 .cfilt1_mv = 1800,
840 .cfilt2_mv = 1800,
841 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
842 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
843 },
844 .regulator = {
845 {
846 .name = "CDC_VDD_CP",
847 .min_uV = 1950000,
848 .max_uV = 2200000,
849 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
850 },
851 {
852 .name = "CDC_VDDA_RX",
853 .min_uV = 1800000,
854 .max_uV = 1800000,
855 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
856 },
857 {
858 .name = "CDC_VDDA_TX",
859 .min_uV = 1800000,
860 .max_uV = 1800000,
861 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
862 },
863 {
864 .name = "VDDIO_CDC",
865 .min_uV = 1800000,
866 .max_uV = 1800000,
867 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
868 },
869 {
870 .name = "VDDD_CDC_D",
871 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700872 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700873 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
874 },
875 {
876 .name = "CDC_VDDA_A_1P2V",
877 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700878 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700879 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
880 },
881 },
882};
883
884static struct slim_device msm_slim_sitar1p1 = {
885 .name = "sitar1p1-slim",
886 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
887 .dev = {
888 .platform_data = &sitar1p1_platform_data,
889 },
890};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800891#endif
892
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530893
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800894static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530895#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800896 {
897 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530898 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800899 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700900 {
901 .bus_num = 1,
902 .slim_slave = &msm_slim_sitar1p1,
903 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800904#endif
905 /* add more slimbus slaves as needed */
906};
907
908#define MSM_WCNSS_PHYS 0x03000000
909#define MSM_WCNSS_SIZE 0x280000
910
911static struct resource resources_wcnss_wlan[] = {
912 {
913 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
914 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
915 .name = "wcnss_wlanrx_irq",
916 .flags = IORESOURCE_IRQ,
917 },
918 {
919 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
920 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
921 .name = "wcnss_wlantx_irq",
922 .flags = IORESOURCE_IRQ,
923 },
924 {
925 .start = MSM_WCNSS_PHYS,
926 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
927 .name = "wcnss_mmio",
928 .flags = IORESOURCE_MEM,
929 },
930 {
931 .start = 84,
932 .end = 88,
933 .name = "wcnss_gpios_5wire",
934 .flags = IORESOURCE_IO,
935 },
936};
937
938static struct qcom_wcnss_opts qcom_wcnss_pdata = {
939 .has_48mhz_xo = 1,
940};
941
942static struct platform_device msm_device_wcnss_wlan = {
943 .name = "wcnss_wlan",
944 .id = 0,
945 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
946 .resource = resources_wcnss_wlan,
947 .dev = {.platform_data = &qcom_wcnss_pdata},
948};
949
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700950#ifdef CONFIG_QSEECOM
951/* qseecom bus scaling */
952static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
953 {
954 .src = MSM_BUS_MASTER_SPS,
955 .dst = MSM_BUS_SLAVE_EBI_CH0,
956 .ib = 0,
957 .ab = 0,
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_dfab_vectors[] = {
968 {
969 .src = MSM_BUS_MASTER_SPS,
970 .dst = MSM_BUS_SLAVE_EBI_CH0,
971 .ib = (492 * 8) * 1000000UL,
972 .ab = (492 * 8) * 100000UL,
973 },
974 {
975 .src = MSM_BUS_MASTER_SPDM,
976 .dst = MSM_BUS_SLAVE_SPDM,
977 .ib = 0,
978 .ab = 0,
979 },
980};
981
982static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
983 {
984 .src = MSM_BUS_MASTER_SPS,
985 .dst = MSM_BUS_SLAVE_EBI_CH0,
986 .ib = 0,
987 .ab = 0,
988 },
989 {
990 .src = MSM_BUS_MASTER_SPDM,
991 .dst = MSM_BUS_SLAVE_SPDM,
992 .ib = (64 * 8) * 1000000UL,
993 .ab = (64 * 8) * 100000UL,
994 },
995};
996
997static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
998 {
999 ARRAY_SIZE(qseecom_clks_init_vectors),
1000 qseecom_clks_init_vectors,
1001 },
1002 {
1003 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1004 qseecom_enable_sfpb_vectors,
1005 },
1006 {
1007 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1008 qseecom_enable_sfpb_vectors,
1009 },
1010};
1011
1012static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1013 qseecom_hw_bus_scale_usecases,
1014 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1015 .name = "qsee",
1016};
1017
1018static struct platform_device qseecom_device = {
1019 .name = "qseecom",
1020 .id = 0,
1021 .dev = {
1022 .platform_data = &qseecom_bus_pdata,
1023 },
1024};
1025#endif
1026
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001027#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1028 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1029 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1030 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1031
1032#define QCE_SIZE 0x10000
1033#define QCE_0_BASE 0x18500000
1034
1035#define QCE_HW_KEY_SUPPORT 0
1036#define QCE_SHA_HMAC_SUPPORT 1
1037#define QCE_SHARE_CE_RESOURCE 1
1038#define QCE_CE_SHARED 0
1039
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001040/* Begin Bus scaling definitions */
1041static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1042 {
1043 .src = MSM_BUS_MASTER_ADM_PORT0,
1044 .dst = MSM_BUS_SLAVE_EBI_CH0,
1045 .ab = 0,
1046 .ib = 0,
1047 },
1048 {
1049 .src = MSM_BUS_MASTER_ADM_PORT1,
1050 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1051 .ab = 0,
1052 .ib = 0,
1053 },
1054};
1055
1056static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1057 {
1058 .src = MSM_BUS_MASTER_ADM_PORT0,
1059 .dst = MSM_BUS_SLAVE_EBI_CH0,
1060 .ab = 70000000UL,
1061 .ib = 70000000UL,
1062 },
1063 {
1064 .src = MSM_BUS_MASTER_ADM_PORT1,
1065 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1066 .ab = 2480000000UL,
1067 .ib = 2480000000UL,
1068 },
1069};
1070
1071static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1072 {
1073 ARRAY_SIZE(crypto_hw_init_vectors),
1074 crypto_hw_init_vectors,
1075 },
1076 {
1077 ARRAY_SIZE(crypto_hw_active_vectors),
1078 crypto_hw_active_vectors,
1079 },
1080};
1081
1082static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1083 crypto_hw_bus_scale_usecases,
1084 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1085 .name = "cryptohw",
1086};
1087/* End Bus Scaling Definitions*/
1088
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001089static struct resource qcrypto_resources[] = {
1090 [0] = {
1091 .start = QCE_0_BASE,
1092 .end = QCE_0_BASE + QCE_SIZE - 1,
1093 .flags = IORESOURCE_MEM,
1094 },
1095 [1] = {
1096 .name = "crypto_channels",
1097 .start = DMOV_CE_IN_CHAN,
1098 .end = DMOV_CE_OUT_CHAN,
1099 .flags = IORESOURCE_DMA,
1100 },
1101 [2] = {
1102 .name = "crypto_crci_in",
1103 .start = DMOV_CE_IN_CRCI,
1104 .end = DMOV_CE_IN_CRCI,
1105 .flags = IORESOURCE_DMA,
1106 },
1107 [3] = {
1108 .name = "crypto_crci_out",
1109 .start = DMOV_CE_OUT_CRCI,
1110 .end = DMOV_CE_OUT_CRCI,
1111 .flags = IORESOURCE_DMA,
1112 },
1113};
1114
1115static struct resource qcedev_resources[] = {
1116 [0] = {
1117 .start = QCE_0_BASE,
1118 .end = QCE_0_BASE + QCE_SIZE - 1,
1119 .flags = IORESOURCE_MEM,
1120 },
1121 [1] = {
1122 .name = "crypto_channels",
1123 .start = DMOV_CE_IN_CHAN,
1124 .end = DMOV_CE_OUT_CHAN,
1125 .flags = IORESOURCE_DMA,
1126 },
1127 [2] = {
1128 .name = "crypto_crci_in",
1129 .start = DMOV_CE_IN_CRCI,
1130 .end = DMOV_CE_IN_CRCI,
1131 .flags = IORESOURCE_DMA,
1132 },
1133 [3] = {
1134 .name = "crypto_crci_out",
1135 .start = DMOV_CE_OUT_CRCI,
1136 .end = DMOV_CE_OUT_CRCI,
1137 .flags = IORESOURCE_DMA,
1138 },
1139};
1140
1141#endif
1142
1143#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1144 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1145
1146static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1147 .ce_shared = QCE_CE_SHARED,
1148 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1149 .hw_key_support = QCE_HW_KEY_SUPPORT,
1150 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001151 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001152};
1153
1154static struct platform_device qcrypto_device = {
1155 .name = "qcrypto",
1156 .id = 0,
1157 .num_resources = ARRAY_SIZE(qcrypto_resources),
1158 .resource = qcrypto_resources,
1159 .dev = {
1160 .coherent_dma_mask = DMA_BIT_MASK(32),
1161 .platform_data = &qcrypto_ce_hw_suppport,
1162 },
1163};
1164#endif
1165
1166#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1167 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1168
1169static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1170 .ce_shared = QCE_CE_SHARED,
1171 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1172 .hw_key_support = QCE_HW_KEY_SUPPORT,
1173 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001174 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001175};
1176
1177static struct platform_device qcedev_device = {
1178 .name = "qce",
1179 .id = 0,
1180 .num_resources = ARRAY_SIZE(qcedev_resources),
1181 .resource = qcedev_resources,
1182 .dev = {
1183 .coherent_dma_mask = DMA_BIT_MASK(32),
1184 .platform_data = &qcedev_ce_hw_suppport,
1185 },
1186};
1187#endif
1188
1189#define MDM2AP_ERRFATAL 70
1190#define AP2MDM_ERRFATAL 95
1191#define MDM2AP_STATUS 69
1192#define AP2MDM_STATUS 94
1193#define AP2MDM_PMIC_RESET_N 80
1194#define AP2MDM_KPDPWR_N 81
1195
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001196static struct resource mdm_resources[] = {
1197 {
1198 .start = MDM2AP_ERRFATAL,
1199 .end = MDM2AP_ERRFATAL,
1200 .name = "MDM2AP_ERRFATAL",
1201 .flags = IORESOURCE_IO,
1202 },
1203 {
1204 .start = AP2MDM_ERRFATAL,
1205 .end = AP2MDM_ERRFATAL,
1206 .name = "AP2MDM_ERRFATAL",
1207 .flags = IORESOURCE_IO,
1208 },
1209 {
1210 .start = MDM2AP_STATUS,
1211 .end = MDM2AP_STATUS,
1212 .name = "MDM2AP_STATUS",
1213 .flags = IORESOURCE_IO,
1214 },
1215 {
1216 .start = AP2MDM_STATUS,
1217 .end = AP2MDM_STATUS,
1218 .name = "AP2MDM_STATUS",
1219 .flags = IORESOURCE_IO,
1220 },
1221 {
1222 .start = AP2MDM_PMIC_RESET_N,
1223 .end = AP2MDM_PMIC_RESET_N,
1224 .name = "AP2MDM_PMIC_RESET_N",
1225 .flags = IORESOURCE_IO,
1226 },
1227 {
1228 .start = AP2MDM_KPDPWR_N,
1229 .end = AP2MDM_KPDPWR_N,
1230 .name = "AP2MDM_KPDPWR_N",
1231 .flags = IORESOURCE_IO,
1232 },
1233};
1234
1235static struct mdm_platform_data mdm_platform_data = {
1236 .mdm_version = "2.5",
1237};
1238
1239static struct platform_device mdm_device = {
1240 .name = "mdm2_modem",
1241 .id = -1,
1242 .num_resources = ARRAY_SIZE(mdm_resources),
1243 .resource = mdm_resources,
1244 .dev = {
1245 .platform_data = &mdm_platform_data,
1246 },
1247};
1248
1249static struct platform_device *mdm_devices[] __initdata = {
1250 &mdm_device,
1251};
1252
Praveen Chidambaram78499012011-11-01 17:15:17 -06001253#ifdef CONFIG_MSM_MPM
1254static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1255 [1] = MSM_GPIO_TO_INT(46),
1256 [2] = MSM_GPIO_TO_INT(150),
1257 [4] = MSM_GPIO_TO_INT(103),
1258 [5] = MSM_GPIO_TO_INT(104),
1259 [6] = MSM_GPIO_TO_INT(105),
1260 [7] = MSM_GPIO_TO_INT(106),
1261 [8] = MSM_GPIO_TO_INT(107),
1262 [9] = MSM_GPIO_TO_INT(7),
1263 [10] = MSM_GPIO_TO_INT(11),
1264 [11] = MSM_GPIO_TO_INT(15),
1265 [12] = MSM_GPIO_TO_INT(19),
1266 [13] = MSM_GPIO_TO_INT(23),
1267 [14] = MSM_GPIO_TO_INT(27),
1268 [15] = MSM_GPIO_TO_INT(31),
1269 [16] = MSM_GPIO_TO_INT(35),
1270 [19] = MSM_GPIO_TO_INT(90),
1271 [20] = MSM_GPIO_TO_INT(92),
1272 [23] = MSM_GPIO_TO_INT(85),
1273 [24] = MSM_GPIO_TO_INT(83),
1274 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001275 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001276 [27] = HDMI_IRQ,
1277 [29] = MSM_GPIO_TO_INT(10),
1278 [30] = MSM_GPIO_TO_INT(102),
1279 [31] = MSM_GPIO_TO_INT(81),
1280 [32] = MSM_GPIO_TO_INT(78),
1281 [33] = MSM_GPIO_TO_INT(94),
1282 [34] = MSM_GPIO_TO_INT(72),
1283 [35] = MSM_GPIO_TO_INT(39),
1284 [36] = MSM_GPIO_TO_INT(43),
1285 [37] = MSM_GPIO_TO_INT(61),
1286 [38] = MSM_GPIO_TO_INT(50),
1287 [39] = MSM_GPIO_TO_INT(42),
1288 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001289 [42] = MSM_GPIO_TO_INT(8),
1290 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001291 [44] = MSM_GPIO_TO_INT(70),
1292 [45] = MSM_GPIO_TO_INT(69),
1293 [46] = MSM_GPIO_TO_INT(67),
1294 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001295 [48] = MSM_GPIO_TO_INT(55),
1296 [49] = MSM_GPIO_TO_INT(74),
1297 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001298 [51] = MSM_GPIO_TO_INT(49),
1299 [52] = MSM_GPIO_TO_INT(40),
1300 [53] = MSM_GPIO_TO_INT(37),
1301 [54] = MSM_GPIO_TO_INT(24),
1302 [55] = MSM_GPIO_TO_INT(14),
1303};
1304
1305static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1306 TLMM_MSM_SUMMARY_IRQ,
1307 RPM_APCC_CPU0_GP_HIGH_IRQ,
1308 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1309 RPM_APCC_CPU0_GP_LOW_IRQ,
1310 RPM_APCC_CPU0_WAKE_UP_IRQ,
1311 RPM_APCC_CPU1_GP_HIGH_IRQ,
1312 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1313 RPM_APCC_CPU1_GP_LOW_IRQ,
1314 RPM_APCC_CPU1_WAKE_UP_IRQ,
1315 MSS_TO_APPS_IRQ_0,
1316 MSS_TO_APPS_IRQ_1,
1317 MSS_TO_APPS_IRQ_2,
1318 MSS_TO_APPS_IRQ_3,
1319 MSS_TO_APPS_IRQ_4,
1320 MSS_TO_APPS_IRQ_5,
1321 MSS_TO_APPS_IRQ_6,
1322 MSS_TO_APPS_IRQ_7,
1323 MSS_TO_APPS_IRQ_8,
1324 MSS_TO_APPS_IRQ_9,
1325 LPASS_SCSS_GP_LOW_IRQ,
1326 LPASS_SCSS_GP_MEDIUM_IRQ,
1327 LPASS_SCSS_GP_HIGH_IRQ,
1328 SPS_MTI_30,
1329 SPS_MTI_31,
1330 RIVA_APSS_SPARE_IRQ,
1331 RIVA_APPS_WLAN_SMSM_IRQ,
1332 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1333 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1334};
1335
1336struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1337 .irqs_m2a = msm_mpm_irqs_m2a,
1338 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1339 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1340 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1341 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1342 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1343 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1344 .mpm_apps_ipc_val = BIT(1),
1345 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1346
1347};
1348#endif
1349
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001350#define MSM_SHARED_RAM_PHYS 0x80000000
1351
1352static void __init msm8930_map_io(void)
1353{
1354 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1355 msm_map_msm8930_io();
1356
1357 if (socinfo_init() < 0)
1358 pr_err("socinfo_init() failed!\n");
1359}
1360
1361static void __init msm8930_init_irq(void)
1362{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001363 struct msm_mpm_device_data *data = NULL;
1364#ifdef CONFIG_MSM_MPM
1365 data = &msm8930_mpm_dev_data;
1366#endif
1367
1368 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001369 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1370 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001371}
1372
1373static void __init msm8930_init_buses(void)
1374{
1375#ifdef CONFIG_MSM_BUS_SCALING
1376 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001377 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1378 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1379 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1380 msm_bus_8930_apps_fabric.dev.platform_data =
1381 &msm_bus_8930_apps_fabric_pdata;
1382 msm_bus_8930_sys_fabric.dev.platform_data =
1383 &msm_bus_8930_sys_fabric_pdata;
1384 msm_bus_8930_mm_fabric.dev.platform_data =
1385 &msm_bus_8930_mm_fabric_pdata;
1386 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1387 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001388#endif
1389}
1390
1391static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1392 .max_clock_speed = 15060000,
1393};
1394
1395#ifdef CONFIG_USB_MSM_OTG_72K
1396static struct msm_otg_platform_data msm_otg_pdata;
1397#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301398#ifdef CONFIG_MSM_BUS_SCALING
1399/* Bandwidth requests (zero) if no vote placed */
1400static struct msm_bus_vectors usb_init_vectors[] = {
1401 {
1402 .src = MSM_BUS_MASTER_SPS,
1403 .dst = MSM_BUS_SLAVE_EBI_CH0,
1404 .ab = 0,
1405 .ib = 0,
1406 },
1407};
1408
1409/* Bus bandwidth requests in Bytes/sec */
1410static struct msm_bus_vectors usb_max_vectors[] = {
1411 {
1412 .src = MSM_BUS_MASTER_SPS,
1413 .dst = MSM_BUS_SLAVE_EBI_CH0,
1414 .ab = 60000000, /* At least 480Mbps on bus. */
1415 .ib = 960000000, /* MAX bursts rate */
1416 },
1417};
1418
1419static struct msm_bus_paths usb_bus_scale_usecases[] = {
1420 {
1421 ARRAY_SIZE(usb_init_vectors),
1422 usb_init_vectors,
1423 },
1424 {
1425 ARRAY_SIZE(usb_max_vectors),
1426 usb_max_vectors,
1427 },
1428};
1429
1430static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1431 usb_bus_scale_usecases,
1432 ARRAY_SIZE(usb_bus_scale_usecases),
1433 .name = "usb",
1434};
1435#endif
1436
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301437static int hsusb_phy_init_seq[] = {
1438 0x44, 0x80, /* set VBUS valid threshold
1439 and disconnect valid threshold */
1440 0x38, 0x81, /* update DC voltage level */
1441 0x24, 0x82, /* set preemphasis and rise/fall time */
1442 0x13, 0x83, /* set source impedance adjusment */
1443 -1};
1444
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001445static struct msm_otg_platform_data msm_otg_pdata = {
1446 .mode = USB_OTG,
1447 .otg_control = OTG_PMIC_CONTROL,
1448 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001449 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001450 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301451#ifdef CONFIG_MSM_BUS_SCALING
1452 .bus_scale_table = &usb_bus_scale_pdata,
1453#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001454};
1455#endif
1456
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001457#define PID_MAGIC_ID 0x71432909
1458#define SERIAL_NUM_MAGIC_ID 0x61945374
1459#define SERIAL_NUMBER_LENGTH 127
1460#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1461
1462struct magic_num_struct {
1463 uint32_t pid;
1464 uint32_t serial_num;
1465};
1466
1467struct dload_struct {
1468 uint32_t reserved1;
1469 uint32_t reserved2;
1470 uint32_t reserved3;
1471 uint16_t reserved4;
1472 uint16_t pid;
1473 char serial_number[SERIAL_NUMBER_LENGTH];
1474 uint16_t reserved5;
1475 struct magic_num_struct magic_struct;
1476};
1477
1478static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1479{
1480 struct dload_struct __iomem *dload = 0;
1481
1482 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1483 if (!dload) {
1484 pr_err("%s: cannot remap I/O memory region: %08x\n",
1485 __func__, DLOAD_USB_BASE_ADD);
1486 return -ENXIO;
1487 }
1488
1489 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1490 __func__, dload, pid, snum);
1491 /* update pid */
1492 dload->magic_struct.pid = PID_MAGIC_ID;
1493 dload->pid = pid;
1494
1495 /* update serial number */
1496 dload->magic_struct.serial_num = 0;
1497 if (!snum) {
1498 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1499 goto out;
1500 }
1501
1502 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1503 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1504out:
1505 iounmap(dload);
1506 return 0;
1507}
1508
1509static struct android_usb_platform_data android_usb_pdata = {
1510 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1511};
1512
1513static struct platform_device android_usb_device = {
1514 .name = "android_usb",
1515 .id = -1,
1516 .dev = {
1517 .platform_data = &android_usb_pdata,
1518 },
1519};
1520
1521static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001522 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001523};
1524
1525static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001526 0x00, 0x24, 0x54, 0x10,
1527 0x09, 0x03, 0x01,
1528 0x10, 0x54, 0x30, 0x0C,
1529 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001530};
1531
1532static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001533 0x00, 0x24, 0x54, 0x10,
1534 0x09, 0x07, 0x01, 0x0B,
1535 0x10, 0x54, 0x30, 0x0C,
1536 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001537};
1538
1539static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1540 [0] = {
1541 .mode = MSM_SPM_MODE_CLOCK_GATING,
1542 .notify_rpm = false,
1543 .cmd = spm_wfi_cmd_sequence,
1544 },
1545 [1] = {
1546 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1547 .notify_rpm = false,
1548 .cmd = spm_power_collapse_without_rpm,
1549 },
1550 [2] = {
1551 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1552 .notify_rpm = true,
1553 .cmd = spm_power_collapse_with_rpm,
1554 },
1555};
1556
1557static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1558 [0] = {
1559 .reg_base_addr = MSM_SAW0_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 [1] = {
1574 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001575 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001576#if defined(CONFIG_MSM_AVS_HW)
1577 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1578 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1579#endif
1580 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001581 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001582 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1583 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1584 .vctl_timeout_us = 50,
1585 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1586 .modes = msm_spm_seq_list,
1587 },
1588};
1589
1590static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001591 0x00, 0x20, 0x03, 0x20,
1592 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001593};
1594
1595static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001596 0x00, 0x20, 0x34, 0x64,
1597 0x48, 0x07, 0x48, 0x20,
1598 0x50, 0x64, 0x04, 0x34,
1599 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001600};
1601static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001602 0x00, 0x10, 0x34, 0x64,
1603 0x48, 0x07, 0x48, 0x10,
1604 0x50, 0x64, 0x04, 0x34,
1605 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001606};
1607
1608static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1609 [0] = {
1610 .mode = MSM_SPM_L2_MODE_RETENTION,
1611 .notify_rpm = false,
1612 .cmd = l2_spm_wfi_cmd_sequence,
1613 },
1614 [1] = {
1615 .mode = MSM_SPM_L2_MODE_GDHS,
1616 .notify_rpm = true,
1617 .cmd = l2_spm_gdhs_cmd_sequence,
1618 },
1619 [2] = {
1620 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1621 .notify_rpm = true,
1622 .cmd = l2_spm_power_off_cmd_sequence,
1623 },
1624};
1625
1626static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1627 [0] = {
1628 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001629 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001630 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001631 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1632 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1633 .modes = msm_spm_l2_seq_list,
1634 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1635 },
1636};
1637
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301638#define ISA1200_HAP_EN_GPIO 77
1639#define ISA1200_HAP_LEN_GPIO 78
1640#define ISA1200_HAP_CLK PM8038_GPIO_PM_TO_SYS(7)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001641
1642static int isa1200_power(int on)
1643{
Amy Malocheb20c1052012-04-11 10:36:13 -07001644 int rc = 0;
1645
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301646 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1647
Amy Malocheb20c1052012-04-11 10:36:13 -07001648 if (on)
1649 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_1, true);
1650 else
1651 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_NONE, true);
1652
1653 if (rc) {
1654 pr_err("%s: unable to write aux clock register(%d)\n",
1655 __func__, rc);
1656 }
1657
1658 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001659}
1660
1661static int isa1200_dev_setup(bool enable)
1662{
1663 int rc = 0;
1664
Amy Malocheb20c1052012-04-11 10:36:13 -07001665 if (!enable)
1666 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301667
1668 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1669 if (rc) {
1670 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
1671 __func__, ISA1200_HAP_CLK, rc);
1672 goto fail_gpio_req;
1673 }
1674
1675 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1676 if (rc) {
1677 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
1678 __func__, ISA1200_HAP_CLK, rc);
1679 goto fail_gpio_dir;
1680 }
1681
1682 return 0;
1683
1684fail_gpio_dir:
1685 gpio_free(ISA1200_HAP_CLK);
1686fail_gpio_req:
1687 return rc;
1688
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001689}
1690
1691static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301692 {
1693 .name = "vddp",
1694 .min_uV = ISA_I2C_VTG_MIN_UV,
1695 .max_uV = ISA_I2C_VTG_MAX_UV,
1696 .load_uA = ISA_I2C_CURR_UA,
1697 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001698 {
1699 .name = "vcc_i2c",
1700 .min_uV = ISA_I2C_VTG_MIN_UV,
1701 .max_uV = ISA_I2C_VTG_MAX_UV,
1702 .load_uA = ISA_I2C_CURR_UA,
1703 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001704};
1705
1706static struct isa1200_platform_data isa1200_1_pdata = {
1707 .name = "vibrator",
1708 .dev_setup = isa1200_dev_setup,
1709 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301710 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1711 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001712 .max_timeout = 15000,
1713 .mode_ctrl = PWM_GEN_MODE,
1714 .pwm_fd = {
1715 .pwm_div = 256,
1716 },
1717 .is_erm = false,
1718 .smart_en = true,
1719 .ext_clk_en = true,
1720 .chip_en = 1,
1721 .regulator_info = isa1200_reg_data,
1722 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1723};
1724
1725static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1726 {
1727 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1728 .platform_data = &isa1200_1_pdata,
1729 },
1730};
1731
Amy Malochef3c9db42011-12-08 15:17:35 -08001732#define MXT_TS_GPIO_IRQ 11
1733#define MXT_TS_RESET_GPIO 52
1734
1735static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001736 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001737 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001738 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301739 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001740 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301741 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001742 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301743 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001744 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301745 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1746 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1747 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1748 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001749 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001750 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1751 0,
1752 /* T18 Object */
1753 0, 0,
1754 /* T19 Object */
1755 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1756 0, 0, 0, 0, 0, 0,
1757 /* T23 Object */
1758 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1759 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001760 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001761 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1762 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001763 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001764 0, 0, 0, 0, 0,
1765 /* T42 Object */
1766 0, 0, 0, 0, 0, 0, 0, 0,
1767 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301768 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001769 /* T47 Object */
1770 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1771 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301772 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1773 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1774 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001775 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1776 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1777 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001778};
1779
Amy Malochef3c9db42011-12-08 15:17:35 -08001780static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1781 struct kobj_attribute *attr, char *buf)
1782{
1783 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301784 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1785 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1786 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1787 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001788 "\n");
1789}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001790
Amy Malochef3c9db42011-12-08 15:17:35 -08001791static struct kobj_attribute mxt224e_vkeys_attr = {
1792 .attr = {
1793 .mode = S_IRUGO,
1794 },
1795 .show = &mxt224e_vkeys_show,
1796};
1797
1798static struct attribute *mxt224e_properties_attrs[] = {
1799 &mxt224e_vkeys_attr.attr,
1800 NULL
1801};
1802
1803static struct attribute_group mxt224e_properties_attr_group = {
1804 .attrs = mxt224e_properties_attrs,
1805};
1806
1807static void mxt_init_vkeys_8930(void)
1808{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001809 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001810 static struct kobject *mxt224e_properties_kobj;
1811
1812 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1813 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1814 NULL);
1815 if (mxt224e_properties_kobj)
1816 rc = sysfs_create_group(mxt224e_properties_kobj,
1817 &mxt224e_properties_attr_group);
1818 if (!mxt224e_properties_kobj || rc)
1819 pr_err("%s: failed to create board_properties\n",
1820 __func__);
1821
1822 return;
1823}
1824
Jing Lindc4413c2012-01-16 15:22:52 -08001825static struct mxt_config_info mxt_config_array[] = {
1826 {
1827 .config = mxt_config_data_8930,
1828 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1829 .family_id = 0x81,
1830 .variant_id = 0x01,
1831 .version = 0x10,
1832 .build = 0xAA,
1833 },
1834};
1835
Amy Malochef3c9db42011-12-08 15:17:35 -08001836static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001837 .config_array = mxt_config_array,
1838 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001839 .panel_minx = 0,
1840 .panel_maxx = 566,
1841 .panel_miny = 0,
1842 .panel_maxy = 1067,
1843 .disp_minx = 0,
1844 .disp_maxx = 540,
1845 .disp_miny = 0,
1846 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001847 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301848#ifdef MSM8930_PHASE_2
1849 .digital_pwr_regulator = true,
1850#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001851 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001852 .reset_gpio = MXT_TS_RESET_GPIO,
1853 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001854};
1855
Amy Malochef3c9db42011-12-08 15:17:35 -08001856static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001857 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001858 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1859 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001860 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1861 },
1862};
1863
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301864#ifdef MSM8930_PHASE_2
1865
1866#define GPIO_VOLUME_UP PM8038_GPIO_PM_TO_SYS(3)
1867#define GPIO_VOLUME_DOWN PM8038_GPIO_PM_TO_SYS(8)
1868#define GPIO_CAMERA_SNAPSHOT PM8038_GPIO_PM_TO_SYS(10)
1869#define GPIO_CAMERA_FOCUS PM8038_GPIO_PM_TO_SYS(11)
1870
1871static struct gpio_keys_button keys_8930[] = {
1872 {
1873 .code = KEY_VOLUMEUP,
1874 .type = EV_KEY,
1875 .desc = "volume_up",
1876 .gpio = GPIO_VOLUME_UP,
1877 .wakeup = 1,
1878 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001879 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301880 },
1881 {
1882 .code = KEY_VOLUMEDOWN,
1883 .type = EV_KEY,
1884 .desc = "volume_down",
1885 .gpio = GPIO_VOLUME_DOWN,
1886 .wakeup = 1,
1887 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001888 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301889 },
1890 {
1891 .code = KEY_CAMERA_FOCUS,
1892 .type = EV_KEY,
1893 .desc = "camera_focus",
1894 .gpio = GPIO_CAMERA_FOCUS,
1895 .wakeup = 1,
1896 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001897 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301898 },
1899 {
1900 .code = KEY_CAMERA_SNAPSHOT,
1901 .type = EV_KEY,
1902 .desc = "camera_snapshot",
1903 .gpio = GPIO_CAMERA_SNAPSHOT,
1904 .wakeup = 1,
1905 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001906 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301907 },
1908};
1909
1910/* Add GPIO keys for 8930 */
1911static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
1912 .buttons = keys_8930,
1913 .nbuttons = 4,
1914};
1915
1916static struct platform_device gpio_keys_8930 = {
1917 .name = "gpio-keys",
1918 .id = -1,
1919 .dev = {
1920 .platform_data = &gpio_keys_8930_pdata,
1921 },
1922};
1923#endif /* MSM8930_PHASE_2 */
1924
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001925static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_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_gsbi3_pdata = {
1931 .clk_freq = 100000,
1932 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001933};
1934
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06001935static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
1936 .clk_freq = 100000,
1937 .src_clk_rate = 24000000,
1938};
1939
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001940static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1941 .clk_freq = 100000,
1942 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001943};
1944
1945static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1946 .clk_freq = 100000,
1947 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001948};
1949
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001950
1951static struct ks8851_pdata spi_eth_pdata = {
1952 .irq_gpio = KS8851_IRQ_GPIO,
1953 .rst_gpio = KS8851_RST_GPIO,
1954};
1955
1956static struct spi_board_info spi_board_info[] __initdata = {
1957 {
1958 .modalias = "ks8851",
1959 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1960 .max_speed_hz = 19200000,
1961 .bus_num = 0,
1962 .chip_select = 0,
1963 .mode = SPI_MODE_0,
1964 .platform_data = &spi_eth_pdata
1965 },
1966 {
1967 .modalias = "dsi_novatek_3d_panel_spi",
1968 .max_speed_hz = 10800000,
1969 .bus_num = 0,
1970 .chip_select = 1,
1971 .mode = SPI_MODE_0,
1972 },
1973};
1974
1975static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001976 .name = "saw-regulator",
1977 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001978 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001979 .platform_data = &msm8930_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001980 },
1981};
1982
1983static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001984 .name = "saw-regulator",
1985 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001986 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001987 .platform_data = &msm8930_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001988 },
1989};
1990
1991static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001992 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08001993 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07001994 .tsens_num_sensor = 10,
1995 .slope = {1132, 1135, 1137, 1135, 1157,
1996 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001997};
1998
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001999static struct platform_device msm_tsens_device = {
2000 .name = "tsens8960-tm",
2001 .id = -1,
2002};
2003
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002004static struct msm_thermal_data msm_thermal_pdata = {
2005 .sensor_id = 9,
2006 .poll_ms = 1000,
2007 .limit_temp = 60,
2008 .temp_hysteresis = 10,
2009 .limit_freq = 918000,
2010};
2011
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002012#ifdef CONFIG_MSM_FAKE_BATTERY
2013static struct platform_device fish_battery_device = {
2014 .name = "fish_battery",
2015};
2016#endif
2017
David Collins1d4061b2011-12-06 15:36:40 -08002018#ifndef MSM8930_PHASE_2
2019
2020/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002021static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002022 .name = GPIO_REGULATOR_DEV_NAME,
2023 .id = PM8921_MPP_PM_TO_SYS(7),
2024 .dev = {
2025 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2026 },
2027};
2028
Jay Chokshi06fa7542011-12-07 13:09:17 -08002029static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002030 .name = GPIO_REGULATOR_DEV_NAME,
2031 .id = 91,
2032 .dev = {
2033 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2034 },
2035};
2036
David Collins1d4061b2011-12-06 15:36:40 -08002037#else
2038
2039/* 8930 Phase 2 */
2040static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2041 .name = GPIO_REGULATOR_DEV_NAME,
2042 .id = 63,
2043 .dev = {
2044 .platform_data =
2045 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_5V],
2046 },
2047};
2048
2049static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2050 .name = GPIO_REGULATOR_DEV_NAME,
2051 .id = 97,
2052 .dev = {
2053 .platform_data =
2054 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
2055 },
2056};
2057
2058#endif
2059
Jay Chokshi06fa7542011-12-07 13:09:17 -08002060static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002061 .name = "rpm-regulator",
2062 .id = -1,
2063 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002064#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002065 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002066#else
2067 .platform_data = &msm8930_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002068#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002069 },
2070};
2071
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002072static struct platform_device *common_devices[] __initdata = {
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002073 &msm8960_device_acpuclk,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002074 &msm8960_device_dmov,
2075 &msm_device_smd,
2076 &msm8960_device_uart_gsbi5,
2077 &msm_device_uart_dm6,
2078 &msm_device_saw_core0,
2079 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002080 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002081#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002082 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002083#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002084 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002085#ifdef MSM8930_PHASE_2
2086 &msm8930_device_ext_otg_sw_vreg,
2087#endif
Stephen Boyd28d54952011-12-16 13:19:51 -08002088 &msm_8960_q6_lpass,
2089 &msm_8960_q6_mss_fw,
2090 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002091 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002092 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002093 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002094 &msm8960_device_qup_spi_gsbi1,
2095 &msm8960_device_qup_i2c_gsbi3,
2096 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002097 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002098 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002099 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002100 &msm_slim_ctrl,
2101 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002102#if defined(CONFIG_QSEECOM)
2103 &qseecom_device,
2104#endif
2105
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002106#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2107 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2108 &qcrypto_device,
2109#endif
2110
2111#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2112 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2113 &qcedev_device,
2114#endif
2115#ifdef CONFIG_MSM_ROTATOR
2116 &msm_rotator_device,
2117#endif
2118 &msm_device_sps,
2119#ifdef CONFIG_MSM_FAKE_BATTERY
2120 &fish_battery_device,
2121#endif
2122#ifdef CONFIG_ANDROID_PMEM
2123#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002124 &msm8930_android_pmem_device,
2125 &msm8930_android_pmem_adsp_device,
2126 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302127#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2128#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002129 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002130 &msm_device_bam_dmux,
2131 &msm_fm_platform_init,
2132
2133#ifdef CONFIG_HW_RANDOM_MSM
2134 &msm_device_rng,
2135#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002136 &msm8930_rpm_device,
2137 &msm8930_rpm_log_device,
2138 &msm8930_rpm_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002139#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002140 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002141#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002142 &msm_device_tz_log,
2143
2144#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07002145 &msm_qdss_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002146 &msm_etb_device,
2147 &msm_tpiu_device,
2148 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08002149 &msm_etm_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002150#endif
2151 &msm_device_dspcrashd_8960,
2152 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302153#ifdef MSM8930_PHASE_2
2154 &gpio_keys_8930,
2155#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002156 &msm8930_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002157 &msm8930_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002158 &msm8930_msm_gov_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002159 &msm_bus_8930_apps_fabric,
2160 &msm_bus_8930_sys_fabric,
2161 &msm_bus_8930_mm_fabric,
2162 &msm_bus_8930_sys_fpb,
2163 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002164 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002165 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002166 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002167 &msm8930_cache_dump_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002168};
2169
2170static struct platform_device *cdp_devices[] __initdata = {
2171 &msm8960_device_otg,
2172 &msm8960_device_gadget_peripheral,
2173 &msm_device_hsusb_host,
2174 &android_usb_device,
2175 &msm_pcm,
2176 &msm_pcm_routing,
2177 &msm_cpudai0,
2178 &msm_cpudai1,
2179 &msm_cpudai_hdmi_rx,
2180 &msm_cpudai_bt_rx,
2181 &msm_cpudai_bt_tx,
2182 &msm_cpudai_fm_rx,
2183 &msm_cpudai_fm_tx,
2184 &msm_cpudai_auxpcm_rx,
2185 &msm_cpudai_auxpcm_tx,
2186 &msm_cpu_fe,
2187 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002188#ifdef CONFIG_MSM_GEMINI
2189 &msm8960_gemini_device,
2190#endif
2191 &msm_voice,
2192 &msm_voip,
2193 &msm_lpa_pcm,
2194 &msm_cpudai_afe_01_rx,
2195 &msm_cpudai_afe_01_tx,
2196 &msm_cpudai_afe_02_rx,
2197 &msm_cpudai_afe_02_tx,
2198 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002199 &msm_compr_dsp,
2200 &msm_cpudai_incall_music_rx,
2201 &msm_cpudai_incall_record_rx,
2202 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002203 &msm_pcm_hostless,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002204};
2205
2206static void __init msm8930_i2c_init(void)
2207{
2208 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2209 &msm8960_i2c_qup_gsbi4_pdata;
2210
2211 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2212 &msm8960_i2c_qup_gsbi3_pdata;
2213
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002214 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2215 &msm8960_i2c_qup_gsbi9_pdata;
2216
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002217 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2218 &msm8960_i2c_qup_gsbi10_pdata;
2219
2220 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2221 &msm8960_i2c_qup_gsbi12_pdata;
2222}
2223
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002224static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2225 {
2226 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2227 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2228 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002229 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002230 },
2231
2232 {
2233 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2234 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2235 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002236 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002237 },
2238
2239 {
2240 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2241 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2242 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002243 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002244 },
2245
2246 {
2247 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002248 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2249 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002250 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002251 },
2252
2253 {
2254 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2255 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2256 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002257 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002258 },
2259
2260 {
2261 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2262 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2263 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002264 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002265 },
2266
2267 {
2268 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2269 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2270 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002271 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002272 },
2273
2274 {
2275 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2276 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2277 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002278 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002279 },
2280};
2281
Praveen Chidambaram78499012011-11-01 17:15:17 -06002282static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2283 .levels = &msm_rpmrs_levels[0],
2284 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2285 .vdd_mem_levels = {
2286 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2287 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2288 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2289 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2290 },
2291 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002292 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2293 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2294 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2295 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002296 },
2297 .vdd_mask = 0x7FFFFF,
2298 .rpmrs_target_id = {
2299 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2300 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002301 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2302 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002303 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2304 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2305 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2306 },
2307};
2308
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002309static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2310 .mode = MSM_PM_BOOT_CONFIG_TZ,
2311};
2312
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002313static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2314 .base_addr = MSM_ACC0_BASE + 0x08,
2315 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2316 .mask = 1UL << 13,
2317};
2318
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002319#ifdef CONFIG_I2C
2320#define I2C_SURF 1
2321#define I2C_FFA (1 << 1)
2322#define I2C_RUMI (1 << 2)
2323#define I2C_SIM (1 << 3)
2324#define I2C_FLUID (1 << 4)
2325#define I2C_LIQUID (1 << 5)
2326
2327struct i2c_registry {
2328 u8 machs;
2329 int bus;
2330 struct i2c_board_info *info;
2331 int len;
2332};
2333
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002334#ifdef CONFIG_INPUT_MPU3050
2335#define MPU3050_INT_GPIO 69
2336
2337static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2338 .gpio_int = MPU3050_INT_GPIO,
2339};
2340
2341static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2342 {
2343 I2C_BOARD_INFO("mpu3050", 0x68),
2344 .platform_data = &mpu3050_gyro,
2345 },
2346};
2347#endif
2348
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002349#ifdef CONFIG_ISL9519_CHARGER
2350static struct isl_platform_data isl_data __initdata = {
2351 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2352 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2353 .max_system_voltage = 4200,
2354 .min_system_voltage = 3200,
2355 .chgcurrent = 1000, /* 1900, */
2356 .term_current = 400, /* Need fine tuning */
2357 .input_current = 2048,
2358};
2359
2360static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2361 {
2362 I2C_BOARD_INFO("isl9519q", 0x9),
2363 .irq = 0, /* Not required when notify-by-pmic */
2364 .platform_data = &isl_data,
2365 },
2366};
2367#endif /* CONFIG_ISL9519_CHARGER */
2368
2369static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002370#ifdef CONFIG_ISL9519_CHARGER
2371 {
2372 I2C_LIQUID,
2373 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2374 isl_charger_i2c_info,
2375 ARRAY_SIZE(isl_charger_i2c_info),
2376 },
2377#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002378#ifdef CONFIG_INPUT_MPU3050
2379 {
2380 I2C_FFA | I2C_FLUID,
2381 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2382 mpu3050_i2c_boardinfo,
2383 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2384 },
2385#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002386 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002387 I2C_SURF | I2C_FFA | I2C_FLUID,
2388 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002389 msm_isa1200_board_info,
2390 ARRAY_SIZE(msm_isa1200_board_info),
2391 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002392 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002393 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002394 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2395 mxt_device_info_8930,
2396 ARRAY_SIZE(mxt_device_info_8930),
2397 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002398};
2399#endif /* CONFIG_I2C */
2400
2401static void __init register_i2c_devices(void)
2402{
2403#ifdef CONFIG_I2C
2404 u8 mach_mask = 0;
2405 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002406#ifdef CONFIG_MSM_CAMERA
2407 struct i2c_registry msm8930_camera_i2c_devices = {
2408 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2409 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2410 msm8930_camera_board_info.board_info,
2411 msm8930_camera_board_info.num_i2c_board_info,
2412 };
2413#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002414
2415 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002416 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002417 mach_mask = I2C_SURF;
2418 else if (machine_is_msm8930_fluid())
2419 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002420 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002421 mach_mask = I2C_FFA;
2422 else
2423 pr_err("unmatched machine ID in register_i2c_devices\n");
2424
2425 /* Run the array and install devices as appropriate */
2426 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2427 if (msm8960_i2c_devices[i].machs & mach_mask)
2428 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2429 msm8960_i2c_devices[i].info,
2430 msm8960_i2c_devices[i].len);
2431 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002432#ifdef CONFIG_MSM_CAMERA
2433 if (msm8930_camera_i2c_devices.machs & mach_mask)
2434 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2435 msm8930_camera_i2c_devices.info,
2436 msm8930_camera_i2c_devices.len);
2437#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002438#endif
2439}
2440
2441static void __init msm8930_cdp_init(void)
2442{
2443 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2444 pr_err("meminfo_init() failed!\n");
2445
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002446 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002447 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002448 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2449 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002450
2451 regulator_suppress_info_printing();
2452 if (msm_xo_init())
2453 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002454 platform_device_register(&msm8930_device_rpm_regulator);
Tianyi Goue3d4f542012-03-15 17:06:45 -07002455 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302456 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002457 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302458 android_usb_pdata.swfi_latency =
2459 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002460 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002461 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2462 &msm8960_qup_spi_gsbi1_pdata;
2463 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2464
Jay Chokshi06fa7542011-12-07 13:09:17 -08002465 /*
2466 * TODO: When physical 8930/PM8038 hardware becomes
2467 * available, remove this block or add the config
2468 * option.
2469 */
2470#ifndef MSM8930_PHASE_2
2471 msm8960_init_pmic();
2472#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002473 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002474#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002475 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302476 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002477 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2478 msm_spm_l2_init(msm_spm_l2_data);
2479 msm8930_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002480 platform_add_devices(msm8930_footswitch, msm8930_num_footswitch);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002481 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002482 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002483 /*
2484 * TODO: When physical 8930/PM8038 hardware becomes
2485 * available, remove this block or add the config
2486 * option.
2487 */
2488#ifndef MSM8930_PHASE_2
2489 msm8960_pm8921_gpio_mpp_init();
2490#else
2491 msm8930_pm8038_gpio_mpp_init();
2492#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002493 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002494#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002495 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002496#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002497 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002498 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002499 register_i2c_devices();
2500 msm8930_init_fb();
2501 slim_register_board_info(msm_slim_devices,
2502 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002503 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002504 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002505 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002506
2507 if (PLATFORM_IS_CHARM25())
2508 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2509}
2510
2511MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2512 .map_io = msm8930_map_io,
2513 .reserve = msm8930_reserve,
2514 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302515 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002516 .timer = &msm_timer,
2517 .init_machine = msm8930_cdp_init,
2518 .init_early = msm8930_allocate_memory_regions,
2519 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002520 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002521MACHINE_END
2522
2523MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2524 .map_io = msm8930_map_io,
2525 .reserve = msm8930_reserve,
2526 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302527 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002528 .timer = &msm_timer,
2529 .init_machine = msm8930_cdp_init,
2530 .init_early = msm8930_allocate_memory_regions,
2531 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002532 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002533MACHINE_END
2534
2535MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2536 .map_io = msm8930_map_io,
2537 .reserve = msm8930_reserve,
2538 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302539 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002540 .timer = &msm_timer,
2541 .init_machine = msm8930_cdp_init,
2542 .init_early = msm8930_allocate_memory_regions,
2543 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002544 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002545MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002546
2547MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2548 .map_io = msm8930_map_io,
2549 .reserve = msm8930_reserve,
2550 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302551 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002552 .timer = &msm_timer,
2553 .init_machine = msm8930_cdp_init,
2554 .init_early = msm8930_allocate_memory_regions,
2555 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002556 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002557MACHINE_END
2558
2559MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2560 .map_io = msm8930_map_io,
2561 .reserve = msm8930_reserve,
2562 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302563 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002564 .timer = &msm_timer,
2565 .init_machine = msm8930_cdp_init,
2566 .init_early = msm8930_allocate_memory_regions,
2567 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002568 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002569MACHINE_END