blob: 624f8ea7fa925022c504ac92a934be9ea552fa37 [file] [log] [blame]
Mayank Rana2a1c7db2013-01-08 15:10:51 +05301/* Copyright (c) 2011-2013, The Linux Foundation. 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>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080029#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
Laura Abbott87eafac2012-09-18 11:45:43 -070032#include <linux/dma-contiguous.h>
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
Wentao Xu114c0152012-06-12 11:40:38 -040051#ifdef CONFIG_STM_LIS3DH
52#include <linux/input/lis3dh.h>
53#endif
54
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080055#include <asm/mach-types.h>
56#include <asm/mach/arch.h>
57#include <asm/setup.h>
58#include <asm/hardware/gic.h>
59#include <asm/mach/mmc.h>
60
61#include <mach/board.h>
62#include <mach/msm_iomap.h>
63#include <mach/msm_spi.h>
64#ifdef CONFIG_USB_MSM_OTG_72K
65#include <mach/msm_hsusb.h>
66#else
67#include <linux/usb/msm_hsusb.h>
68#endif
69#include <linux/usb/android.h>
70#include <mach/usbdiag.h>
71#include <mach/socinfo.h>
72#include <mach/rpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080073#include <mach/gpiomux.h>
74#include <mach/msm_bus_board.h>
75#include <mach/msm_memtypes.h>
76#include <mach/dma.h>
Saket Saurabh2a47f222013-03-11 19:36:48 +053077#include <mach/msm_serial_hs.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080078#include <mach/msm_xo.h>
79#include <mach/restart.h>
80
Mitchel Humpherys46475f62012-09-06 11:33:28 -070081#include <linux/msm_ion.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080082#include <mach/ion.h>
83#include <mach/mdm2.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080084#include <mach/msm_rtb.h>
Hanumant Singheea62562012-05-14 11:32:45 -070085#include <linux/fmem.h>
Laura Abbottf3173042012-05-29 15:23:18 -070086#include <mach/msm_cache_dump.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080087
Jordan Crouse914de9b2012-07-09 13:49:46 -060088#include <mach/kgsl.h>
Wentao Xuf59ce4e2012-05-22 17:30:13 -040089#ifdef CONFIG_INPUT_MPU3050
90#include <linux/input/mpu3050.h>
91#endif
92
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080093#include "timer.h"
94#include "devices.h"
95#include "devices-msm8x60.h"
96#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080097#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080098#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080099#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530100#include <mach/mpm.h>
Matt Wagantalld55b90f2012-02-23 23:27:44 -0800101#include "clock.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800102#include "smd_private.h"
103#include "pm-boot.h"
104#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -0800105#include "board-8930.h"
Patrick Dalya3b73c42012-08-28 13:39:17 -0700106#include "acpuclock-krait.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800107
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800108static struct platform_device msm_fm_platform_init = {
109 .name = "iris_fm",
110 .id = -1,
111};
112
113#define KS8851_RST_GPIO 89
114#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800115#define HAP_SHIFT_LVL_OE_GPIO 47
116
Manoj Raoc6d904c2012-06-22 00:32:14 -0700117#define HDMI_MHL_MUX_GPIO 73
118#define MHL_GPIO_INT 72
119#define MHL_GPIO_RESET 71
120#define MHL_GPIO_PWR_EN 5
121
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800122#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
123
124struct sx150x_platform_data msm8930_sx150x_data[] = {
125 [SX150X_CAM] = {
126 .gpio_base = GPIO_CAM_EXPANDER_BASE,
127 .oscio_is_gpo = false,
128 .io_pullup_ena = 0x0,
129 .io_pulldn_ena = 0xc0,
130 .io_open_drain_ena = 0x0,
131 .irq_summary = -1,
132 },
133};
134
135#endif
136
Olav Haugana21169d2012-01-04 09:17:06 -0800137#define MSM_PMEM_ADSP_SIZE 0x7800000
Sudhir Sharmab83b1472012-11-28 19:46:13 -0800138#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800139#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
140#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
141#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800142#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800143#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700144#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800145
146#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur9830bf02012-06-01 15:04:29 -0700147#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700148#define MSM_CONTIG_MEM_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700149#ifdef CONFIG_MSM_IOMMU
150#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
151#define MSM_ION_SF_SIZE 0x0
Olav Haugan494e4dc2012-05-15 15:14:31 -0700152#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Laura Abbott03e3cd72013-02-09 09:35:30 -0800153#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700154#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800155#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800156#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan494e4dc2012-05-15 15:14:31 -0700157#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Hanumant Singheea62562012-05-14 11:32:45 -0700158#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700159#endif
Deepak Kotur9830bf02012-06-01 15:04:29 -0700160#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800161#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800162#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700163
164#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
165#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
166#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
167
Deepak Kotur9830bf02012-06-01 15:04:29 -0700168#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */
169#define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
170 HOLE_SIZE))
Hanumant Singheea62562012-05-14 11:32:45 -0700171#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur9830bf02012-06-01 15:04:29 -0700172#define MSM8930_FW_START MSM8930_FIXED_AREA_START
Laura Abbott03e3cd72013-02-09 09:35:30 -0800173#define MSM_ION_ADSP_SIZE SZ_8M
Hanumant Singheea62562012-05-14 11:32:45 -0700174
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800175#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700176#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800177#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800178#endif
179
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700180#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
181static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
182static int __init msm_contig_mem_size_setup(char *p)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800183{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700184 msm_contig_mem_size = memparse(p, NULL);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800185 return 0;
186}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700187early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800188#endif
189
190#ifdef CONFIG_ANDROID_PMEM
191static unsigned pmem_size = MSM_PMEM_SIZE;
192static int __init pmem_size_setup(char *p)
193{
194 pmem_size = memparse(p, NULL);
195 return 0;
196}
197early_param("pmem_size", pmem_size_setup);
198
199static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
200
201static int __init pmem_adsp_size_setup(char *p)
202{
203 pmem_adsp_size = memparse(p, NULL);
204 return 0;
205}
206early_param("pmem_adsp_size", pmem_adsp_size_setup);
207
208static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
209
210static int __init pmem_audio_size_setup(char *p)
211{
212 pmem_audio_size = memparse(p, NULL);
213 return 0;
214}
215early_param("pmem_audio_size", pmem_audio_size_setup);
216#endif
217
218#ifdef CONFIG_ANDROID_PMEM
219#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
220static struct android_pmem_platform_data android_pmem_pdata = {
221 .name = "pmem",
222 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
223 .cached = 1,
224 .memory_type = MEMTYPE_EBI1,
225};
226
Laura Abbottb93525f2012-04-12 09:57:19 -0700227static struct platform_device msm8930_android_pmem_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800228 .name = "android_pmem",
229 .id = 0,
230 .dev = {.platform_data = &android_pmem_pdata},
231};
232
233static struct android_pmem_platform_data android_pmem_adsp_pdata = {
234 .name = "pmem_adsp",
235 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
236 .cached = 0,
237 .memory_type = MEMTYPE_EBI1,
238};
Laura Abbottb93525f2012-04-12 09:57:19 -0700239static struct platform_device msm8930_android_pmem_adsp_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800240 .name = "android_pmem",
241 .id = 2,
242 .dev = { .platform_data = &android_pmem_adsp_pdata },
243};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800244
245static struct android_pmem_platform_data android_pmem_audio_pdata = {
246 .name = "pmem_audio",
247 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
248 .cached = 0,
249 .memory_type = MEMTYPE_EBI1,
250};
251
Laura Abbottb93525f2012-04-12 09:57:19 -0700252static struct platform_device msm8930_android_pmem_audio_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800253 .name = "android_pmem",
254 .id = 4,
255 .dev = { .platform_data = &android_pmem_audio_pdata },
256};
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530257#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
258#endif /* CONFIG_ANDROID_PMEM */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800259
Hanumant Singheea62562012-05-14 11:32:45 -0700260struct fmem_platform_data msm8930_fmem_pdata = {
261};
262
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800263#define DSP_RAM_BASE_8960 0x8da00000
264#define DSP_RAM_SIZE_8960 0x1800000
265static int dspcrashd_pdata_8960 = 0xDEADDEAD;
266
267static struct resource resources_dspcrashd_8960[] = {
268 {
269 .name = "msm_dspcrashd",
270 .start = DSP_RAM_BASE_8960,
271 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
272 .flags = IORESOURCE_DMA,
273 },
274};
275
276static struct platform_device msm_device_dspcrashd_8960 = {
277 .name = "msm_dspcrashd",
278 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
279 .resource = resources_dspcrashd_8960,
280 .dev = { .platform_data = &dspcrashd_pdata_8960 },
281};
282
283static struct memtype_reserve msm8930_reserve_table[] __initdata = {
284 [MEMTYPE_SMI] = {
285 },
286 [MEMTYPE_EBI0] = {
287 .flags = MEMTYPE_FLAGS_1M_ALIGN,
288 },
289 [MEMTYPE_EBI1] = {
290 .flags = MEMTYPE_FLAGS_1M_ALIGN,
291 },
292};
293
Laura Abbottf8c03b92012-02-16 14:57:58 -0800294
295static void __init reserve_rtb_memory(void)
296{
297#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700298 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800299#endif
300}
301
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800302static void __init size_pmem_devices(void)
303{
304#ifdef CONFIG_ANDROID_PMEM
305#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
306 android_pmem_adsp_pdata.size = pmem_adsp_size;
307 android_pmem_pdata.size = pmem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800308 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530309#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
310#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800311}
312
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530313#ifdef CONFIG_ANDROID_PMEM
314#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800315static void __init reserve_memory_for(struct android_pmem_platform_data *p)
316{
317 msm8930_reserve_table[p->memory_type].size += p->size;
318}
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530319#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
320#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800321
322static void __init reserve_pmem_memory(void)
323{
324#ifdef CONFIG_ANDROID_PMEM
325#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
326 reserve_memory_for(&android_pmem_adsp_pdata);
327 reserve_memory_for(&android_pmem_pdata);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800328 reserve_memory_for(&android_pmem_audio_pdata);
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530329#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700330 msm8930_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530331#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800332}
333
334static int msm8930_paddr_to_memtype(unsigned int paddr)
335{
336 return MEMTYPE_EBI1;
337}
338
Steve Mucklef132c6c2012-06-06 18:30:57 -0700339#define FMEM_ENABLED 0
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800340#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800341#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700342static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800343 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800344 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700345 .reusable = FMEM_ENABLED,
346 .mem_is_fmem = FMEM_ENABLED,
347 .fixed_position = FIXED_MIDDLE,
Laura Abbottadec9c72012-12-05 11:49:59 -0800348 .is_cma = 1,
Laura Abbott5249a052012-12-11 15:09:03 -0800349 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800350};
351
Laura Abbottb93525f2012-04-12 09:57:19 -0700352static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800353 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800354 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700355 .reusable = 0,
356 .mem_is_fmem = FMEM_ENABLED,
357 .fixed_position = FIXED_HIGH,
Laura Abbott5249a052012-12-11 15:09:03 -0800358 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800359};
Hanumant Singheea62562012-05-14 11:32:45 -0700360
Laura Abbottb93525f2012-04-12 09:57:19 -0700361static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800362 .adjacent_mem_id = INVALID_HEAP_ID,
363 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700364 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800365};
Hanumant Singheea62562012-05-14 11:32:45 -0700366
Laura Abbottb93525f2012-04-12 09:57:19 -0700367static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800368 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
369 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700370 .mem_is_fmem = FMEM_ENABLED,
371 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800372};
373#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800374
Laura Abbott87eafac2012-09-18 11:45:43 -0700375
376static u64 msm_dmamask = DMA_BIT_MASK(32);
377
378static struct platform_device ion_mm_heap_device = {
379 .name = "ion-mm-heap-device",
380 .id = -1,
381 .dev = {
382 .dma_mask = &msm_dmamask,
383 .coherent_dma_mask = DMA_BIT_MASK(32),
384 }
385};
386
Laura Abbott03e3cd72013-02-09 09:35:30 -0800387static struct platform_device ion_adsp_heap_device = {
388 .name = "ion-adsp-heap-device",
389 .id = -1,
390 .dev = {
391 .dma_mask = &msm_dmamask,
392 .coherent_dma_mask = DMA_BIT_MASK(32),
393 }
394};
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800395/**
396 * These heaps are listed in the order they will be allocated. Due to
397 * video hardware restrictions and content protection the FW heap has to
398 * be allocated adjacent (below) the MM heap and the MFC heap has to be
399 * allocated after the MM heap to ensure MFC heap is not more than 256MB
400 * away from the base address of the FW heap.
401 * However, the order of FW heap and MM heap doesn't matter since these
402 * two heaps are taken care of by separate code to ensure they are adjacent
403 * to each other.
404 * Don't swap the order unless you know what you are doing!
405 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700406struct ion_platform_heap msm8930_heaps[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800407 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800408 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800409 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800410 .name = ION_VMALLOC_HEAP_NAME,
411 },
412#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
413 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800414 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800415 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800416 .name = ION_MM_HEAP_NAME,
417 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800418 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700419 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Laura Abbott87eafac2012-09-18 11:45:43 -0700420 .priv = &ion_mm_heap_device.dev
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800421 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800422 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800423 .id = ION_MM_FIRMWARE_HEAP_ID,
424 .type = ION_HEAP_TYPE_CARVEOUT,
425 .name = ION_MM_FIRMWARE_HEAP_NAME,
426 .size = MSM_ION_MM_FW_SIZE,
427 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700428 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800429 },
430 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800431 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800432 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800433 .name = ION_MFC_HEAP_NAME,
434 .size = MSM_ION_MFC_SIZE,
435 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700436 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800437 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700438#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800439 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800440 .id = ION_SF_HEAP_ID,
441 .type = ION_HEAP_TYPE_CARVEOUT,
442 .name = ION_SF_HEAP_NAME,
443 .size = MSM_ION_SF_SIZE,
444 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700445 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800446 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700447#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800448 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800449 .id = ION_IOMMU_HEAP_ID,
450 .type = ION_HEAP_TYPE_IOMMU,
451 .name = ION_IOMMU_HEAP_NAME,
452 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800453 {
454 .id = ION_QSECOM_HEAP_ID,
455 .type = ION_HEAP_TYPE_CARVEOUT,
456 .name = ION_QSECOM_HEAP_NAME,
457 .size = MSM_ION_QSECOM_SIZE,
458 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700459 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800460 },
Olav Haugan7355db02012-01-13 16:59:13 -0800461 {
462 .id = ION_AUDIO_HEAP_ID,
463 .type = ION_HEAP_TYPE_CARVEOUT,
464 .name = ION_AUDIO_HEAP_NAME,
465 .size = MSM_ION_AUDIO_SIZE,
466 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700467 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800468 },
Laura Abbott03e3cd72013-02-09 09:35:30 -0800469 {
470 .id = ION_ADSP_HEAP_ID,
471 .type = ION_HEAP_TYPE_DMA,
472 .name = ION_ADSP_HEAP_NAME,
473 .size = MSM_ION_ADSP_SIZE,
474 .memory_type = ION_EBI_TYPE,
475 .extra_data = (void *) &co_msm8930_ion_pdata,
476 .priv = &ion_adsp_heap_device.dev,
477 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800478#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700479};
480
481static struct ion_platform_data msm8930_ion_pdata = {
482 .nr = MSM_ION_HEAP_NUM,
483 .heaps = msm8930_heaps,
484
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800485};
486
Laura Abbottb93525f2012-04-12 09:57:19 -0700487static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800488 .name = "ion-msm",
489 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700490 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800491};
492#endif
493
Hanumant Singheea62562012-05-14 11:32:45 -0700494struct platform_device msm8930_fmem_device = {
495 .name = "fmem",
496 .id = 1,
497 .dev = { .platform_data = &msm8930_fmem_pdata },
498};
499
500static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
501 unsigned long size)
502{
503 msm8930_reserve_table[mem_type].size += size;
504}
505
506static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
507{
508#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
509 int ret;
510
511 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
512 panic("fixed area size is larger than %dM\n",
513 MAX_FIXED_AREA_SIZE >> 20);
514
515 reserve_info->fixed_area_size = fixed_area_size;
516 reserve_info->fixed_area_start = MSM8930_FW_START;
517
518 ret = memblock_remove(reserve_info->fixed_area_start,
519 reserve_info->fixed_area_size);
520 BUG_ON(ret);
521#endif
522}
523
524/**
525 * Reserve memory for ION and calculate amount of reusable memory for fmem.
526 * We only reserve memory for heaps that are not reusable. However, we only
527 * support one reusable heap at the moment so we ignore the reusable flag for
528 * other than the first heap with reusable flag set. Also handle special case
529 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
530 * at a higher address than FW in addition to not more than 256MB away from the
531 * base address of the firmware. This means that if MM is reusable the other
532 * two heaps must be allocated in the same region as FW. This is handled by the
533 * mem_is_fmem flag in the platform data. In addition the MM heap must be
534 * adjacent to the FW heap for content protection purposes.
535 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700536static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800537{
538#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700539 unsigned int i;
Laura Abbott87eafac2012-09-18 11:45:43 -0700540 int ret;
Hanumant Singheea62562012-05-14 11:32:45 -0700541 unsigned int fixed_size = 0;
542 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
543 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700544 unsigned long cma_alignment;
545 unsigned int low_use_cma = 0;
546 unsigned int middle_use_cma = 0;
547 unsigned int high_use_cma = 0;
Hanumant Singheea62562012-05-14 11:32:45 -0700548
Hanumant Singheea62562012-05-14 11:32:45 -0700549 fixed_low_size = 0;
550 fixed_middle_size = 0;
551 fixed_high_size = 0;
552
Laura Abbott87eafac2012-09-18 11:45:43 -0700553 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
554
Hanumant Singheea62562012-05-14 11:32:45 -0700555 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
Laura Abbott87eafac2012-09-18 11:45:43 -0700556 struct ion_platform_heap *heap =
Hanumant Singheea62562012-05-14 11:32:45 -0700557 &(msm8930_ion_pdata.heaps[i]);
558
Laura Abbott87eafac2012-09-18 11:45:43 -0700559 int use_cma = 0;
560
Hanumant Singheea62562012-05-14 11:32:45 -0700561 if (heap->extra_data) {
562 int fixed_position = NOT_FIXED;
Hanumant Singheea62562012-05-14 11:32:45 -0700563
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700564 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700565 case ION_HEAP_TYPE_CP:
Laura Abbott87eafac2012-09-18 11:45:43 -0700566 if (((struct ion_cp_heap_pdata *)
567 heap->extra_data)->is_cma) {
568 heap->size = ALIGN(heap->size,
569 cma_alignment);
570 use_cma = 1;
571 }
Hanumant Singheea62562012-05-14 11:32:45 -0700572 fixed_position = ((struct ion_cp_heap_pdata *)
573 heap->extra_data)->fixed_position;
574 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700575 case ION_HEAP_TYPE_DMA:
576 use_cma = 1;
577 /* Purposely fall through here */
Hanumant Singheea62562012-05-14 11:32:45 -0700578 case ION_HEAP_TYPE_CARVEOUT:
Hanumant Singheea62562012-05-14 11:32:45 -0700579 fixed_position = ((struct ion_co_heap_pdata *)
580 heap->extra_data)->fixed_position;
581 break;
582 default:
583 break;
584 }
585
586 if (fixed_position != NOT_FIXED)
587 fixed_size += heap->size;
588 else
589 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
590
Laura Abbott87eafac2012-09-18 11:45:43 -0700591 if (fixed_position == FIXED_LOW) {
Hanumant Singheea62562012-05-14 11:32:45 -0700592 fixed_low_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700593 low_use_cma = use_cma;
594 } else if (fixed_position == FIXED_MIDDLE) {
Hanumant Singheea62562012-05-14 11:32:45 -0700595 fixed_middle_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700596 middle_use_cma = use_cma;
597 } else if (fixed_position == FIXED_HIGH) {
Hanumant Singheea62562012-05-14 11:32:45 -0700598 fixed_high_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700599 high_use_cma = use_cma;
600 } else if (use_cma) {
601 /*
602 * Heaps that use CMA but are not part of the
603 * fixed set. Create wherever.
604 */
605 dma_declare_contiguous(
606 heap->priv,
607 heap->size,
608 0,
609 0xb0000000);
610 }
Hanumant Singheea62562012-05-14 11:32:45 -0700611 }
612 }
613
614 if (!fixed_size)
615 return;
Laura Abbott87eafac2012-09-18 11:45:43 -0700616 /*
617 * Given the setup for the fixed area, we can't round up all sizes.
618 * Some sizes must be set up exactly and aligned correctly. Incorrect
619 * alignments are considered a configuration issue
Hanumant Singheea62562012-05-14 11:32:45 -0700620 */
Hanumant Singheea62562012-05-14 11:32:45 -0700621
622 fixed_low_start = MSM8930_FIXED_AREA_START;
Laura Abbott87eafac2012-09-18 11:45:43 -0700623 if (low_use_cma) {
624 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
625 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
626 } else {
627 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
628 ret = memblock_remove(fixed_low_start,
629 fixed_low_size + HOLE_SIZE);
630 BUG_ON(ret);
631 }
632
Deepak Kotur9830bf02012-06-01 15:04:29 -0700633 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott87eafac2012-09-18 11:45:43 -0700634 if (middle_use_cma) {
635 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
636 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
637 } else {
638 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
639 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
640 BUG_ON(ret);
641 }
642
Hanumant Singheea62562012-05-14 11:32:45 -0700643 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700644 if (high_use_cma) {
645 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
646 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
647 } else {
648 /* This is the end of the fixed area so it's okay to round up */
649 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
650 ret = memblock_remove(fixed_high_start, fixed_high_size);
651 BUG_ON(ret);
652 }
Hanumant Singheea62562012-05-14 11:32:45 -0700653
654 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
655 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
656
657 if (heap->extra_data) {
658 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700659 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700660
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700661 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700662 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700663 pdata =
664 (struct ion_cp_heap_pdata *)heap->extra_data;
665 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700666 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700667 case ION_HEAP_TYPE_DMA:
Hanumant Singheea62562012-05-14 11:32:45 -0700668 case ION_HEAP_TYPE_CARVEOUT:
669 fixed_position = ((struct ion_co_heap_pdata *)
670 heap->extra_data)->fixed_position;
671 break;
672 default:
673 break;
674 }
675
676 switch (fixed_position) {
677 case FIXED_LOW:
678 heap->base = fixed_low_start;
679 break;
680 case FIXED_MIDDLE:
681 heap->base = fixed_middle_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700682 if (middle_use_cma)
683 dma_declare_contiguous(
684 &ion_mm_heap_device.dev,
685 heap->size,
686 fixed_middle_start,
687 0xa0000000);
Deepak Kotur9830bf02012-06-01 15:04:29 -0700688 pdata->secure_base = fixed_middle_start
689 - HOLE_SIZE;
690 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700691 break;
692 case FIXED_HIGH:
693 heap->base = fixed_high_start;
694 break;
695 default:
696 break;
697 }
698 }
699 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800700#endif
701}
Huaibin Yanga5419422011-12-08 23:52:10 -0800702
703static void __init reserve_mdp_memory(void)
704{
705 msm8930_mdp_writeback(msm8930_reserve_table);
706}
707
Laura Abbottf3173042012-05-29 15:23:18 -0700708#ifdef CONFIG_MSM_CACHE_DUMP
709static void __init reserve_cache_dump_memory(void)
710{
711 unsigned int total;
712
713 total = msm8930_cache_dump_pdata.l1_size +
714 msm8930_cache_dump_pdata.l2_size;
715 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
716}
717#else
718static void __init reserve_cache_dump_memory(void) { }
719#endif
720
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800721static void __init msm8930_calculate_reserve_sizes(void)
722{
723 size_pmem_devices();
724 reserve_pmem_memory();
725 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800726 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800727 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700728 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800729}
730
731static struct reserve_info msm8930_reserve_info __initdata = {
732 .memtype_reserve_table = msm8930_reserve_table,
733 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700734 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800735 .paddr_to_memtype = msm8930_paddr_to_memtype,
736};
737
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800738static void __init msm8930_early_memory(void)
739{
740 reserve_info = &msm8930_reserve_info;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800741}
742
743static void __init msm8930_reserve(void)
744{
745 msm_reserve();
746}
747
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800748static void __init msm8930_allocate_memory_regions(void)
749{
750 msm8930_allocate_fb_region();
751}
752
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530753#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800754
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530755#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800756
757/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
758 * 4 micbiases are used to power various analog and digital
759 * microphones operating at 1800 mV. Technically, all micbiases
760 * can source from single cfilter since all microphones operate
761 * at the same voltage level. The arrangement below is to make
762 * sure all cfilters are exercised. LDO_H regulator ouput level
763 * does not need to be as high as 2.85V. It is choosen for
764 * microphone sensitivity purpose.
765 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530766static struct wcd9xxx_pdata sitar_platform_data = {
767 .slimbus_slave_device = {
768 .name = "sitar-slave",
769 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800770 },
771 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530772 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530773 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530774 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800775 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530776 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800777 .cfilt1_mv = 1800,
778 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530779 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
780 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700781 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
782 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530783 },
784 .regulator = {
785 {
786 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700787 .min_uV = 1800000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530788 .max_uV = 2200000,
789 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
790 },
791 {
792 .name = "CDC_VDDA_RX",
793 .min_uV = 1800000,
794 .max_uV = 1800000,
795 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
796 },
797 {
798 .name = "CDC_VDDA_TX",
799 .min_uV = 1800000,
800 .max_uV = 1800000,
801 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
802 },
803 {
804 .name = "VDDIO_CDC",
805 .min_uV = 1800000,
806 .max_uV = 1800000,
807 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
808 },
809 {
810 .name = "VDDD_CDC_D",
811 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700812 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530813 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
814 },
815 {
816 .name = "CDC_VDDA_A_1P2V",
817 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700818 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530819 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
820 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800821 },
822};
823
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530824static struct slim_device msm_slim_sitar = {
825 .name = "sitar-slim",
826 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800827 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530828 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800829 },
830};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700831
832static struct wcd9xxx_pdata sitar1p1_platform_data = {
833 .slimbus_slave_device = {
834 .name = "sitar-slave",
835 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
836 },
837 .irq = MSM_GPIO_TO_INT(62),
838 .irq_base = SITAR_INTERRUPT_BASE,
839 .num_irqs = NR_WCD9XXX_IRQS,
840 .reset_gpio = 42,
841 .micbias = {
842 .ldoh_v = SITAR_LDOH_2P85_V,
843 .cfilt1_mv = 1800,
844 .cfilt2_mv = 1800,
845 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
846 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700847 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
848 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700849 },
850 .regulator = {
851 {
852 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700853 .min_uV = 1800000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700854 .max_uV = 2200000,
855 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
856 },
857 {
858 .name = "CDC_VDDA_RX",
859 .min_uV = 1800000,
860 .max_uV = 1800000,
861 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
862 },
863 {
864 .name = "CDC_VDDA_TX",
865 .min_uV = 1800000,
866 .max_uV = 1800000,
867 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
868 },
869 {
870 .name = "VDDIO_CDC",
871 .min_uV = 1800000,
872 .max_uV = 1800000,
873 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
874 },
875 {
876 .name = "VDDD_CDC_D",
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_D_CUR_MAX,
880 },
881 {
882 .name = "CDC_VDDA_A_1P2V",
883 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700884 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700885 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
886 },
887 },
888};
889
890static struct slim_device msm_slim_sitar1p1 = {
891 .name = "sitar1p1-slim",
892 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
893 .dev = {
894 .platform_data = &sitar1p1_platform_data,
895 },
896};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800897#endif
898
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530899
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800900static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530901#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800902 {
903 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530904 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800905 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700906 {
907 .bus_num = 1,
908 .slim_slave = &msm_slim_sitar1p1,
909 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800910#endif
911 /* add more slimbus slaves as needed */
912};
913
914#define MSM_WCNSS_PHYS 0x03000000
915#define MSM_WCNSS_SIZE 0x280000
916
917static struct resource resources_wcnss_wlan[] = {
918 {
919 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
920 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
921 .name = "wcnss_wlanrx_irq",
922 .flags = IORESOURCE_IRQ,
923 },
924 {
925 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
926 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
927 .name = "wcnss_wlantx_irq",
928 .flags = IORESOURCE_IRQ,
929 },
930 {
931 .start = MSM_WCNSS_PHYS,
932 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
933 .name = "wcnss_mmio",
934 .flags = IORESOURCE_MEM,
935 },
936 {
937 .start = 84,
938 .end = 88,
939 .name = "wcnss_gpios_5wire",
940 .flags = IORESOURCE_IO,
941 },
942};
943
944static struct qcom_wcnss_opts qcom_wcnss_pdata = {
945 .has_48mhz_xo = 1,
946};
947
948static struct platform_device msm_device_wcnss_wlan = {
949 .name = "wcnss_wlan",
950 .id = 0,
951 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
952 .resource = resources_wcnss_wlan,
953 .dev = {.platform_data = &qcom_wcnss_pdata},
954};
955
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700956#ifdef CONFIG_QSEECOM
957/* qseecom bus scaling */
958static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
959 {
960 .src = MSM_BUS_MASTER_SPS,
961 .dst = MSM_BUS_SLAVE_EBI_CH0,
962 .ib = 0,
963 .ab = 0,
964 },
965 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -0700966 .src = MSM_BUS_MASTER_SPS,
967 .dst = MSM_BUS_SLAVE_SPS,
968 .ib = 0,
969 .ab = 0,
970 },
971 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700972 .src = MSM_BUS_MASTER_SPDM,
973 .dst = MSM_BUS_SLAVE_SPDM,
974 .ib = 0,
975 .ab = 0,
976 },
977};
978
979static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
980 {
981 .src = MSM_BUS_MASTER_SPS,
982 .dst = MSM_BUS_SLAVE_EBI_CH0,
983 .ib = (492 * 8) * 1000000UL,
984 .ab = (492 * 8) * 100000UL,
985 },
986 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -0700987 .src = MSM_BUS_MASTER_SPS,
988 .dst = MSM_BUS_SLAVE_SPS,
989 .ib = (492 * 8) * 1000000UL,
990 .ab = (492 * 8) * 100000UL,
991 },
992 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700993 .src = MSM_BUS_MASTER_SPDM,
994 .dst = MSM_BUS_SLAVE_SPDM,
995 .ib = 0,
996 .ab = 0,
997 },
998};
999
1000static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1001 {
1002 .src = MSM_BUS_MASTER_SPS,
1003 .dst = MSM_BUS_SLAVE_EBI_CH0,
1004 .ib = 0,
1005 .ab = 0,
1006 },
1007 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001008 .src = MSM_BUS_MASTER_SPS,
1009 .dst = MSM_BUS_SLAVE_SPS,
1010 .ib = 0,
1011 .ab = 0,
1012 },
1013 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001014 .src = MSM_BUS_MASTER_SPDM,
1015 .dst = MSM_BUS_SLAVE_SPDM,
1016 .ib = (64 * 8) * 1000000UL,
1017 .ab = (64 * 8) * 100000UL,
1018 },
1019};
1020
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001021static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1022 {
1023 .src = MSM_BUS_MASTER_SPS,
1024 .dst = MSM_BUS_SLAVE_EBI_CH0,
1025 .ib = (492 * 8) * 1000000UL,
1026 .ab = (492 * 8) * 100000UL,
1027 },
1028 {
1029 .src = MSM_BUS_MASTER_SPS,
1030 .dst = MSM_BUS_SLAVE_SPS,
1031 .ib = (492 * 8) * 1000000UL,
1032 .ab = (492 * 8) * 100000UL,
1033 },
1034 {
1035 .src = MSM_BUS_MASTER_SPDM,
1036 .dst = MSM_BUS_SLAVE_SPDM,
1037 .ib = (64 * 8) * 1000000UL,
1038 .ab = (64 * 8) * 100000UL,
1039 },
1040};
1041
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001042static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1043 {
1044 ARRAY_SIZE(qseecom_clks_init_vectors),
1045 qseecom_clks_init_vectors,
1046 },
1047 {
1048 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1049 qseecom_enable_sfpb_vectors,
1050 },
1051 {
1052 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1053 qseecom_enable_sfpb_vectors,
1054 },
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001055 {
1056 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1057 qseecom_enable_dfab_sfpb_vectors,
1058 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001059};
1060
1061static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1062 qseecom_hw_bus_scale_usecases,
1063 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1064 .name = "qsee",
1065};
1066
1067static struct platform_device qseecom_device = {
1068 .name = "qseecom",
1069 .id = 0,
1070 .dev = {
1071 .platform_data = &qseecom_bus_pdata,
1072 },
1073};
1074#endif
1075
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001076#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1077 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1078 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1079 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1080
1081#define QCE_SIZE 0x10000
1082#define QCE_0_BASE 0x18500000
1083
1084#define QCE_HW_KEY_SUPPORT 0
1085#define QCE_SHA_HMAC_SUPPORT 1
1086#define QCE_SHARE_CE_RESOURCE 1
1087#define QCE_CE_SHARED 0
1088
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001089/* Begin Bus scaling definitions */
1090static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1091 {
1092 .src = MSM_BUS_MASTER_ADM_PORT0,
1093 .dst = MSM_BUS_SLAVE_EBI_CH0,
1094 .ab = 0,
1095 .ib = 0,
1096 },
1097 {
1098 .src = MSM_BUS_MASTER_ADM_PORT1,
1099 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1100 .ab = 0,
1101 .ib = 0,
1102 },
1103};
1104
1105static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1106 {
1107 .src = MSM_BUS_MASTER_ADM_PORT0,
1108 .dst = MSM_BUS_SLAVE_EBI_CH0,
1109 .ab = 70000000UL,
1110 .ib = 70000000UL,
1111 },
1112 {
1113 .src = MSM_BUS_MASTER_ADM_PORT1,
1114 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1115 .ab = 2480000000UL,
1116 .ib = 2480000000UL,
1117 },
1118};
1119
1120static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1121 {
1122 ARRAY_SIZE(crypto_hw_init_vectors),
1123 crypto_hw_init_vectors,
1124 },
1125 {
1126 ARRAY_SIZE(crypto_hw_active_vectors),
1127 crypto_hw_active_vectors,
1128 },
1129};
1130
1131static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1132 crypto_hw_bus_scale_usecases,
1133 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1134 .name = "cryptohw",
1135};
1136/* End Bus Scaling Definitions*/
1137
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001138static struct resource qcrypto_resources[] = {
1139 [0] = {
1140 .start = QCE_0_BASE,
1141 .end = QCE_0_BASE + QCE_SIZE - 1,
1142 .flags = IORESOURCE_MEM,
1143 },
1144 [1] = {
1145 .name = "crypto_channels",
1146 .start = DMOV_CE_IN_CHAN,
1147 .end = DMOV_CE_OUT_CHAN,
1148 .flags = IORESOURCE_DMA,
1149 },
1150 [2] = {
1151 .name = "crypto_crci_in",
1152 .start = DMOV_CE_IN_CRCI,
1153 .end = DMOV_CE_IN_CRCI,
1154 .flags = IORESOURCE_DMA,
1155 },
1156 [3] = {
1157 .name = "crypto_crci_out",
1158 .start = DMOV_CE_OUT_CRCI,
1159 .end = DMOV_CE_OUT_CRCI,
1160 .flags = IORESOURCE_DMA,
1161 },
1162};
1163
1164static struct resource qcedev_resources[] = {
1165 [0] = {
1166 .start = QCE_0_BASE,
1167 .end = QCE_0_BASE + QCE_SIZE - 1,
1168 .flags = IORESOURCE_MEM,
1169 },
1170 [1] = {
1171 .name = "crypto_channels",
1172 .start = DMOV_CE_IN_CHAN,
1173 .end = DMOV_CE_OUT_CHAN,
1174 .flags = IORESOURCE_DMA,
1175 },
1176 [2] = {
1177 .name = "crypto_crci_in",
1178 .start = DMOV_CE_IN_CRCI,
1179 .end = DMOV_CE_IN_CRCI,
1180 .flags = IORESOURCE_DMA,
1181 },
1182 [3] = {
1183 .name = "crypto_crci_out",
1184 .start = DMOV_CE_OUT_CRCI,
1185 .end = DMOV_CE_OUT_CRCI,
1186 .flags = IORESOURCE_DMA,
1187 },
1188};
1189
1190#endif
1191
1192#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1193 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1194
1195static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1196 .ce_shared = QCE_CE_SHARED,
1197 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1198 .hw_key_support = QCE_HW_KEY_SUPPORT,
1199 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001200 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001201};
1202
1203static struct platform_device qcrypto_device = {
1204 .name = "qcrypto",
1205 .id = 0,
1206 .num_resources = ARRAY_SIZE(qcrypto_resources),
1207 .resource = qcrypto_resources,
1208 .dev = {
1209 .coherent_dma_mask = DMA_BIT_MASK(32),
1210 .platform_data = &qcrypto_ce_hw_suppport,
1211 },
1212};
1213#endif
1214
1215#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1216 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1217
1218static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1219 .ce_shared = QCE_CE_SHARED,
1220 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1221 .hw_key_support = QCE_HW_KEY_SUPPORT,
1222 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001223 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001224};
1225
1226static struct platform_device qcedev_device = {
1227 .name = "qce",
1228 .id = 0,
1229 .num_resources = ARRAY_SIZE(qcedev_resources),
1230 .resource = qcedev_resources,
1231 .dev = {
1232 .coherent_dma_mask = DMA_BIT_MASK(32),
1233 .platform_data = &qcedev_ce_hw_suppport,
1234 },
1235};
1236#endif
1237
1238#define MDM2AP_ERRFATAL 70
1239#define AP2MDM_ERRFATAL 95
1240#define MDM2AP_STATUS 69
1241#define AP2MDM_STATUS 94
1242#define AP2MDM_PMIC_RESET_N 80
1243#define AP2MDM_KPDPWR_N 81
1244
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001245static struct resource mdm_resources[] = {
1246 {
1247 .start = MDM2AP_ERRFATAL,
1248 .end = MDM2AP_ERRFATAL,
1249 .name = "MDM2AP_ERRFATAL",
1250 .flags = IORESOURCE_IO,
1251 },
1252 {
1253 .start = AP2MDM_ERRFATAL,
1254 .end = AP2MDM_ERRFATAL,
1255 .name = "AP2MDM_ERRFATAL",
1256 .flags = IORESOURCE_IO,
1257 },
1258 {
1259 .start = MDM2AP_STATUS,
1260 .end = MDM2AP_STATUS,
1261 .name = "MDM2AP_STATUS",
1262 .flags = IORESOURCE_IO,
1263 },
1264 {
1265 .start = AP2MDM_STATUS,
1266 .end = AP2MDM_STATUS,
1267 .name = "AP2MDM_STATUS",
1268 .flags = IORESOURCE_IO,
1269 },
1270 {
1271 .start = AP2MDM_PMIC_RESET_N,
1272 .end = AP2MDM_PMIC_RESET_N,
1273 .name = "AP2MDM_PMIC_RESET_N",
1274 .flags = IORESOURCE_IO,
1275 },
1276 {
1277 .start = AP2MDM_KPDPWR_N,
1278 .end = AP2MDM_KPDPWR_N,
1279 .name = "AP2MDM_KPDPWR_N",
1280 .flags = IORESOURCE_IO,
1281 },
1282};
1283
1284static struct mdm_platform_data mdm_platform_data = {
1285 .mdm_version = "2.5",
1286};
1287
1288static struct platform_device mdm_device = {
1289 .name = "mdm2_modem",
1290 .id = -1,
1291 .num_resources = ARRAY_SIZE(mdm_resources),
1292 .resource = mdm_resources,
1293 .dev = {
1294 .platform_data = &mdm_platform_data,
1295 },
1296};
1297
Taniya Das087145b2013-03-16 21:37:41 +05301298static struct mdm_platform_data sglte_platform_data = {
1299 .mdm_version = "4.0",
1300 .ramdump_delay_ms = 1000,
1301 .soft_reset_inverted = 1,
1302 .peripheral_platform_device = NULL,
1303 .ramdump_timeout_ms = 600000,
1304 .no_powerdown_after_ramdumps = 1,
1305 .image_upgrade_supported = 1,
1306};
1307
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001308static struct platform_device *mdm_devices[] __initdata = {
1309 &mdm_device,
1310};
1311
Praveen Chidambaram78499012011-11-01 17:15:17 -06001312#ifdef CONFIG_MSM_MPM
1313static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1314 [1] = MSM_GPIO_TO_INT(46),
1315 [2] = MSM_GPIO_TO_INT(150),
1316 [4] = MSM_GPIO_TO_INT(103),
1317 [5] = MSM_GPIO_TO_INT(104),
1318 [6] = MSM_GPIO_TO_INT(105),
1319 [7] = MSM_GPIO_TO_INT(106),
1320 [8] = MSM_GPIO_TO_INT(107),
1321 [9] = MSM_GPIO_TO_INT(7),
1322 [10] = MSM_GPIO_TO_INT(11),
1323 [11] = MSM_GPIO_TO_INT(15),
1324 [12] = MSM_GPIO_TO_INT(19),
1325 [13] = MSM_GPIO_TO_INT(23),
1326 [14] = MSM_GPIO_TO_INT(27),
1327 [15] = MSM_GPIO_TO_INT(31),
1328 [16] = MSM_GPIO_TO_INT(35),
1329 [19] = MSM_GPIO_TO_INT(90),
1330 [20] = MSM_GPIO_TO_INT(92),
1331 [23] = MSM_GPIO_TO_INT(85),
1332 [24] = MSM_GPIO_TO_INT(83),
1333 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001334 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001335 [27] = HDMI_IRQ,
1336 [29] = MSM_GPIO_TO_INT(10),
1337 [30] = MSM_GPIO_TO_INT(102),
1338 [31] = MSM_GPIO_TO_INT(81),
1339 [32] = MSM_GPIO_TO_INT(78),
1340 [33] = MSM_GPIO_TO_INT(94),
1341 [34] = MSM_GPIO_TO_INT(72),
1342 [35] = MSM_GPIO_TO_INT(39),
1343 [36] = MSM_GPIO_TO_INT(43),
1344 [37] = MSM_GPIO_TO_INT(61),
1345 [38] = MSM_GPIO_TO_INT(50),
1346 [39] = MSM_GPIO_TO_INT(42),
1347 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001348 [42] = MSM_GPIO_TO_INT(8),
1349 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001350 [44] = MSM_GPIO_TO_INT(70),
1351 [45] = MSM_GPIO_TO_INT(69),
1352 [46] = MSM_GPIO_TO_INT(67),
1353 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001354 [48] = MSM_GPIO_TO_INT(55),
1355 [49] = MSM_GPIO_TO_INT(74),
1356 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001357 [51] = MSM_GPIO_TO_INT(49),
1358 [52] = MSM_GPIO_TO_INT(40),
1359 [53] = MSM_GPIO_TO_INT(37),
1360 [54] = MSM_GPIO_TO_INT(24),
1361 [55] = MSM_GPIO_TO_INT(14),
1362};
1363
1364static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1365 TLMM_MSM_SUMMARY_IRQ,
1366 RPM_APCC_CPU0_GP_HIGH_IRQ,
1367 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1368 RPM_APCC_CPU0_GP_LOW_IRQ,
1369 RPM_APCC_CPU0_WAKE_UP_IRQ,
1370 RPM_APCC_CPU1_GP_HIGH_IRQ,
1371 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1372 RPM_APCC_CPU1_GP_LOW_IRQ,
1373 RPM_APCC_CPU1_WAKE_UP_IRQ,
1374 MSS_TO_APPS_IRQ_0,
1375 MSS_TO_APPS_IRQ_1,
1376 MSS_TO_APPS_IRQ_2,
1377 MSS_TO_APPS_IRQ_3,
1378 MSS_TO_APPS_IRQ_4,
1379 MSS_TO_APPS_IRQ_5,
1380 MSS_TO_APPS_IRQ_6,
1381 MSS_TO_APPS_IRQ_7,
1382 MSS_TO_APPS_IRQ_8,
1383 MSS_TO_APPS_IRQ_9,
1384 LPASS_SCSS_GP_LOW_IRQ,
1385 LPASS_SCSS_GP_MEDIUM_IRQ,
1386 LPASS_SCSS_GP_HIGH_IRQ,
1387 SPS_MTI_30,
1388 SPS_MTI_31,
1389 RIVA_APSS_SPARE_IRQ,
1390 RIVA_APPS_WLAN_SMSM_IRQ,
1391 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1392 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1393};
1394
1395struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1396 .irqs_m2a = msm_mpm_irqs_m2a,
1397 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1398 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1399 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1400 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1401 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1402 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1403 .mpm_apps_ipc_val = BIT(1),
1404 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1405
1406};
1407#endif
1408
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001409#define MSM_SHARED_RAM_PHYS 0x80000000
1410
1411static void __init msm8930_map_io(void)
1412{
1413 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1414 msm_map_msm8930_io();
1415
1416 if (socinfo_init() < 0)
1417 pr_err("socinfo_init() failed!\n");
1418}
1419
1420static void __init msm8930_init_irq(void)
1421{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001422 struct msm_mpm_device_data *data = NULL;
1423#ifdef CONFIG_MSM_MPM
1424 data = &msm8930_mpm_dev_data;
1425#endif
1426
1427 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001428 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1429 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001430}
1431
1432static void __init msm8930_init_buses(void)
1433{
1434#ifdef CONFIG_MSM_BUS_SCALING
1435 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001436 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1437 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1438 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1439 msm_bus_8930_apps_fabric.dev.platform_data =
1440 &msm_bus_8930_apps_fabric_pdata;
1441 msm_bus_8930_sys_fabric.dev.platform_data =
1442 &msm_bus_8930_sys_fabric_pdata;
1443 msm_bus_8930_mm_fabric.dev.platform_data =
1444 &msm_bus_8930_mm_fabric_pdata;
1445 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1446 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001447#endif
1448}
1449
1450static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1451 .max_clock_speed = 15060000,
1452};
1453
1454#ifdef CONFIG_USB_MSM_OTG_72K
1455static struct msm_otg_platform_data msm_otg_pdata;
1456#else
Mayank Rana2a1c7db2013-01-08 15:10:51 +05301457static int enable_usb_host_mode;
1458static int __init usb_host_mode_with_pm8917(char *param)
1459{
1460 int ret;
1461
1462 ret = kstrtoint(param, 10, &enable_usb_host_mode);
1463 return ret;
1464}
1465early_param("usb_host_mode_pm8917", usb_host_mode_with_pm8917);
1466
Manu Gautam32ab9462012-02-20 12:33:01 +05301467#ifdef CONFIG_MSM_BUS_SCALING
1468/* Bandwidth requests (zero) if no vote placed */
1469static struct msm_bus_vectors usb_init_vectors[] = {
1470 {
1471 .src = MSM_BUS_MASTER_SPS,
1472 .dst = MSM_BUS_SLAVE_EBI_CH0,
1473 .ab = 0,
1474 .ib = 0,
1475 },
1476};
1477
1478/* Bus bandwidth requests in Bytes/sec */
1479static struct msm_bus_vectors usb_max_vectors[] = {
1480 {
1481 .src = MSM_BUS_MASTER_SPS,
1482 .dst = MSM_BUS_SLAVE_EBI_CH0,
1483 .ab = 60000000, /* At least 480Mbps on bus. */
1484 .ib = 960000000, /* MAX bursts rate */
1485 },
1486};
1487
1488static struct msm_bus_paths usb_bus_scale_usecases[] = {
1489 {
1490 ARRAY_SIZE(usb_init_vectors),
1491 usb_init_vectors,
1492 },
1493 {
1494 ARRAY_SIZE(usb_max_vectors),
1495 usb_max_vectors,
1496 },
1497};
1498
1499static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1500 usb_bus_scale_usecases,
1501 ARRAY_SIZE(usb_bus_scale_usecases),
1502 .name = "usb",
1503};
1504#endif
1505
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301506static int hsusb_phy_init_seq[] = {
1507 0x44, 0x80, /* set VBUS valid threshold
1508 and disconnect valid threshold */
1509 0x38, 0x81, /* update DC voltage level */
1510 0x24, 0x82, /* set preemphasis and rise/fall time */
1511 0x13, 0x83, /* set source impedance adjusment */
1512 -1};
1513
Jack Pham87f202f2012-08-06 00:24:22 -07001514#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1515
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001516static struct msm_otg_platform_data msm_otg_pdata = {
1517 .mode = USB_OTG,
1518 .otg_control = OTG_PMIC_CONTROL,
1519 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001520 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301521#ifdef CONFIG_MSM_BUS_SCALING
1522 .bus_scale_table = &usb_bus_scale_pdata,
1523#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301524#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1525 .mhl_dev_name = "sii8334",
1526#endif
Jack Pham87f202f2012-08-06 00:24:22 -07001527 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001528};
1529#endif
1530
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001531#define PID_MAGIC_ID 0x71432909
1532#define SERIAL_NUM_MAGIC_ID 0x61945374
1533#define SERIAL_NUMBER_LENGTH 127
1534#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1535
1536struct magic_num_struct {
1537 uint32_t pid;
1538 uint32_t serial_num;
1539};
1540
1541struct dload_struct {
1542 uint32_t reserved1;
1543 uint32_t reserved2;
1544 uint32_t reserved3;
1545 uint16_t reserved4;
1546 uint16_t pid;
1547 char serial_number[SERIAL_NUMBER_LENGTH];
1548 uint16_t reserved5;
1549 struct magic_num_struct magic_struct;
1550};
1551
1552static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1553{
1554 struct dload_struct __iomem *dload = 0;
1555
1556 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1557 if (!dload) {
1558 pr_err("%s: cannot remap I/O memory region: %08x\n",
1559 __func__, DLOAD_USB_BASE_ADD);
1560 return -ENXIO;
1561 }
1562
1563 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1564 __func__, dload, pid, snum);
1565 /* update pid */
1566 dload->magic_struct.pid = PID_MAGIC_ID;
1567 dload->pid = pid;
1568
1569 /* update serial number */
1570 dload->magic_struct.serial_num = 0;
1571 if (!snum) {
1572 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1573 goto out;
1574 }
1575
1576 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1577 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1578out:
1579 iounmap(dload);
1580 return 0;
1581}
1582
1583static struct android_usb_platform_data android_usb_pdata = {
1584 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1585};
1586
1587static struct platform_device android_usb_device = {
1588 .name = "android_usb",
1589 .id = -1,
1590 .dev = {
1591 .platform_data = &android_usb_pdata,
1592 },
1593};
1594
1595static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001596 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001597};
1598
Anji Jonnala786b39e2013-01-29 13:34:10 +05301599
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301600static uint8_t spm_retention_cmd_sequence[] __initdata = {
1601 0x00, 0x05, 0x03, 0x0D,
1602 0x0B, 0x00, 0x0f,
1603};
1604
Anji Jonnala786b39e2013-01-29 13:34:10 +05301605static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
1606 0x42, 0x1B, 0x00,
1607 0x05, 0x03, 0x0D, 0x0B,
1608 0x00, 0x42, 0x1B,
1609 0x0f,
1610};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001611static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001612 0x00, 0x24, 0x54, 0x10,
1613 0x09, 0x03, 0x01,
1614 0x10, 0x54, 0x30, 0x0C,
1615 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001616};
1617
1618static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001619 0x00, 0x24, 0x54, 0x10,
1620 0x09, 0x07, 0x01, 0x0B,
1621 0x10, 0x54, 0x30, 0x0C,
1622 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001623};
1624
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301625static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1626 [0] = {
1627 .mode = MSM_SPM_MODE_CLOCK_GATING,
1628 .notify_rpm = false,
1629 .cmd = spm_wfi_cmd_sequence,
1630 },
1631 [1] = {
1632 .mode = MSM_SPM_MODE_POWER_RETENTION,
1633 .notify_rpm = false,
1634 .cmd = spm_retention_cmd_sequence,
1635 },
1636 [2] = {
1637 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1638 .notify_rpm = false,
1639 .cmd = spm_power_collapse_without_rpm,
1640 },
1641 [3] = {
1642 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1643 .notify_rpm = true,
1644 .cmd = spm_power_collapse_with_rpm,
1645 },
1646};
1647
1648static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001649 [0] = {
1650 .mode = MSM_SPM_MODE_CLOCK_GATING,
1651 .notify_rpm = false,
1652 .cmd = spm_wfi_cmd_sequence,
1653 },
1654 [1] = {
Anji Jonnala786b39e2013-01-29 13:34:10 +05301655 .mode = MSM_SPM_MODE_POWER_RETENTION,
1656 .notify_rpm = false,
1657 .cmd = spm_retention_cmd_sequence,
1658 },
1659 [2] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001660 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1661 .notify_rpm = false,
1662 .cmd = spm_power_collapse_without_rpm,
1663 },
Anji Jonnala786b39e2013-01-29 13:34:10 +05301664 [3] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001665 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1666 .notify_rpm = true,
1667 .cmd = spm_power_collapse_with_rpm,
1668 },
1669};
1670
1671static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1672 [0] = {
1673 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001674 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001675#if defined(CONFIG_MSM_AVS_HW)
1676 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1677 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1678#endif
1679 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301680 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1681 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1682 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001683 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301684 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1685 .modes = msm_spm_boot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001686 },
1687 [1] = {
1688 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001689 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001690#if defined(CONFIG_MSM_AVS_HW)
1691 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1692 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1693#endif
1694 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala786b39e2013-01-29 13:34:10 +05301695 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1696 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1697 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001698 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301699 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1700 .modes = msm_spm_nonboot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001701 },
1702};
1703
1704static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001705 0x00, 0x20, 0x03, 0x20,
1706 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001707};
1708
1709static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001710 0x00, 0x20, 0x34, 0x64,
1711 0x48, 0x07, 0x48, 0x20,
1712 0x50, 0x64, 0x04, 0x34,
1713 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001714};
1715static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001716 0x00, 0x10, 0x34, 0x64,
1717 0x48, 0x07, 0x48, 0x10,
1718 0x50, 0x64, 0x04, 0x34,
1719 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001720};
1721
1722static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1723 [0] = {
1724 .mode = MSM_SPM_L2_MODE_RETENTION,
1725 .notify_rpm = false,
1726 .cmd = l2_spm_wfi_cmd_sequence,
1727 },
1728 [1] = {
1729 .mode = MSM_SPM_L2_MODE_GDHS,
1730 .notify_rpm = true,
1731 .cmd = l2_spm_gdhs_cmd_sequence,
1732 },
1733 [2] = {
1734 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1735 .notify_rpm = true,
1736 .cmd = l2_spm_power_off_cmd_sequence,
1737 },
1738};
1739
1740static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1741 [0] = {
1742 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001743 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001744 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001745 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1746 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1747 .modes = msm_spm_l2_seq_list,
1748 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1749 },
1750};
1751
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301752#define ISA1200_HAP_EN_GPIO 77
1753#define ISA1200_HAP_LEN_GPIO 78
David Collins04499982012-08-06 15:02:03 -07001754#define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7)
1755#define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001756
1757static int isa1200_power(int on)
1758{
David Collins04499982012-08-06 15:02:03 -07001759 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
1760 enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1;
Amy Malocheb20c1052012-04-11 10:36:13 -07001761 int rc = 0;
1762
David Collins04499982012-08-06 15:02:03 -07001763 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
1764 gpio = ISA1200_HAP_CLK_PM8917;
1765 clk_id = CLK_MP3_2;
1766 }
1767
1768 gpio_set_value_cansleep(gpio, !!on);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301769
Amy Malocheb20c1052012-04-11 10:36:13 -07001770 if (on)
David Collins04499982012-08-06 15:02:03 -07001771 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001772 else
David Collins04499982012-08-06 15:02:03 -07001773 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001774
1775 if (rc) {
1776 pr_err("%s: unable to write aux clock register(%d)\n",
1777 __func__, rc);
1778 }
1779
1780 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001781}
1782
1783static int isa1200_dev_setup(bool enable)
1784{
David Collins04499982012-08-06 15:02:03 -07001785 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001786 int rc = 0;
1787
David Collins04499982012-08-06 15:02:03 -07001788 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1789 gpio = ISA1200_HAP_CLK_PM8917;
1790
Amy Malocheb20c1052012-04-11 10:36:13 -07001791 if (!enable)
1792 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301793
David Collins04499982012-08-06 15:02:03 -07001794 rc = gpio_request(gpio, "haptics_clk");
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301795 if (rc) {
1796 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001797 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301798 goto fail_gpio_req;
1799 }
1800
David Collins04499982012-08-06 15:02:03 -07001801 rc = gpio_direction_output(gpio, 0);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301802 if (rc) {
1803 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001804 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301805 goto fail_gpio_dir;
1806 }
1807
1808 return 0;
1809
1810fail_gpio_dir:
David Collins04499982012-08-06 15:02:03 -07001811 gpio_free(gpio);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301812fail_gpio_req:
1813 return rc;
1814
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001815}
1816
1817static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301818 {
1819 .name = "vddp",
1820 .min_uV = ISA_I2C_VTG_MIN_UV,
1821 .max_uV = ISA_I2C_VTG_MAX_UV,
1822 .load_uA = ISA_I2C_CURR_UA,
1823 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001824 {
1825 .name = "vcc_i2c",
1826 .min_uV = ISA_I2C_VTG_MIN_UV,
1827 .max_uV = ISA_I2C_VTG_MAX_UV,
1828 .load_uA = ISA_I2C_CURR_UA,
1829 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001830};
1831
1832static struct isa1200_platform_data isa1200_1_pdata = {
1833 .name = "vibrator",
1834 .dev_setup = isa1200_dev_setup,
1835 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301836 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1837 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001838 .max_timeout = 15000,
1839 .mode_ctrl = PWM_GEN_MODE,
1840 .pwm_fd = {
1841 .pwm_div = 256,
1842 },
1843 .is_erm = false,
1844 .smart_en = true,
1845 .ext_clk_en = true,
1846 .chip_en = 1,
1847 .regulator_info = isa1200_reg_data,
1848 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1849};
1850
1851static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1852 {
1853 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1854 .platform_data = &isa1200_1_pdata,
1855 },
1856};
1857
Amy Malochef3c9db42011-12-08 15:17:35 -08001858#define MXT_TS_GPIO_IRQ 11
1859#define MXT_TS_RESET_GPIO 52
1860
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301861static const u8 mxt_config_data_8930_v1[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001862 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001863 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001864 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301865 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001866 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301867 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001868 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301869 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001870 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301871 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1872 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1873 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1874 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001875 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001876 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1877 0,
1878 /* T18 Object */
1879 0, 0,
1880 /* T19 Object */
1881 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1882 0, 0, 0, 0, 0, 0,
1883 /* T23 Object */
1884 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1885 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001886 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001887 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1888 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001889 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001890 0, 0, 0, 0, 0,
1891 /* T42 Object */
1892 0, 0, 0, 0, 0, 0, 0, 0,
1893 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301894 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001895 /* T47 Object */
1896 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1897 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301898 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1899 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1900 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001901 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1902 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1903 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001904};
1905
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301906static const u8 mxt_config_data_8930_v2[] = {
1907 /* T6 Object */
1908 0, 0, 0, 0, 0, 0,
1909 /* T38 Object */
1910 15, 4, 0, 9, 7, 12, 0, 0,
1911 /* T7 Object */
1912 32, 16, 50,
1913 /* T8 Object */
1914 30, 0, 5, 10, 0, 0, 10, 10, 0, 0,
1915 /* T9 Object */
1916 131, 0, 0, 19, 11, 0, 16, 50, 1, 3,
1917 12, 7, 2, 0, 4, 5, 2, 10, 43, 4,
1918 54, 2, -25, 29, 38, 18, 143, 40, 207, 80,
1919 17, 5, 50, 50, 0,
1920 /* T18 Object */
1921 0, 0,
1922 /* T19 Object */
1923 0, 0, 0, 0, 0, 0,
1924 /* T25 Object */
1925 0, 0, 0, 0, 0, 0,
1926 /* T42 Object */
1927 3, 60, 20, 20, 150, 0, 0, 0,
1928 /* T46 Object */
1929 0, 3, 28, 28, 0, 0, 1, 0, 0,
1930 /* T47 Object */
1931 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1932 /* T48 Object */
1933 1, 3, 82, 0, 0, 0, 0, 0, 0, 0,
1934 16, 30, 0, 6, 6, 0, 0, 124, 4, 100,
1935 0, 0, 0, 5, 0, 42, 0, 1, 0, 40,
1936 52, 20, 0, 0, 0, 50, 1, 5, 2, 1,
1937 4, 5, 3, -25, 29, 38, 18, 143, 40, 207,
1938 80, 10, 5, 2,
1939 /* T55 Object */
1940 0, 0, 0, 0,
1941};
1942
Amy Malochef3c9db42011-12-08 15:17:35 -08001943static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1944 struct kobj_attribute *attr, char *buf)
1945{
1946 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301947 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1948 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1949 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1950 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001951 "\n");
1952}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001953
Amy Malochef3c9db42011-12-08 15:17:35 -08001954static struct kobj_attribute mxt224e_vkeys_attr = {
1955 .attr = {
1956 .mode = S_IRUGO,
1957 },
1958 .show = &mxt224e_vkeys_show,
1959};
1960
1961static struct attribute *mxt224e_properties_attrs[] = {
1962 &mxt224e_vkeys_attr.attr,
1963 NULL
1964};
1965
1966static struct attribute_group mxt224e_properties_attr_group = {
1967 .attrs = mxt224e_properties_attrs,
1968};
1969
1970static void mxt_init_vkeys_8930(void)
1971{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001972 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001973 static struct kobject *mxt224e_properties_kobj;
1974
1975 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1976 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1977 NULL);
1978 if (mxt224e_properties_kobj)
1979 rc = sysfs_create_group(mxt224e_properties_kobj,
1980 &mxt224e_properties_attr_group);
1981 if (!mxt224e_properties_kobj || rc)
1982 pr_err("%s: failed to create board_properties\n",
1983 __func__);
1984
1985 return;
1986}
1987
Jing Lindc4413c2012-01-16 15:22:52 -08001988static struct mxt_config_info mxt_config_array[] = {
1989 {
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301990 .config = mxt_config_data_8930_v1,
1991 .config_length = ARRAY_SIZE(mxt_config_data_8930_v1),
Jing Lindc4413c2012-01-16 15:22:52 -08001992 .family_id = 0x81,
1993 .variant_id = 0x01,
1994 .version = 0x10,
1995 .build = 0xAA,
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301996 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1997 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1998 },
1999 {
2000 .config = mxt_config_data_8930_v2,
2001 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
2002 .family_id = 0x81,
2003 .variant_id = 0x15,
2004 .version = 0x11,
2005 .build = 0xAA,
2006 .bootldr_id = MXT_BOOTLOADER_ID_224E,
2007 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
2008 },
2009 {
2010 .config = mxt_config_data_8930_v2,
2011 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
2012 .family_id = 0x81,
2013 .variant_id = 0x01,
2014 .version = 0x20,
2015 .build = 0xAB,
2016 .bootldr_id = MXT_BOOTLOADER_ID_224E,
Jing Lindc4413c2012-01-16 15:22:52 -08002017 },
2018};
2019
Amy Malochef3c9db42011-12-08 15:17:35 -08002020static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08002021 .config_array = mxt_config_array,
2022 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002023 .panel_minx = 0,
2024 .panel_maxx = 566,
2025 .panel_miny = 0,
2026 .panel_maxy = 1067,
2027 .disp_minx = 0,
2028 .disp_maxx = 540,
2029 .disp_miny = 0,
2030 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002031 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05302032#ifdef MSM8930_PHASE_2
2033 .digital_pwr_regulator = true,
2034#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002035 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08002036 .reset_gpio = MXT_TS_RESET_GPIO,
2037 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002038};
2039
Amy Malochef3c9db42011-12-08 15:17:35 -08002040static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002041 {
Amy Malochef3c9db42011-12-08 15:17:35 -08002042 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
2043 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002044 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2045 },
2046};
2047
David Collins04499982012-08-06 15:02:03 -07002048#define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
2049#define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25)
Manoj Raoc6d904c2012-06-22 00:32:14 -07002050static struct msm_mhl_platform_data mhl_platform_data = {
2051 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
2052 .gpio_mhl_int = MHL_GPIO_INT,
2053 .gpio_mhl_reset = MHL_GPIO_RESET,
David Collins04499982012-08-06 15:02:03 -07002054 .gpio_mhl_power = MHL_POWER_GPIO_PM8038,
Manoj Raoc6d904c2012-06-22 00:32:14 -07002055 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
2056};
2057
2058static struct i2c_board_info sii_device_info[] __initdata = {
2059 {
2060 /*
2061 * keeps SI 8334 as the default
2062 * MHL TX
2063 */
2064 I2C_BOARD_INFO("sii8334", 0x39),
2065 .platform_data = &mhl_platform_data,
2066 .flags = I2C_CLIENT_WAKE,
2067 },
2068};
2069
2070
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302071#ifdef MSM8930_PHASE_2
2072
David Collins04499982012-08-06 15:02:03 -07002073#define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3)
2074#define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8)
2075#define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10)
2076#define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11)
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302077
David Collins04499982012-08-06 15:02:03 -07002078#define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27)
2079#define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28)
2080#define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36)
2081#define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37)
2082
2083static struct gpio_keys_button keys_8930_pm8038[] = {
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302084 {
2085 .code = KEY_VOLUMEUP,
2086 .type = EV_KEY,
2087 .desc = "volume_up",
David Collins04499982012-08-06 15:02:03 -07002088 .gpio = GPIO_VOLUME_UP_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302089 .wakeup = 1,
2090 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002091 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302092 },
2093 {
2094 .code = KEY_VOLUMEDOWN,
2095 .type = EV_KEY,
2096 .desc = "volume_down",
David Collins04499982012-08-06 15:02:03 -07002097 .gpio = GPIO_VOLUME_DOWN_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302098 .wakeup = 1,
2099 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002100 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302101 },
2102 {
2103 .code = KEY_CAMERA_FOCUS,
2104 .type = EV_KEY,
2105 .desc = "camera_focus",
David Collins04499982012-08-06 15:02:03 -07002106 .gpio = GPIO_CAMERA_FOCUS_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302107 .wakeup = 1,
2108 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002109 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302110 },
2111 {
2112 .code = KEY_CAMERA_SNAPSHOT,
2113 .type = EV_KEY,
2114 .desc = "camera_snapshot",
David Collins04499982012-08-06 15:02:03 -07002115 .gpio = GPIO_CAMERA_SNAPSHOT_PM8038,
2116 .wakeup = 1,
2117 .active_low = 1,
2118 .debounce_interval = 15,
2119 },
2120};
2121
2122static struct gpio_keys_button keys_8930_pm8917[] = {
2123 {
2124 .code = KEY_VOLUMEUP,
2125 .type = EV_KEY,
2126 .desc = "volume_up",
2127 .gpio = GPIO_VOLUME_UP_PM8917,
2128 .wakeup = 1,
2129 .active_low = 1,
2130 .debounce_interval = 15,
2131 },
2132 {
2133 .code = KEY_VOLUMEDOWN,
2134 .type = EV_KEY,
2135 .desc = "volume_down",
2136 .gpio = GPIO_VOLUME_DOWN_PM8917,
2137 .wakeup = 1,
2138 .active_low = 1,
2139 .debounce_interval = 15,
2140 },
2141 {
2142 .code = KEY_CAMERA_FOCUS,
2143 .type = EV_KEY,
2144 .desc = "camera_focus",
2145 .gpio = GPIO_CAMERA_FOCUS_PM8917,
2146 .wakeup = 1,
2147 .active_low = 1,
2148 .debounce_interval = 15,
2149 },
2150 {
2151 .code = KEY_CAMERA_SNAPSHOT,
2152 .type = EV_KEY,
2153 .desc = "camera_snapshot",
2154 .gpio = GPIO_CAMERA_SNAPSHOT_PM8917,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302155 .wakeup = 1,
2156 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002157 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302158 },
2159};
2160
2161/* Add GPIO keys for 8930 */
2162static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
David Collins04499982012-08-06 15:02:03 -07002163 .buttons = keys_8930_pm8038,
2164 .nbuttons = ARRAY_SIZE(keys_8930_pm8038),
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302165};
2166
2167static struct platform_device gpio_keys_8930 = {
2168 .name = "gpio-keys",
2169 .id = -1,
2170 .dev = {
2171 .platform_data = &gpio_keys_8930_pdata,
2172 },
2173};
2174#endif /* MSM8930_PHASE_2 */
2175
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002176static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2177 .clk_freq = 100000,
2178 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002179};
2180
2181static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2182 .clk_freq = 100000,
2183 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002184};
2185
Kiran Gunda484442e2013-03-11 19:14:44 +05302186
2187static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi8_pdata = {
2188 .clk_freq = 100000,
2189 .src_clk_rate = 24000000,
2190};
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002191static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
2192 .clk_freq = 100000,
2193 .src_clk_rate = 24000000,
2194};
2195
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002196static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2197 .clk_freq = 100000,
2198 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002199};
2200
2201static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2202 .clk_freq = 100000,
2203 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002204};
2205
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002206
2207static struct ks8851_pdata spi_eth_pdata = {
2208 .irq_gpio = KS8851_IRQ_GPIO,
2209 .rst_gpio = KS8851_RST_GPIO,
2210};
2211
2212static struct spi_board_info spi_board_info[] __initdata = {
2213 {
2214 .modalias = "ks8851",
2215 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2216 .max_speed_hz = 19200000,
2217 .bus_num = 0,
2218 .chip_select = 0,
2219 .mode = SPI_MODE_0,
2220 .platform_data = &spi_eth_pdata
2221 },
2222 {
2223 .modalias = "dsi_novatek_3d_panel_spi",
2224 .max_speed_hz = 10800000,
2225 .bus_num = 0,
2226 .chip_select = 1,
2227 .mode = SPI_MODE_0,
2228 },
2229};
2230
2231static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002232 .name = "saw-regulator",
2233 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002234 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002235 .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002236 },
2237};
2238
2239static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002240 .name = "saw-regulator",
2241 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002242 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002243 .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002244 },
2245};
2246
2247static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002248 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002249 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002250 .tsens_num_sensor = 10,
2251 .slope = {1132, 1135, 1137, 1135, 1157,
2252 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002253};
2254
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002255static struct platform_device msm_tsens_device = {
2256 .name = "tsens8960-tm",
2257 .id = -1,
2258};
2259
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002260static struct msm_thermal_data msm_thermal_pdata = {
2261 .sensor_id = 9,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002262 .poll_ms = 250,
2263 .limit_temp_degC = 60,
2264 .temp_hysteresis_degC = 10,
2265 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002266};
2267
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002268#ifdef CONFIG_MSM_FAKE_BATTERY
2269static struct platform_device fish_battery_device = {
2270 .name = "fish_battery",
2271};
2272#endif
2273
David Collins1d4061b2011-12-06 15:36:40 -08002274#ifndef MSM8930_PHASE_2
2275
2276/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002277static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002278 .name = GPIO_REGULATOR_DEV_NAME,
2279 .id = PM8921_MPP_PM_TO_SYS(7),
2280 .dev = {
2281 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2282 },
2283};
2284
Jay Chokshi06fa7542011-12-07 13:09:17 -08002285static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002286 .name = GPIO_REGULATOR_DEV_NAME,
2287 .id = 91,
2288 .dev = {
2289 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2290 },
2291};
2292
David Collins1d4061b2011-12-06 15:36:40 -08002293#else
2294
2295/* 8930 Phase 2 */
2296static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2297 .name = GPIO_REGULATOR_DEV_NAME,
2298 .id = 63,
2299 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002300 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2301 MSM8930_GPIO_VREG_ID_EXT_5V],
David Collins1d4061b2011-12-06 15:36:40 -08002302 },
2303};
2304
2305static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2306 .name = GPIO_REGULATOR_DEV_NAME,
2307 .id = 97,
2308 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002309 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2310 MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
David Collins1d4061b2011-12-06 15:36:40 -08002311 },
2312};
2313
2314#endif
2315
Jay Chokshi06fa7542011-12-07 13:09:17 -08002316static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002317 .name = "rpm-regulator",
2318 .id = -1,
2319 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002320#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002321 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002322#else
David Collins86161e42012-08-20 12:17:09 -07002323 .platform_data = &msm8930_pm8038_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002324#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002325 },
2326};
2327
David Collins86161e42012-08-20 12:17:09 -07002328static struct platform_device *early_common_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002329 &msm8960_device_dmov,
2330 &msm_device_smd,
2331 &msm8960_device_uart_gsbi5,
2332 &msm_device_uart_dm6,
2333 &msm_device_saw_core0,
2334 &msm_device_saw_core1,
David Collins86161e42012-08-20 12:17:09 -07002335};
2336
2337/* ext_5v and ext_otg_sw are present when using PM8038 */
2338static struct platform_device *pmic_pm8038_devices[] __initdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002339 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002340#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002341 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002342#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002343 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002344#ifdef MSM8930_PHASE_2
2345 &msm8930_device_ext_otg_sw_vreg,
2346#endif
David Collins86161e42012-08-20 12:17:09 -07002347};
2348
2349/* ext_5v and ext_otg_sw are not present when using PM8917 */
2350static struct platform_device *pmic_pm8917_devices[] __initdata = {
2351 &msm8960_device_ssbi_pmic,
2352};
2353
Kiran Gunda484442e2013-03-11 19:14:44 +05302354static struct platform_device *i2c_qup_devices[] __initdata = {
2355 &msm8960_device_qup_i2c_gsbi4,
2356 &msm8960_device_qup_i2c_gsbi9,
2357};
2358
2359static struct platform_device *i2c_qup_sglte_devices[] __initdata = {
2360 &msm8960_device_qup_i2c_gsbi8,
2361};
2362
David Collins86161e42012-08-20 12:17:09 -07002363static struct platform_device *common_devices[] __initdata = {
Stephen Boyd28d54952011-12-16 13:19:51 -08002364 &msm_8960_q6_lpass,
2365 &msm_8960_q6_mss_fw,
2366 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002367 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002368 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002369 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002370 &msm8960_device_qup_spi_gsbi1,
2371 &msm8960_device_qup_i2c_gsbi3,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002372 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002373 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002374 &msm_slim_ctrl,
2375 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002376#if defined(CONFIG_QSEECOM)
2377 &qseecom_device,
2378#endif
2379
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002380#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2381 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2382 &qcrypto_device,
2383#endif
2384
2385#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2386 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2387 &qcedev_device,
2388#endif
2389#ifdef CONFIG_MSM_ROTATOR
2390 &msm_rotator_device,
2391#endif
2392 &msm_device_sps,
2393#ifdef CONFIG_MSM_FAKE_BATTERY
2394 &fish_battery_device,
2395#endif
2396#ifdef CONFIG_ANDROID_PMEM
2397#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002398 &msm8930_android_pmem_device,
2399 &msm8930_android_pmem_adsp_device,
2400 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302401#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2402#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002403 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002404 &msm_device_bam_dmux,
2405 &msm_fm_platform_init,
2406
2407#ifdef CONFIG_HW_RANDOM_MSM
2408 &msm_device_rng,
2409#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002410 &msm8930_rpm_device,
2411 &msm8930_rpm_log_device,
Girish Mahadevan898c56d2012-06-05 16:09:19 -06002412 &msm8930_rpm_rbcpr_device,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002413 &msm8930_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302414 &msm8930_rpm_master_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002415#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002416 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002417#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002418 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002419 &coresight_tpiu_device,
2420 &coresight_etb_device,
2421 &coresight_funnel_device,
2422 &coresight_etm0_device,
2423 &coresight_etm1_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002424 &msm_device_dspcrashd_8960,
2425 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302426#ifdef MSM8930_PHASE_2
2427 &gpio_keys_8930,
2428#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002429 &msm8930_rtb_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002430 &msm_bus_8930_apps_fabric,
2431 &msm_bus_8930_sys_fabric,
2432 &msm_bus_8930_mm_fabric,
2433 &msm_bus_8930_sys_fpb,
2434 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002435 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002436 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002437 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002438 &msm8930_cache_dump_device,
Anji Jonnalae84292b2012-09-21 13:34:44 +05302439 &msm8930_pc_cntr,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002440};
2441
2442static struct platform_device *cdp_devices[] __initdata = {
2443 &msm8960_device_otg,
2444 &msm8960_device_gadget_peripheral,
2445 &msm_device_hsusb_host,
2446 &android_usb_device,
2447 &msm_pcm,
2448 &msm_pcm_routing,
2449 &msm_cpudai0,
2450 &msm_cpudai1,
2451 &msm_cpudai_hdmi_rx,
2452 &msm_cpudai_bt_rx,
2453 &msm_cpudai_bt_tx,
2454 &msm_cpudai_fm_rx,
2455 &msm_cpudai_fm_tx,
2456 &msm_cpudai_auxpcm_rx,
2457 &msm_cpudai_auxpcm_tx,
2458 &msm_cpu_fe,
2459 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002460#ifdef CONFIG_MSM_GEMINI
2461 &msm8960_gemini_device,
2462#endif
2463 &msm_voice,
2464 &msm_voip,
2465 &msm_lpa_pcm,
2466 &msm_cpudai_afe_01_rx,
2467 &msm_cpudai_afe_01_tx,
2468 &msm_cpudai_afe_02_rx,
2469 &msm_cpudai_afe_02_tx,
2470 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002471 &msm_compr_dsp,
2472 &msm_cpudai_incall_music_rx,
2473 &msm_cpudai_incall_record_rx,
2474 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002475 &msm_pcm_hostless,
Asish Bhattacharya705c6732012-08-14 23:22:55 +05302476 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002477 &msm_lowlatency_pcm,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002478};
2479
2480static void __init msm8930_i2c_init(void)
2481{
2482 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2483 &msm8960_i2c_qup_gsbi4_pdata;
2484
2485 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2486 &msm8960_i2c_qup_gsbi3_pdata;
Kiran Gunda484442e2013-03-11 19:14:44 +05302487 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
2488 msm8960_device_qup_i2c_gsbi8.dev.platform_data =
2489 &msm8960_i2c_qup_gsbi8_pdata;
2490 else
2491 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002492 &msm8960_i2c_qup_gsbi9_pdata;
2493
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002494 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2495 &msm8960_i2c_qup_gsbi10_pdata;
2496
2497 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2498 &msm8960_i2c_qup_gsbi12_pdata;
2499}
2500
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002501static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2502 {
2503 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2504 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2505 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002506 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002507 },
2508
2509 {
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302510 MSM_PM_SLEEP_MODE_RETENTION,
2511 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2512 true,
2513 415, 715, 340827, 475,
2514 },
2515
2516 {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002517 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2518 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2519 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002520 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002521 },
2522
2523 {
2524 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2525 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2526 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002527 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002528 },
2529
2530 {
2531 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002532 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2533 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002534 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002535 },
2536
2537 {
2538 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2539 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2540 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002541 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002542 },
2543
2544 {
2545 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2546 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2547 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002548 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002549 },
2550
2551 {
2552 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2553 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2554 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002555 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002556 },
2557
2558 {
2559 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2560 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2561 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002562 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002563 },
2564};
2565
Praveen Chidambaram78499012011-11-01 17:15:17 -06002566static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2567 .levels = &msm_rpmrs_levels[0],
2568 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2569 .vdd_mem_levels = {
2570 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2571 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2572 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2573 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2574 },
2575 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002576 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2577 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2578 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2579 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002580 },
2581 .vdd_mask = 0x7FFFFF,
2582 .rpmrs_target_id = {
2583 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2584 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002585 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2586 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002587 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2588 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2589 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2590 },
2591};
2592
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002593static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = {
2594 .levels = &msm_rpmrs_levels[0],
2595 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2596 .vdd_mem_levels = {
2597 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2598 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2599 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2600 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2601 },
2602 .vdd_dig_levels = {
2603 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2604 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2605 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2606 [MSM_RPMRS_VDD_DIG_MAX] = 3,
2607 },
2608 .vdd_mask = 0x7FFFFF,
2609 .rpmrs_target_id = {
2610 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2611 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2612 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2613 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
2614 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0,
2615 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1,
2616 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2617 },
2618};
2619
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002620static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2621 .mode = MSM_PM_BOOT_CONFIG_TZ,
2622};
2623
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002624#ifdef CONFIG_I2C
2625#define I2C_SURF 1
2626#define I2C_FFA (1 << 1)
2627#define I2C_RUMI (1 << 2)
2628#define I2C_SIM (1 << 3)
2629#define I2C_FLUID (1 << 4)
2630#define I2C_LIQUID (1 << 5)
Taniya Das087145b2013-03-16 21:37:41 +05302631#define I2C_EVT (1 << 6)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002632
2633struct i2c_registry {
2634 u8 machs;
2635 int bus;
2636 struct i2c_board_info *info;
2637 int len;
2638};
2639
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002640#ifdef CONFIG_INPUT_MPU3050
2641#define MPU3050_INT_GPIO 69
2642
2643static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2644 .gpio_int = MPU3050_INT_GPIO,
2645};
2646
2647static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2648 {
2649 I2C_BOARD_INFO("mpu3050", 0x68),
Wentao Xuc7769c02012-08-03 15:06:41 -04002650 .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO),
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002651 .platform_data = &mpu3050_gyro,
2652 },
2653};
2654#endif
2655
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002656#ifdef CONFIG_ISL9519_CHARGER
2657static struct isl_platform_data isl_data __initdata = {
2658 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2659 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2660 .max_system_voltage = 4200,
2661 .min_system_voltage = 3200,
2662 .chgcurrent = 1000, /* 1900, */
2663 .term_current = 400, /* Need fine tuning */
2664 .input_current = 2048,
2665};
2666
2667static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2668 {
2669 I2C_BOARD_INFO("isl9519q", 0x9),
2670 .irq = 0, /* Not required when notify-by-pmic */
2671 .platform_data = &isl_data,
2672 },
2673};
2674#endif /* CONFIG_ISL9519_CHARGER */
2675
Wentao Xu114c0152012-06-12 11:40:38 -04002676#ifdef CONFIG_STM_LIS3DH
2677static struct lis3dh_acc_platform_data lis3dh_accel = {
2678 .poll_interval = 200,
2679 .min_interval = 10,
2680 .g_range = LIS3DH_ACC_G_2G,
2681 .axis_map_x = 1,
2682 .axis_map_y = 0,
2683 .axis_map_z = 2,
2684 .negate_x = 0,
2685 .negate_y = 0,
2686 .negate_z = 1,
2687 .init = NULL,
2688 .exit = NULL,
2689 .gpio_int1 = -EINVAL,
2690 .gpio_int2 = -EINVAL,
2691};
2692
2693static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = {
2694 {
2695 I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18),
2696 .platform_data = &lis3dh_accel,
2697 },
2698};
2699#endif /* CONFIG_STM_LIS3DH */
2700
Orkhan Karimov4e7999f2013-02-13 17:52:11 -05002701#ifdef CONFIG_BMP18X_I2C
2702static struct i2c_board_info __initdata bmp18x_i2c_boardinfo[] = {
2703 {
2704 I2C_BOARD_INFO("bmp18x", 0x77),
2705 },
2706};
2707#endif
2708
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002709static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002710#ifdef CONFIG_ISL9519_CHARGER
2711 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302712 I2C_LIQUID | I2C_EVT,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002713 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2714 isl_charger_i2c_info,
2715 ARRAY_SIZE(isl_charger_i2c_info),
2716 },
2717#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002718#ifdef CONFIG_INPUT_MPU3050
2719 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302720 I2C_FFA | I2C_FLUID | I2C_EVT,
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002721 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2722 mpu3050_i2c_boardinfo,
2723 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2724 },
2725#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002726 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002727 I2C_SURF | I2C_FFA | I2C_FLUID,
2728 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002729 msm_isa1200_board_info,
2730 ARRAY_SIZE(msm_isa1200_board_info),
2731 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002732 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302733 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_EVT,
Amy Malochef3c9db42011-12-08 15:17:35 -08002734 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2735 mxt_device_info_8930,
2736 ARRAY_SIZE(mxt_device_info_8930),
2737 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002738 {
2739 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2740 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2741 sii_device_info,
2742 ARRAY_SIZE(sii_device_info),
2743 },
Wentao Xu114c0152012-06-12 11:40:38 -04002744#ifdef CONFIG_STM_LIS3DH
2745 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302746 I2C_FFA | I2C_FLUID | I2C_EVT,
Wentao Xu114c0152012-06-12 11:40:38 -04002747 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2748 lis3dh_i2c_boardinfo,
2749 ARRAY_SIZE(lis3dh_i2c_boardinfo),
2750 },
2751#endif
Orkhan Karimov4e7999f2013-02-13 17:52:11 -05002752#ifdef CONFIG_BMP18X_I2C
2753 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302754 I2C_FFA | I2C_FLUID | I2C_EVT,
Orkhan Karimov4e7999f2013-02-13 17:52:11 -05002755 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2756 bmp18x_i2c_boardinfo,
2757 ARRAY_SIZE(bmp18x_i2c_boardinfo),
2758 },
2759#endif
2760
2761
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002762};
2763#endif /* CONFIG_I2C */
2764
2765static void __init register_i2c_devices(void)
2766{
2767#ifdef CONFIG_I2C
2768 u8 mach_mask = 0;
2769 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002770#ifdef CONFIG_MSM_CAMERA
2771 struct i2c_registry msm8930_camera_i2c_devices = {
Raju P.L.S.S.S.N98274022013-03-12 20:30:50 +05302772 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI
2773 | I2C_EVT,
Kevin Chan09f4e662011-12-16 08:17:02 -08002774 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2775 msm8930_camera_board_info.board_info,
2776 msm8930_camera_board_info.num_i2c_board_info,
2777 };
Kiran Gunda484442e2013-03-11 19:14:44 +05302778 if (machine_is_msm8930_evt() &&
2779 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)) {
2780 msm8930_camera_i2c_devices.machs |= I2C_EVT;
2781 msm8930_camera_i2c_devices.bus = MSM_8930_GSBI8_QUP_I2C_BUS_ID;
2782 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002783#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002784
2785 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002786 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002787 mach_mask = I2C_SURF;
2788 else if (machine_is_msm8930_fluid())
2789 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002790 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002791 mach_mask = I2C_FFA;
Taniya Das087145b2013-03-16 21:37:41 +05302792 else if (machine_is_msm8930_evt())
2793 mach_mask = I2C_EVT;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002794 else
2795 pr_err("unmatched machine ID in register_i2c_devices\n");
2796
2797 /* Run the array and install devices as appropriate */
2798 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2799 if (msm8960_i2c_devices[i].machs & mach_mask)
2800 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2801 msm8960_i2c_devices[i].info,
2802 msm8960_i2c_devices[i].len);
2803 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002804#ifdef CONFIG_MSM_CAMERA
2805 if (msm8930_camera_i2c_devices.machs & mach_mask)
2806 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2807 msm8930_camera_i2c_devices.info,
2808 msm8930_camera_i2c_devices.len);
2809#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002810#endif
2811}
2812
David Collins04499982012-08-06 15:02:03 -07002813/* Modify platform data values to match requirements for PM8917. */
2814static void __init msm8930_pm8917_pdata_fixup(void)
2815{
Patrick Dalya3b73c42012-08-28 13:39:17 -07002816 struct acpuclk_platform_data *pdata;
2817
David Collins04499982012-08-06 15:02:03 -07002818 mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917;
2819
2820 gpio_keys_8930_pdata.buttons = keys_8930_pm8917;
2821 gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917);
David Collins86161e42012-08-20 12:17:09 -07002822
2823 msm_device_saw_core0.dev.platform_data
2824 = &msm8930_pm8038_saw_regulator_core0_pdata;
2825 msm_device_saw_core1.dev.platform_data
2826 = &msm8930_pm8038_saw_regulator_core1_pdata;
2827
2828 msm8930_device_rpm_regulator.dev.platform_data
2829 = &msm8930_pm8917_rpm_regulator_pdata;
Patrick Dalya3b73c42012-08-28 13:39:17 -07002830
2831 pdata = msm8930_device_acpuclk.dev.platform_data;
2832 pdata->uses_pm8917 = true;
Tianyi Gou01c27a32012-10-29 19:13:53 -07002833
2834 pdata = msm8930ab_device_acpuclk.dev.platform_data;
2835 pdata->uses_pm8917 = true;
David Collins04499982012-08-06 15:02:03 -07002836}
2837
Anji Jonnala786b39e2013-01-29 13:34:10 +05302838static void __init msm8930ab_update_retention_spm(void)
2839{
2840 int i;
2841
2842 /* Update the SPM sequences for krait retention on all cores */
2843 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
2844 int j;
2845 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
2846 for (j = 0; j < pdata->num_modes; j++) {
2847 if (pdata->modes[j].cmd ==
2848 spm_retention_cmd_sequence)
2849 pdata->modes[j].cmd =
2850 spm_retention_with_krait_v3_cmd_sequence;
2851 }
2852 }
2853}
2854
Saket Saurabh2a47f222013-03-11 19:36:48 +05302855#ifdef CONFIG_SERIAL_MSM_HS
2856static int configure_uart_gpios(int on)
2857{
2858 int ret = 0, i;
2859 int uart_gpios[] = {93, 94, 95, 96};
2860
2861 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2862 if (on) {
2863 ret = gpio_request(uart_gpios[i], NULL);
2864 if (ret) {
2865 pr_err("%s: unable to request uart gpio[%d]\n",
2866 __func__, uart_gpios[i]);
2867 break;
2868 }
2869 } else {
2870 gpio_free(uart_gpios[i]);
2871 }
2872 }
2873
2874 if (ret && on && i)
2875 for (; i >= 0; i--)
2876 gpio_free(uart_gpios[i]);
2877 return ret;
2878}
2879
2880static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
2881 .gpio_config = configure_uart_gpios,
2882};
2883#else
2884static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2885#endif
2886
2887
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002888static void __init msm8930_cdp_init(void)
2889{
David Collins04499982012-08-06 15:02:03 -07002890 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2891 msm8930_pm8917_pdata_fixup();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002892 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2893 pr_err("meminfo_init() failed!\n");
2894
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07002895 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002896 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002897 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002898 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
2899 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2900 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
2901 } else {
2902 BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917));
2903 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917));
2904 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002905
2906 regulator_suppress_info_printing();
2907 if (msm_xo_init())
2908 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002909 platform_device_register(&msm8930_device_rpm_regulator);
Patrick Dalyb1d5f752012-08-27 16:25:07 -07002910 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2911 msm_clock_init(&msm8930_pm8917_clock_init_data);
2912 else
2913 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2a1c7db2013-01-08 15:10:51 +05302914
2915 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
2916 /*
2917 * By default, set USB mode as USB Peripheral only due to
2918 * hardware rework requirement for USB Host Mode.
2919 * Provide pmic_id_irq number only if host mode is enable
2920 * by user assuming that hardware rework is available.
2921 */
2922 if (enable_usb_host_mode) {
2923 /* MPP01 IRQ number */
2924 msm_otg_pdata.pmic_id_irq =
2925 PM8921_MPP_IRQ(PM8917_IRQ_BASE, 1);
2926 } else {
2927 pr_err("Enabling USB Peripheral Only mode.\n");
2928 msm_otg_pdata.mode = USB_PERIPHERAL;
2929 }
2930 } else {
2931 msm_otg_pdata.pmic_id_irq =
2932 PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE);
2933 }
2934
Saket Saurabh2a47f222013-03-11 19:36:48 +05302935 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE &&
2936 machine_is_msm8930_evt()) {
2937#ifdef CONFIG_SERIAL_MSM_HS
2938 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
2939 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
2940#endif
2941 platform_device_register(&msm_device_uart_dm9);
2942 }
2943
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302944 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002945 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302946 android_usb_pdata.swfi_latency =
2947 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002948 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002949 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2950 &msm8960_qup_spi_gsbi1_pdata;
2951 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2952
Jay Chokshi06fa7542011-12-07 13:09:17 -08002953 /*
2954 * TODO: When physical 8930/PM8038 hardware becomes
2955 * available, remove this block or add the config
2956 * option.
2957 */
2958#ifndef MSM8930_PHASE_2
2959 msm8960_init_pmic();
2960#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002961 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002962#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002963 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302964 msm8930_init_gpu();
Anji Jonnala786b39e2013-01-29 13:34:10 +05302965 if (cpu_is_krait_v3()) {
2966 msm_pm_set_tz_retention_flag(0);
2967 msm8930ab_update_retention_spm();
2968 } else {
2969 msm_pm_set_tz_retention_flag(1);
2970 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002971 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2972 msm_spm_l2_init(msm_spm_l2_data);
2973 msm8930_init_buses();
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002974 if (cpu_is_msm8627()) {
Tianyi Gou723843b2012-06-13 15:24:56 -07002975 platform_add_devices(msm8627_footswitch,
2976 msm8627_num_footswitch);
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07002977 } else {
2978 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2979 platform_add_devices(msm8930_pm8917_footswitch,
2980 msm8930_pm8917_num_footswitch);
2981 else
2982 platform_add_devices(msm8930_footswitch,
2983 msm8930_num_footswitch);
2984 }
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002985 if (cpu_is_msm8627())
Matt Wagantallab730bd2012-06-07 20:13:51 -07002986 platform_device_register(&msm8627_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002987 else if (cpu_is_msm8930())
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002988 platform_device_register(&msm8930_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002989 else if (cpu_is_msm8930aa())
2990 platform_device_register(&msm8930aa_device_acpuclk);
Tianyi Gou01c27a32012-10-29 19:13:53 -07002991 else if (cpu_is_msm8930ab())
2992 platform_device_register(&msm8930ab_device_acpuclk);
David Collins86161e42012-08-20 12:17:09 -07002993 platform_add_devices(early_common_devices,
2994 ARRAY_SIZE(early_common_devices));
2995 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2996 platform_add_devices(pmic_pm8038_devices,
2997 ARRAY_SIZE(pmic_pm8038_devices));
2998 else
2999 platform_add_devices(pmic_pm8917_devices,
3000 ARRAY_SIZE(pmic_pm8917_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003001 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Kiran Gunda484442e2013-03-11 19:14:44 +05303002 if (machine_is_msm8930_evt() &&
3003 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)) {
3004 /* Removing GSBI4 and GSBI9 and initializing GSBI8
3005 * as per SGLTE platform requirement */
3006 platform_add_devices(i2c_qup_sglte_devices,
3007 ARRAY_SIZE(i2c_qup_sglte_devices));
3008 } else {
3009 platform_add_devices(i2c_qup_devices,
3010 ARRAY_SIZE(i2c_qup_devices));
3011 }
Arun Menonaabf2632012-02-24 15:30:47 -08003012 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08003013 /*
3014 * TODO: When physical 8930/PM8038 hardware becomes
3015 * available, remove this block or add the config
3016 * option.
3017 */
3018#ifndef MSM8930_PHASE_2
3019 msm8960_pm8921_gpio_mpp_init();
3020#else
David Collins04499982012-08-06 15:02:03 -07003021 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3022 msm8930_pm8038_gpio_mpp_init();
3023 else
3024 msm8930_pm8917_gpio_mpp_init();
Jay Chokshi06fa7542011-12-07 13:09:17 -08003025#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003026 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07003027#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003028 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003029#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003030 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07003031 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003032 register_i2c_devices();
3033 msm8930_init_fb();
3034 slim_register_board_info(msm_slim_devices,
3035 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003036 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003037
Taniya Das087145b2013-03-16 21:37:41 +05303038 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3039 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3040 platform_device_register(&mdm_sglte_device);
3041 }
3042
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003043 if (PLATFORM_IS_CHARM25())
3044 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
3045}
3046
3047MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
3048 .map_io = msm8930_map_io,
3049 .reserve = msm8930_reserve,
3050 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303051 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003052 .timer = &msm_timer,
3053 .init_machine = msm8930_cdp_init,
3054 .init_early = msm8930_allocate_memory_regions,
3055 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003056 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003057MACHINE_END
3058
3059MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
3060 .map_io = msm8930_map_io,
3061 .reserve = msm8930_reserve,
3062 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303063 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003064 .timer = &msm_timer,
3065 .init_machine = msm8930_cdp_init,
3066 .init_early = msm8930_allocate_memory_regions,
3067 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003068 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003069MACHINE_END
3070
3071MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
3072 .map_io = msm8930_map_io,
3073 .reserve = msm8930_reserve,
3074 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303075 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003076 .timer = &msm_timer,
3077 .init_machine = msm8930_cdp_init,
3078 .init_early = msm8930_allocate_memory_regions,
3079 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003080 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003081MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003082
3083MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
3084 .map_io = msm8930_map_io,
3085 .reserve = msm8930_reserve,
3086 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303087 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003088 .timer = &msm_timer,
3089 .init_machine = msm8930_cdp_init,
3090 .init_early = msm8930_allocate_memory_regions,
3091 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003092 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003093MACHINE_END
3094
3095MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
3096 .map_io = msm8930_map_io,
3097 .reserve = msm8930_reserve,
3098 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303099 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003100 .timer = &msm_timer,
3101 .init_machine = msm8930_cdp_init,
3102 .init_early = msm8930_allocate_memory_regions,
3103 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003104 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003105MACHINE_END
Taniya Das799085a2013-03-06 11:39:04 +05303106
3107MACHINE_START(MSM8930_EVT, "QRD8930 SGLTE EVT")
3108 .map_io = msm8930_map_io,
3109 .reserve = msm8930_reserve,
3110 .init_irq = msm8930_init_irq,
3111 .handle_irq = gic_handle_irq,
3112 .timer = &msm_timer,
3113 .init_machine = msm8930_cdp_init,
3114 .init_early = msm8930_allocate_memory_regions,
3115 .init_very_early = msm8930_early_memory,
3116 .restart = msm_restart,
3117MACHINE_END