blob: 1c4251cd4f2e00e83cc0c6fb8fb279a27e8117cd [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>
22#include <linux/regulator/gpio-regulator.h>
23#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>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080045
Asish Bhattacharyab86c3472012-02-15 08:31:52 +053046#include <linux/slimbus/slimbus.h>
47#include <linux/mfd/wcd9xxx/core.h>
48#include <linux/mfd/wcd9xxx/pdata.h>
49
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080050#include <asm/mach-types.h>
51#include <asm/mach/arch.h>
52#include <asm/setup.h>
53#include <asm/hardware/gic.h>
54#include <asm/mach/mmc.h>
55
56#include <mach/board.h>
57#include <mach/msm_iomap.h>
58#include <mach/msm_spi.h>
59#ifdef CONFIG_USB_MSM_OTG_72K
60#include <mach/msm_hsusb.h>
61#else
62#include <linux/usb/msm_hsusb.h>
63#endif
64#include <linux/usb/android.h>
65#include <mach/usbdiag.h>
66#include <mach/socinfo.h>
67#include <mach/rpm.h>
68#include <mach/gpio.h>
69#include <mach/gpiomux.h>
70#include <mach/msm_bus_board.h>
71#include <mach/msm_memtypes.h>
72#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080073#include <mach/msm_xo.h>
74#include <mach/restart.h>
75
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080076#include <linux/ion.h>
77#include <mach/ion.h>
78#include <mach/mdm2.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080079#include <mach/msm_rtb.h>
Hanumant Singheea62562012-05-14 11:32:45 -070080#include <linux/fmem.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080081
82#include "timer.h"
83#include "devices.h"
84#include "devices-msm8x60.h"
85#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080086#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080087#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080088#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053089#include <mach/mpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080090#include "acpuclock.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080091#include "smd_private.h"
92#include "pm-boot.h"
93#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -080094#include "board-8930.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080095
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080096static struct platform_device msm_fm_platform_init = {
97 .name = "iris_fm",
98 .id = -1,
99};
100
101#define KS8851_RST_GPIO 89
102#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800103#define HAP_SHIFT_LVL_OE_GPIO 47
104
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800105#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
106
107struct sx150x_platform_data msm8930_sx150x_data[] = {
108 [SX150X_CAM] = {
109 .gpio_base = GPIO_CAM_EXPANDER_BASE,
110 .oscio_is_gpo = false,
111 .io_pullup_ena = 0x0,
112 .io_pulldn_ena = 0xc0,
113 .io_open_drain_ena = 0x0,
114 .irq_summary = -1,
115 },
116};
117
118#endif
119
Olav Haugana21169d2012-01-04 09:17:06 -0800120#define MSM_PMEM_ADSP_SIZE 0x7800000
Asish Bhattacharya9ed880f2012-04-12 08:33:37 +0530121#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800122#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
123#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
124#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800125#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800126#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700127#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800128
129#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Asish Bhattacharya9ed880f2012-04-12 08:33:37 +0530130#define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700131#ifdef CONFIG_MSM_IOMMU
132#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
133#define MSM_ION_SF_SIZE 0x0
134#define MSM_ION_HEAP_NUM 7
135#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800136#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800137#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700138#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700139#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700140#define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */
Hanumant Singhedfb0462012-05-15 14:49:32 -0700141#define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */
Olav Hauganb5be7992011-11-18 14:29:02 -0800142#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800143#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700144
145#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
146#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
147#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
148
149#define MSM8930_FIXED_AREA_START 0xa0000000
150#define MAX_FIXED_AREA_SIZE 0x10000000
151#define MSM_MM_FW_SIZE 0x200000
152#define MSM8930_FW_START (MSM8930_FIXED_AREA_START - MSM_MM_FW_SIZE)
153
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800154#else
155#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800156#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800157#endif
158
159#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
160static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
161static int __init pmem_kernel_ebi1_size_setup(char *p)
162{
163 pmem_kernel_ebi1_size = memparse(p, NULL);
164 return 0;
165}
166early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
167#endif
168
169#ifdef CONFIG_ANDROID_PMEM
170static unsigned pmem_size = MSM_PMEM_SIZE;
171static int __init pmem_size_setup(char *p)
172{
173 pmem_size = memparse(p, NULL);
174 return 0;
175}
176early_param("pmem_size", pmem_size_setup);
177
178static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
179
180static int __init pmem_adsp_size_setup(char *p)
181{
182 pmem_adsp_size = memparse(p, NULL);
183 return 0;
184}
185early_param("pmem_adsp_size", pmem_adsp_size_setup);
186
187static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
188
189static int __init pmem_audio_size_setup(char *p)
190{
191 pmem_audio_size = memparse(p, NULL);
192 return 0;
193}
194early_param("pmem_audio_size", pmem_audio_size_setup);
195#endif
196
197#ifdef CONFIG_ANDROID_PMEM
198#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
199static struct android_pmem_platform_data android_pmem_pdata = {
200 .name = "pmem",
201 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
202 .cached = 1,
203 .memory_type = MEMTYPE_EBI1,
204};
205
Laura Abbottb93525f2012-04-12 09:57:19 -0700206static struct platform_device msm8930_android_pmem_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800207 .name = "android_pmem",
208 .id = 0,
209 .dev = {.platform_data = &android_pmem_pdata},
210};
211
212static struct android_pmem_platform_data android_pmem_adsp_pdata = {
213 .name = "pmem_adsp",
214 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
215 .cached = 0,
216 .memory_type = MEMTYPE_EBI1,
217};
Laura Abbottb93525f2012-04-12 09:57:19 -0700218static struct platform_device msm8930_android_pmem_adsp_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800219 .name = "android_pmem",
220 .id = 2,
221 .dev = { .platform_data = &android_pmem_adsp_pdata },
222};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800223
224static struct android_pmem_platform_data android_pmem_audio_pdata = {
225 .name = "pmem_audio",
226 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
227 .cached = 0,
228 .memory_type = MEMTYPE_EBI1,
229};
230
Laura Abbottb93525f2012-04-12 09:57:19 -0700231static struct platform_device msm8930_android_pmem_audio_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800232 .name = "android_pmem",
233 .id = 4,
234 .dev = { .platform_data = &android_pmem_audio_pdata },
235};
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530236#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
237#endif /* CONFIG_ANDROID_PMEM */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800238
Hanumant Singheea62562012-05-14 11:32:45 -0700239struct fmem_platform_data msm8930_fmem_pdata = {
240};
241
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800242#define DSP_RAM_BASE_8960 0x8da00000
243#define DSP_RAM_SIZE_8960 0x1800000
244static int dspcrashd_pdata_8960 = 0xDEADDEAD;
245
246static struct resource resources_dspcrashd_8960[] = {
247 {
248 .name = "msm_dspcrashd",
249 .start = DSP_RAM_BASE_8960,
250 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
251 .flags = IORESOURCE_DMA,
252 },
253};
254
255static struct platform_device msm_device_dspcrashd_8960 = {
256 .name = "msm_dspcrashd",
257 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
258 .resource = resources_dspcrashd_8960,
259 .dev = { .platform_data = &dspcrashd_pdata_8960 },
260};
261
262static struct memtype_reserve msm8930_reserve_table[] __initdata = {
263 [MEMTYPE_SMI] = {
264 },
265 [MEMTYPE_EBI0] = {
266 .flags = MEMTYPE_FLAGS_1M_ALIGN,
267 },
268 [MEMTYPE_EBI1] = {
269 .flags = MEMTYPE_FLAGS_1M_ALIGN,
270 },
271};
272
Laura Abbottf8c03b92012-02-16 14:57:58 -0800273
274static void __init reserve_rtb_memory(void)
275{
276#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700277 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800278#endif
279}
280
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800281static void __init size_pmem_devices(void)
282{
283#ifdef CONFIG_ANDROID_PMEM
284#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
285 android_pmem_adsp_pdata.size = pmem_adsp_size;
286 android_pmem_pdata.size = pmem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800287 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530288#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
289#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800290}
291
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530292#ifdef CONFIG_ANDROID_PMEM
293#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800294static void __init reserve_memory_for(struct android_pmem_platform_data *p)
295{
296 msm8930_reserve_table[p->memory_type].size += p->size;
297}
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530298#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
299#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800300
301static void __init reserve_pmem_memory(void)
302{
303#ifdef CONFIG_ANDROID_PMEM
304#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
305 reserve_memory_for(&android_pmem_adsp_pdata);
306 reserve_memory_for(&android_pmem_pdata);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800307 reserve_memory_for(&android_pmem_audio_pdata);
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530308#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800309 msm8930_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530310#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800311}
312
313static int msm8930_paddr_to_memtype(unsigned int paddr)
314{
315 return MEMTYPE_EBI1;
316}
317
Hanumant Singheea62562012-05-14 11:32:45 -0700318#define FMEM_ENABLED 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800319#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800320#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700321static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800322 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800323 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700324 .reusable = FMEM_ENABLED,
325 .mem_is_fmem = FMEM_ENABLED,
326 .fixed_position = FIXED_MIDDLE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800327};
328
Laura Abbottb93525f2012-04-12 09:57:19 -0700329static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800330 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800331 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700332 .reusable = 0,
333 .mem_is_fmem = FMEM_ENABLED,
334 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800335};
Hanumant Singheea62562012-05-14 11:32:45 -0700336
Laura Abbottb93525f2012-04-12 09:57:19 -0700337static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800338 .adjacent_mem_id = INVALID_HEAP_ID,
339 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700340 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800341};
Hanumant Singheea62562012-05-14 11:32:45 -0700342
Laura Abbottb93525f2012-04-12 09:57:19 -0700343static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800344 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
345 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700346 .mem_is_fmem = FMEM_ENABLED,
347 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800348};
349#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800350
351/**
352 * These heaps are listed in the order they will be allocated. Due to
353 * video hardware restrictions and content protection the FW heap has to
354 * be allocated adjacent (below) the MM heap and the MFC heap has to be
355 * allocated after the MM heap to ensure MFC heap is not more than 256MB
356 * away from the base address of the FW heap.
357 * However, the order of FW heap and MM heap doesn't matter since these
358 * two heaps are taken care of by separate code to ensure they are adjacent
359 * to each other.
360 * Don't swap the order unless you know what you are doing!
361 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700362static struct ion_platform_data msm8930_ion_pdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800363 .nr = MSM_ION_HEAP_NUM,
364 .heaps = {
365 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800366 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800367 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800368 .name = ION_VMALLOC_HEAP_NAME,
369 },
370#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
371 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800372 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800373 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800374 .name = ION_MM_HEAP_NAME,
375 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800376 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700377 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800378 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800379 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800380 .id = ION_MM_FIRMWARE_HEAP_ID,
381 .type = ION_HEAP_TYPE_CARVEOUT,
382 .name = ION_MM_FIRMWARE_HEAP_NAME,
383 .size = MSM_ION_MM_FW_SIZE,
384 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700385 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800386 },
387 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800388 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800389 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800390 .name = ION_MFC_HEAP_NAME,
391 .size = MSM_ION_MFC_SIZE,
392 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700393 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800394 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700395#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800396 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800397 .id = ION_SF_HEAP_ID,
398 .type = ION_HEAP_TYPE_CARVEOUT,
399 .name = ION_SF_HEAP_NAME,
400 .size = MSM_ION_SF_SIZE,
401 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700402 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800403 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700404#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800405 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800406 .id = ION_IOMMU_HEAP_ID,
407 .type = ION_HEAP_TYPE_IOMMU,
408 .name = ION_IOMMU_HEAP_NAME,
409 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800410 {
411 .id = ION_QSECOM_HEAP_ID,
412 .type = ION_HEAP_TYPE_CARVEOUT,
413 .name = ION_QSECOM_HEAP_NAME,
414 .size = MSM_ION_QSECOM_SIZE,
415 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700416 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800417 },
Olav Haugan7355db02012-01-13 16:59:13 -0800418 {
419 .id = ION_AUDIO_HEAP_ID,
420 .type = ION_HEAP_TYPE_CARVEOUT,
421 .name = ION_AUDIO_HEAP_NAME,
422 .size = MSM_ION_AUDIO_SIZE,
423 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700424 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800425 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800426#endif
427 }
428};
429
Laura Abbottb93525f2012-04-12 09:57:19 -0700430static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800431 .name = "ion-msm",
432 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700433 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800434};
435#endif
436
Hanumant Singheea62562012-05-14 11:32:45 -0700437struct platform_device msm8930_fmem_device = {
438 .name = "fmem",
439 .id = 1,
440 .dev = { .platform_data = &msm8930_fmem_pdata },
441};
442
443static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
444 unsigned long size)
445{
446 msm8930_reserve_table[mem_type].size += size;
447}
448
449static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
450{
451#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
452 int ret;
453
454 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
455 panic("fixed area size is larger than %dM\n",
456 MAX_FIXED_AREA_SIZE >> 20);
457
458 reserve_info->fixed_area_size = fixed_area_size;
459 reserve_info->fixed_area_start = MSM8930_FW_START;
460
461 ret = memblock_remove(reserve_info->fixed_area_start,
462 reserve_info->fixed_area_size);
463 BUG_ON(ret);
464#endif
465}
466
467/**
468 * Reserve memory for ION and calculate amount of reusable memory for fmem.
469 * We only reserve memory for heaps that are not reusable. However, we only
470 * support one reusable heap at the moment so we ignore the reusable flag for
471 * other than the first heap with reusable flag set. Also handle special case
472 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
473 * at a higher address than FW in addition to not more than 256MB away from the
474 * base address of the firmware. This means that if MM is reusable the other
475 * two heaps must be allocated in the same region as FW. This is handled by the
476 * mem_is_fmem flag in the platform data. In addition the MM heap must be
477 * adjacent to the FW heap for content protection purposes.
478 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700479static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800480{
481#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700482 unsigned int i;
483 unsigned int reusable_count = 0;
484 unsigned int fixed_size = 0;
485 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
486 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
487
488 msm8930_fmem_pdata.size = 0;
489 msm8930_fmem_pdata.reserved_size_low = 0;
490 msm8930_fmem_pdata.reserved_size_high = 0;
Olav Haugan62436252012-05-16 09:09:43 -0700491 msm8930_fmem_pdata.align = PAGE_SIZE;
Hanumant Singheea62562012-05-14 11:32:45 -0700492 fixed_low_size = 0;
493 fixed_middle_size = 0;
494 fixed_high_size = 0;
495
496 /* We only support 1 reusable heap. Check if more than one heap
497 * is specified as reusable and set as non-reusable if found.
498 */
499 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
500 const struct ion_platform_heap *heap =
501 &(msm8930_ion_pdata.heaps[i]);
502
503 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
504 struct ion_cp_heap_pdata *data = heap->extra_data;
505
506 reusable_count += (data->reusable) ? 1 : 0;
507
508 if (data->reusable && reusable_count > 1) {
509 pr_err("%s: Too many heaps specified as "
510 "reusable. Heap %s was not configured "
511 "as reusable.\n", __func__, heap->name);
512 data->reusable = 0;
513 }
514 }
515 }
516
517 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
518 const struct ion_platform_heap *heap =
519 &(msm8930_ion_pdata.heaps[i]);
520
521 if (heap->extra_data) {
522 int fixed_position = NOT_FIXED;
523 int mem_is_fmem = 0;
524
525 switch (heap->type) {
526 case ION_HEAP_TYPE_CP:
527 mem_is_fmem = ((struct ion_cp_heap_pdata *)
528 heap->extra_data)->mem_is_fmem;
529 fixed_position = ((struct ion_cp_heap_pdata *)
530 heap->extra_data)->fixed_position;
531 break;
532 case ION_HEAP_TYPE_CARVEOUT:
533 mem_is_fmem = ((struct ion_co_heap_pdata *)
534 heap->extra_data)->mem_is_fmem;
535 fixed_position = ((struct ion_co_heap_pdata *)
536 heap->extra_data)->fixed_position;
537 break;
538 default:
539 break;
540 }
541
542 if (fixed_position != NOT_FIXED)
543 fixed_size += heap->size;
544 else
545 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
546
547 if (fixed_position == FIXED_LOW)
548 fixed_low_size += heap->size;
549 else if (fixed_position == FIXED_MIDDLE)
550 fixed_middle_size += heap->size;
551 else if (fixed_position == FIXED_HIGH)
552 fixed_high_size += heap->size;
553
554 if (mem_is_fmem)
555 msm8930_fmem_pdata.size += heap->size;
556 }
557 }
558
559 if (!fixed_size)
560 return;
561
562 if (msm8930_fmem_pdata.size) {
563 msm8930_fmem_pdata.reserved_size_low = fixed_low_size;
564 msm8930_fmem_pdata.reserved_size_high = fixed_high_size;
565 }
566
567 /* Since the fixed area may be carved out of lowmem,
568 * make sure the length is a multiple of 1M.
569 */
570 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
571 & SECTION_MASK;
572 msm8930_reserve_fixed_area(fixed_size);
573
574 fixed_low_start = MSM8930_FIXED_AREA_START;
575 fixed_middle_start = fixed_low_start + fixed_low_size;
576 fixed_high_start = fixed_middle_start + fixed_middle_size;
577
578 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
579 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
580
581 if (heap->extra_data) {
582 int fixed_position = NOT_FIXED;
583
584 switch (heap->type) {
585 case ION_HEAP_TYPE_CP:
586 fixed_position = ((struct ion_cp_heap_pdata *)
587 heap->extra_data)->fixed_position;
588 break;
589 case ION_HEAP_TYPE_CARVEOUT:
590 fixed_position = ((struct ion_co_heap_pdata *)
591 heap->extra_data)->fixed_position;
592 break;
593 default:
594 break;
595 }
596
597 switch (fixed_position) {
598 case FIXED_LOW:
599 heap->base = fixed_low_start;
600 break;
601 case FIXED_MIDDLE:
602 heap->base = fixed_middle_start;
603 break;
604 case FIXED_HIGH:
605 heap->base = fixed_high_start;
606 break;
607 default:
608 break;
609 }
610 }
611 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800612#endif
613}
Huaibin Yanga5419422011-12-08 23:52:10 -0800614
615static void __init reserve_mdp_memory(void)
616{
617 msm8930_mdp_writeback(msm8930_reserve_table);
618}
619
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800620static void __init msm8930_calculate_reserve_sizes(void)
621{
622 size_pmem_devices();
623 reserve_pmem_memory();
624 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800625 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800626 reserve_rtb_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800627}
628
629static struct reserve_info msm8930_reserve_info __initdata = {
630 .memtype_reserve_table = msm8930_reserve_table,
631 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700632 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800633 .paddr_to_memtype = msm8930_paddr_to_memtype,
634};
635
636static int msm8930_memory_bank_size(void)
637{
638 return 1<<29;
639}
640
641static void __init locate_unstable_memory(void)
642{
643 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
644 unsigned long bank_size;
645 unsigned long low, high;
646
647 bank_size = msm8930_memory_bank_size();
648 low = meminfo.bank[0].start;
649 high = mb->start + mb->size;
650
651 /* Check if 32 bit overflow occured */
652 if (high < mb->start)
Hanumant Singheea62562012-05-14 11:32:45 -0700653 high -= PAGE_SIZE;
654
655 if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START)
656 panic("fixed area extends beyond end of memory\n");
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800657
658 low &= ~(bank_size - 1);
659
660 if (high - low <= bank_size)
Hanumant Singheea62562012-05-14 11:32:45 -0700661 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800662
663 msm8930_reserve_info.bank_size = bank_size;
664#ifdef CONFIG_ENABLE_DMM
Jack Cheung6ce8f682012-01-17 10:35:42 -0800665 msm8930_reserve_info.low_unstable_address = mb->start -
666 MIN_MEMORY_BLOCK_SIZE + mb->size;
667 msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800668 pr_info("low unstable address %lx max size %lx bank size %lx\n",
669 msm8930_reserve_info.low_unstable_address,
670 msm8930_reserve_info.max_unstable_size,
671 msm8930_reserve_info.bank_size);
Hanumant Singheea62562012-05-14 11:32:45 -0700672 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800673#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700674no_dmm:
675 msm8930_reserve_info.low_unstable_address = high;
676 msm8930_reserve_info.max_unstable_size = 0;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800677}
678
679static void __init place_movable_zone(void)
680{
Larry Basselb8d61022012-02-24 10:49:45 -0800681#ifdef CONFIG_ENABLE_DMM
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800682 movable_reserved_start = msm8930_reserve_info.low_unstable_address;
683 movable_reserved_size = msm8930_reserve_info.max_unstable_size;
684 pr_info("movable zone start %lx size %lx\n",
685 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800686#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800687}
688
689static void __init msm8930_early_memory(void)
690{
691 reserve_info = &msm8930_reserve_info;
692 locate_unstable_memory();
693 place_movable_zone();
694}
695
696static void __init msm8930_reserve(void)
697{
698 msm_reserve();
Hanumant Singheea62562012-05-14 11:32:45 -0700699 if (msm8930_fmem_pdata.size) {
700#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
701 if (reserve_info->fixed_area_size) {
702 msm8930_fmem_pdata.phys =
703 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
704 pr_info("mm fw at %lx (fixed) size %x\n",
705 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
706 pr_info("fmem start %lx (fixed) size %lx\n",
707 msm8930_fmem_pdata.phys, msm8930_fmem_pdata.size);
708 }
709#endif
710 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800711}
712
713static int msm8930_change_memory_power(u64 start, u64 size,
714 int change_type)
715{
716 return soc_change_memory_power(start, size, change_type);
717}
718
719static void __init msm8930_allocate_memory_regions(void)
720{
721 msm8930_allocate_fb_region();
722}
723
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530724#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800725
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530726#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800727
728/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
729 * 4 micbiases are used to power various analog and digital
730 * microphones operating at 1800 mV. Technically, all micbiases
731 * can source from single cfilter since all microphones operate
732 * at the same voltage level. The arrangement below is to make
733 * sure all cfilters are exercised. LDO_H regulator ouput level
734 * does not need to be as high as 2.85V. It is choosen for
735 * microphone sensitivity purpose.
736 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530737static struct wcd9xxx_pdata sitar_platform_data = {
738 .slimbus_slave_device = {
739 .name = "sitar-slave",
740 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800741 },
742 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530743 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530744 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530745 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800746 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530747 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800748 .cfilt1_mv = 1800,
749 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530750 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
751 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
752 },
753 .regulator = {
754 {
755 .name = "CDC_VDD_CP",
David Collins226f2512012-03-19 13:18:39 -0700756 .min_uV = 1950000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530757 .max_uV = 2200000,
758 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
759 },
760 {
761 .name = "CDC_VDDA_RX",
762 .min_uV = 1800000,
763 .max_uV = 1800000,
764 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
765 },
766 {
767 .name = "CDC_VDDA_TX",
768 .min_uV = 1800000,
769 .max_uV = 1800000,
770 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
771 },
772 {
773 .name = "VDDIO_CDC",
774 .min_uV = 1800000,
775 .max_uV = 1800000,
776 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
777 },
778 {
779 .name = "VDDD_CDC_D",
780 .min_uV = 1200000,
781 .max_uV = 1200000,
782 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
783 },
784 {
785 .name = "CDC_VDDA_A_1P2V",
786 .min_uV = 1200000,
787 .max_uV = 1200000,
788 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
789 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800790 },
791};
792
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530793static struct slim_device msm_slim_sitar = {
794 .name = "sitar-slim",
795 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800796 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530797 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800798 },
799};
800#endif
801
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530802
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800803static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530804#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800805 {
806 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530807 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800808 },
809#endif
810 /* add more slimbus slaves as needed */
811};
812
813#define MSM_WCNSS_PHYS 0x03000000
814#define MSM_WCNSS_SIZE 0x280000
815
816static struct resource resources_wcnss_wlan[] = {
817 {
818 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
819 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
820 .name = "wcnss_wlanrx_irq",
821 .flags = IORESOURCE_IRQ,
822 },
823 {
824 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
825 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
826 .name = "wcnss_wlantx_irq",
827 .flags = IORESOURCE_IRQ,
828 },
829 {
830 .start = MSM_WCNSS_PHYS,
831 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
832 .name = "wcnss_mmio",
833 .flags = IORESOURCE_MEM,
834 },
835 {
836 .start = 84,
837 .end = 88,
838 .name = "wcnss_gpios_5wire",
839 .flags = IORESOURCE_IO,
840 },
841};
842
843static struct qcom_wcnss_opts qcom_wcnss_pdata = {
844 .has_48mhz_xo = 1,
845};
846
847static struct platform_device msm_device_wcnss_wlan = {
848 .name = "wcnss_wlan",
849 .id = 0,
850 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
851 .resource = resources_wcnss_wlan,
852 .dev = {.platform_data = &qcom_wcnss_pdata},
853};
854
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700855#ifdef CONFIG_QSEECOM
856/* qseecom bus scaling */
857static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
858 {
859 .src = MSM_BUS_MASTER_SPS,
860 .dst = MSM_BUS_SLAVE_EBI_CH0,
861 .ib = 0,
862 .ab = 0,
863 },
864 {
865 .src = MSM_BUS_MASTER_SPDM,
866 .dst = MSM_BUS_SLAVE_SPDM,
867 .ib = 0,
868 .ab = 0,
869 },
870};
871
872static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
873 {
874 .src = MSM_BUS_MASTER_SPS,
875 .dst = MSM_BUS_SLAVE_EBI_CH0,
876 .ib = (492 * 8) * 1000000UL,
877 .ab = (492 * 8) * 100000UL,
878 },
879 {
880 .src = MSM_BUS_MASTER_SPDM,
881 .dst = MSM_BUS_SLAVE_SPDM,
882 .ib = 0,
883 .ab = 0,
884 },
885};
886
887static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
888 {
889 .src = MSM_BUS_MASTER_SPS,
890 .dst = MSM_BUS_SLAVE_EBI_CH0,
891 .ib = 0,
892 .ab = 0,
893 },
894 {
895 .src = MSM_BUS_MASTER_SPDM,
896 .dst = MSM_BUS_SLAVE_SPDM,
897 .ib = (64 * 8) * 1000000UL,
898 .ab = (64 * 8) * 100000UL,
899 },
900};
901
902static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
903 {
904 ARRAY_SIZE(qseecom_clks_init_vectors),
905 qseecom_clks_init_vectors,
906 },
907 {
908 ARRAY_SIZE(qseecom_enable_dfab_vectors),
909 qseecom_enable_sfpb_vectors,
910 },
911 {
912 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
913 qseecom_enable_sfpb_vectors,
914 },
915};
916
917static struct msm_bus_scale_pdata qseecom_bus_pdata = {
918 qseecom_hw_bus_scale_usecases,
919 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
920 .name = "qsee",
921};
922
923static struct platform_device qseecom_device = {
924 .name = "qseecom",
925 .id = 0,
926 .dev = {
927 .platform_data = &qseecom_bus_pdata,
928 },
929};
930#endif
931
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800932#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
933 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
934 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
935 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
936
937#define QCE_SIZE 0x10000
938#define QCE_0_BASE 0x18500000
939
940#define QCE_HW_KEY_SUPPORT 0
941#define QCE_SHA_HMAC_SUPPORT 1
942#define QCE_SHARE_CE_RESOURCE 1
943#define QCE_CE_SHARED 0
944
945static struct resource qcrypto_resources[] = {
946 [0] = {
947 .start = QCE_0_BASE,
948 .end = QCE_0_BASE + QCE_SIZE - 1,
949 .flags = IORESOURCE_MEM,
950 },
951 [1] = {
952 .name = "crypto_channels",
953 .start = DMOV_CE_IN_CHAN,
954 .end = DMOV_CE_OUT_CHAN,
955 .flags = IORESOURCE_DMA,
956 },
957 [2] = {
958 .name = "crypto_crci_in",
959 .start = DMOV_CE_IN_CRCI,
960 .end = DMOV_CE_IN_CRCI,
961 .flags = IORESOURCE_DMA,
962 },
963 [3] = {
964 .name = "crypto_crci_out",
965 .start = DMOV_CE_OUT_CRCI,
966 .end = DMOV_CE_OUT_CRCI,
967 .flags = IORESOURCE_DMA,
968 },
969};
970
971static struct resource qcedev_resources[] = {
972 [0] = {
973 .start = QCE_0_BASE,
974 .end = QCE_0_BASE + QCE_SIZE - 1,
975 .flags = IORESOURCE_MEM,
976 },
977 [1] = {
978 .name = "crypto_channels",
979 .start = DMOV_CE_IN_CHAN,
980 .end = DMOV_CE_OUT_CHAN,
981 .flags = IORESOURCE_DMA,
982 },
983 [2] = {
984 .name = "crypto_crci_in",
985 .start = DMOV_CE_IN_CRCI,
986 .end = DMOV_CE_IN_CRCI,
987 .flags = IORESOURCE_DMA,
988 },
989 [3] = {
990 .name = "crypto_crci_out",
991 .start = DMOV_CE_OUT_CRCI,
992 .end = DMOV_CE_OUT_CRCI,
993 .flags = IORESOURCE_DMA,
994 },
995};
996
997#endif
998
999#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1000 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1001
1002static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1003 .ce_shared = QCE_CE_SHARED,
1004 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1005 .hw_key_support = QCE_HW_KEY_SUPPORT,
1006 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1007};
1008
1009static struct platform_device qcrypto_device = {
1010 .name = "qcrypto",
1011 .id = 0,
1012 .num_resources = ARRAY_SIZE(qcrypto_resources),
1013 .resource = qcrypto_resources,
1014 .dev = {
1015 .coherent_dma_mask = DMA_BIT_MASK(32),
1016 .platform_data = &qcrypto_ce_hw_suppport,
1017 },
1018};
1019#endif
1020
1021#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1022 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1023
1024static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1025 .ce_shared = QCE_CE_SHARED,
1026 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1027 .hw_key_support = QCE_HW_KEY_SUPPORT,
1028 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1029};
1030
1031static struct platform_device qcedev_device = {
1032 .name = "qce",
1033 .id = 0,
1034 .num_resources = ARRAY_SIZE(qcedev_resources),
1035 .resource = qcedev_resources,
1036 .dev = {
1037 .coherent_dma_mask = DMA_BIT_MASK(32),
1038 .platform_data = &qcedev_ce_hw_suppport,
1039 },
1040};
1041#endif
1042
1043#define MDM2AP_ERRFATAL 70
1044#define AP2MDM_ERRFATAL 95
1045#define MDM2AP_STATUS 69
1046#define AP2MDM_STATUS 94
1047#define AP2MDM_PMIC_RESET_N 80
1048#define AP2MDM_KPDPWR_N 81
1049
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001050static struct resource mdm_resources[] = {
1051 {
1052 .start = MDM2AP_ERRFATAL,
1053 .end = MDM2AP_ERRFATAL,
1054 .name = "MDM2AP_ERRFATAL",
1055 .flags = IORESOURCE_IO,
1056 },
1057 {
1058 .start = AP2MDM_ERRFATAL,
1059 .end = AP2MDM_ERRFATAL,
1060 .name = "AP2MDM_ERRFATAL",
1061 .flags = IORESOURCE_IO,
1062 },
1063 {
1064 .start = MDM2AP_STATUS,
1065 .end = MDM2AP_STATUS,
1066 .name = "MDM2AP_STATUS",
1067 .flags = IORESOURCE_IO,
1068 },
1069 {
1070 .start = AP2MDM_STATUS,
1071 .end = AP2MDM_STATUS,
1072 .name = "AP2MDM_STATUS",
1073 .flags = IORESOURCE_IO,
1074 },
1075 {
1076 .start = AP2MDM_PMIC_RESET_N,
1077 .end = AP2MDM_PMIC_RESET_N,
1078 .name = "AP2MDM_PMIC_RESET_N",
1079 .flags = IORESOURCE_IO,
1080 },
1081 {
1082 .start = AP2MDM_KPDPWR_N,
1083 .end = AP2MDM_KPDPWR_N,
1084 .name = "AP2MDM_KPDPWR_N",
1085 .flags = IORESOURCE_IO,
1086 },
1087};
1088
1089static struct mdm_platform_data mdm_platform_data = {
1090 .mdm_version = "2.5",
1091};
1092
1093static struct platform_device mdm_device = {
1094 .name = "mdm2_modem",
1095 .id = -1,
1096 .num_resources = ARRAY_SIZE(mdm_resources),
1097 .resource = mdm_resources,
1098 .dev = {
1099 .platform_data = &mdm_platform_data,
1100 },
1101};
1102
1103static struct platform_device *mdm_devices[] __initdata = {
1104 &mdm_device,
1105};
1106
Praveen Chidambaram78499012011-11-01 17:15:17 -06001107#ifdef CONFIG_MSM_MPM
1108static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1109 [1] = MSM_GPIO_TO_INT(46),
1110 [2] = MSM_GPIO_TO_INT(150),
1111 [4] = MSM_GPIO_TO_INT(103),
1112 [5] = MSM_GPIO_TO_INT(104),
1113 [6] = MSM_GPIO_TO_INT(105),
1114 [7] = MSM_GPIO_TO_INT(106),
1115 [8] = MSM_GPIO_TO_INT(107),
1116 [9] = MSM_GPIO_TO_INT(7),
1117 [10] = MSM_GPIO_TO_INT(11),
1118 [11] = MSM_GPIO_TO_INT(15),
1119 [12] = MSM_GPIO_TO_INT(19),
1120 [13] = MSM_GPIO_TO_INT(23),
1121 [14] = MSM_GPIO_TO_INT(27),
1122 [15] = MSM_GPIO_TO_INT(31),
1123 [16] = MSM_GPIO_TO_INT(35),
1124 [19] = MSM_GPIO_TO_INT(90),
1125 [20] = MSM_GPIO_TO_INT(92),
1126 [23] = MSM_GPIO_TO_INT(85),
1127 [24] = MSM_GPIO_TO_INT(83),
1128 [25] = USB1_HS_IRQ,
1129 [27] = HDMI_IRQ,
1130 [29] = MSM_GPIO_TO_INT(10),
1131 [30] = MSM_GPIO_TO_INT(102),
1132 [31] = MSM_GPIO_TO_INT(81),
1133 [32] = MSM_GPIO_TO_INT(78),
1134 [33] = MSM_GPIO_TO_INT(94),
1135 [34] = MSM_GPIO_TO_INT(72),
1136 [35] = MSM_GPIO_TO_INT(39),
1137 [36] = MSM_GPIO_TO_INT(43),
1138 [37] = MSM_GPIO_TO_INT(61),
1139 [38] = MSM_GPIO_TO_INT(50),
1140 [39] = MSM_GPIO_TO_INT(42),
1141 [41] = MSM_GPIO_TO_INT(62),
1142 [42] = MSM_GPIO_TO_INT(76),
1143 [43] = MSM_GPIO_TO_INT(75),
1144 [44] = MSM_GPIO_TO_INT(70),
1145 [45] = MSM_GPIO_TO_INT(69),
1146 [46] = MSM_GPIO_TO_INT(67),
1147 [47] = MSM_GPIO_TO_INT(65),
1148 [48] = MSM_GPIO_TO_INT(58),
1149 [49] = MSM_GPIO_TO_INT(54),
1150 [50] = MSM_GPIO_TO_INT(52),
1151 [51] = MSM_GPIO_TO_INT(49),
1152 [52] = MSM_GPIO_TO_INT(40),
1153 [53] = MSM_GPIO_TO_INT(37),
1154 [54] = MSM_GPIO_TO_INT(24),
1155 [55] = MSM_GPIO_TO_INT(14),
1156};
1157
1158static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1159 TLMM_MSM_SUMMARY_IRQ,
1160 RPM_APCC_CPU0_GP_HIGH_IRQ,
1161 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1162 RPM_APCC_CPU0_GP_LOW_IRQ,
1163 RPM_APCC_CPU0_WAKE_UP_IRQ,
1164 RPM_APCC_CPU1_GP_HIGH_IRQ,
1165 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1166 RPM_APCC_CPU1_GP_LOW_IRQ,
1167 RPM_APCC_CPU1_WAKE_UP_IRQ,
1168 MSS_TO_APPS_IRQ_0,
1169 MSS_TO_APPS_IRQ_1,
1170 MSS_TO_APPS_IRQ_2,
1171 MSS_TO_APPS_IRQ_3,
1172 MSS_TO_APPS_IRQ_4,
1173 MSS_TO_APPS_IRQ_5,
1174 MSS_TO_APPS_IRQ_6,
1175 MSS_TO_APPS_IRQ_7,
1176 MSS_TO_APPS_IRQ_8,
1177 MSS_TO_APPS_IRQ_9,
1178 LPASS_SCSS_GP_LOW_IRQ,
1179 LPASS_SCSS_GP_MEDIUM_IRQ,
1180 LPASS_SCSS_GP_HIGH_IRQ,
1181 SPS_MTI_30,
1182 SPS_MTI_31,
1183 RIVA_APSS_SPARE_IRQ,
1184 RIVA_APPS_WLAN_SMSM_IRQ,
1185 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1186 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1187};
1188
1189struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1190 .irqs_m2a = msm_mpm_irqs_m2a,
1191 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1192 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1193 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1194 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1195 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1196 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1197 .mpm_apps_ipc_val = BIT(1),
1198 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1199
1200};
1201#endif
1202
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001203#define MSM_SHARED_RAM_PHYS 0x80000000
1204
1205static void __init msm8930_map_io(void)
1206{
1207 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1208 msm_map_msm8930_io();
1209
1210 if (socinfo_init() < 0)
1211 pr_err("socinfo_init() failed!\n");
1212}
1213
1214static void __init msm8930_init_irq(void)
1215{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001216 struct msm_mpm_device_data *data = NULL;
1217#ifdef CONFIG_MSM_MPM
1218 data = &msm8930_mpm_dev_data;
1219#endif
1220
1221 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001222 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1223 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001224}
1225
1226static void __init msm8930_init_buses(void)
1227{
1228#ifdef CONFIG_MSM_BUS_SCALING
1229 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001230 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1231 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1232 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1233 msm_bus_8930_apps_fabric.dev.platform_data =
1234 &msm_bus_8930_apps_fabric_pdata;
1235 msm_bus_8930_sys_fabric.dev.platform_data =
1236 &msm_bus_8930_sys_fabric_pdata;
1237 msm_bus_8930_mm_fabric.dev.platform_data =
1238 &msm_bus_8930_mm_fabric_pdata;
1239 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1240 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001241#endif
1242}
1243
1244static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1245 .max_clock_speed = 15060000,
1246};
1247
1248#ifdef CONFIG_USB_MSM_OTG_72K
1249static struct msm_otg_platform_data msm_otg_pdata;
1250#else
Manu Gautam32ab9462012-02-20 12:33:01 +05301251#ifdef CONFIG_MSM_BUS_SCALING
1252/* Bandwidth requests (zero) if no vote placed */
1253static struct msm_bus_vectors usb_init_vectors[] = {
1254 {
1255 .src = MSM_BUS_MASTER_SPS,
1256 .dst = MSM_BUS_SLAVE_EBI_CH0,
1257 .ab = 0,
1258 .ib = 0,
1259 },
1260};
1261
1262/* Bus bandwidth requests in Bytes/sec */
1263static struct msm_bus_vectors usb_max_vectors[] = {
1264 {
1265 .src = MSM_BUS_MASTER_SPS,
1266 .dst = MSM_BUS_SLAVE_EBI_CH0,
1267 .ab = 60000000, /* At least 480Mbps on bus. */
1268 .ib = 960000000, /* MAX bursts rate */
1269 },
1270};
1271
1272static struct msm_bus_paths usb_bus_scale_usecases[] = {
1273 {
1274 ARRAY_SIZE(usb_init_vectors),
1275 usb_init_vectors,
1276 },
1277 {
1278 ARRAY_SIZE(usb_max_vectors),
1279 usb_max_vectors,
1280 },
1281};
1282
1283static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1284 usb_bus_scale_usecases,
1285 ARRAY_SIZE(usb_bus_scale_usecases),
1286 .name = "usb",
1287};
1288#endif
1289
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001290static struct msm_otg_platform_data msm_otg_pdata = {
1291 .mode = USB_OTG,
1292 .otg_control = OTG_PMIC_CONTROL,
1293 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001294 .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE),
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001295 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301296#ifdef CONFIG_MSM_BUS_SCALING
1297 .bus_scale_table = &usb_bus_scale_pdata,
1298#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001299};
1300#endif
1301
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001302#define PID_MAGIC_ID 0x71432909
1303#define SERIAL_NUM_MAGIC_ID 0x61945374
1304#define SERIAL_NUMBER_LENGTH 127
1305#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1306
1307struct magic_num_struct {
1308 uint32_t pid;
1309 uint32_t serial_num;
1310};
1311
1312struct dload_struct {
1313 uint32_t reserved1;
1314 uint32_t reserved2;
1315 uint32_t reserved3;
1316 uint16_t reserved4;
1317 uint16_t pid;
1318 char serial_number[SERIAL_NUMBER_LENGTH];
1319 uint16_t reserved5;
1320 struct magic_num_struct magic_struct;
1321};
1322
1323static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1324{
1325 struct dload_struct __iomem *dload = 0;
1326
1327 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1328 if (!dload) {
1329 pr_err("%s: cannot remap I/O memory region: %08x\n",
1330 __func__, DLOAD_USB_BASE_ADD);
1331 return -ENXIO;
1332 }
1333
1334 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1335 __func__, dload, pid, snum);
1336 /* update pid */
1337 dload->magic_struct.pid = PID_MAGIC_ID;
1338 dload->pid = pid;
1339
1340 /* update serial number */
1341 dload->magic_struct.serial_num = 0;
1342 if (!snum) {
1343 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1344 goto out;
1345 }
1346
1347 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1348 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1349out:
1350 iounmap(dload);
1351 return 0;
1352}
1353
1354static struct android_usb_platform_data android_usb_pdata = {
1355 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1356};
1357
1358static struct platform_device android_usb_device = {
1359 .name = "android_usb",
1360 .id = -1,
1361 .dev = {
1362 .platform_data = &android_usb_pdata,
1363 },
1364};
1365
1366static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001367 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001368};
1369
1370static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001371 0x00, 0x24, 0x54, 0x10,
1372 0x09, 0x03, 0x01,
1373 0x10, 0x54, 0x30, 0x0C,
1374 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001375};
1376
1377static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001378 0x00, 0x24, 0x54, 0x10,
1379 0x09, 0x07, 0x01, 0x0B,
1380 0x10, 0x54, 0x30, 0x0C,
1381 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001382};
1383
1384static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1385 [0] = {
1386 .mode = MSM_SPM_MODE_CLOCK_GATING,
1387 .notify_rpm = false,
1388 .cmd = spm_wfi_cmd_sequence,
1389 },
1390 [1] = {
1391 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1392 .notify_rpm = false,
1393 .cmd = spm_power_collapse_without_rpm,
1394 },
1395 [2] = {
1396 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1397 .notify_rpm = true,
1398 .cmd = spm_power_collapse_with_rpm,
1399 },
1400};
1401
1402static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1403 [0] = {
1404 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001405 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001406#if defined(CONFIG_MSM_AVS_HW)
1407 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1408 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1409#endif
1410 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001411 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001412 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1413 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1414 .vctl_timeout_us = 50,
1415 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1416 .modes = msm_spm_seq_list,
1417 },
1418 [1] = {
1419 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001420 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001421#if defined(CONFIG_MSM_AVS_HW)
1422 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1423 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1424#endif
1425 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001426 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001427 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1428 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1429 .vctl_timeout_us = 50,
1430 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1431 .modes = msm_spm_seq_list,
1432 },
1433};
1434
1435static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001436 0x00, 0x20, 0x03, 0x20,
1437 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001438};
1439
1440static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001441 0x00, 0x20, 0x34, 0x64,
1442 0x48, 0x07, 0x48, 0x20,
1443 0x50, 0x64, 0x04, 0x34,
1444 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001445};
1446static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001447 0x00, 0x10, 0x34, 0x64,
1448 0x48, 0x07, 0x48, 0x10,
1449 0x50, 0x64, 0x04, 0x34,
1450 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001451};
1452
1453static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1454 [0] = {
1455 .mode = MSM_SPM_L2_MODE_RETENTION,
1456 .notify_rpm = false,
1457 .cmd = l2_spm_wfi_cmd_sequence,
1458 },
1459 [1] = {
1460 .mode = MSM_SPM_L2_MODE_GDHS,
1461 .notify_rpm = true,
1462 .cmd = l2_spm_gdhs_cmd_sequence,
1463 },
1464 [2] = {
1465 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1466 .notify_rpm = true,
1467 .cmd = l2_spm_power_off_cmd_sequence,
1468 },
1469};
1470
1471static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1472 [0] = {
1473 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001474 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001475 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001476 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1477 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1478 .modes = msm_spm_l2_seq_list,
1479 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1480 },
1481};
1482
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301483#define ISA1200_HAP_EN_GPIO 77
1484#define ISA1200_HAP_LEN_GPIO 78
1485#define ISA1200_HAP_CLK PM8038_GPIO_PM_TO_SYS(7)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001486
1487static int isa1200_power(int on)
1488{
Amy Malocheb20c1052012-04-11 10:36:13 -07001489 int rc = 0;
1490
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301491 gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on);
1492
Amy Malocheb20c1052012-04-11 10:36:13 -07001493 if (on)
1494 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_1, true);
1495 else
1496 rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_NONE, true);
1497
1498 if (rc) {
1499 pr_err("%s: unable to write aux clock register(%d)\n",
1500 __func__, rc);
1501 }
1502
1503 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001504}
1505
1506static int isa1200_dev_setup(bool enable)
1507{
1508 int rc = 0;
1509
Amy Malocheb20c1052012-04-11 10:36:13 -07001510 if (!enable)
1511 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301512
1513 rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk");
1514 if (rc) {
1515 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
1516 __func__, ISA1200_HAP_CLK, rc);
1517 goto fail_gpio_req;
1518 }
1519
1520 rc = gpio_direction_output(ISA1200_HAP_CLK, 0);
1521 if (rc) {
1522 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
1523 __func__, ISA1200_HAP_CLK, rc);
1524 goto fail_gpio_dir;
1525 }
1526
1527 return 0;
1528
1529fail_gpio_dir:
1530 gpio_free(ISA1200_HAP_CLK);
1531fail_gpio_req:
1532 return rc;
1533
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001534}
1535
1536static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301537 {
1538 .name = "vddp",
1539 .min_uV = ISA_I2C_VTG_MIN_UV,
1540 .max_uV = ISA_I2C_VTG_MAX_UV,
1541 .load_uA = ISA_I2C_CURR_UA,
1542 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001543 {
1544 .name = "vcc_i2c",
1545 .min_uV = ISA_I2C_VTG_MIN_UV,
1546 .max_uV = ISA_I2C_VTG_MAX_UV,
1547 .load_uA = ISA_I2C_CURR_UA,
1548 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001549};
1550
1551static struct isa1200_platform_data isa1200_1_pdata = {
1552 .name = "vibrator",
1553 .dev_setup = isa1200_dev_setup,
1554 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301555 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1556 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001557 .max_timeout = 15000,
1558 .mode_ctrl = PWM_GEN_MODE,
1559 .pwm_fd = {
1560 .pwm_div = 256,
1561 },
1562 .is_erm = false,
1563 .smart_en = true,
1564 .ext_clk_en = true,
1565 .chip_en = 1,
1566 .regulator_info = isa1200_reg_data,
1567 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1568};
1569
1570static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1571 {
1572 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1573 .platform_data = &isa1200_1_pdata,
1574 },
1575};
1576
Amy Malochef3c9db42011-12-08 15:17:35 -08001577#define MXT_TS_GPIO_IRQ 11
1578#define MXT_TS_RESET_GPIO 52
1579
1580static const u8 mxt_config_data_8930[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001581 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001582 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001583 /* T38 Object */
Amy Malochec0dbec52012-04-23 10:55:45 -07001584 15, 2, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001585 /* T7 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001586 48, 255, 25,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001587 /* T8 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001588 27, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001589 /* T9 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001590 131, 0, 0, 19, 11, 0, 16, 35, 1, 3,
Amy Malochef8130f92012-02-01 10:38:59 +05301591 10, 15, 1, 11, 4, 5, 40, 10, 43, 4,
1592 54, 2, 0, 0, 0, 0, 143, 40, 143, 80,
Amy Malochef3c9db42011-12-08 15:17:35 -08001593 18, 15, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001594 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1596 0,
1597 /* T18 Object */
1598 0, 0,
1599 /* T19 Object */
1600 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1601 0, 0, 0, 0, 0, 0,
1602 /* T23 Object */
1603 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1604 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001605 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001606 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1607 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001608 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001609 0, 0, 0, 0, 0,
1610 /* T42 Object */
1611 0, 0, 0, 0, 0, 0, 0, 0,
1612 /* T46 Object */
1613 0, 3, 16, 48, 0, 0, 1, 0, 0,
1614 /* T47 Object */
1615 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1616 /* T48 Object */
1617 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1618 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1619 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1620 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1621 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1622 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001623};
1624
Amy Malochef3c9db42011-12-08 15:17:35 -08001625static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1626 struct kobj_attribute *attr, char *buf)
1627{
1628 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301629 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1630 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1631 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1632 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001633 "\n");
1634}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001635
Amy Malochef3c9db42011-12-08 15:17:35 -08001636static struct kobj_attribute mxt224e_vkeys_attr = {
1637 .attr = {
1638 .mode = S_IRUGO,
1639 },
1640 .show = &mxt224e_vkeys_show,
1641};
1642
1643static struct attribute *mxt224e_properties_attrs[] = {
1644 &mxt224e_vkeys_attr.attr,
1645 NULL
1646};
1647
1648static struct attribute_group mxt224e_properties_attr_group = {
1649 .attrs = mxt224e_properties_attrs,
1650};
1651
1652static void mxt_init_vkeys_8930(void)
1653{
1654 int rc;
1655 static struct kobject *mxt224e_properties_kobj;
1656
1657 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1658 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1659 NULL);
1660 if (mxt224e_properties_kobj)
1661 rc = sysfs_create_group(mxt224e_properties_kobj,
1662 &mxt224e_properties_attr_group);
1663 if (!mxt224e_properties_kobj || rc)
1664 pr_err("%s: failed to create board_properties\n",
1665 __func__);
1666
1667 return;
1668}
1669
Jing Lindc4413c2012-01-16 15:22:52 -08001670static struct mxt_config_info mxt_config_array[] = {
1671 {
1672 .config = mxt_config_data_8930,
1673 .config_length = ARRAY_SIZE(mxt_config_data_8930),
1674 .family_id = 0x81,
1675 .variant_id = 0x01,
1676 .version = 0x10,
1677 .build = 0xAA,
1678 },
1679};
1680
Amy Malochef3c9db42011-12-08 15:17:35 -08001681static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001682 .config_array = mxt_config_array,
1683 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001684 .panel_minx = 0,
1685 .panel_maxx = 566,
1686 .panel_miny = 0,
1687 .panel_maxy = 1067,
1688 .disp_minx = 0,
1689 .disp_maxx = 540,
1690 .disp_miny = 0,
1691 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001692 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301693#ifdef MSM8930_PHASE_2
1694 .digital_pwr_regulator = true,
1695#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001696 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001697 .reset_gpio = MXT_TS_RESET_GPIO,
1698 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001699};
1700
Amy Malochef3c9db42011-12-08 15:17:35 -08001701static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001702 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001703 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1704 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001705 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1706 },
1707};
1708
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301709#ifdef MSM8930_PHASE_2
1710
1711#define GPIO_VOLUME_UP PM8038_GPIO_PM_TO_SYS(3)
1712#define GPIO_VOLUME_DOWN PM8038_GPIO_PM_TO_SYS(8)
1713#define GPIO_CAMERA_SNAPSHOT PM8038_GPIO_PM_TO_SYS(10)
1714#define GPIO_CAMERA_FOCUS PM8038_GPIO_PM_TO_SYS(11)
1715
1716static struct gpio_keys_button keys_8930[] = {
1717 {
1718 .code = KEY_VOLUMEUP,
1719 .type = EV_KEY,
1720 .desc = "volume_up",
1721 .gpio = GPIO_VOLUME_UP,
1722 .wakeup = 1,
1723 .active_low = 1,
1724 },
1725 {
1726 .code = KEY_VOLUMEDOWN,
1727 .type = EV_KEY,
1728 .desc = "volume_down",
1729 .gpio = GPIO_VOLUME_DOWN,
1730 .wakeup = 1,
1731 .active_low = 1,
1732 },
1733 {
1734 .code = KEY_CAMERA_FOCUS,
1735 .type = EV_KEY,
1736 .desc = "camera_focus",
1737 .gpio = GPIO_CAMERA_FOCUS,
1738 .wakeup = 1,
1739 .active_low = 1,
1740 },
1741 {
1742 .code = KEY_CAMERA_SNAPSHOT,
1743 .type = EV_KEY,
1744 .desc = "camera_snapshot",
1745 .gpio = GPIO_CAMERA_SNAPSHOT,
1746 .wakeup = 1,
1747 .active_low = 1,
1748 },
1749};
1750
1751/* Add GPIO keys for 8930 */
1752static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
1753 .buttons = keys_8930,
1754 .nbuttons = 4,
1755};
1756
1757static struct platform_device gpio_keys_8930 = {
1758 .name = "gpio-keys",
1759 .id = -1,
1760 .dev = {
1761 .platform_data = &gpio_keys_8930_pdata,
1762 },
1763};
1764#endif /* MSM8930_PHASE_2 */
1765
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001766static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
1767 .clk_freq = 100000,
1768 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001769};
1770
1771static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
1772 .clk_freq = 100000,
1773 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001774};
1775
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06001776static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
1777 .clk_freq = 100000,
1778 .src_clk_rate = 24000000,
1779};
1780
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001781static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
1782 .clk_freq = 100000,
1783 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001784};
1785
1786static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
1787 .clk_freq = 100000,
1788 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001789};
1790
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001791
1792static struct ks8851_pdata spi_eth_pdata = {
1793 .irq_gpio = KS8851_IRQ_GPIO,
1794 .rst_gpio = KS8851_RST_GPIO,
1795};
1796
1797static struct spi_board_info spi_board_info[] __initdata = {
1798 {
1799 .modalias = "ks8851",
1800 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
1801 .max_speed_hz = 19200000,
1802 .bus_num = 0,
1803 .chip_select = 0,
1804 .mode = SPI_MODE_0,
1805 .platform_data = &spi_eth_pdata
1806 },
1807 {
1808 .modalias = "dsi_novatek_3d_panel_spi",
1809 .max_speed_hz = 10800000,
1810 .bus_num = 0,
1811 .chip_select = 1,
1812 .mode = SPI_MODE_0,
1813 },
1814};
1815
1816static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001817 .name = "saw-regulator",
1818 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001819 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001820 .platform_data = &msm8930_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001821 },
1822};
1823
1824static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001825 .name = "saw-regulator",
1826 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001827 .dev = {
David Collinsb4558422012-01-05 10:50:49 -08001828 .platform_data = &msm8930_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001829 },
1830};
1831
1832static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08001833 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08001834 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07001835 .tsens_num_sensor = 10,
1836 .slope = {1132, 1135, 1137, 1135, 1157,
1837 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001838};
1839
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001840static struct platform_device msm_tsens_device = {
1841 .name = "tsens8960-tm",
1842 .id = -1,
1843};
1844
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001845#ifdef CONFIG_MSM_FAKE_BATTERY
1846static struct platform_device fish_battery_device = {
1847 .name = "fish_battery",
1848};
1849#endif
1850
David Collins1d4061b2011-12-06 15:36:40 -08001851#ifndef MSM8930_PHASE_2
1852
1853/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08001854static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001855 .name = GPIO_REGULATOR_DEV_NAME,
1856 .id = PM8921_MPP_PM_TO_SYS(7),
1857 .dev = {
1858 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
1859 },
1860};
1861
Jay Chokshi06fa7542011-12-07 13:09:17 -08001862static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001863 .name = GPIO_REGULATOR_DEV_NAME,
1864 .id = 91,
1865 .dev = {
1866 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
1867 },
1868};
1869
David Collins1d4061b2011-12-06 15:36:40 -08001870#else
1871
1872/* 8930 Phase 2 */
1873static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
1874 .name = GPIO_REGULATOR_DEV_NAME,
1875 .id = 63,
1876 .dev = {
1877 .platform_data =
1878 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_5V],
1879 },
1880};
1881
1882static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
1883 .name = GPIO_REGULATOR_DEV_NAME,
1884 .id = 97,
1885 .dev = {
1886 .platform_data =
1887 &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
1888 },
1889};
1890
1891#endif
1892
Jay Chokshi06fa7542011-12-07 13:09:17 -08001893static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001894 .name = "rpm-regulator",
1895 .id = -1,
1896 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08001897#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001898 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08001899#else
1900 .platform_data = &msm8930_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001901#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001902 },
1903};
1904
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001905static struct platform_device *common_devices[] __initdata = {
1906 &msm8960_device_dmov,
1907 &msm_device_smd,
1908 &msm8960_device_uart_gsbi5,
1909 &msm_device_uart_dm6,
1910 &msm_device_saw_core0,
1911 &msm_device_saw_core1,
Jay Chokshi06fa7542011-12-07 13:09:17 -08001912 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08001913#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08001914 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08001915#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08001916 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08001917#ifdef MSM8930_PHASE_2
1918 &msm8930_device_ext_otg_sw_vreg,
1919#endif
Stephen Boyd28d54952011-12-16 13:19:51 -08001920 &msm_8960_q6_lpass,
1921 &msm_8960_q6_mss_fw,
1922 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07001923 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07001924 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08001925 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001926 &msm8960_device_qup_spi_gsbi1,
1927 &msm8960_device_qup_i2c_gsbi3,
1928 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06001929 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001930 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001931 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001932 &msm_slim_ctrl,
1933 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001934#if defined(CONFIG_QSEECOM)
1935 &qseecom_device,
1936#endif
1937
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001938#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1939 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1940 &qcrypto_device,
1941#endif
1942
1943#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1944 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1945 &qcedev_device,
1946#endif
1947#ifdef CONFIG_MSM_ROTATOR
1948 &msm_rotator_device,
1949#endif
1950 &msm_device_sps,
1951#ifdef CONFIG_MSM_FAKE_BATTERY
1952 &fish_battery_device,
1953#endif
1954#ifdef CONFIG_ANDROID_PMEM
1955#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07001956 &msm8930_android_pmem_device,
1957 &msm8930_android_pmem_adsp_device,
1958 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05301959#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
1960#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07001961 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001962 &msm_device_bam_dmux,
1963 &msm_fm_platform_init,
1964
1965#ifdef CONFIG_HW_RANDOM_MSM
1966 &msm_device_rng,
1967#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06001968 &msm8930_rpm_device,
1969 &msm8930_rpm_log_device,
1970 &msm8930_rpm_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001971#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07001972 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001973#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001974 &msm_device_tz_log,
1975
1976#ifdef CONFIG_MSM_QDSS
Pratik Patel1403f2a2012-03-21 10:10:00 -07001977 &msm_qdss_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001978 &msm_etb_device,
1979 &msm_tpiu_device,
1980 &msm_funnel_device,
Pratik Patel492b3012012-03-06 14:22:30 -08001981 &msm_etm_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001982#endif
1983 &msm_device_dspcrashd_8960,
1984 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301985#ifdef MSM8930_PHASE_2
1986 &gpio_keys_8930,
1987#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07001988 &msm8930_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07001989 &msm8930_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07001990 &msm8930_msm_gov_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07001991 &msm_bus_8930_apps_fabric,
1992 &msm_bus_8930_sys_fabric,
1993 &msm_bus_8930_mm_fabric,
1994 &msm_bus_8930_sys_fpb,
1995 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08001996 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07001997 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001998 &msm_tsens_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001999};
2000
2001static struct platform_device *cdp_devices[] __initdata = {
2002 &msm8960_device_otg,
2003 &msm8960_device_gadget_peripheral,
2004 &msm_device_hsusb_host,
2005 &android_usb_device,
2006 &msm_pcm,
2007 &msm_pcm_routing,
2008 &msm_cpudai0,
2009 &msm_cpudai1,
2010 &msm_cpudai_hdmi_rx,
2011 &msm_cpudai_bt_rx,
2012 &msm_cpudai_bt_tx,
2013 &msm_cpudai_fm_rx,
2014 &msm_cpudai_fm_tx,
2015 &msm_cpudai_auxpcm_rx,
2016 &msm_cpudai_auxpcm_tx,
2017 &msm_cpu_fe,
2018 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002019#ifdef CONFIG_MSM_GEMINI
2020 &msm8960_gemini_device,
2021#endif
2022 &msm_voice,
2023 &msm_voip,
2024 &msm_lpa_pcm,
2025 &msm_cpudai_afe_01_rx,
2026 &msm_cpudai_afe_01_tx,
2027 &msm_cpudai_afe_02_rx,
2028 &msm_cpudai_afe_02_tx,
2029 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002030 &msm_compr_dsp,
2031 &msm_cpudai_incall_music_rx,
2032 &msm_cpudai_incall_record_rx,
2033 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002034 &msm_pcm_hostless,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002035};
2036
2037static void __init msm8930_i2c_init(void)
2038{
2039 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2040 &msm8960_i2c_qup_gsbi4_pdata;
2041
2042 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2043 &msm8960_i2c_qup_gsbi3_pdata;
2044
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002045 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2046 &msm8960_i2c_qup_gsbi9_pdata;
2047
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002048 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2049 &msm8960_i2c_qup_gsbi10_pdata;
2050
2051 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2052 &msm8960_i2c_qup_gsbi12_pdata;
2053}
2054
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002055static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2056 {
2057 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2058 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2059 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002060 100, 650, 801, 200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002061 },
2062
2063 {
2064 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2065 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2066 true,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002067 2000, 200, 576000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002068 },
2069
2070 {
2071 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2072 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2073 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002074 8500, 51, 1122000, 8500,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002075 },
2076
2077 {
2078 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2079 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2080 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002081 9000, 51, 1130300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002082 },
2083 {
2084 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2085 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2086 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002087 10000, 51, 1130300, 10000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002088 },
2089
2090 {
2091 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2092 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2093 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002094 12000, 14, 2205900, 12000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002095 },
2096
2097 {
2098 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2099 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2100 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002101 18000, 12, 2364250, 18000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002102 },
2103
2104 {
2105 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2106 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2107 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002108 23500, 10, 2667000, 23500,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002109 },
2110
2111 {
2112 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2113 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2114 false,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002115 29700, 5, 2867000, 30000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002116 },
2117};
2118
Praveen Chidambaram78499012011-11-01 17:15:17 -06002119static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2120 .levels = &msm_rpmrs_levels[0],
2121 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2122 .vdd_mem_levels = {
2123 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2124 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2125 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2126 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2127 },
2128 .vdd_dig_levels = {
2129 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2130 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2131 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2132 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2133 },
2134 .vdd_mask = 0x7FFFFF,
2135 .rpmrs_target_id = {
2136 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2137 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2138 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8038_S1_0,
2139 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8038_S1_1,
2140 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2141 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2142 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2143 },
2144};
2145
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002146static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2147 .mode = MSM_PM_BOOT_CONFIG_TZ,
2148};
2149
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002150static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = {
2151 .base_addr = MSM_ACC0_BASE + 0x08,
2152 .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE,
2153 .mask = 1UL << 13,
2154};
2155
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002156#ifdef CONFIG_I2C
2157#define I2C_SURF 1
2158#define I2C_FFA (1 << 1)
2159#define I2C_RUMI (1 << 2)
2160#define I2C_SIM (1 << 3)
2161#define I2C_FLUID (1 << 4)
2162#define I2C_LIQUID (1 << 5)
2163
2164struct i2c_registry {
2165 u8 machs;
2166 int bus;
2167 struct i2c_board_info *info;
2168 int len;
2169};
2170
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002171#ifdef CONFIG_ISL9519_CHARGER
2172static struct isl_platform_data isl_data __initdata = {
2173 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2174 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2175 .max_system_voltage = 4200,
2176 .min_system_voltage = 3200,
2177 .chgcurrent = 1000, /* 1900, */
2178 .term_current = 400, /* Need fine tuning */
2179 .input_current = 2048,
2180};
2181
2182static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2183 {
2184 I2C_BOARD_INFO("isl9519q", 0x9),
2185 .irq = 0, /* Not required when notify-by-pmic */
2186 .platform_data = &isl_data,
2187 },
2188};
2189#endif /* CONFIG_ISL9519_CHARGER */
2190
2191static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002192#ifdef CONFIG_ISL9519_CHARGER
2193 {
2194 I2C_LIQUID,
2195 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2196 isl_charger_i2c_info,
2197 ARRAY_SIZE(isl_charger_i2c_info),
2198 },
2199#endif /* CONFIG_ISL9519_CHARGER */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002200 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002201 I2C_SURF | I2C_FFA | I2C_FLUID,
2202 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002203 msm_isa1200_board_info,
2204 ARRAY_SIZE(msm_isa1200_board_info),
2205 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002206 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002207 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002208 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2209 mxt_device_info_8930,
2210 ARRAY_SIZE(mxt_device_info_8930),
2211 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002212};
2213#endif /* CONFIG_I2C */
2214
2215static void __init register_i2c_devices(void)
2216{
2217#ifdef CONFIG_I2C
2218 u8 mach_mask = 0;
2219 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002220#ifdef CONFIG_MSM_CAMERA
2221 struct i2c_registry msm8930_camera_i2c_devices = {
2222 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2223 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2224 msm8930_camera_board_info.board_info,
2225 msm8930_camera_board_info.num_i2c_board_info,
2226 };
2227#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002228
2229 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002230 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002231 mach_mask = I2C_SURF;
2232 else if (machine_is_msm8930_fluid())
2233 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002234 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002235 mach_mask = I2C_FFA;
2236 else
2237 pr_err("unmatched machine ID in register_i2c_devices\n");
2238
2239 /* Run the array and install devices as appropriate */
2240 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2241 if (msm8960_i2c_devices[i].machs & mach_mask)
2242 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2243 msm8960_i2c_devices[i].info,
2244 msm8960_i2c_devices[i].len);
2245 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002246#ifdef CONFIG_MSM_CAMERA
2247 if (msm8930_camera_i2c_devices.machs & mach_mask)
2248 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2249 msm8930_camera_i2c_devices.info,
2250 msm8930_camera_i2c_devices.len);
2251#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002252#endif
2253}
2254
2255static void __init msm8930_cdp_init(void)
2256{
2257 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2258 pr_err("meminfo_init() failed!\n");
2259
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002260 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06002261 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2262 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002263
2264 regulator_suppress_info_printing();
2265 if (msm_xo_init())
2266 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002267 platform_device_register(&msm8930_device_rpm_regulator);
Tianyi Goue3d4f542012-03-15 17:06:45 -07002268 msm_clock_init(&msm8930_clock_init_data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002269 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002270 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002271 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2272 &msm8960_qup_spi_gsbi1_pdata;
2273 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2274
Jay Chokshi06fa7542011-12-07 13:09:17 -08002275 /*
2276 * TODO: When physical 8930/PM8038 hardware becomes
2277 * available, remove this block or add the config
2278 * option.
2279 */
2280#ifndef MSM8930_PHASE_2
2281 msm8960_init_pmic();
2282#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002283 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002284#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002285 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302286 msm8930_init_gpu();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002287 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2288 msm_spm_l2_init(msm_spm_l2_data);
2289 msm8930_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07002290 platform_add_devices(msm8930_footswitch, msm8930_num_footswitch);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002291 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002292 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002293 /*
2294 * TODO: When physical 8930/PM8038 hardware becomes
2295 * available, remove this block or add the config
2296 * option.
2297 */
2298#ifndef MSM8930_PHASE_2
2299 msm8960_pm8921_gpio_mpp_init();
2300#else
2301 msm8930_pm8038_gpio_mpp_init();
2302#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002303 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002304 msm8930_init_cam();
2305 msm8930_init_mmc();
Tianyi Gou7c6b81f2011-12-07 23:09:08 -08002306 acpuclk_init(&acpuclk_8930_soc_data);
Amy Maloche8eb91112012-03-30 10:22:37 -07002307 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002308 register_i2c_devices();
2309 msm8930_init_fb();
2310 slim_register_board_info(msm_slim_devices,
2311 ARRAY_SIZE(msm_slim_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002312 change_memory_power = &msm8930_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002313 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Praveen Chidambaram4d19be42012-04-03 18:05:52 -06002314 msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002315
2316 if (PLATFORM_IS_CHARM25())
2317 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2318}
2319
2320MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2321 .map_io = msm8930_map_io,
2322 .reserve = msm8930_reserve,
2323 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302324 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002325 .timer = &msm_timer,
2326 .init_machine = msm8930_cdp_init,
2327 .init_early = msm8930_allocate_memory_regions,
2328 .init_very_early = msm8930_early_memory,
2329MACHINE_END
2330
2331MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2332 .map_io = msm8930_map_io,
2333 .reserve = msm8930_reserve,
2334 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302335 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002336 .timer = &msm_timer,
2337 .init_machine = msm8930_cdp_init,
2338 .init_early = msm8930_allocate_memory_regions,
2339 .init_very_early = msm8930_early_memory,
2340MACHINE_END
2341
2342MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2343 .map_io = msm8930_map_io,
2344 .reserve = msm8930_reserve,
2345 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302346 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002347 .timer = &msm_timer,
2348 .init_machine = msm8930_cdp_init,
2349 .init_early = msm8930_allocate_memory_regions,
2350 .init_very_early = msm8930_early_memory,
2351MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002352
2353MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2354 .map_io = msm8930_map_io,
2355 .reserve = msm8930_reserve,
2356 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302357 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002358 .timer = &msm_timer,
2359 .init_machine = msm8930_cdp_init,
2360 .init_early = msm8930_allocate_memory_regions,
2361 .init_very_early = msm8930_early_memory,
2362MACHINE_END
2363
2364MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2365 .map_io = msm8930_map_io,
2366 .reserve = msm8930_reserve,
2367 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302368 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002369 .timer = &msm_timer,
2370 .init_machine = msm8930_cdp_init,
2371 .init_early = msm8930_allocate_memory_regions,
2372 .init_very_early = msm8930_early_memory,
2373MACHINE_END