blob: 4f01ba98733c835c59b87b0dcbfa79df6e939e5c [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>
Shantanu Jain55d277a2013-03-08 11:37:29 +053046#include <linux/input/synaptics_dsx.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080047
Asish Bhattacharyab86c3472012-02-15 08:31:52 +053048#include <linux/slimbus/slimbus.h>
49#include <linux/mfd/wcd9xxx/core.h>
50#include <linux/mfd/wcd9xxx/pdata.h>
51
Wentao Xu114c0152012-06-12 11:40:38 -040052#ifdef CONFIG_STM_LIS3DH
53#include <linux/input/lis3dh.h>
54#endif
55
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080056#include <asm/mach-types.h>
57#include <asm/mach/arch.h>
58#include <asm/setup.h>
59#include <asm/hardware/gic.h>
60#include <asm/mach/mmc.h>
61
62#include <mach/board.h>
63#include <mach/msm_iomap.h>
64#include <mach/msm_spi.h>
65#ifdef CONFIG_USB_MSM_OTG_72K
66#include <mach/msm_hsusb.h>
67#else
68#include <linux/usb/msm_hsusb.h>
69#endif
70#include <linux/usb/android.h>
71#include <mach/usbdiag.h>
72#include <mach/socinfo.h>
73#include <mach/rpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080074#include <mach/gpiomux.h>
75#include <mach/msm_bus_board.h>
76#include <mach/msm_memtypes.h>
77#include <mach/dma.h>
Saket Saurabh2a47f222013-03-11 19:36:48 +053078#include <mach/msm_serial_hs.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080079#include <mach/msm_xo.h>
80#include <mach/restart.h>
81
Mitchel Humpherys46475f62012-09-06 11:33:28 -070082#include <linux/msm_ion.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080083#include <mach/ion.h>
84#include <mach/mdm2.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080085#include <mach/msm_rtb.h>
Hanumant Singheea62562012-05-14 11:32:45 -070086#include <linux/fmem.h>
Laura Abbottf3173042012-05-29 15:23:18 -070087#include <mach/msm_cache_dump.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080088
Jordan Crouse914de9b2012-07-09 13:49:46 -060089#include <mach/kgsl.h>
Wentao Xuf59ce4e2012-05-22 17:30:13 -040090#ifdef CONFIG_INPUT_MPU3050
91#include <linux/input/mpu3050.h>
92#endif
93
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080094#include "timer.h"
95#include "devices.h"
96#include "devices-msm8x60.h"
97#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080098#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080099#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800100#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530101#include <mach/mpm.h>
Matt Wagantalld55b90f2012-02-23 23:27:44 -0800102#include "clock.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800103#include "smd_private.h"
104#include "pm-boot.h"
105#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -0800106#include "board-8930.h"
Patrick Dalya3b73c42012-08-28 13:39:17 -0700107#include "acpuclock-krait.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800108
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800109static struct platform_device msm_fm_platform_init = {
110 .name = "iris_fm",
111 .id = -1,
112};
113
114#define KS8851_RST_GPIO 89
115#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800116#define HAP_SHIFT_LVL_OE_GPIO 47
117
Manoj Raoc6d904c2012-06-22 00:32:14 -0700118#define HDMI_MHL_MUX_GPIO 73
119#define MHL_GPIO_INT 72
120#define MHL_GPIO_RESET 71
121#define MHL_GPIO_PWR_EN 5
122
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800123#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
124
125struct sx150x_platform_data msm8930_sx150x_data[] = {
126 [SX150X_CAM] = {
127 .gpio_base = GPIO_CAM_EXPANDER_BASE,
128 .oscio_is_gpo = false,
129 .io_pullup_ena = 0x0,
130 .io_pulldn_ena = 0xc0,
131 .io_open_drain_ena = 0x0,
132 .irq_summary = -1,
133 },
134};
135
136#endif
137
Olav Haugana21169d2012-01-04 09:17:06 -0800138#define MSM_PMEM_ADSP_SIZE 0x7800000
Sudhir Sharmab83b1472012-11-28 19:46:13 -0800139#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800140#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
141#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
142#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800143#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800144#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700145#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800146
147#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur9830bf02012-06-01 15:04:29 -0700148#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700149#define MSM_CONTIG_MEM_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700150#ifdef CONFIG_MSM_IOMMU
151#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
152#define MSM_ION_SF_SIZE 0x0
Olav Haugan494e4dc2012-05-15 15:14:31 -0700153#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Laura Abbott03e3cd72013-02-09 09:35:30 -0800154#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700155#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800156#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800157#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan494e4dc2012-05-15 15:14:31 -0700158#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Hanumant Singheea62562012-05-14 11:32:45 -0700159#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700160#endif
Deepak Kotur9830bf02012-06-01 15:04:29 -0700161#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800162#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800163#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700164
165#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
166#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
167#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
168
Deepak Kotur9830bf02012-06-01 15:04:29 -0700169#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */
170#define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
171 HOLE_SIZE))
Hanumant Singheea62562012-05-14 11:32:45 -0700172#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur9830bf02012-06-01 15:04:29 -0700173#define MSM8930_FW_START MSM8930_FIXED_AREA_START
Laura Abbott03e3cd72013-02-09 09:35:30 -0800174#define MSM_ION_ADSP_SIZE SZ_8M
Hanumant Singheea62562012-05-14 11:32:45 -0700175
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800176#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700177#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800178#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800179#endif
180
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700181#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
182static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
183static int __init msm_contig_mem_size_setup(char *p)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800184{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700185 msm_contig_mem_size = memparse(p, NULL);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800186 return 0;
187}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700188early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800189#endif
190
191#ifdef CONFIG_ANDROID_PMEM
192static unsigned pmem_size = MSM_PMEM_SIZE;
193static int __init pmem_size_setup(char *p)
194{
195 pmem_size = memparse(p, NULL);
196 return 0;
197}
198early_param("pmem_size", pmem_size_setup);
199
200static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
201
202static int __init pmem_adsp_size_setup(char *p)
203{
204 pmem_adsp_size = memparse(p, NULL);
205 return 0;
206}
207early_param("pmem_adsp_size", pmem_adsp_size_setup);
208
209static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
210
211static int __init pmem_audio_size_setup(char *p)
212{
213 pmem_audio_size = memparse(p, NULL);
214 return 0;
215}
216early_param("pmem_audio_size", pmem_audio_size_setup);
217#endif
218
219#ifdef CONFIG_ANDROID_PMEM
220#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
221static struct android_pmem_platform_data android_pmem_pdata = {
222 .name = "pmem",
223 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
224 .cached = 1,
225 .memory_type = MEMTYPE_EBI1,
226};
227
Laura Abbottb93525f2012-04-12 09:57:19 -0700228static struct platform_device msm8930_android_pmem_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800229 .name = "android_pmem",
230 .id = 0,
231 .dev = {.platform_data = &android_pmem_pdata},
232};
233
234static struct android_pmem_platform_data android_pmem_adsp_pdata = {
235 .name = "pmem_adsp",
236 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
237 .cached = 0,
238 .memory_type = MEMTYPE_EBI1,
239};
Laura Abbottb93525f2012-04-12 09:57:19 -0700240static struct platform_device msm8930_android_pmem_adsp_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800241 .name = "android_pmem",
242 .id = 2,
243 .dev = { .platform_data = &android_pmem_adsp_pdata },
244};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800245
246static struct android_pmem_platform_data android_pmem_audio_pdata = {
247 .name = "pmem_audio",
248 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
249 .cached = 0,
250 .memory_type = MEMTYPE_EBI1,
251};
252
Laura Abbottb93525f2012-04-12 09:57:19 -0700253static struct platform_device msm8930_android_pmem_audio_device = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800254 .name = "android_pmem",
255 .id = 4,
256 .dev = { .platform_data = &android_pmem_audio_pdata },
257};
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530258#endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */
259#endif /* CONFIG_ANDROID_PMEM */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800260
Hanumant Singheea62562012-05-14 11:32:45 -0700261struct fmem_platform_data msm8930_fmem_pdata = {
262};
263
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800264#define DSP_RAM_BASE_8960 0x8da00000
265#define DSP_RAM_SIZE_8960 0x1800000
266static int dspcrashd_pdata_8960 = 0xDEADDEAD;
267
268static struct resource resources_dspcrashd_8960[] = {
269 {
270 .name = "msm_dspcrashd",
271 .start = DSP_RAM_BASE_8960,
272 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
273 .flags = IORESOURCE_DMA,
274 },
275};
276
277static struct platform_device msm_device_dspcrashd_8960 = {
278 .name = "msm_dspcrashd",
279 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
280 .resource = resources_dspcrashd_8960,
281 .dev = { .platform_data = &dspcrashd_pdata_8960 },
282};
283
284static struct memtype_reserve msm8930_reserve_table[] __initdata = {
285 [MEMTYPE_SMI] = {
286 },
287 [MEMTYPE_EBI0] = {
288 .flags = MEMTYPE_FLAGS_1M_ALIGN,
289 },
290 [MEMTYPE_EBI1] = {
291 .flags = MEMTYPE_FLAGS_1M_ALIGN,
292 },
293};
294
Laura Abbottf8c03b92012-02-16 14:57:58 -0800295
296static void __init reserve_rtb_memory(void)
297{
298#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700299 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800300#endif
301}
302
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800303static void __init size_pmem_devices(void)
304{
305#ifdef CONFIG_ANDROID_PMEM
306#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
307 android_pmem_adsp_pdata.size = pmem_adsp_size;
308 android_pmem_pdata.size = pmem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800309 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530310#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
311#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800312}
313
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530314#ifdef CONFIG_ANDROID_PMEM
315#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800316static void __init reserve_memory_for(struct android_pmem_platform_data *p)
317{
318 msm8930_reserve_table[p->memory_type].size += p->size;
319}
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530320#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
321#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800322
323static void __init reserve_pmem_memory(void)
324{
325#ifdef CONFIG_ANDROID_PMEM
326#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
327 reserve_memory_for(&android_pmem_adsp_pdata);
328 reserve_memory_for(&android_pmem_pdata);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800329 reserve_memory_for(&android_pmem_audio_pdata);
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530330#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700331 msm8930_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +0530332#endif /*CONFIG_ANDROID_PMEM*/
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800333}
334
335static int msm8930_paddr_to_memtype(unsigned int paddr)
336{
337 return MEMTYPE_EBI1;
338}
339
Steve Mucklef132c6c2012-06-06 18:30:57 -0700340#define FMEM_ENABLED 0
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800341#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800342#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700343static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800344 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800345 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700346 .reusable = FMEM_ENABLED,
347 .mem_is_fmem = FMEM_ENABLED,
348 .fixed_position = FIXED_MIDDLE,
Laura Abbottadec9c72012-12-05 11:49:59 -0800349 .is_cma = 1,
Laura Abbott5249a052012-12-11 15:09:03 -0800350 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800351};
352
Laura Abbottb93525f2012-04-12 09:57:19 -0700353static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800354 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800355 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700356 .reusable = 0,
357 .mem_is_fmem = FMEM_ENABLED,
358 .fixed_position = FIXED_HIGH,
Laura Abbott5249a052012-12-11 15:09:03 -0800359 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800360};
Hanumant Singheea62562012-05-14 11:32:45 -0700361
Laura Abbottb93525f2012-04-12 09:57:19 -0700362static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800363 .adjacent_mem_id = INVALID_HEAP_ID,
364 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700365 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800366};
Hanumant Singheea62562012-05-14 11:32:45 -0700367
Laura Abbottb93525f2012-04-12 09:57:19 -0700368static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800369 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
370 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700371 .mem_is_fmem = FMEM_ENABLED,
372 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800373};
374#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800375
Laura Abbott87eafac2012-09-18 11:45:43 -0700376
377static u64 msm_dmamask = DMA_BIT_MASK(32);
378
379static struct platform_device ion_mm_heap_device = {
380 .name = "ion-mm-heap-device",
381 .id = -1,
382 .dev = {
383 .dma_mask = &msm_dmamask,
384 .coherent_dma_mask = DMA_BIT_MASK(32),
385 }
386};
387
Laura Abbott03e3cd72013-02-09 09:35:30 -0800388static struct platform_device ion_adsp_heap_device = {
389 .name = "ion-adsp-heap-device",
390 .id = -1,
391 .dev = {
392 .dma_mask = &msm_dmamask,
393 .coherent_dma_mask = DMA_BIT_MASK(32),
394 }
395};
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800396/**
397 * These heaps are listed in the order they will be allocated. Due to
398 * video hardware restrictions and content protection the FW heap has to
399 * be allocated adjacent (below) the MM heap and the MFC heap has to be
400 * allocated after the MM heap to ensure MFC heap is not more than 256MB
401 * away from the base address of the FW heap.
402 * However, the order of FW heap and MM heap doesn't matter since these
403 * two heaps are taken care of by separate code to ensure they are adjacent
404 * to each other.
405 * Don't swap the order unless you know what you are doing!
406 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700407struct ion_platform_heap msm8930_heaps[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800408 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800409 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800410 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800411 .name = ION_VMALLOC_HEAP_NAME,
412 },
413#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
414 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800415 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800416 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800417 .name = ION_MM_HEAP_NAME,
418 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800419 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700420 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Laura Abbott87eafac2012-09-18 11:45:43 -0700421 .priv = &ion_mm_heap_device.dev
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800422 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800423 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800424 .id = ION_MM_FIRMWARE_HEAP_ID,
425 .type = ION_HEAP_TYPE_CARVEOUT,
426 .name = ION_MM_FIRMWARE_HEAP_NAME,
427 .size = MSM_ION_MM_FW_SIZE,
428 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700429 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800430 },
431 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800432 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800433 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800434 .name = ION_MFC_HEAP_NAME,
435 .size = MSM_ION_MFC_SIZE,
436 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700437 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800438 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700439#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800440 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800441 .id = ION_SF_HEAP_ID,
442 .type = ION_HEAP_TYPE_CARVEOUT,
443 .name = ION_SF_HEAP_NAME,
444 .size = MSM_ION_SF_SIZE,
445 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700446 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800447 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700448#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800449 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800450 .id = ION_IOMMU_HEAP_ID,
451 .type = ION_HEAP_TYPE_IOMMU,
452 .name = ION_IOMMU_HEAP_NAME,
453 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800454 {
455 .id = ION_QSECOM_HEAP_ID,
456 .type = ION_HEAP_TYPE_CARVEOUT,
457 .name = ION_QSECOM_HEAP_NAME,
458 .size = MSM_ION_QSECOM_SIZE,
459 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700460 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800461 },
Olav Haugan7355db02012-01-13 16:59:13 -0800462 {
463 .id = ION_AUDIO_HEAP_ID,
464 .type = ION_HEAP_TYPE_CARVEOUT,
465 .name = ION_AUDIO_HEAP_NAME,
466 .size = MSM_ION_AUDIO_SIZE,
467 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700468 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800469 },
Laura Abbott03e3cd72013-02-09 09:35:30 -0800470 {
471 .id = ION_ADSP_HEAP_ID,
472 .type = ION_HEAP_TYPE_DMA,
473 .name = ION_ADSP_HEAP_NAME,
474 .size = MSM_ION_ADSP_SIZE,
475 .memory_type = ION_EBI_TYPE,
476 .extra_data = (void *) &co_msm8930_ion_pdata,
477 .priv = &ion_adsp_heap_device.dev,
478 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800479#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700480};
481
482static struct ion_platform_data msm8930_ion_pdata = {
483 .nr = MSM_ION_HEAP_NUM,
484 .heaps = msm8930_heaps,
485
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800486};
487
Laura Abbottb93525f2012-04-12 09:57:19 -0700488static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800489 .name = "ion-msm",
490 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700491 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800492};
493#endif
494
Hanumant Singheea62562012-05-14 11:32:45 -0700495struct platform_device msm8930_fmem_device = {
496 .name = "fmem",
497 .id = 1,
498 .dev = { .platform_data = &msm8930_fmem_pdata },
499};
500
501static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
502 unsigned long size)
503{
504 msm8930_reserve_table[mem_type].size += size;
505}
506
507static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
508{
509#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
510 int ret;
511
512 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
513 panic("fixed area size is larger than %dM\n",
514 MAX_FIXED_AREA_SIZE >> 20);
515
516 reserve_info->fixed_area_size = fixed_area_size;
517 reserve_info->fixed_area_start = MSM8930_FW_START;
518
519 ret = memblock_remove(reserve_info->fixed_area_start,
520 reserve_info->fixed_area_size);
521 BUG_ON(ret);
522#endif
523}
524
525/**
526 * Reserve memory for ION and calculate amount of reusable memory for fmem.
527 * We only reserve memory for heaps that are not reusable. However, we only
528 * support one reusable heap at the moment so we ignore the reusable flag for
529 * other than the first heap with reusable flag set. Also handle special case
530 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
531 * at a higher address than FW in addition to not more than 256MB away from the
532 * base address of the firmware. This means that if MM is reusable the other
533 * two heaps must be allocated in the same region as FW. This is handled by the
534 * mem_is_fmem flag in the platform data. In addition the MM heap must be
535 * adjacent to the FW heap for content protection purposes.
536 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700537static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800538{
539#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700540 unsigned int i;
Laura Abbott87eafac2012-09-18 11:45:43 -0700541 int ret;
Hanumant Singheea62562012-05-14 11:32:45 -0700542 unsigned int fixed_size = 0;
543 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
544 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700545 unsigned long cma_alignment;
546 unsigned int low_use_cma = 0;
547 unsigned int middle_use_cma = 0;
548 unsigned int high_use_cma = 0;
Hanumant Singheea62562012-05-14 11:32:45 -0700549
Hanumant Singheea62562012-05-14 11:32:45 -0700550 fixed_low_size = 0;
551 fixed_middle_size = 0;
552 fixed_high_size = 0;
553
Laura Abbott87eafac2012-09-18 11:45:43 -0700554 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
555
Hanumant Singheea62562012-05-14 11:32:45 -0700556 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
Laura Abbott87eafac2012-09-18 11:45:43 -0700557 struct ion_platform_heap *heap =
Hanumant Singheea62562012-05-14 11:32:45 -0700558 &(msm8930_ion_pdata.heaps[i]);
559
Laura Abbott87eafac2012-09-18 11:45:43 -0700560 int use_cma = 0;
561
Hanumant Singheea62562012-05-14 11:32:45 -0700562 if (heap->extra_data) {
563 int fixed_position = NOT_FIXED;
Hanumant Singheea62562012-05-14 11:32:45 -0700564
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700565 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700566 case ION_HEAP_TYPE_CP:
Laura Abbott87eafac2012-09-18 11:45:43 -0700567 if (((struct ion_cp_heap_pdata *)
568 heap->extra_data)->is_cma) {
569 heap->size = ALIGN(heap->size,
570 cma_alignment);
571 use_cma = 1;
572 }
Hanumant Singheea62562012-05-14 11:32:45 -0700573 fixed_position = ((struct ion_cp_heap_pdata *)
574 heap->extra_data)->fixed_position;
575 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700576 case ION_HEAP_TYPE_DMA:
577 use_cma = 1;
578 /* Purposely fall through here */
Hanumant Singheea62562012-05-14 11:32:45 -0700579 case ION_HEAP_TYPE_CARVEOUT:
Hanumant Singheea62562012-05-14 11:32:45 -0700580 fixed_position = ((struct ion_co_heap_pdata *)
581 heap->extra_data)->fixed_position;
582 break;
583 default:
584 break;
585 }
586
587 if (fixed_position != NOT_FIXED)
588 fixed_size += heap->size;
589 else
590 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
591
Laura Abbott87eafac2012-09-18 11:45:43 -0700592 if (fixed_position == FIXED_LOW) {
Hanumant Singheea62562012-05-14 11:32:45 -0700593 fixed_low_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700594 low_use_cma = use_cma;
595 } else if (fixed_position == FIXED_MIDDLE) {
Hanumant Singheea62562012-05-14 11:32:45 -0700596 fixed_middle_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700597 middle_use_cma = use_cma;
598 } else if (fixed_position == FIXED_HIGH) {
Hanumant Singheea62562012-05-14 11:32:45 -0700599 fixed_high_size += heap->size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700600 high_use_cma = use_cma;
601 } else if (use_cma) {
602 /*
603 * Heaps that use CMA but are not part of the
604 * fixed set. Create wherever.
605 */
606 dma_declare_contiguous(
607 heap->priv,
608 heap->size,
609 0,
610 0xb0000000);
611 }
Hanumant Singheea62562012-05-14 11:32:45 -0700612 }
613 }
614
615 if (!fixed_size)
616 return;
Laura Abbott87eafac2012-09-18 11:45:43 -0700617 /*
618 * Given the setup for the fixed area, we can't round up all sizes.
619 * Some sizes must be set up exactly and aligned correctly. Incorrect
620 * alignments are considered a configuration issue
Hanumant Singheea62562012-05-14 11:32:45 -0700621 */
Hanumant Singheea62562012-05-14 11:32:45 -0700622
623 fixed_low_start = MSM8930_FIXED_AREA_START;
Laura Abbott87eafac2012-09-18 11:45:43 -0700624 if (low_use_cma) {
625 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
626 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
627 } else {
628 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
629 ret = memblock_remove(fixed_low_start,
630 fixed_low_size + HOLE_SIZE);
631 BUG_ON(ret);
632 }
633
Deepak Kotur9830bf02012-06-01 15:04:29 -0700634 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott87eafac2012-09-18 11:45:43 -0700635 if (middle_use_cma) {
636 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
637 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
638 } else {
639 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
640 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
641 BUG_ON(ret);
642 }
643
Hanumant Singheea62562012-05-14 11:32:45 -0700644 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott87eafac2012-09-18 11:45:43 -0700645 if (high_use_cma) {
646 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
647 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
648 } else {
649 /* This is the end of the fixed area so it's okay to round up */
650 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
651 ret = memblock_remove(fixed_high_start, fixed_high_size);
652 BUG_ON(ret);
653 }
Hanumant Singheea62562012-05-14 11:32:45 -0700654
655 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
656 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
657
658 if (heap->extra_data) {
659 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700660 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700661
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700662 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700663 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700664 pdata =
665 (struct ion_cp_heap_pdata *)heap->extra_data;
666 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700667 break;
Laura Abbott87eafac2012-09-18 11:45:43 -0700668 case ION_HEAP_TYPE_DMA:
Hanumant Singheea62562012-05-14 11:32:45 -0700669 case ION_HEAP_TYPE_CARVEOUT:
670 fixed_position = ((struct ion_co_heap_pdata *)
671 heap->extra_data)->fixed_position;
672 break;
673 default:
674 break;
675 }
676
677 switch (fixed_position) {
678 case FIXED_LOW:
679 heap->base = fixed_low_start;
680 break;
681 case FIXED_MIDDLE:
682 heap->base = fixed_middle_start;
Laura Abbott87eafac2012-09-18 11:45:43 -0700683 if (middle_use_cma)
684 dma_declare_contiguous(
685 &ion_mm_heap_device.dev,
686 heap->size,
687 fixed_middle_start,
688 0xa0000000);
Deepak Kotur9830bf02012-06-01 15:04:29 -0700689 pdata->secure_base = fixed_middle_start
690 - HOLE_SIZE;
691 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700692 break;
693 case FIXED_HIGH:
694 heap->base = fixed_high_start;
695 break;
696 default:
697 break;
698 }
699 }
700 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800701#endif
702}
Huaibin Yanga5419422011-12-08 23:52:10 -0800703
704static void __init reserve_mdp_memory(void)
705{
706 msm8930_mdp_writeback(msm8930_reserve_table);
707}
708
Laura Abbottf3173042012-05-29 15:23:18 -0700709#ifdef CONFIG_MSM_CACHE_DUMP
710static void __init reserve_cache_dump_memory(void)
711{
712 unsigned int total;
713
714 total = msm8930_cache_dump_pdata.l1_size +
715 msm8930_cache_dump_pdata.l2_size;
716 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
717}
718#else
719static void __init reserve_cache_dump_memory(void) { }
720#endif
721
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800722static void __init msm8930_calculate_reserve_sizes(void)
723{
724 size_pmem_devices();
725 reserve_pmem_memory();
726 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800727 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800728 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700729 reserve_cache_dump_memory();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800730}
731
732static struct reserve_info msm8930_reserve_info __initdata = {
733 .memtype_reserve_table = msm8930_reserve_table,
734 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700735 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800736 .paddr_to_memtype = msm8930_paddr_to_memtype,
737};
738
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800739static void __init msm8930_early_memory(void)
740{
741 reserve_info = &msm8930_reserve_info;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800742}
743
744static void __init msm8930_reserve(void)
745{
746 msm_reserve();
747}
748
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800749static void __init msm8930_allocate_memory_regions(void)
750{
751 msm8930_allocate_fb_region();
752}
753
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530754#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800755
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530756#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800757
758/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
759 * 4 micbiases are used to power various analog and digital
760 * microphones operating at 1800 mV. Technically, all micbiases
761 * can source from single cfilter since all microphones operate
762 * at the same voltage level. The arrangement below is to make
763 * sure all cfilters are exercised. LDO_H regulator ouput level
764 * does not need to be as high as 2.85V. It is choosen for
765 * microphone sensitivity purpose.
766 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530767static struct wcd9xxx_pdata sitar_platform_data = {
768 .slimbus_slave_device = {
769 .name = "sitar-slave",
770 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800771 },
772 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530773 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530774 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530775 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800776 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530777 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800778 .cfilt1_mv = 1800,
779 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530780 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
781 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700782 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
783 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530784 },
785 .regulator = {
786 {
787 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700788 .min_uV = 1800000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530789 .max_uV = 2200000,
790 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
791 },
792 {
793 .name = "CDC_VDDA_RX",
794 .min_uV = 1800000,
795 .max_uV = 1800000,
796 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
797 },
798 {
799 .name = "CDC_VDDA_TX",
800 .min_uV = 1800000,
801 .max_uV = 1800000,
802 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
803 },
804 {
805 .name = "VDDIO_CDC",
806 .min_uV = 1800000,
807 .max_uV = 1800000,
808 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
809 },
810 {
811 .name = "VDDD_CDC_D",
812 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700813 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530814 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
815 },
816 {
817 .name = "CDC_VDDA_A_1P2V",
818 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700819 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530820 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
821 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800822 },
823};
824
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530825static struct slim_device msm_slim_sitar = {
826 .name = "sitar-slim",
827 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800828 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530829 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800830 },
831};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700832
833static struct wcd9xxx_pdata sitar1p1_platform_data = {
834 .slimbus_slave_device = {
835 .name = "sitar-slave",
836 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
837 },
838 .irq = MSM_GPIO_TO_INT(62),
839 .irq_base = SITAR_INTERRUPT_BASE,
840 .num_irqs = NR_WCD9XXX_IRQS,
841 .reset_gpio = 42,
842 .micbias = {
843 .ldoh_v = SITAR_LDOH_2P85_V,
844 .cfilt1_mv = 1800,
845 .cfilt2_mv = 1800,
846 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
847 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700848 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
849 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700850 },
851 .regulator = {
852 {
853 .name = "CDC_VDD_CP",
David Collinsbba26332012-08-16 16:11:53 -0700854 .min_uV = 1800000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700855 .max_uV = 2200000,
856 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
857 },
858 {
859 .name = "CDC_VDDA_RX",
860 .min_uV = 1800000,
861 .max_uV = 1800000,
862 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
863 },
864 {
865 .name = "CDC_VDDA_TX",
866 .min_uV = 1800000,
867 .max_uV = 1800000,
868 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
869 },
870 {
871 .name = "VDDIO_CDC",
872 .min_uV = 1800000,
873 .max_uV = 1800000,
874 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
875 },
876 {
877 .name = "VDDD_CDC_D",
878 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700879 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700880 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
881 },
882 {
883 .name = "CDC_VDDA_A_1P2V",
884 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700885 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700886 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
887 },
888 },
889};
890
891static struct slim_device msm_slim_sitar1p1 = {
892 .name = "sitar1p1-slim",
893 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
894 .dev = {
895 .platform_data = &sitar1p1_platform_data,
896 },
897};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800898#endif
899
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530900
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800901static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530902#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800903 {
904 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530905 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800906 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700907 {
908 .bus_num = 1,
909 .slim_slave = &msm_slim_sitar1p1,
910 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800911#endif
912 /* add more slimbus slaves as needed */
913};
914
915#define MSM_WCNSS_PHYS 0x03000000
916#define MSM_WCNSS_SIZE 0x280000
917
918static struct resource resources_wcnss_wlan[] = {
919 {
920 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
921 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
922 .name = "wcnss_wlanrx_irq",
923 .flags = IORESOURCE_IRQ,
924 },
925 {
926 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
927 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
928 .name = "wcnss_wlantx_irq",
929 .flags = IORESOURCE_IRQ,
930 },
931 {
932 .start = MSM_WCNSS_PHYS,
933 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
934 .name = "wcnss_mmio",
935 .flags = IORESOURCE_MEM,
936 },
937 {
938 .start = 84,
939 .end = 88,
940 .name = "wcnss_gpios_5wire",
941 .flags = IORESOURCE_IO,
942 },
943};
944
945static struct qcom_wcnss_opts qcom_wcnss_pdata = {
946 .has_48mhz_xo = 1,
947};
948
949static struct platform_device msm_device_wcnss_wlan = {
950 .name = "wcnss_wlan",
951 .id = 0,
952 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
953 .resource = resources_wcnss_wlan,
954 .dev = {.platform_data = &qcom_wcnss_pdata},
955};
956
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700957#ifdef CONFIG_QSEECOM
958/* qseecom bus scaling */
959static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
960 {
961 .src = MSM_BUS_MASTER_SPS,
962 .dst = MSM_BUS_SLAVE_EBI_CH0,
963 .ib = 0,
964 .ab = 0,
965 },
966 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -0700967 .src = MSM_BUS_MASTER_SPS,
968 .dst = MSM_BUS_SLAVE_SPS,
969 .ib = 0,
970 .ab = 0,
971 },
972 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700973 .src = MSM_BUS_MASTER_SPDM,
974 .dst = MSM_BUS_SLAVE_SPDM,
975 .ib = 0,
976 .ab = 0,
977 },
978};
979
980static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
981 {
982 .src = MSM_BUS_MASTER_SPS,
983 .dst = MSM_BUS_SLAVE_EBI_CH0,
984 .ib = (492 * 8) * 1000000UL,
985 .ab = (492 * 8) * 100000UL,
986 },
987 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -0700988 .src = MSM_BUS_MASTER_SPS,
989 .dst = MSM_BUS_SLAVE_SPS,
990 .ib = (492 * 8) * 1000000UL,
991 .ab = (492 * 8) * 100000UL,
992 },
993 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700994 .src = MSM_BUS_MASTER_SPDM,
995 .dst = MSM_BUS_SLAVE_SPDM,
996 .ib = 0,
997 .ab = 0,
998 },
999};
1000
1001static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1002 {
1003 .src = MSM_BUS_MASTER_SPS,
1004 .dst = MSM_BUS_SLAVE_EBI_CH0,
1005 .ib = 0,
1006 .ab = 0,
1007 },
1008 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001009 .src = MSM_BUS_MASTER_SPS,
1010 .dst = MSM_BUS_SLAVE_SPS,
1011 .ib = 0,
1012 .ab = 0,
1013 },
1014 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001015 .src = MSM_BUS_MASTER_SPDM,
1016 .dst = MSM_BUS_SLAVE_SPDM,
1017 .ib = (64 * 8) * 1000000UL,
1018 .ab = (64 * 8) * 100000UL,
1019 },
1020};
1021
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001022static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1023 {
1024 .src = MSM_BUS_MASTER_SPS,
1025 .dst = MSM_BUS_SLAVE_EBI_CH0,
1026 .ib = (492 * 8) * 1000000UL,
1027 .ab = (492 * 8) * 100000UL,
1028 },
1029 {
1030 .src = MSM_BUS_MASTER_SPS,
1031 .dst = MSM_BUS_SLAVE_SPS,
1032 .ib = (492 * 8) * 1000000UL,
1033 .ab = (492 * 8) * 100000UL,
1034 },
1035 {
1036 .src = MSM_BUS_MASTER_SPDM,
1037 .dst = MSM_BUS_SLAVE_SPDM,
1038 .ib = (64 * 8) * 1000000UL,
1039 .ab = (64 * 8) * 100000UL,
1040 },
1041};
1042
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001043static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1044 {
1045 ARRAY_SIZE(qseecom_clks_init_vectors),
1046 qseecom_clks_init_vectors,
1047 },
1048 {
1049 ARRAY_SIZE(qseecom_enable_dfab_vectors),
1050 qseecom_enable_sfpb_vectors,
1051 },
1052 {
1053 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1054 qseecom_enable_sfpb_vectors,
1055 },
Ramesh Masavarapu4f091cb2012-10-03 10:18:06 -07001056 {
1057 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1058 qseecom_enable_dfab_sfpb_vectors,
1059 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001060};
1061
1062static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1063 qseecom_hw_bus_scale_usecases,
1064 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1065 .name = "qsee",
1066};
1067
1068static struct platform_device qseecom_device = {
1069 .name = "qseecom",
1070 .id = 0,
1071 .dev = {
1072 .platform_data = &qseecom_bus_pdata,
1073 },
1074};
1075#endif
1076
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001077#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1078 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1079 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1080 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1081
1082#define QCE_SIZE 0x10000
1083#define QCE_0_BASE 0x18500000
1084
1085#define QCE_HW_KEY_SUPPORT 0
1086#define QCE_SHA_HMAC_SUPPORT 1
1087#define QCE_SHARE_CE_RESOURCE 1
1088#define QCE_CE_SHARED 0
1089
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001090/* Begin Bus scaling definitions */
1091static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1092 {
1093 .src = MSM_BUS_MASTER_ADM_PORT0,
1094 .dst = MSM_BUS_SLAVE_EBI_CH0,
1095 .ab = 0,
1096 .ib = 0,
1097 },
1098 {
1099 .src = MSM_BUS_MASTER_ADM_PORT1,
1100 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1101 .ab = 0,
1102 .ib = 0,
1103 },
1104};
1105
1106static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1107 {
1108 .src = MSM_BUS_MASTER_ADM_PORT0,
1109 .dst = MSM_BUS_SLAVE_EBI_CH0,
1110 .ab = 70000000UL,
1111 .ib = 70000000UL,
1112 },
1113 {
1114 .src = MSM_BUS_MASTER_ADM_PORT1,
1115 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1116 .ab = 2480000000UL,
1117 .ib = 2480000000UL,
1118 },
1119};
1120
1121static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1122 {
1123 ARRAY_SIZE(crypto_hw_init_vectors),
1124 crypto_hw_init_vectors,
1125 },
1126 {
1127 ARRAY_SIZE(crypto_hw_active_vectors),
1128 crypto_hw_active_vectors,
1129 },
1130};
1131
1132static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1133 crypto_hw_bus_scale_usecases,
1134 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1135 .name = "cryptohw",
1136};
1137/* End Bus Scaling Definitions*/
1138
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001139static struct resource qcrypto_resources[] = {
1140 [0] = {
1141 .start = QCE_0_BASE,
1142 .end = QCE_0_BASE + QCE_SIZE - 1,
1143 .flags = IORESOURCE_MEM,
1144 },
1145 [1] = {
1146 .name = "crypto_channels",
1147 .start = DMOV_CE_IN_CHAN,
1148 .end = DMOV_CE_OUT_CHAN,
1149 .flags = IORESOURCE_DMA,
1150 },
1151 [2] = {
1152 .name = "crypto_crci_in",
1153 .start = DMOV_CE_IN_CRCI,
1154 .end = DMOV_CE_IN_CRCI,
1155 .flags = IORESOURCE_DMA,
1156 },
1157 [3] = {
1158 .name = "crypto_crci_out",
1159 .start = DMOV_CE_OUT_CRCI,
1160 .end = DMOV_CE_OUT_CRCI,
1161 .flags = IORESOURCE_DMA,
1162 },
1163};
1164
1165static struct resource qcedev_resources[] = {
1166 [0] = {
1167 .start = QCE_0_BASE,
1168 .end = QCE_0_BASE + QCE_SIZE - 1,
1169 .flags = IORESOURCE_MEM,
1170 },
1171 [1] = {
1172 .name = "crypto_channels",
1173 .start = DMOV_CE_IN_CHAN,
1174 .end = DMOV_CE_OUT_CHAN,
1175 .flags = IORESOURCE_DMA,
1176 },
1177 [2] = {
1178 .name = "crypto_crci_in",
1179 .start = DMOV_CE_IN_CRCI,
1180 .end = DMOV_CE_IN_CRCI,
1181 .flags = IORESOURCE_DMA,
1182 },
1183 [3] = {
1184 .name = "crypto_crci_out",
1185 .start = DMOV_CE_OUT_CRCI,
1186 .end = DMOV_CE_OUT_CRCI,
1187 .flags = IORESOURCE_DMA,
1188 },
1189};
1190
1191#endif
1192
1193#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1194 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1195
1196static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1197 .ce_shared = QCE_CE_SHARED,
1198 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1199 .hw_key_support = QCE_HW_KEY_SUPPORT,
1200 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001201 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001202};
1203
1204static struct platform_device qcrypto_device = {
1205 .name = "qcrypto",
1206 .id = 0,
1207 .num_resources = ARRAY_SIZE(qcrypto_resources),
1208 .resource = qcrypto_resources,
1209 .dev = {
1210 .coherent_dma_mask = DMA_BIT_MASK(32),
1211 .platform_data = &qcrypto_ce_hw_suppport,
1212 },
1213};
1214#endif
1215
1216#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1217 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1218
1219static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1220 .ce_shared = QCE_CE_SHARED,
1221 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1222 .hw_key_support = QCE_HW_KEY_SUPPORT,
1223 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001224 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001225};
1226
1227static struct platform_device qcedev_device = {
1228 .name = "qce",
1229 .id = 0,
1230 .num_resources = ARRAY_SIZE(qcedev_resources),
1231 .resource = qcedev_resources,
1232 .dev = {
1233 .coherent_dma_mask = DMA_BIT_MASK(32),
1234 .platform_data = &qcedev_ce_hw_suppport,
1235 },
1236};
1237#endif
1238
1239#define MDM2AP_ERRFATAL 70
1240#define AP2MDM_ERRFATAL 95
1241#define MDM2AP_STATUS 69
1242#define AP2MDM_STATUS 94
1243#define AP2MDM_PMIC_RESET_N 80
1244#define AP2MDM_KPDPWR_N 81
1245
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001246static struct resource mdm_resources[] = {
1247 {
1248 .start = MDM2AP_ERRFATAL,
1249 .end = MDM2AP_ERRFATAL,
1250 .name = "MDM2AP_ERRFATAL",
1251 .flags = IORESOURCE_IO,
1252 },
1253 {
1254 .start = AP2MDM_ERRFATAL,
1255 .end = AP2MDM_ERRFATAL,
1256 .name = "AP2MDM_ERRFATAL",
1257 .flags = IORESOURCE_IO,
1258 },
1259 {
1260 .start = MDM2AP_STATUS,
1261 .end = MDM2AP_STATUS,
1262 .name = "MDM2AP_STATUS",
1263 .flags = IORESOURCE_IO,
1264 },
1265 {
1266 .start = AP2MDM_STATUS,
1267 .end = AP2MDM_STATUS,
1268 .name = "AP2MDM_STATUS",
1269 .flags = IORESOURCE_IO,
1270 },
1271 {
1272 .start = AP2MDM_PMIC_RESET_N,
1273 .end = AP2MDM_PMIC_RESET_N,
1274 .name = "AP2MDM_PMIC_RESET_N",
1275 .flags = IORESOURCE_IO,
1276 },
1277 {
1278 .start = AP2MDM_KPDPWR_N,
1279 .end = AP2MDM_KPDPWR_N,
1280 .name = "AP2MDM_KPDPWR_N",
1281 .flags = IORESOURCE_IO,
1282 },
1283};
1284
1285static struct mdm_platform_data mdm_platform_data = {
1286 .mdm_version = "2.5",
1287};
1288
1289static struct platform_device mdm_device = {
1290 .name = "mdm2_modem",
1291 .id = -1,
1292 .num_resources = ARRAY_SIZE(mdm_resources),
1293 .resource = mdm_resources,
1294 .dev = {
1295 .platform_data = &mdm_platform_data,
1296 },
1297};
1298
Taniya Das087145b2013-03-16 21:37:41 +05301299static struct mdm_platform_data sglte_platform_data = {
1300 .mdm_version = "4.0",
1301 .ramdump_delay_ms = 1000,
1302 .soft_reset_inverted = 1,
1303 .peripheral_platform_device = NULL,
1304 .ramdump_timeout_ms = 600000,
1305 .no_powerdown_after_ramdumps = 1,
1306 .image_upgrade_supported = 1,
1307};
1308
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001309static struct platform_device *mdm_devices[] __initdata = {
1310 &mdm_device,
1311};
1312
Praveen Chidambaram78499012011-11-01 17:15:17 -06001313#ifdef CONFIG_MSM_MPM
1314static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1315 [1] = MSM_GPIO_TO_INT(46),
1316 [2] = MSM_GPIO_TO_INT(150),
1317 [4] = MSM_GPIO_TO_INT(103),
1318 [5] = MSM_GPIO_TO_INT(104),
1319 [6] = MSM_GPIO_TO_INT(105),
1320 [7] = MSM_GPIO_TO_INT(106),
1321 [8] = MSM_GPIO_TO_INT(107),
1322 [9] = MSM_GPIO_TO_INT(7),
1323 [10] = MSM_GPIO_TO_INT(11),
1324 [11] = MSM_GPIO_TO_INT(15),
1325 [12] = MSM_GPIO_TO_INT(19),
1326 [13] = MSM_GPIO_TO_INT(23),
1327 [14] = MSM_GPIO_TO_INT(27),
1328 [15] = MSM_GPIO_TO_INT(31),
1329 [16] = MSM_GPIO_TO_INT(35),
1330 [19] = MSM_GPIO_TO_INT(90),
1331 [20] = MSM_GPIO_TO_INT(92),
1332 [23] = MSM_GPIO_TO_INT(85),
1333 [24] = MSM_GPIO_TO_INT(83),
1334 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001335 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001336 [27] = HDMI_IRQ,
1337 [29] = MSM_GPIO_TO_INT(10),
1338 [30] = MSM_GPIO_TO_INT(102),
1339 [31] = MSM_GPIO_TO_INT(81),
1340 [32] = MSM_GPIO_TO_INT(78),
1341 [33] = MSM_GPIO_TO_INT(94),
1342 [34] = MSM_GPIO_TO_INT(72),
1343 [35] = MSM_GPIO_TO_INT(39),
1344 [36] = MSM_GPIO_TO_INT(43),
1345 [37] = MSM_GPIO_TO_INT(61),
1346 [38] = MSM_GPIO_TO_INT(50),
1347 [39] = MSM_GPIO_TO_INT(42),
1348 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001349 [42] = MSM_GPIO_TO_INT(8),
1350 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001351 [44] = MSM_GPIO_TO_INT(70),
1352 [45] = MSM_GPIO_TO_INT(69),
1353 [46] = MSM_GPIO_TO_INT(67),
1354 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001355 [48] = MSM_GPIO_TO_INT(55),
1356 [49] = MSM_GPIO_TO_INT(74),
1357 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001358 [51] = MSM_GPIO_TO_INT(49),
1359 [52] = MSM_GPIO_TO_INT(40),
1360 [53] = MSM_GPIO_TO_INT(37),
1361 [54] = MSM_GPIO_TO_INT(24),
1362 [55] = MSM_GPIO_TO_INT(14),
1363};
1364
1365static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1366 TLMM_MSM_SUMMARY_IRQ,
1367 RPM_APCC_CPU0_GP_HIGH_IRQ,
1368 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1369 RPM_APCC_CPU0_GP_LOW_IRQ,
1370 RPM_APCC_CPU0_WAKE_UP_IRQ,
1371 RPM_APCC_CPU1_GP_HIGH_IRQ,
1372 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1373 RPM_APCC_CPU1_GP_LOW_IRQ,
1374 RPM_APCC_CPU1_WAKE_UP_IRQ,
1375 MSS_TO_APPS_IRQ_0,
1376 MSS_TO_APPS_IRQ_1,
1377 MSS_TO_APPS_IRQ_2,
1378 MSS_TO_APPS_IRQ_3,
1379 MSS_TO_APPS_IRQ_4,
1380 MSS_TO_APPS_IRQ_5,
1381 MSS_TO_APPS_IRQ_6,
1382 MSS_TO_APPS_IRQ_7,
1383 MSS_TO_APPS_IRQ_8,
1384 MSS_TO_APPS_IRQ_9,
1385 LPASS_SCSS_GP_LOW_IRQ,
1386 LPASS_SCSS_GP_MEDIUM_IRQ,
1387 LPASS_SCSS_GP_HIGH_IRQ,
1388 SPS_MTI_30,
1389 SPS_MTI_31,
1390 RIVA_APSS_SPARE_IRQ,
1391 RIVA_APPS_WLAN_SMSM_IRQ,
1392 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1393 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1394};
1395
1396struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1397 .irqs_m2a = msm_mpm_irqs_m2a,
1398 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1399 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1400 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1401 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1402 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1403 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1404 .mpm_apps_ipc_val = BIT(1),
1405 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1406
1407};
1408#endif
1409
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001410#define MSM_SHARED_RAM_PHYS 0x80000000
1411
1412static void __init msm8930_map_io(void)
1413{
1414 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1415 msm_map_msm8930_io();
1416
1417 if (socinfo_init() < 0)
1418 pr_err("socinfo_init() failed!\n");
1419}
1420
1421static void __init msm8930_init_irq(void)
1422{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001423 struct msm_mpm_device_data *data = NULL;
1424#ifdef CONFIG_MSM_MPM
1425 data = &msm8930_mpm_dev_data;
1426#endif
1427
1428 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001429 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1430 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001431}
1432
1433static void __init msm8930_init_buses(void)
1434{
1435#ifdef CONFIG_MSM_BUS_SCALING
1436 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001437 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1438 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1439 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1440 msm_bus_8930_apps_fabric.dev.platform_data =
1441 &msm_bus_8930_apps_fabric_pdata;
1442 msm_bus_8930_sys_fabric.dev.platform_data =
1443 &msm_bus_8930_sys_fabric_pdata;
1444 msm_bus_8930_mm_fabric.dev.platform_data =
1445 &msm_bus_8930_mm_fabric_pdata;
1446 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1447 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001448#endif
1449}
1450
1451static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1452 .max_clock_speed = 15060000,
1453};
1454
1455#ifdef CONFIG_USB_MSM_OTG_72K
1456static struct msm_otg_platform_data msm_otg_pdata;
1457#else
Mayank Rana2a1c7db2013-01-08 15:10:51 +05301458static int enable_usb_host_mode;
1459static int __init usb_host_mode_with_pm8917(char *param)
1460{
1461 int ret;
1462
1463 ret = kstrtoint(param, 10, &enable_usb_host_mode);
1464 return ret;
1465}
1466early_param("usb_host_mode_pm8917", usb_host_mode_with_pm8917);
1467
Manu Gautam32ab9462012-02-20 12:33:01 +05301468#ifdef CONFIG_MSM_BUS_SCALING
1469/* Bandwidth requests (zero) if no vote placed */
1470static struct msm_bus_vectors usb_init_vectors[] = {
1471 {
1472 .src = MSM_BUS_MASTER_SPS,
1473 .dst = MSM_BUS_SLAVE_EBI_CH0,
1474 .ab = 0,
1475 .ib = 0,
1476 },
1477};
1478
1479/* Bus bandwidth requests in Bytes/sec */
1480static struct msm_bus_vectors usb_max_vectors[] = {
1481 {
1482 .src = MSM_BUS_MASTER_SPS,
1483 .dst = MSM_BUS_SLAVE_EBI_CH0,
1484 .ab = 60000000, /* At least 480Mbps on bus. */
1485 .ib = 960000000, /* MAX bursts rate */
1486 },
1487};
1488
1489static struct msm_bus_paths usb_bus_scale_usecases[] = {
1490 {
1491 ARRAY_SIZE(usb_init_vectors),
1492 usb_init_vectors,
1493 },
1494 {
1495 ARRAY_SIZE(usb_max_vectors),
1496 usb_max_vectors,
1497 },
1498};
1499
1500static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1501 usb_bus_scale_usecases,
1502 ARRAY_SIZE(usb_bus_scale_usecases),
1503 .name = "usb",
1504};
1505#endif
1506
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301507static int hsusb_phy_init_seq[] = {
1508 0x44, 0x80, /* set VBUS valid threshold
1509 and disconnect valid threshold */
1510 0x38, 0x81, /* update DC voltage level */
1511 0x24, 0x82, /* set preemphasis and rise/fall time */
1512 0x13, 0x83, /* set source impedance adjusment */
1513 -1};
1514
Jack Pham87f202f2012-08-06 00:24:22 -07001515#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1516
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001517static struct msm_otg_platform_data msm_otg_pdata = {
1518 .mode = USB_OTG,
1519 .otg_control = OTG_PMIC_CONTROL,
1520 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001521 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301522#ifdef CONFIG_MSM_BUS_SCALING
1523 .bus_scale_table = &usb_bus_scale_pdata,
1524#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301525#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1526 .mhl_dev_name = "sii8334",
1527#endif
Jack Pham87f202f2012-08-06 00:24:22 -07001528 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001529};
1530#endif
1531
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001532#define PID_MAGIC_ID 0x71432909
1533#define SERIAL_NUM_MAGIC_ID 0x61945374
1534#define SERIAL_NUMBER_LENGTH 127
1535#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1536
1537struct magic_num_struct {
1538 uint32_t pid;
1539 uint32_t serial_num;
1540};
1541
1542struct dload_struct {
1543 uint32_t reserved1;
1544 uint32_t reserved2;
1545 uint32_t reserved3;
1546 uint16_t reserved4;
1547 uint16_t pid;
1548 char serial_number[SERIAL_NUMBER_LENGTH];
1549 uint16_t reserved5;
1550 struct magic_num_struct magic_struct;
1551};
1552
1553static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1554{
1555 struct dload_struct __iomem *dload = 0;
1556
1557 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1558 if (!dload) {
1559 pr_err("%s: cannot remap I/O memory region: %08x\n",
1560 __func__, DLOAD_USB_BASE_ADD);
1561 return -ENXIO;
1562 }
1563
1564 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1565 __func__, dload, pid, snum);
1566 /* update pid */
1567 dload->magic_struct.pid = PID_MAGIC_ID;
1568 dload->pid = pid;
1569
1570 /* update serial number */
1571 dload->magic_struct.serial_num = 0;
1572 if (!snum) {
1573 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1574 goto out;
1575 }
1576
1577 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1578 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1579out:
1580 iounmap(dload);
1581 return 0;
1582}
1583
1584static struct android_usb_platform_data android_usb_pdata = {
1585 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1586};
1587
1588static struct platform_device android_usb_device = {
1589 .name = "android_usb",
1590 .id = -1,
1591 .dev = {
1592 .platform_data = &android_usb_pdata,
1593 },
1594};
1595
1596static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001597 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001598};
1599
Anji Jonnala786b39e2013-01-29 13:34:10 +05301600
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301601static uint8_t spm_retention_cmd_sequence[] __initdata = {
1602 0x00, 0x05, 0x03, 0x0D,
1603 0x0B, 0x00, 0x0f,
1604};
1605
Anji Jonnala786b39e2013-01-29 13:34:10 +05301606static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
1607 0x42, 0x1B, 0x00,
1608 0x05, 0x03, 0x0D, 0x0B,
1609 0x00, 0x42, 0x1B,
1610 0x0f,
1611};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001612static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001613 0x00, 0x24, 0x54, 0x10,
1614 0x09, 0x03, 0x01,
1615 0x10, 0x54, 0x30, 0x0C,
1616 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001617};
1618
1619static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001620 0x00, 0x24, 0x54, 0x10,
1621 0x09, 0x07, 0x01, 0x0B,
1622 0x10, 0x54, 0x30, 0x0C,
1623 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001624};
1625
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301626static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1627 [0] = {
1628 .mode = MSM_SPM_MODE_CLOCK_GATING,
1629 .notify_rpm = false,
1630 .cmd = spm_wfi_cmd_sequence,
1631 },
1632 [1] = {
1633 .mode = MSM_SPM_MODE_POWER_RETENTION,
1634 .notify_rpm = false,
1635 .cmd = spm_retention_cmd_sequence,
1636 },
1637 [2] = {
1638 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1639 .notify_rpm = false,
1640 .cmd = spm_power_collapse_without_rpm,
1641 },
1642 [3] = {
1643 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1644 .notify_rpm = true,
1645 .cmd = spm_power_collapse_with_rpm,
1646 },
1647};
1648
1649static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001650 [0] = {
1651 .mode = MSM_SPM_MODE_CLOCK_GATING,
1652 .notify_rpm = false,
1653 .cmd = spm_wfi_cmd_sequence,
1654 },
1655 [1] = {
Anji Jonnala786b39e2013-01-29 13:34:10 +05301656 .mode = MSM_SPM_MODE_POWER_RETENTION,
1657 .notify_rpm = false,
1658 .cmd = spm_retention_cmd_sequence,
1659 },
1660 [2] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001661 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1662 .notify_rpm = false,
1663 .cmd = spm_power_collapse_without_rpm,
1664 },
Anji Jonnala786b39e2013-01-29 13:34:10 +05301665 [3] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001666 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1667 .notify_rpm = true,
1668 .cmd = spm_power_collapse_with_rpm,
1669 },
1670};
1671
1672static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1673 [0] = {
1674 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001675 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001676#if defined(CONFIG_MSM_AVS_HW)
1677 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1678 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1679#endif
1680 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301681 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1682 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1683 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001684 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301685 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1686 .modes = msm_spm_boot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001687 },
1688 [1] = {
1689 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001690 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001691#if defined(CONFIG_MSM_AVS_HW)
1692 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1693 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1694#endif
1695 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Anji Jonnala786b39e2013-01-29 13:34:10 +05301696 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1697 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1698 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001699 .vctl_timeout_us = 50,
Anji Jonnala85b29ff2013-01-15 14:12:45 +05301700 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1701 .modes = msm_spm_nonboot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001702 },
1703};
1704
1705static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001706 0x00, 0x20, 0x03, 0x20,
1707 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001708};
1709
1710static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001711 0x00, 0x20, 0x34, 0x64,
1712 0x48, 0x07, 0x48, 0x20,
1713 0x50, 0x64, 0x04, 0x34,
1714 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001715};
1716static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001717 0x00, 0x10, 0x34, 0x64,
1718 0x48, 0x07, 0x48, 0x10,
1719 0x50, 0x64, 0x04, 0x34,
1720 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001721};
1722
1723static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1724 [0] = {
1725 .mode = MSM_SPM_L2_MODE_RETENTION,
1726 .notify_rpm = false,
1727 .cmd = l2_spm_wfi_cmd_sequence,
1728 },
1729 [1] = {
1730 .mode = MSM_SPM_L2_MODE_GDHS,
1731 .notify_rpm = true,
1732 .cmd = l2_spm_gdhs_cmd_sequence,
1733 },
1734 [2] = {
1735 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1736 .notify_rpm = true,
1737 .cmd = l2_spm_power_off_cmd_sequence,
1738 },
1739};
1740
1741static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1742 [0] = {
1743 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001744 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001745 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001746 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1747 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1748 .modes = msm_spm_l2_seq_list,
1749 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1750 },
1751};
1752
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301753#define ISA1200_HAP_EN_GPIO 77
1754#define ISA1200_HAP_LEN_GPIO 78
David Collins04499982012-08-06 15:02:03 -07001755#define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7)
1756#define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001757
1758static int isa1200_power(int on)
1759{
David Collins04499982012-08-06 15:02:03 -07001760 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
1761 enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1;
Amy Malocheb20c1052012-04-11 10:36:13 -07001762 int rc = 0;
1763
David Collins04499982012-08-06 15:02:03 -07001764 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
1765 gpio = ISA1200_HAP_CLK_PM8917;
1766 clk_id = CLK_MP3_2;
1767 }
1768
1769 gpio_set_value_cansleep(gpio, !!on);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301770
Amy Malocheb20c1052012-04-11 10:36:13 -07001771 if (on)
David Collins04499982012-08-06 15:02:03 -07001772 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001773 else
David Collins04499982012-08-06 15:02:03 -07001774 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001775
1776 if (rc) {
1777 pr_err("%s: unable to write aux clock register(%d)\n",
1778 __func__, rc);
1779 }
1780
1781 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001782}
1783
1784static int isa1200_dev_setup(bool enable)
1785{
David Collins04499982012-08-06 15:02:03 -07001786 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001787 int rc = 0;
1788
David Collins04499982012-08-06 15:02:03 -07001789 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1790 gpio = ISA1200_HAP_CLK_PM8917;
1791
Amy Malocheb20c1052012-04-11 10:36:13 -07001792 if (!enable)
1793 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301794
David Collins04499982012-08-06 15:02:03 -07001795 rc = gpio_request(gpio, "haptics_clk");
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301796 if (rc) {
1797 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001798 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301799 goto fail_gpio_req;
1800 }
1801
David Collins04499982012-08-06 15:02:03 -07001802 rc = gpio_direction_output(gpio, 0);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301803 if (rc) {
1804 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
David Collins04499982012-08-06 15:02:03 -07001805 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301806 goto fail_gpio_dir;
1807 }
1808
1809 return 0;
1810
1811fail_gpio_dir:
David Collins04499982012-08-06 15:02:03 -07001812 gpio_free(gpio);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301813fail_gpio_req:
1814 return rc;
1815
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001816}
1817
1818static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301819 {
1820 .name = "vddp",
1821 .min_uV = ISA_I2C_VTG_MIN_UV,
1822 .max_uV = ISA_I2C_VTG_MAX_UV,
1823 .load_uA = ISA_I2C_CURR_UA,
1824 },
Amy Malochee8de95d2012-02-23 10:40:25 -08001825 {
1826 .name = "vcc_i2c",
1827 .min_uV = ISA_I2C_VTG_MIN_UV,
1828 .max_uV = ISA_I2C_VTG_MAX_UV,
1829 .load_uA = ISA_I2C_CURR_UA,
1830 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001831};
1832
1833static struct isa1200_platform_data isa1200_1_pdata = {
1834 .name = "vibrator",
1835 .dev_setup = isa1200_dev_setup,
1836 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301837 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1838 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001839 .max_timeout = 15000,
1840 .mode_ctrl = PWM_GEN_MODE,
1841 .pwm_fd = {
1842 .pwm_div = 256,
1843 },
1844 .is_erm = false,
1845 .smart_en = true,
1846 .ext_clk_en = true,
1847 .chip_en = 1,
1848 .regulator_info = isa1200_reg_data,
1849 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1850};
1851
1852static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1853 {
1854 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1855 .platform_data = &isa1200_1_pdata,
1856 },
1857};
1858
Amy Malochef3c9db42011-12-08 15:17:35 -08001859#define MXT_TS_GPIO_IRQ 11
1860#define MXT_TS_RESET_GPIO 52
1861
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301862static const u8 mxt_config_data_8930_v1[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001863 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001864 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001865 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301866 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001867 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301868 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001869 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301870 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001871 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301872 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1873 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1874 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1875 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001876 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001877 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1878 0,
1879 /* T18 Object */
1880 0, 0,
1881 /* T19 Object */
1882 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1883 0, 0, 0, 0, 0, 0,
1884 /* T23 Object */
1885 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1886 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001887 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001888 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1889 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001890 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001891 0, 0, 0, 0, 0,
1892 /* T42 Object */
1893 0, 0, 0, 0, 0, 0, 0, 0,
1894 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301895 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001896 /* T47 Object */
1897 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1898 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301899 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1900 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1901 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001902 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1903 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1904 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001905};
1906
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301907static const u8 mxt_config_data_8930_v2[] = {
1908 /* T6 Object */
1909 0, 0, 0, 0, 0, 0,
1910 /* T38 Object */
1911 15, 4, 0, 9, 7, 12, 0, 0,
1912 /* T7 Object */
1913 32, 16, 50,
1914 /* T8 Object */
1915 30, 0, 5, 10, 0, 0, 10, 10, 0, 0,
1916 /* T9 Object */
1917 131, 0, 0, 19, 11, 0, 16, 50, 1, 3,
1918 12, 7, 2, 0, 4, 5, 2, 10, 43, 4,
1919 54, 2, -25, 29, 38, 18, 143, 40, 207, 80,
1920 17, 5, 50, 50, 0,
1921 /* T18 Object */
1922 0, 0,
1923 /* T19 Object */
1924 0, 0, 0, 0, 0, 0,
1925 /* T25 Object */
1926 0, 0, 0, 0, 0, 0,
1927 /* T42 Object */
1928 3, 60, 20, 20, 150, 0, 0, 0,
1929 /* T46 Object */
1930 0, 3, 28, 28, 0, 0, 1, 0, 0,
1931 /* T47 Object */
1932 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1933 /* T48 Object */
1934 1, 3, 82, 0, 0, 0, 0, 0, 0, 0,
1935 16, 30, 0, 6, 6, 0, 0, 124, 4, 100,
1936 0, 0, 0, 5, 0, 42, 0, 1, 0, 40,
1937 52, 20, 0, 0, 0, 50, 1, 5, 2, 1,
1938 4, 5, 3, -25, 29, 38, 18, 143, 40, 207,
1939 80, 10, 5, 2,
1940 /* T55 Object */
1941 0, 0, 0, 0,
1942};
1943
Amy Malochef3c9db42011-12-08 15:17:35 -08001944static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1945 struct kobj_attribute *attr, char *buf)
1946{
1947 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301948 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1949 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1950 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1951 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001952 "\n");
1953}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001954
Amy Malochef3c9db42011-12-08 15:17:35 -08001955static struct kobj_attribute mxt224e_vkeys_attr = {
1956 .attr = {
1957 .mode = S_IRUGO,
1958 },
1959 .show = &mxt224e_vkeys_show,
1960};
1961
1962static struct attribute *mxt224e_properties_attrs[] = {
1963 &mxt224e_vkeys_attr.attr,
1964 NULL
1965};
1966
1967static struct attribute_group mxt224e_properties_attr_group = {
1968 .attrs = mxt224e_properties_attrs,
1969};
1970
1971static void mxt_init_vkeys_8930(void)
1972{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001973 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001974 static struct kobject *mxt224e_properties_kobj;
1975
1976 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1977 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1978 NULL);
1979 if (mxt224e_properties_kobj)
1980 rc = sysfs_create_group(mxt224e_properties_kobj,
1981 &mxt224e_properties_attr_group);
1982 if (!mxt224e_properties_kobj || rc)
1983 pr_err("%s: failed to create board_properties\n",
1984 __func__);
1985
1986 return;
1987}
1988
Jing Lindc4413c2012-01-16 15:22:52 -08001989static struct mxt_config_info mxt_config_array[] = {
1990 {
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301991 .config = mxt_config_data_8930_v1,
1992 .config_length = ARRAY_SIZE(mxt_config_data_8930_v1),
Jing Lindc4413c2012-01-16 15:22:52 -08001993 .family_id = 0x81,
1994 .variant_id = 0x01,
1995 .version = 0x10,
1996 .build = 0xAA,
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301997 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1998 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1999 },
2000 {
2001 .config = mxt_config_data_8930_v2,
2002 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
2003 .family_id = 0x81,
2004 .variant_id = 0x15,
2005 .version = 0x11,
2006 .build = 0xAA,
2007 .bootldr_id = MXT_BOOTLOADER_ID_224E,
2008 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
2009 },
2010 {
2011 .config = mxt_config_data_8930_v2,
2012 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
2013 .family_id = 0x81,
2014 .variant_id = 0x01,
2015 .version = 0x20,
2016 .build = 0xAB,
2017 .bootldr_id = MXT_BOOTLOADER_ID_224E,
Jing Lindc4413c2012-01-16 15:22:52 -08002018 },
2019};
2020
Amy Malochef3c9db42011-12-08 15:17:35 -08002021static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08002022 .config_array = mxt_config_array,
2023 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002024 .panel_minx = 0,
2025 .panel_maxx = 566,
2026 .panel_miny = 0,
2027 .panel_maxy = 1067,
2028 .disp_minx = 0,
2029 .disp_maxx = 540,
2030 .disp_miny = 0,
2031 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002032 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05302033#ifdef MSM8930_PHASE_2
2034 .digital_pwr_regulator = true,
2035#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002036 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08002037 .reset_gpio = MXT_TS_RESET_GPIO,
2038 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002039};
2040
Amy Malochef3c9db42011-12-08 15:17:35 -08002041static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002042 {
Amy Malochef3c9db42011-12-08 15:17:35 -08002043 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
2044 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002045 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2046 },
2047};
2048
Shantanu Jain55d277a2013-03-08 11:37:29 +05302049/*» Synaptics Thin Driver» */
2050
2051#define CLEARPAD3202_ADDR 0x20
2052#define CLEARPAD3202_ATTEN_GPIO (11)
2053#define CLEARPAD3202_RESET_GPIO (52)
2054
2055static unsigned char synaptic_rmi4_button_codes[] = {KEY_MENU, KEY_HOME,
2056 KEY_BACK};
2057
2058static struct synaptics_rmi4_capacitance_button_map synaptic_rmi4_button_map = {
2059 .nbuttons = ARRAY_SIZE(synaptic_rmi4_button_codes),
2060 .map = synaptic_rmi4_button_codes,
2061};
2062
2063static struct synaptics_rmi4_platform_data rmi4_platformdata = {
2064 .irq_flags = IRQF_TRIGGER_FALLING,
2065 .irq_gpio = CLEARPAD3202_ATTEN_GPIO,
2066 .reset_gpio = CLEARPAD3202_RESET_GPIO,
2067 .regulator_en = true,
2068 .i2c_pull_up = true,
2069 .capacitance_button_map = &synaptic_rmi4_button_map,
2070};
2071
2072static struct i2c_board_info rmi4_i2c_devices[] = {
2073 {
2074 I2C_BOARD_INFO("synaptics_rmi4_i2c",
2075 CLEARPAD3202_ADDR),
2076 .platform_data = &rmi4_platformdata,
2077 },
2078};
2079
David Collins04499982012-08-06 15:02:03 -07002080#define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
2081#define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25)
Manoj Raoc6d904c2012-06-22 00:32:14 -07002082static struct msm_mhl_platform_data mhl_platform_data = {
2083 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
2084 .gpio_mhl_int = MHL_GPIO_INT,
2085 .gpio_mhl_reset = MHL_GPIO_RESET,
David Collins04499982012-08-06 15:02:03 -07002086 .gpio_mhl_power = MHL_POWER_GPIO_PM8038,
Manoj Raoc6d904c2012-06-22 00:32:14 -07002087 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
2088};
2089
2090static struct i2c_board_info sii_device_info[] __initdata = {
2091 {
2092 /*
2093 * keeps SI 8334 as the default
2094 * MHL TX
2095 */
2096 I2C_BOARD_INFO("sii8334", 0x39),
2097 .platform_data = &mhl_platform_data,
2098 .flags = I2C_CLIENT_WAKE,
2099 },
2100};
2101
2102
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302103#ifdef MSM8930_PHASE_2
2104
David Collins04499982012-08-06 15:02:03 -07002105#define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3)
2106#define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8)
2107#define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10)
2108#define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11)
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302109
David Collins04499982012-08-06 15:02:03 -07002110#define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27)
2111#define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28)
2112#define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36)
2113#define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37)
2114
2115static struct gpio_keys_button keys_8930_pm8038[] = {
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302116 {
2117 .code = KEY_VOLUMEUP,
2118 .type = EV_KEY,
2119 .desc = "volume_up",
David Collins04499982012-08-06 15:02:03 -07002120 .gpio = GPIO_VOLUME_UP_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302121 .wakeup = 1,
2122 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002123 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302124 },
2125 {
2126 .code = KEY_VOLUMEDOWN,
2127 .type = EV_KEY,
2128 .desc = "volume_down",
David Collins04499982012-08-06 15:02:03 -07002129 .gpio = GPIO_VOLUME_DOWN_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302130 .wakeup = 1,
2131 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002132 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302133 },
2134 {
2135 .code = KEY_CAMERA_FOCUS,
2136 .type = EV_KEY,
2137 .desc = "camera_focus",
David Collins04499982012-08-06 15:02:03 -07002138 .gpio = GPIO_CAMERA_FOCUS_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302139 .wakeup = 1,
2140 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002141 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302142 },
2143 {
2144 .code = KEY_CAMERA_SNAPSHOT,
2145 .type = EV_KEY,
2146 .desc = "camera_snapshot",
David Collins04499982012-08-06 15:02:03 -07002147 .gpio = GPIO_CAMERA_SNAPSHOT_PM8038,
2148 .wakeup = 1,
2149 .active_low = 1,
2150 .debounce_interval = 15,
2151 },
2152};
2153
2154static struct gpio_keys_button keys_8930_pm8917[] = {
2155 {
2156 .code = KEY_VOLUMEUP,
2157 .type = EV_KEY,
2158 .desc = "volume_up",
2159 .gpio = GPIO_VOLUME_UP_PM8917,
2160 .wakeup = 1,
2161 .active_low = 1,
2162 .debounce_interval = 15,
2163 },
2164 {
2165 .code = KEY_VOLUMEDOWN,
2166 .type = EV_KEY,
2167 .desc = "volume_down",
2168 .gpio = GPIO_VOLUME_DOWN_PM8917,
2169 .wakeup = 1,
2170 .active_low = 1,
2171 .debounce_interval = 15,
2172 },
2173 {
2174 .code = KEY_CAMERA_FOCUS,
2175 .type = EV_KEY,
2176 .desc = "camera_focus",
2177 .gpio = GPIO_CAMERA_FOCUS_PM8917,
2178 .wakeup = 1,
2179 .active_low = 1,
2180 .debounce_interval = 15,
2181 },
2182 {
2183 .code = KEY_CAMERA_SNAPSHOT,
2184 .type = EV_KEY,
2185 .desc = "camera_snapshot",
2186 .gpio = GPIO_CAMERA_SNAPSHOT_PM8917,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302187 .wakeup = 1,
2188 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002189 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302190 },
2191};
2192
2193/* Add GPIO keys for 8930 */
2194static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
David Collins04499982012-08-06 15:02:03 -07002195 .buttons = keys_8930_pm8038,
2196 .nbuttons = ARRAY_SIZE(keys_8930_pm8038),
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302197};
2198
2199static struct platform_device gpio_keys_8930 = {
2200 .name = "gpio-keys",
2201 .id = -1,
2202 .dev = {
2203 .platform_data = &gpio_keys_8930_pdata,
2204 },
2205};
2206#endif /* MSM8930_PHASE_2 */
2207
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002208static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2209 .clk_freq = 100000,
2210 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002211};
2212
2213static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2214 .clk_freq = 100000,
2215 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002216};
2217
Kiran Gunda484442e2013-03-11 19:14:44 +05302218
2219static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi8_pdata = {
2220 .clk_freq = 100000,
2221 .src_clk_rate = 24000000,
2222};
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002223static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
2224 .clk_freq = 100000,
2225 .src_clk_rate = 24000000,
2226};
2227
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002228static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2229 .clk_freq = 100000,
2230 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002231};
2232
2233static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2234 .clk_freq = 100000,
2235 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002236};
2237
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002238
2239static struct ks8851_pdata spi_eth_pdata = {
2240 .irq_gpio = KS8851_IRQ_GPIO,
2241 .rst_gpio = KS8851_RST_GPIO,
2242};
2243
2244static struct spi_board_info spi_board_info[] __initdata = {
2245 {
2246 .modalias = "ks8851",
2247 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2248 .max_speed_hz = 19200000,
2249 .bus_num = 0,
2250 .chip_select = 0,
2251 .mode = SPI_MODE_0,
2252 .platform_data = &spi_eth_pdata
2253 },
2254 {
2255 .modalias = "dsi_novatek_3d_panel_spi",
2256 .max_speed_hz = 10800000,
2257 .bus_num = 0,
2258 .chip_select = 1,
2259 .mode = SPI_MODE_0,
2260 },
2261};
2262
2263static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002264 .name = "saw-regulator",
2265 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002266 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002267 .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002268 },
2269};
2270
2271static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002272 .name = "saw-regulator",
2273 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002274 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002275 .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002276 },
2277};
2278
2279static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002280 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002281 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002282 .tsens_num_sensor = 10,
2283 .slope = {1132, 1135, 1137, 1135, 1157,
2284 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002285};
2286
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002287static struct platform_device msm_tsens_device = {
2288 .name = "tsens8960-tm",
2289 .id = -1,
2290};
2291
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002292static struct msm_thermal_data msm_thermal_pdata = {
2293 .sensor_id = 9,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002294 .poll_ms = 250,
2295 .limit_temp_degC = 60,
2296 .temp_hysteresis_degC = 10,
2297 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002298};
2299
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002300#ifdef CONFIG_MSM_FAKE_BATTERY
2301static struct platform_device fish_battery_device = {
2302 .name = "fish_battery",
2303};
2304#endif
2305
David Collins1d4061b2011-12-06 15:36:40 -08002306#ifndef MSM8930_PHASE_2
2307
2308/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002309static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002310 .name = GPIO_REGULATOR_DEV_NAME,
2311 .id = PM8921_MPP_PM_TO_SYS(7),
2312 .dev = {
2313 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2314 },
2315};
2316
Jay Chokshi06fa7542011-12-07 13:09:17 -08002317static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002318 .name = GPIO_REGULATOR_DEV_NAME,
2319 .id = 91,
2320 .dev = {
2321 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2322 },
2323};
2324
David Collins1d4061b2011-12-06 15:36:40 -08002325#else
2326
2327/* 8930 Phase 2 */
2328static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2329 .name = GPIO_REGULATOR_DEV_NAME,
2330 .id = 63,
2331 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002332 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2333 MSM8930_GPIO_VREG_ID_EXT_5V],
David Collins1d4061b2011-12-06 15:36:40 -08002334 },
2335};
2336
2337static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2338 .name = GPIO_REGULATOR_DEV_NAME,
2339 .id = 97,
2340 .dev = {
David Collins86161e42012-08-20 12:17:09 -07002341 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2342 MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
David Collins1d4061b2011-12-06 15:36:40 -08002343 },
2344};
2345
2346#endif
2347
Jay Chokshi06fa7542011-12-07 13:09:17 -08002348static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002349 .name = "rpm-regulator",
2350 .id = -1,
2351 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002352#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002353 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002354#else
David Collins86161e42012-08-20 12:17:09 -07002355 .platform_data = &msm8930_pm8038_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002356#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002357 },
2358};
2359
David Collins86161e42012-08-20 12:17:09 -07002360static struct platform_device *early_common_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002361 &msm8960_device_dmov,
2362 &msm_device_smd,
2363 &msm8960_device_uart_gsbi5,
2364 &msm_device_uart_dm6,
2365 &msm_device_saw_core0,
2366 &msm_device_saw_core1,
David Collins86161e42012-08-20 12:17:09 -07002367};
2368
2369/* ext_5v and ext_otg_sw are present when using PM8038 */
2370static struct platform_device *pmic_pm8038_devices[] __initdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002371 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002372#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002373 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002374#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002375 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002376#ifdef MSM8930_PHASE_2
2377 &msm8930_device_ext_otg_sw_vreg,
2378#endif
David Collins86161e42012-08-20 12:17:09 -07002379};
2380
2381/* ext_5v and ext_otg_sw are not present when using PM8917 */
2382static struct platform_device *pmic_pm8917_devices[] __initdata = {
2383 &msm8960_device_ssbi_pmic,
2384};
2385
Kiran Gunda484442e2013-03-11 19:14:44 +05302386static struct platform_device *i2c_qup_devices[] __initdata = {
2387 &msm8960_device_qup_i2c_gsbi4,
2388 &msm8960_device_qup_i2c_gsbi9,
2389};
2390
2391static struct platform_device *i2c_qup_sglte_devices[] __initdata = {
2392 &msm8960_device_qup_i2c_gsbi8,
2393};
2394
David Collins86161e42012-08-20 12:17:09 -07002395static struct platform_device *common_devices[] __initdata = {
Stephen Boyd28d54952011-12-16 13:19:51 -08002396 &msm_8960_q6_lpass,
2397 &msm_8960_q6_mss_fw,
2398 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002399 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002400 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002401 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002402 &msm8960_device_qup_spi_gsbi1,
2403 &msm8960_device_qup_i2c_gsbi3,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002404 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002405 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002406 &msm_slim_ctrl,
2407 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002408#if defined(CONFIG_QSEECOM)
2409 &qseecom_device,
2410#endif
2411
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002412#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2413 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2414 &qcrypto_device,
2415#endif
2416
2417#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2418 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2419 &qcedev_device,
2420#endif
2421#ifdef CONFIG_MSM_ROTATOR
2422 &msm_rotator_device,
2423#endif
2424 &msm_device_sps,
2425#ifdef CONFIG_MSM_FAKE_BATTERY
2426 &fish_battery_device,
2427#endif
2428#ifdef CONFIG_ANDROID_PMEM
2429#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002430 &msm8930_android_pmem_device,
2431 &msm8930_android_pmem_adsp_device,
2432 &msm8930_android_pmem_audio_device,
Asish Bhattacharya5d63c4b2012-04-12 08:41:12 +05302433#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
2434#endif /*CONFIG_ANDROID_PMEM*/
Hanumant Singheea62562012-05-14 11:32:45 -07002435 &msm8930_fmem_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002436 &msm_device_bam_dmux,
2437 &msm_fm_platform_init,
2438
2439#ifdef CONFIG_HW_RANDOM_MSM
2440 &msm_device_rng,
2441#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002442 &msm8930_rpm_device,
2443 &msm8930_rpm_log_device,
Girish Mahadevan898c56d2012-06-05 16:09:19 -06002444 &msm8930_rpm_rbcpr_device,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002445 &msm8930_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302446 &msm8930_rpm_master_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002447#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002448 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002449#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002450 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002451 &coresight_tpiu_device,
2452 &coresight_etb_device,
2453 &coresight_funnel_device,
2454 &coresight_etm0_device,
2455 &coresight_etm1_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002456 &msm_device_dspcrashd_8960,
2457 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302458#ifdef MSM8930_PHASE_2
2459 &gpio_keys_8930,
2460#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002461 &msm8930_rtb_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002462 &msm_bus_8930_apps_fabric,
2463 &msm_bus_8930_sys_fabric,
2464 &msm_bus_8930_mm_fabric,
2465 &msm_bus_8930_sys_fpb,
2466 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002467 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002468 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002469 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002470 &msm8930_cache_dump_device,
Anji Jonnalae84292b2012-09-21 13:34:44 +05302471 &msm8930_pc_cntr,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002472};
2473
2474static struct platform_device *cdp_devices[] __initdata = {
2475 &msm8960_device_otg,
2476 &msm8960_device_gadget_peripheral,
2477 &msm_device_hsusb_host,
2478 &android_usb_device,
2479 &msm_pcm,
2480 &msm_pcm_routing,
2481 &msm_cpudai0,
2482 &msm_cpudai1,
2483 &msm_cpudai_hdmi_rx,
2484 &msm_cpudai_bt_rx,
2485 &msm_cpudai_bt_tx,
2486 &msm_cpudai_fm_rx,
2487 &msm_cpudai_fm_tx,
2488 &msm_cpudai_auxpcm_rx,
2489 &msm_cpudai_auxpcm_tx,
2490 &msm_cpu_fe,
2491 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002492#ifdef CONFIG_MSM_GEMINI
2493 &msm8960_gemini_device,
2494#endif
2495 &msm_voice,
2496 &msm_voip,
2497 &msm_lpa_pcm,
2498 &msm_cpudai_afe_01_rx,
2499 &msm_cpudai_afe_01_tx,
2500 &msm_cpudai_afe_02_rx,
2501 &msm_cpudai_afe_02_tx,
2502 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002503 &msm_compr_dsp,
2504 &msm_cpudai_incall_music_rx,
2505 &msm_cpudai_incall_record_rx,
2506 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002507 &msm_pcm_hostless,
Asish Bhattacharya705c6732012-08-14 23:22:55 +05302508 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002509 &msm_lowlatency_pcm,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002510};
2511
2512static void __init msm8930_i2c_init(void)
2513{
2514 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2515 &msm8960_i2c_qup_gsbi4_pdata;
2516
2517 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2518 &msm8960_i2c_qup_gsbi3_pdata;
Kiran Gunda484442e2013-03-11 19:14:44 +05302519 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
2520 msm8960_device_qup_i2c_gsbi8.dev.platform_data =
2521 &msm8960_i2c_qup_gsbi8_pdata;
2522 else
2523 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002524 &msm8960_i2c_qup_gsbi9_pdata;
2525
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002526 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2527 &msm8960_i2c_qup_gsbi10_pdata;
2528
2529 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2530 &msm8960_i2c_qup_gsbi12_pdata;
2531}
2532
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002533static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2534 {
2535 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2536 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2537 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002538 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002539 },
2540
2541 {
Anji Jonnala85b29ff2013-01-15 14:12:45 +05302542 MSM_PM_SLEEP_MODE_RETENTION,
2543 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2544 true,
2545 415, 715, 340827, 475,
2546 },
2547
2548 {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002549 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2550 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2551 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002552 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002553 },
2554
2555 {
2556 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2557 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2558 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002559 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002560 },
2561
2562 {
2563 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002564 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2565 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002566 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002567 },
2568
2569 {
2570 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2571 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2572 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002573 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002574 },
2575
2576 {
2577 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2578 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2579 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002580 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002581 },
2582
2583 {
2584 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2585 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2586 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002587 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002588 },
2589
2590 {
2591 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2592 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2593 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002594 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002595 },
2596};
2597
Praveen Chidambaram78499012011-11-01 17:15:17 -06002598static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2599 .levels = &msm_rpmrs_levels[0],
2600 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2601 .vdd_mem_levels = {
2602 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2603 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2604 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2605 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2606 },
2607 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002608 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2609 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2610 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2611 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002612 },
2613 .vdd_mask = 0x7FFFFF,
2614 .rpmrs_target_id = {
2615 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2616 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002617 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2618 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002619 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2620 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2621 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2622 },
2623};
2624
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002625static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = {
2626 .levels = &msm_rpmrs_levels[0],
2627 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2628 .vdd_mem_levels = {
2629 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2630 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2631 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2632 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2633 },
2634 .vdd_dig_levels = {
2635 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2636 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2637 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2638 [MSM_RPMRS_VDD_DIG_MAX] = 3,
2639 },
2640 .vdd_mask = 0x7FFFFF,
2641 .rpmrs_target_id = {
2642 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2643 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2644 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2645 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
2646 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0,
2647 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1,
2648 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2649 },
2650};
2651
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002652static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2653 .mode = MSM_PM_BOOT_CONFIG_TZ,
2654};
2655
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002656#ifdef CONFIG_I2C
2657#define I2C_SURF 1
2658#define I2C_FFA (1 << 1)
2659#define I2C_RUMI (1 << 2)
2660#define I2C_SIM (1 << 3)
2661#define I2C_FLUID (1 << 4)
2662#define I2C_LIQUID (1 << 5)
Taniya Das087145b2013-03-16 21:37:41 +05302663#define I2C_EVT (1 << 6)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002664
2665struct i2c_registry {
2666 u8 machs;
2667 int bus;
2668 struct i2c_board_info *info;
2669 int len;
2670};
2671
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002672#ifdef CONFIG_INPUT_MPU3050
2673#define MPU3050_INT_GPIO 69
2674
2675static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2676 .gpio_int = MPU3050_INT_GPIO,
2677};
2678
2679static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2680 {
2681 I2C_BOARD_INFO("mpu3050", 0x68),
Wentao Xuc7769c02012-08-03 15:06:41 -04002682 .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO),
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002683 .platform_data = &mpu3050_gyro,
2684 },
2685};
2686#endif
2687
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002688#ifdef CONFIG_ISL9519_CHARGER
2689static struct isl_platform_data isl_data __initdata = {
2690 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2691 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2692 .max_system_voltage = 4200,
2693 .min_system_voltage = 3200,
2694 .chgcurrent = 1000, /* 1900, */
2695 .term_current = 400, /* Need fine tuning */
2696 .input_current = 2048,
2697};
2698
2699static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2700 {
2701 I2C_BOARD_INFO("isl9519q", 0x9),
2702 .irq = 0, /* Not required when notify-by-pmic */
2703 .platform_data = &isl_data,
2704 },
2705};
2706#endif /* CONFIG_ISL9519_CHARGER */
2707
Wentao Xu114c0152012-06-12 11:40:38 -04002708#ifdef CONFIG_STM_LIS3DH
2709static struct lis3dh_acc_platform_data lis3dh_accel = {
2710 .poll_interval = 200,
2711 .min_interval = 10,
2712 .g_range = LIS3DH_ACC_G_2G,
2713 .axis_map_x = 1,
2714 .axis_map_y = 0,
2715 .axis_map_z = 2,
2716 .negate_x = 0,
2717 .negate_y = 0,
2718 .negate_z = 1,
2719 .init = NULL,
2720 .exit = NULL,
2721 .gpio_int1 = -EINVAL,
2722 .gpio_int2 = -EINVAL,
2723};
2724
2725static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = {
2726 {
2727 I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18),
2728 .platform_data = &lis3dh_accel,
2729 },
2730};
2731#endif /* CONFIG_STM_LIS3DH */
2732
Orkhan Karimov4e7999f2013-02-13 17:52:11 -05002733#ifdef CONFIG_BMP18X_I2C
2734static struct i2c_board_info __initdata bmp18x_i2c_boardinfo[] = {
2735 {
2736 I2C_BOARD_INFO("bmp18x", 0x77),
2737 },
2738};
2739#endif
2740
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002741static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002742#ifdef CONFIG_ISL9519_CHARGER
2743 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302744 I2C_LIQUID | I2C_EVT,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002745 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2746 isl_charger_i2c_info,
2747 ARRAY_SIZE(isl_charger_i2c_info),
2748 },
2749#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002750#ifdef CONFIG_INPUT_MPU3050
2751 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302752 I2C_FFA | I2C_FLUID | I2C_EVT,
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002753 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2754 mpu3050_i2c_boardinfo,
2755 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2756 },
2757#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002758 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002759 I2C_SURF | I2C_FFA | I2C_FLUID,
2760 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002761 msm_isa1200_board_info,
2762 ARRAY_SIZE(msm_isa1200_board_info),
2763 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002764 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302765 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_EVT,
Amy Malochef3c9db42011-12-08 15:17:35 -08002766 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2767 mxt_device_info_8930,
2768 ARRAY_SIZE(mxt_device_info_8930),
2769 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002770 {
Shantanu Jain55d277a2013-03-08 11:37:29 +05302771 I2C_EVT,
2772 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2773 rmi4_i2c_devices,
2774 ARRAY_SIZE(rmi4_i2c_devices),
2775 },
2776 {
Manoj Raoc6d904c2012-06-22 00:32:14 -07002777 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2778 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2779 sii_device_info,
2780 ARRAY_SIZE(sii_device_info),
2781 },
Wentao Xu114c0152012-06-12 11:40:38 -04002782#ifdef CONFIG_STM_LIS3DH
2783 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302784 I2C_FFA | I2C_FLUID | I2C_EVT,
Wentao Xu114c0152012-06-12 11:40:38 -04002785 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2786 lis3dh_i2c_boardinfo,
2787 ARRAY_SIZE(lis3dh_i2c_boardinfo),
2788 },
2789#endif
Orkhan Karimov4e7999f2013-02-13 17:52:11 -05002790#ifdef CONFIG_BMP18X_I2C
2791 {
Kiran Gunda484442e2013-03-11 19:14:44 +05302792 I2C_FFA | I2C_FLUID | I2C_EVT,
Orkhan Karimov4e7999f2013-02-13 17:52:11 -05002793 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2794 bmp18x_i2c_boardinfo,
2795 ARRAY_SIZE(bmp18x_i2c_boardinfo),
2796 },
2797#endif
2798
2799
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002800};
2801#endif /* CONFIG_I2C */
2802
2803static void __init register_i2c_devices(void)
2804{
2805#ifdef CONFIG_I2C
2806 u8 mach_mask = 0;
2807 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002808#ifdef CONFIG_MSM_CAMERA
2809 struct i2c_registry msm8930_camera_i2c_devices = {
Raju P.L.S.S.S.N98274022013-03-12 20:30:50 +05302810 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI
2811 | I2C_EVT,
Kevin Chan09f4e662011-12-16 08:17:02 -08002812 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2813 msm8930_camera_board_info.board_info,
2814 msm8930_camera_board_info.num_i2c_board_info,
2815 };
Kiran Gunda484442e2013-03-11 19:14:44 +05302816 if (machine_is_msm8930_evt() &&
2817 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)) {
2818 msm8930_camera_i2c_devices.machs |= I2C_EVT;
2819 msm8930_camera_i2c_devices.bus = MSM_8930_GSBI8_QUP_I2C_BUS_ID;
2820 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002821#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002822
2823 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002824 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002825 mach_mask = I2C_SURF;
2826 else if (machine_is_msm8930_fluid())
2827 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002828 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002829 mach_mask = I2C_FFA;
Taniya Das087145b2013-03-16 21:37:41 +05302830 else if (machine_is_msm8930_evt())
2831 mach_mask = I2C_EVT;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002832 else
2833 pr_err("unmatched machine ID in register_i2c_devices\n");
2834
2835 /* Run the array and install devices as appropriate */
2836 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2837 if (msm8960_i2c_devices[i].machs & mach_mask)
2838 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2839 msm8960_i2c_devices[i].info,
2840 msm8960_i2c_devices[i].len);
2841 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002842#ifdef CONFIG_MSM_CAMERA
2843 if (msm8930_camera_i2c_devices.machs & mach_mask)
2844 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2845 msm8930_camera_i2c_devices.info,
2846 msm8930_camera_i2c_devices.len);
2847#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002848#endif
2849}
2850
David Collins04499982012-08-06 15:02:03 -07002851/* Modify platform data values to match requirements for PM8917. */
2852static void __init msm8930_pm8917_pdata_fixup(void)
2853{
Patrick Dalya3b73c42012-08-28 13:39:17 -07002854 struct acpuclk_platform_data *pdata;
2855
David Collins04499982012-08-06 15:02:03 -07002856 mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917;
2857
2858 gpio_keys_8930_pdata.buttons = keys_8930_pm8917;
2859 gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917);
David Collins86161e42012-08-20 12:17:09 -07002860
2861 msm_device_saw_core0.dev.platform_data
2862 = &msm8930_pm8038_saw_regulator_core0_pdata;
2863 msm_device_saw_core1.dev.platform_data
2864 = &msm8930_pm8038_saw_regulator_core1_pdata;
2865
2866 msm8930_device_rpm_regulator.dev.platform_data
2867 = &msm8930_pm8917_rpm_regulator_pdata;
Patrick Dalya3b73c42012-08-28 13:39:17 -07002868
2869 pdata = msm8930_device_acpuclk.dev.platform_data;
2870 pdata->uses_pm8917 = true;
Tianyi Gou01c27a32012-10-29 19:13:53 -07002871
2872 pdata = msm8930ab_device_acpuclk.dev.platform_data;
2873 pdata->uses_pm8917 = true;
David Collins04499982012-08-06 15:02:03 -07002874}
2875
Anji Jonnala786b39e2013-01-29 13:34:10 +05302876static void __init msm8930ab_update_retention_spm(void)
2877{
2878 int i;
2879
2880 /* Update the SPM sequences for krait retention on all cores */
2881 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
2882 int j;
2883 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
2884 for (j = 0; j < pdata->num_modes; j++) {
2885 if (pdata->modes[j].cmd ==
2886 spm_retention_cmd_sequence)
2887 pdata->modes[j].cmd =
2888 spm_retention_with_krait_v3_cmd_sequence;
2889 }
2890 }
2891}
2892
Saket Saurabh2a47f222013-03-11 19:36:48 +05302893#ifdef CONFIG_SERIAL_MSM_HS
2894static int configure_uart_gpios(int on)
2895{
2896 int ret = 0, i;
2897 int uart_gpios[] = {93, 94, 95, 96};
2898
2899 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2900 if (on) {
2901 ret = gpio_request(uart_gpios[i], NULL);
2902 if (ret) {
2903 pr_err("%s: unable to request uart gpio[%d]\n",
2904 __func__, uart_gpios[i]);
2905 break;
2906 }
2907 } else {
2908 gpio_free(uart_gpios[i]);
2909 }
2910 }
2911
2912 if (ret && on && i)
2913 for (; i >= 0; i--)
2914 gpio_free(uart_gpios[i]);
2915 return ret;
2916}
2917
2918static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
2919 .gpio_config = configure_uart_gpios,
2920};
2921#else
2922static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2923#endif
2924
2925
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002926static void __init msm8930_cdp_init(void)
2927{
Laxminath Kasam8e1e8d02013-03-19 17:53:48 +05302928 int i, reg_size = 0;
David Collins04499982012-08-06 15:02:03 -07002929 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2930 msm8930_pm8917_pdata_fixup();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002931 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2932 pr_err("meminfo_init() failed!\n");
2933
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07002934 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002935 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002936 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaramc6e04692012-08-10 16:26:37 -06002937 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
2938 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2939 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
2940 } else {
2941 BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917));
2942 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917));
2943 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002944
2945 regulator_suppress_info_printing();
2946 if (msm_xo_init())
2947 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002948 platform_device_register(&msm8930_device_rpm_regulator);
Patrick Dalyb1d5f752012-08-27 16:25:07 -07002949 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2950 msm_clock_init(&msm8930_pm8917_clock_init_data);
2951 else
2952 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana2a1c7db2013-01-08 15:10:51 +05302953
2954 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
2955 /*
2956 * By default, set USB mode as USB Peripheral only due to
2957 * hardware rework requirement for USB Host Mode.
2958 * Provide pmic_id_irq number only if host mode is enable
2959 * by user assuming that hardware rework is available.
2960 */
2961 if (enable_usb_host_mode) {
2962 /* MPP01 IRQ number */
2963 msm_otg_pdata.pmic_id_irq =
2964 PM8921_MPP_IRQ(PM8917_IRQ_BASE, 1);
2965 } else {
2966 pr_err("Enabling USB Peripheral Only mode.\n");
2967 msm_otg_pdata.mode = USB_PERIPHERAL;
2968 }
2969 } else {
2970 msm_otg_pdata.pmic_id_irq =
2971 PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE);
2972 }
2973
Saket Saurabh2a47f222013-03-11 19:36:48 +05302974 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE &&
2975 machine_is_msm8930_evt()) {
2976#ifdef CONFIG_SERIAL_MSM_HS
2977 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
2978 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
2979#endif
2980 platform_device_register(&msm_device_uart_dm9);
2981 }
2982
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302983 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002984 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302985 android_usb_pdata.swfi_latency =
2986 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002987 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002988 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2989 &msm8960_qup_spi_gsbi1_pdata;
2990 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2991
Jay Chokshi06fa7542011-12-07 13:09:17 -08002992 /*
2993 * TODO: When physical 8930/PM8038 hardware becomes
2994 * available, remove this block or add the config
2995 * option.
2996 */
2997#ifndef MSM8930_PHASE_2
2998 msm8960_init_pmic();
2999#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003000 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08003001#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003002 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05303003 msm8930_init_gpu();
Anji Jonnala786b39e2013-01-29 13:34:10 +05303004 if (cpu_is_krait_v3()) {
3005 msm_pm_set_tz_retention_flag(0);
3006 msm8930ab_update_retention_spm();
3007 } else {
3008 msm_pm_set_tz_retention_flag(1);
3009 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003010 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3011 msm_spm_l2_init(msm_spm_l2_data);
3012 msm8930_init_buses();
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07003013 if (cpu_is_msm8627()) {
Tianyi Gou723843b2012-06-13 15:24:56 -07003014 platform_add_devices(msm8627_footswitch,
3015 msm8627_num_footswitch);
Aravind Venkateswaranc5f91ca2012-10-29 17:54:55 -07003016 } else {
3017 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3018 platform_add_devices(msm8930_pm8917_footswitch,
3019 msm8930_pm8917_num_footswitch);
3020 else
3021 platform_add_devices(msm8930_footswitch,
3022 msm8930_num_footswitch);
3023 }
Matt Wagantall6dcfa922012-06-07 20:13:51 -07003024 if (cpu_is_msm8627())
Matt Wagantallab730bd2012-06-07 20:13:51 -07003025 platform_device_register(&msm8627_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07003026 else if (cpu_is_msm8930())
Matt Wagantall6dcfa922012-06-07 20:13:51 -07003027 platform_device_register(&msm8930_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07003028 else if (cpu_is_msm8930aa())
3029 platform_device_register(&msm8930aa_device_acpuclk);
Tianyi Gou01c27a32012-10-29 19:13:53 -07003030 else if (cpu_is_msm8930ab())
3031 platform_device_register(&msm8930ab_device_acpuclk);
David Collins86161e42012-08-20 12:17:09 -07003032 platform_add_devices(early_common_devices,
3033 ARRAY_SIZE(early_common_devices));
3034 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3035 platform_add_devices(pmic_pm8038_devices,
3036 ARRAY_SIZE(pmic_pm8038_devices));
3037 else
3038 platform_add_devices(pmic_pm8917_devices,
3039 ARRAY_SIZE(pmic_pm8917_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003040 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Kiran Gunda484442e2013-03-11 19:14:44 +05303041 if (machine_is_msm8930_evt() &&
3042 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)) {
3043 /* Removing GSBI4 and GSBI9 and initializing GSBI8
3044 * as per SGLTE platform requirement */
3045 platform_add_devices(i2c_qup_sglte_devices,
3046 ARRAY_SIZE(i2c_qup_sglte_devices));
3047 } else {
3048 platform_add_devices(i2c_qup_devices,
3049 ARRAY_SIZE(i2c_qup_devices));
3050 }
Arun Menonaabf2632012-02-24 15:30:47 -08003051 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08003052 /*
3053 * TODO: When physical 8930/PM8038 hardware becomes
3054 * available, remove this block or add the config
3055 * option.
3056 */
3057#ifndef MSM8930_PHASE_2
3058 msm8960_pm8921_gpio_mpp_init();
3059#else
David Collins04499982012-08-06 15:02:03 -07003060 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3061 msm8930_pm8038_gpio_mpp_init();
3062 else
3063 msm8930_pm8917_gpio_mpp_init();
Jay Chokshi06fa7542011-12-07 13:09:17 -08003064#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003065 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07003066#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003067 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003068#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003069 msm8930_init_mmc();
Shantanu Jain55d277a2013-03-08 11:37:29 +05303070 if (!machine_is_msm8930_evt())
3071 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003072 register_i2c_devices();
3073 msm8930_init_fb();
Laxminath Kasam8e1e8d02013-03-19 17:53:48 +05303074
3075 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3076 reg_size = ARRAY_SIZE((
3077 (struct wcd9xxx_pdata *)msm_slim_devices[1].
3078 slim_slave->dev.platform_data)->regulator);
3079
3080 for (i = 0; i < reg_size; i++) {
3081 if (!(((struct wcd9xxx_pdata *)msm_slim_devices[1].
3082 slim_slave->dev.platform_data)->
3083 regulator[i].name))
3084 break;
3085 }
3086
3087 ((struct wcd9xxx_pdata *)msm_slim_devices[1].slim_slave->dev.
3088 platform_data)->regulator[i].name =
3089 "CDC_VDDA_A_L9_2P85V";
3090 ((struct wcd9xxx_pdata *)msm_slim_devices[1].slim_slave->dev.
3091 platform_data)->regulator[i].min_uV = 2850000;
3092 ((struct wcd9xxx_pdata *)msm_slim_devices[1].slim_slave->dev.
3093 platform_data)->regulator[i].max_uV = 2850000;
3094 ((struct wcd9xxx_pdata *)msm_slim_devices[1].slim_slave->dev.
3095 platform_data)->regulator[i].optimum_uA = 300000;
3096 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003097 slim_register_board_info(msm_slim_devices,
3098 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003099 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003100
Taniya Das087145b2013-03-16 21:37:41 +05303101 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3102 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3103 platform_device_register(&mdm_sglte_device);
3104 }
3105
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003106 if (PLATFORM_IS_CHARM25())
3107 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
3108}
3109
3110MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
3111 .map_io = msm8930_map_io,
3112 .reserve = msm8930_reserve,
3113 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303114 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003115 .timer = &msm_timer,
3116 .init_machine = msm8930_cdp_init,
3117 .init_early = msm8930_allocate_memory_regions,
3118 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003119 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003120MACHINE_END
3121
3122MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
3123 .map_io = msm8930_map_io,
3124 .reserve = msm8930_reserve,
3125 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303126 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003127 .timer = &msm_timer,
3128 .init_machine = msm8930_cdp_init,
3129 .init_early = msm8930_allocate_memory_regions,
3130 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003131 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003132MACHINE_END
3133
3134MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
3135 .map_io = msm8930_map_io,
3136 .reserve = msm8930_reserve,
3137 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303138 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003139 .timer = &msm_timer,
3140 .init_machine = msm8930_cdp_init,
3141 .init_early = msm8930_allocate_memory_regions,
3142 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003143 .restart = msm_restart,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08003144MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003145
3146MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
3147 .map_io = msm8930_map_io,
3148 .reserve = msm8930_reserve,
3149 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303150 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003151 .timer = &msm_timer,
3152 .init_machine = msm8930_cdp_init,
3153 .init_early = msm8930_allocate_memory_regions,
3154 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003155 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003156MACHINE_END
3157
3158MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
3159 .map_io = msm8930_map_io,
3160 .reserve = msm8930_reserve,
3161 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303162 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003163 .timer = &msm_timer,
3164 .init_machine = msm8930_cdp_init,
3165 .init_early = msm8930_allocate_memory_regions,
3166 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003167 .restart = msm_restart,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08003168MACHINE_END
Taniya Das799085a2013-03-06 11:39:04 +05303169
3170MACHINE_START(MSM8930_EVT, "QRD8930 SGLTE EVT")
3171 .map_io = msm8930_map_io,
3172 .reserve = msm8930_reserve,
3173 .init_irq = msm8930_init_irq,
3174 .handle_irq = gic_handle_irq,
3175 .timer = &msm_timer,
3176 .init_machine = msm8930_cdp_init,
3177 .init_early = msm8930_allocate_memory_regions,
3178 .init_very_early = msm8930_early_memory,
3179 .restart = msm_restart,
3180MACHINE_END