blob: 2050f38d31aca664c144b4f5276236e74b1a8620 [file] [log] [blame]
Anji Jonnala1a1711a2013-01-29 13:34:10 +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 */
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -080013#include <linux/err.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080014#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/irq.h>
18#include <linux/i2c.h>
19#include <linux/i2c/sx150x.h>
20#include <linux/i2c/isl9519.h>
21#include <linux/gpio.h>
22#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070023#include <linux/regulator/msm-gpio-regulator.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080024#include <linux/mfd/pm8xxx/pm8921.h>
25#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
26#include <linux/regulator/consumer.h>
27#include <linux/spi/spi.h>
28#include <linux/slimbus/slimbus.h>
29#include <linux/bootmem.h>
Laura Abbottfd1ad202012-09-18 11:45:43 -070030#include <linux/dma-contiguous.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080031#include <linux/dma-mapping.h>
32#include <linux/platform_data/qcom_crypto_device.h>
33#include <linux/platform_data/qcom_wcnss_device.h>
34#include <linux/leds.h>
35#include <linux/leds-pm8xxx.h>
36#include <linux/i2c/atmel_mxt_ts.h>
37#include <linux/msm_tsens.h>
38#include <linux/ks8851.h>
39#include <linux/i2c/isa1200.h>
Anirudh Ghayaleb3af972011-12-13 17:29:06 +053040#include <linux/gpio_keys.h>
Jack Cheung6ce8f682012-01-17 10:35:42 -080041#include <linux/memory.h>
Hanumant Singheea62562012-05-14 11:32:45 -070042#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060043#include <linux/msm_thermal.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080044
Asish Bhattacharyab86c3472012-02-15 08:31:52 +053045#include <linux/slimbus/slimbus.h>
46#include <linux/mfd/wcd9xxx/core.h>
47#include <linux/mfd/wcd9xxx/pdata.h>
48
Wentao Xu114c0152012-06-12 11:40:38 -040049#ifdef CONFIG_STM_LIS3DH
50#include <linux/input/lis3dh.h>
51#endif
52
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080053#include <asm/mach-types.h>
54#include <asm/mach/arch.h>
55#include <asm/setup.h>
56#include <asm/hardware/gic.h>
57#include <asm/mach/mmc.h>
58
59#include <mach/board.h>
60#include <mach/msm_iomap.h>
61#include <mach/msm_spi.h>
62#ifdef CONFIG_USB_MSM_OTG_72K
63#include <mach/msm_hsusb.h>
64#else
65#include <linux/usb/msm_hsusb.h>
66#endif
67#include <linux/usb/android.h>
68#include <mach/usbdiag.h>
69#include <mach/socinfo.h>
70#include <mach/rpm.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080071#include <mach/gpiomux.h>
72#include <mach/msm_bus_board.h>
73#include <mach/msm_memtypes.h>
74#include <mach/dma.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080075#include <mach/msm_xo.h>
76#include <mach/restart.h>
77
Mitchel Humpherysb8055522012-09-06 11:33:28 -070078#include <linux/msm_ion.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080079#include <mach/ion.h>
80#include <mach/mdm2.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080081#include <mach/msm_rtb.h>
Laura Abbottf3173042012-05-29 15:23:18 -070082#include <mach/msm_cache_dump.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080083
Jordan Crouse914de9b2012-07-09 13:49:46 -060084#include <mach/kgsl.h>
Wentao Xuf59ce4e2012-05-22 17:30:13 -040085#ifdef CONFIG_INPUT_MPU3050
86#include <linux/input/mpu3050.h>
87#endif
88
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080089#include "timer.h"
90#include "devices.h"
91#include "devices-msm8x60.h"
92#include "spm.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080093#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080094#include <mach/cpuidle.h>
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080095#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053096#include <mach/mpm.h>
Matt Wagantall33d01f52012-02-23 23:27:44 -080097#include "clock.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -080098#include "pm-boot.h"
99#include "msm_watchdog.h"
Jay Chokshi06fa7542011-12-07 13:09:17 -0800100#include "board-8930.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800101#include "platsmp.h"
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800102
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800103static struct platform_device msm_fm_platform_init = {
104 .name = "iris_fm",
105 .id = -1,
106};
107
108#define KS8851_RST_GPIO 89
109#define KS8851_IRQ_GPIO 90
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800110#define HAP_SHIFT_LVL_OE_GPIO 47
111
Manoj Raoc6d904c2012-06-22 00:32:14 -0700112#define MHL_GPIO_INT 72
113#define MHL_GPIO_RESET 71
114#define MHL_GPIO_PWR_EN 5
115
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800116#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
117
118struct sx150x_platform_data msm8930_sx150x_data[] = {
119 [SX150X_CAM] = {
120 .gpio_base = GPIO_CAM_EXPANDER_BASE,
121 .oscio_is_gpo = false,
122 .io_pullup_ena = 0x0,
123 .io_pulldn_ena = 0xc0,
124 .io_open_drain_ena = 0x0,
125 .irq_summary = -1,
126 },
127};
128
129#endif
130
Olav Haugana21169d2012-01-04 09:17:06 -0800131#define MSM_PMEM_ADSP_SIZE 0x7800000
Vicky Sehrawat074f5432012-11-07 14:32:17 -0800132#define MSM_PMEM_AUDIO_SIZE 0x408000
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800133#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
134#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
135#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800136#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800137#endif
Hanumant Singheea62562012-05-14 11:32:45 -0700138#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800139
140#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur9830bf02012-06-01 15:04:29 -0700141#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700142#define MSM_CONTIG_MEM_SIZE 0x65000
Hanumant Singhedfb0462012-05-15 14:49:32 -0700143#ifdef CONFIG_MSM_IOMMU
144#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
145#define MSM_ION_SF_SIZE 0x0
Olav Haugan494e4dc2012-05-15 15:14:31 -0700146#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800147#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700148#else
Olav Hauganb88eef12012-01-15 10:59:26 -0800149#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganb88eef12012-01-15 10:59:26 -0800150#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan494e4dc2012-05-15 15:14:31 -0700151#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Hanumant Singheea62562012-05-14 11:32:45 -0700152#define MSM_ION_HEAP_NUM 8
Hanumant Singhedfb0462012-05-15 14:49:32 -0700153#endif
Deepak Kotur9830bf02012-06-01 15:04:29 -0700154#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800155#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800156#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Hanumant Singheea62562012-05-14 11:32:45 -0700157
158#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
159#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
160#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
161
Deepak Kotur9830bf02012-06-01 15:04:29 -0700162#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */
163#define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
164 HOLE_SIZE))
Hanumant Singheea62562012-05-14 11:32:45 -0700165#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur9830bf02012-06-01 15:04:29 -0700166#define MSM8930_FW_START MSM8930_FIXED_AREA_START
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800167#define MSM_ION_ADSP_SIZE SZ_8M
Hanumant Singheea62562012-05-14 11:32:45 -0700168
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800169#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700170#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800171#define MSM_ION_HEAP_NUM 1
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800172#endif
173
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700174#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
175static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
176static int __init msm_contig_mem_size_setup(char *p)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800177{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700178 msm_contig_mem_size = memparse(p, NULL);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800179 return 0;
180}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700181early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800182#endif
183
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800184#define DSP_RAM_BASE_8960 0x8da00000
185#define DSP_RAM_SIZE_8960 0x1800000
186static int dspcrashd_pdata_8960 = 0xDEADDEAD;
187
188static struct resource resources_dspcrashd_8960[] = {
189 {
190 .name = "msm_dspcrashd",
191 .start = DSP_RAM_BASE_8960,
192 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
193 .flags = IORESOURCE_DMA,
194 },
195};
196
197static struct platform_device msm_device_dspcrashd_8960 = {
198 .name = "msm_dspcrashd",
199 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
200 .resource = resources_dspcrashd_8960,
201 .dev = { .platform_data = &dspcrashd_pdata_8960 },
202};
203
204static struct memtype_reserve msm8930_reserve_table[] __initdata = {
205 [MEMTYPE_SMI] = {
206 },
207 [MEMTYPE_EBI0] = {
208 .flags = MEMTYPE_FLAGS_1M_ALIGN,
209 },
210 [MEMTYPE_EBI1] = {
211 .flags = MEMTYPE_FLAGS_1M_ALIGN,
212 },
213};
214
Laura Abbottf8c03b92012-02-16 14:57:58 -0800215
216static void __init reserve_rtb_memory(void)
217{
218#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700219 msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800220#endif
221}
222
Laura Abbott938d7502013-04-09 10:44:16 -0700223static int msm8930_paddr_to_memtype(phys_addr_t paddr)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800224{
225 return MEMTYPE_EBI1;
226}
227
228#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800229#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700230static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800231 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan42ebe712012-01-10 16:30:58 -0800232 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700233 .fixed_position = FIXED_MIDDLE,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800234};
235
Laura Abbottb93525f2012-04-12 09:57:19 -0700236static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800237 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800238 .align = PAGE_SIZE,
Hanumant Singheea62562012-05-14 11:32:45 -0700239 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800240};
Hanumant Singheea62562012-05-14 11:32:45 -0700241
Laura Abbottb93525f2012-04-12 09:57:19 -0700242static struct ion_co_heap_pdata co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800243 .adjacent_mem_id = INVALID_HEAP_ID,
244 .align = PAGE_SIZE,
245};
Hanumant Singheea62562012-05-14 11:32:45 -0700246
Laura Abbottb93525f2012-04-12 09:57:19 -0700247static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800248 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
249 .align = SZ_128K,
Hanumant Singheea62562012-05-14 11:32:45 -0700250 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800251};
252#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800253
Laura Abbottfd1ad202012-09-18 11:45:43 -0700254
255static u64 msm_dmamask = DMA_BIT_MASK(32);
256
257static struct platform_device ion_mm_heap_device = {
258 .name = "ion-mm-heap-device",
259 .id = -1,
260 .dev = {
261 .dma_mask = &msm_dmamask,
262 .coherent_dma_mask = DMA_BIT_MASK(32),
263 }
264};
265
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800266static struct platform_device ion_adsp_heap_device = {
267 .name = "ion-adsp-heap-device",
268 .id = -1,
269 .dev = {
270 .dma_mask = &msm_dmamask,
271 .coherent_dma_mask = DMA_BIT_MASK(32),
272 }
273};
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800274/**
275 * These heaps are listed in the order they will be allocated. Due to
276 * video hardware restrictions and content protection the FW heap has to
277 * be allocated adjacent (below) the MM heap and the MFC heap has to be
278 * allocated after the MM heap to ensure MFC heap is not more than 256MB
279 * away from the base address of the FW heap.
280 * However, the order of FW heap and MM heap doesn't matter since these
281 * two heaps are taken care of by separate code to ensure they are adjacent
282 * to each other.
283 * Don't swap the order unless you know what you are doing!
284 */
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700285struct ion_platform_heap msm8930_heaps[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800286 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800287 .id = ION_SYSTEM_HEAP_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800288 .type = ION_HEAP_TYPE_SYSTEM,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800289 .name = ION_VMALLOC_HEAP_NAME,
290 },
291#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
292 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800293 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800294 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800295 .name = ION_MM_HEAP_NAME,
296 .size = MSM_ION_MM_SIZE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800297 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700298 .extra_data = (void *) &cp_mm_msm8930_ion_pdata,
Laura Abbottfd1ad202012-09-18 11:45:43 -0700299 .priv = &ion_mm_heap_device.dev
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800300 },
Olav Hauganb5be7992011-11-18 14:29:02 -0800301 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800302 .id = ION_MM_FIRMWARE_HEAP_ID,
303 .type = ION_HEAP_TYPE_CARVEOUT,
304 .name = ION_MM_FIRMWARE_HEAP_NAME,
305 .size = MSM_ION_MM_FW_SIZE,
306 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700307 .extra_data = (void *) &fw_co_msm8930_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800308 },
309 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800310 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800311 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800312 .name = ION_MFC_HEAP_NAME,
313 .size = MSM_ION_MFC_SIZE,
314 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700315 .extra_data = (void *) &cp_mfc_msm8930_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800316 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700317#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800318 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800319 .id = ION_SF_HEAP_ID,
320 .type = ION_HEAP_TYPE_CARVEOUT,
321 .name = ION_SF_HEAP_NAME,
322 .size = MSM_ION_SF_SIZE,
323 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700324 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800325 },
Hanumant Singhedfb0462012-05-15 14:49:32 -0700326#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800327 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800328 .id = ION_IOMMU_HEAP_ID,
329 .type = ION_HEAP_TYPE_IOMMU,
330 .name = ION_IOMMU_HEAP_NAME,
331 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800332 {
333 .id = ION_QSECOM_HEAP_ID,
334 .type = ION_HEAP_TYPE_CARVEOUT,
335 .name = ION_QSECOM_HEAP_NAME,
336 .size = MSM_ION_QSECOM_SIZE,
337 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700338 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800339 },
Olav Haugan7355db02012-01-13 16:59:13 -0800340 {
341 .id = ION_AUDIO_HEAP_ID,
342 .type = ION_HEAP_TYPE_CARVEOUT,
343 .name = ION_AUDIO_HEAP_NAME,
344 .size = MSM_ION_AUDIO_SIZE,
345 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700346 .extra_data = (void *) &co_msm8930_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800347 },
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800348 {
349 .id = ION_ADSP_HEAP_ID,
350 .type = ION_HEAP_TYPE_DMA,
351 .name = ION_ADSP_HEAP_NAME,
352 .size = MSM_ION_ADSP_SIZE,
353 .memory_type = ION_EBI_TYPE,
354 .extra_data = (void *) &co_msm8930_ion_pdata,
355 .priv = &ion_adsp_heap_device.dev,
356 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800357#endif
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700358};
359
360static struct ion_platform_data msm8930_ion_pdata = {
361 .nr = MSM_ION_HEAP_NUM,
362 .heaps = msm8930_heaps,
363
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800364};
365
Laura Abbottb93525f2012-04-12 09:57:19 -0700366static struct platform_device msm8930_ion_dev = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800367 .name = "ion-msm",
368 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700369 .dev = { .platform_data = &msm8930_ion_pdata },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800370};
371#endif
372
Hanumant Singheea62562012-05-14 11:32:45 -0700373static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
374 unsigned long size)
375{
376 msm8930_reserve_table[mem_type].size += size;
377}
378
379static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size)
380{
381#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
382 int ret;
383
384 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
385 panic("fixed area size is larger than %dM\n",
386 MAX_FIXED_AREA_SIZE >> 20);
387
388 reserve_info->fixed_area_size = fixed_area_size;
389 reserve_info->fixed_area_start = MSM8930_FW_START;
390
391 ret = memblock_remove(reserve_info->fixed_area_start,
392 reserve_info->fixed_area_size);
393 BUG_ON(ret);
394#endif
395}
396
397/**
Larry Basseld653d092013-06-20 10:46:21 -0700398 * Reserve memory for ION. Also handle special case
Hanumant Singheea62562012-05-14 11:32:45 -0700399 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
400 * at a higher address than FW in addition to not more than 256MB away from the
Larry Basseld653d092013-06-20 10:46:21 -0700401 * base address of the firmware. In addition the MM heap must be
Hanumant Singheea62562012-05-14 11:32:45 -0700402 * adjacent to the FW heap for content protection purposes.
403 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700404static void __init reserve_ion_memory(void)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800405{
406#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Hanumant Singheea62562012-05-14 11:32:45 -0700407 unsigned int i;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700408 int ret;
Hanumant Singheea62562012-05-14 11:32:45 -0700409 unsigned int fixed_size = 0;
410 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
411 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700412 unsigned long cma_alignment;
413 unsigned int low_use_cma = 0;
414 unsigned int middle_use_cma = 0;
415 unsigned int high_use_cma = 0;
Hanumant Singheea62562012-05-14 11:32:45 -0700416
Hanumant Singheea62562012-05-14 11:32:45 -0700417 fixed_low_size = 0;
418 fixed_middle_size = 0;
419 fixed_high_size = 0;
420
Laura Abbottfd1ad202012-09-18 11:45:43 -0700421 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
422
Hanumant Singheea62562012-05-14 11:32:45 -0700423 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
Laura Abbottfd1ad202012-09-18 11:45:43 -0700424 struct ion_platform_heap *heap =
Hanumant Singheea62562012-05-14 11:32:45 -0700425 &(msm8930_ion_pdata.heaps[i]);
426
Laura Abbottfd1ad202012-09-18 11:45:43 -0700427 int use_cma = 0;
428
Hanumant Singheea62562012-05-14 11:32:45 -0700429 if (heap->extra_data) {
430 int fixed_position = NOT_FIXED;
Hanumant Singheea62562012-05-14 11:32:45 -0700431
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700432 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700433 case ION_HEAP_TYPE_CP:
Laura Abbottfd1ad202012-09-18 11:45:43 -0700434 if (((struct ion_cp_heap_pdata *)
435 heap->extra_data)->is_cma) {
436 heap->size = ALIGN(heap->size,
437 cma_alignment);
438 use_cma = 1;
439 }
Hanumant Singheea62562012-05-14 11:32:45 -0700440 fixed_position = ((struct ion_cp_heap_pdata *)
441 heap->extra_data)->fixed_position;
442 break;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700443 case ION_HEAP_TYPE_DMA:
444 use_cma = 1;
445 /* Purposely fall through here */
Hanumant Singheea62562012-05-14 11:32:45 -0700446 case ION_HEAP_TYPE_CARVEOUT:
Hanumant Singheea62562012-05-14 11:32:45 -0700447 fixed_position = ((struct ion_co_heap_pdata *)
448 heap->extra_data)->fixed_position;
449 break;
450 default:
451 break;
452 }
453
454 if (fixed_position != NOT_FIXED)
455 fixed_size += heap->size;
Chintan Pandya07f05cd2013-04-12 14:50:29 +0530456 else if (!use_cma)
Hanumant Singheea62562012-05-14 11:32:45 -0700457 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
458
Laura Abbottfd1ad202012-09-18 11:45:43 -0700459 if (fixed_position == FIXED_LOW) {
Hanumant Singheea62562012-05-14 11:32:45 -0700460 fixed_low_size += heap->size;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700461 low_use_cma = use_cma;
462 } else if (fixed_position == FIXED_MIDDLE) {
Hanumant Singheea62562012-05-14 11:32:45 -0700463 fixed_middle_size += heap->size;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700464 middle_use_cma = use_cma;
465 } else if (fixed_position == FIXED_HIGH) {
Hanumant Singheea62562012-05-14 11:32:45 -0700466 fixed_high_size += heap->size;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700467 high_use_cma = use_cma;
468 } else if (use_cma) {
469 /*
470 * Heaps that use CMA but are not part of the
471 * fixed set. Create wherever.
472 */
473 dma_declare_contiguous(
474 heap->priv,
475 heap->size,
476 0,
477 0xb0000000);
478 }
Hanumant Singheea62562012-05-14 11:32:45 -0700479 }
480 }
481
482 if (!fixed_size)
483 return;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700484 /*
485 * Given the setup for the fixed area, we can't round up all sizes.
486 * Some sizes must be set up exactly and aligned correctly. Incorrect
487 * alignments are considered a configuration issue
Hanumant Singheea62562012-05-14 11:32:45 -0700488 */
Hanumant Singheea62562012-05-14 11:32:45 -0700489
490 fixed_low_start = MSM8930_FIXED_AREA_START;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700491 if (low_use_cma) {
492 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
493 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
494 } else {
495 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
496 ret = memblock_remove(fixed_low_start,
497 fixed_low_size + HOLE_SIZE);
498 BUG_ON(ret);
499 }
500
Deepak Kotur9830bf02012-06-01 15:04:29 -0700501 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700502 if (middle_use_cma) {
503 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
504 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
505 } else {
506 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
507 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
508 BUG_ON(ret);
509 }
510
Hanumant Singheea62562012-05-14 11:32:45 -0700511 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700512 if (high_use_cma) {
513 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
514 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
515 } else {
516 /* This is the end of the fixed area so it's okay to round up */
517 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
518 ret = memblock_remove(fixed_high_start, fixed_high_size);
519 BUG_ON(ret);
520 }
Hanumant Singheea62562012-05-14 11:32:45 -0700521
522 for (i = 0; i < msm8930_ion_pdata.nr; ++i) {
523 struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]);
524
525 if (heap->extra_data) {
526 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700527 struct ion_cp_heap_pdata *pdata = NULL;
Hanumant Singheea62562012-05-14 11:32:45 -0700528
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700529 switch ((int) heap->type) {
Hanumant Singheea62562012-05-14 11:32:45 -0700530 case ION_HEAP_TYPE_CP:
Deepak Kotur9830bf02012-06-01 15:04:29 -0700531 pdata =
532 (struct ion_cp_heap_pdata *)heap->extra_data;
533 fixed_position = pdata->fixed_position;
Hanumant Singheea62562012-05-14 11:32:45 -0700534 break;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700535 case ION_HEAP_TYPE_DMA:
Hanumant Singheea62562012-05-14 11:32:45 -0700536 case ION_HEAP_TYPE_CARVEOUT:
537 fixed_position = ((struct ion_co_heap_pdata *)
538 heap->extra_data)->fixed_position;
539 break;
540 default:
541 break;
542 }
543
544 switch (fixed_position) {
545 case FIXED_LOW:
546 heap->base = fixed_low_start;
547 break;
548 case FIXED_MIDDLE:
549 heap->base = fixed_middle_start;
Laura Abbottfd1ad202012-09-18 11:45:43 -0700550 if (middle_use_cma)
551 dma_declare_contiguous(
552 &ion_mm_heap_device.dev,
553 heap->size,
554 fixed_middle_start,
555 0xa0000000);
Deepak Kotur9830bf02012-06-01 15:04:29 -0700556 pdata->secure_base = fixed_middle_start
557 - HOLE_SIZE;
558 pdata->secure_size = HOLE_SIZE + heap->size;
Hanumant Singheea62562012-05-14 11:32:45 -0700559 break;
560 case FIXED_HIGH:
561 heap->base = fixed_high_start;
562 break;
563 default:
564 break;
565 }
566 }
567 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800568#endif
569}
Huaibin Yanga5419422011-12-08 23:52:10 -0800570
571static void __init reserve_mdp_memory(void)
572{
573 msm8930_mdp_writeback(msm8930_reserve_table);
574}
575
Laura Abbottf3173042012-05-29 15:23:18 -0700576#ifdef CONFIG_MSM_CACHE_DUMP
577static void __init reserve_cache_dump_memory(void)
578{
579 unsigned int total;
580
581 total = msm8930_cache_dump_pdata.l1_size +
582 msm8930_cache_dump_pdata.l2_size;
583 msm8930_reserve_table[MEMTYPE_EBI1].size += total;
584}
585#else
586static void __init reserve_cache_dump_memory(void) { }
587#endif
588
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800589static void __init msm8930_calculate_reserve_sizes(void)
590{
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800591 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800592 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800593 reserve_rtb_memory();
Laura Abbottf3173042012-05-29 15:23:18 -0700594 reserve_cache_dump_memory();
Laura Abbottf3aada42013-03-08 14:44:52 -0800595 msm8930_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800596}
597
598static struct reserve_info msm8930_reserve_info __initdata = {
599 .memtype_reserve_table = msm8930_reserve_table,
600 .calculate_reserve_sizes = msm8930_calculate_reserve_sizes,
Hanumant Singheea62562012-05-14 11:32:45 -0700601 .reserve_fixed_area = msm8930_reserve_fixed_area,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800602 .paddr_to_memtype = msm8930_paddr_to_memtype,
603};
604
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800605static void __init msm8930_early_memory(void)
606{
607 reserve_info = &msm8930_reserve_info;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800608}
609
Aravind Venkateswaran06a46352012-08-16 14:52:39 -0700610static char prim_panel_name[PANEL_NAME_MAX_LEN];
611static char ext_panel_name[PANEL_NAME_MAX_LEN];
612
613static int __init prim_display_setup(char *param)
614{
615 if (strnlen(param, PANEL_NAME_MAX_LEN))
616 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
617 return 0;
618}
619early_param("prim_display", prim_display_setup);
620
621static int __init ext_display_setup(char *param)
622{
623 if (strnlen(param, PANEL_NAME_MAX_LEN))
624 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
625 return 0;
626}
627early_param("ext_display", ext_display_setup);
628
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800629static void __init msm8930_reserve(void)
630{
Aravind Venkateswaran06a46352012-08-16 14:52:39 -0700631 msm8930_set_display_params(prim_panel_name, ext_panel_name);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800632 msm_reserve();
633}
634
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800635static void __init msm8930_allocate_memory_regions(void)
636{
637 msm8930_allocate_fb_region();
638}
639
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530640#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800641
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530642#define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800643
644/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
645 * 4 micbiases are used to power various analog and digital
646 * microphones operating at 1800 mV. Technically, all micbiases
647 * can source from single cfilter since all microphones operate
648 * at the same voltage level. The arrangement below is to make
649 * sure all cfilters are exercised. LDO_H regulator ouput level
650 * does not need to be as high as 2.85V. It is choosen for
651 * microphone sensitivity purpose.
652 */
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530653static struct wcd9xxx_pdata sitar_platform_data = {
654 .slimbus_slave_device = {
655 .name = "sitar-slave",
656 .e_addr = {0, 0, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800657 },
658 .irq = MSM_GPIO_TO_INT(62),
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530659 .irq_base = SITAR_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530660 .num_irqs = NR_WCD9XXX_IRQS,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530661 .reset_gpio = 42,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800662 .micbias = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530663 .ldoh_v = SITAR_LDOH_2P85_V,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800664 .cfilt1_mv = 1800,
665 .cfilt2_mv = 1800,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530666 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
667 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700668 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
669 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530670 },
671 .regulator = {
672 {
673 .name = "CDC_VDD_CP",
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -0700674 .min_uV = 2200000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530675 .max_uV = 2200000,
676 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
677 },
678 {
679 .name = "CDC_VDDA_RX",
680 .min_uV = 1800000,
681 .max_uV = 1800000,
682 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
683 },
684 {
685 .name = "CDC_VDDA_TX",
686 .min_uV = 1800000,
687 .max_uV = 1800000,
688 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
689 },
690 {
691 .name = "VDDIO_CDC",
692 .min_uV = 1800000,
693 .max_uV = 1800000,
694 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
695 },
696 {
697 .name = "VDDD_CDC_D",
698 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700699 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530700 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
701 },
702 {
703 .name = "CDC_VDDA_A_1P2V",
704 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700705 .max_uV = 1250000,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530706 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
707 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800708 },
709};
710
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530711static struct slim_device msm_slim_sitar = {
712 .name = "sitar-slim",
713 .e_addr = {0, 1, 0x00, 0, 0x17, 2},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800714 .dev = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530715 .platform_data = &sitar_platform_data,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800716 },
717};
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700718
719static struct wcd9xxx_pdata sitar1p1_platform_data = {
720 .slimbus_slave_device = {
721 .name = "sitar-slave",
722 .e_addr = {0, 0, 0x70, 0, 0x17, 2},
723 },
724 .irq = MSM_GPIO_TO_INT(62),
725 .irq_base = SITAR_INTERRUPT_BASE,
726 .num_irqs = NR_WCD9XXX_IRQS,
727 .reset_gpio = 42,
728 .micbias = {
729 .ldoh_v = SITAR_LDOH_2P85_V,
730 .cfilt1_mv = 1800,
731 .cfilt2_mv = 1800,
732 .bias1_cfilt_sel = SITAR_CFILT1_SEL,
733 .bias2_cfilt_sel = SITAR_CFILT2_SEL,
Bhalchandra Gajare15dbeaa2012-06-26 12:53:07 -0700734 .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
735 .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700736 },
737 .regulator = {
738 {
739 .name = "CDC_VDD_CP",
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -0700740 .min_uV = 2200000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700741 .max_uV = 2200000,
742 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
743 },
744 {
745 .name = "CDC_VDDA_RX",
746 .min_uV = 1800000,
747 .max_uV = 1800000,
748 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
749 },
750 {
751 .name = "CDC_VDDA_TX",
752 .min_uV = 1800000,
753 .max_uV = 1800000,
754 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
755 },
756 {
757 .name = "VDDIO_CDC",
758 .min_uV = 1800000,
759 .max_uV = 1800000,
760 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
761 },
762 {
763 .name = "VDDD_CDC_D",
764 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700765 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700766 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
767 },
768 {
769 .name = "CDC_VDDA_A_1P2V",
770 .min_uV = 1200000,
David Collins19e78812012-06-04 15:50:09 -0700771 .max_uV = 1250000,
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700772 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
773 },
774 },
775};
776
777static struct slim_device msm_slim_sitar1p1 = {
778 .name = "sitar1p1-slim",
779 .e_addr = {0, 1, 0x70, 0, 0x17, 2},
780 .dev = {
781 .platform_data = &sitar1p1_platform_data,
782 },
783};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800784#endif
785
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530786
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800787static struct slim_boardinfo msm_slim_devices[] = {
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530788#ifdef CONFIG_WCD9304_CODEC
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800789 {
790 .bus_num = 1,
Asish Bhattacharyab86c3472012-02-15 08:31:52 +0530791 .slim_slave = &msm_slim_sitar,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800792 },
Bhalchandra Gajare83c81f62012-05-18 16:09:05 -0700793 {
794 .bus_num = 1,
795 .slim_slave = &msm_slim_sitar1p1,
796 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800797#endif
798 /* add more slimbus slaves as needed */
799};
800
801#define MSM_WCNSS_PHYS 0x03000000
802#define MSM_WCNSS_SIZE 0x280000
803
804static struct resource resources_wcnss_wlan[] = {
805 {
806 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
807 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
808 .name = "wcnss_wlanrx_irq",
809 .flags = IORESOURCE_IRQ,
810 },
811 {
812 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
813 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
814 .name = "wcnss_wlantx_irq",
815 .flags = IORESOURCE_IRQ,
816 },
817 {
818 .start = MSM_WCNSS_PHYS,
819 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
820 .name = "wcnss_mmio",
821 .flags = IORESOURCE_MEM,
822 },
823 {
824 .start = 84,
825 .end = 88,
826 .name = "wcnss_gpios_5wire",
827 .flags = IORESOURCE_IO,
828 },
829};
830
831static struct qcom_wcnss_opts qcom_wcnss_pdata = {
832 .has_48mhz_xo = 1,
833};
834
835static struct platform_device msm_device_wcnss_wlan = {
836 .name = "wcnss_wlan",
837 .id = 0,
838 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
839 .resource = resources_wcnss_wlan,
840 .dev = {.platform_data = &qcom_wcnss_pdata},
841};
842
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700843#ifdef CONFIG_QSEECOM
844/* qseecom bus scaling */
845static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
846 {
847 .src = MSM_BUS_MASTER_SPS,
848 .dst = MSM_BUS_SLAVE_EBI_CH0,
849 .ib = 0,
850 .ab = 0,
851 },
852 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700853 .src = MSM_BUS_MASTER_SPS,
854 .dst = MSM_BUS_SLAVE_SPS,
855 .ib = 0,
856 .ab = 0,
857 },
858 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700859 .src = MSM_BUS_MASTER_SPDM,
860 .dst = MSM_BUS_SLAVE_SPDM,
861 .ib = 0,
862 .ab = 0,
863 },
864};
865
866static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
867 {
868 .src = MSM_BUS_MASTER_SPS,
869 .dst = MSM_BUS_SLAVE_EBI_CH0,
870 .ib = (492 * 8) * 1000000UL,
871 .ab = (492 * 8) * 100000UL,
872 },
873 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700874 .src = MSM_BUS_MASTER_SPS,
875 .dst = MSM_BUS_SLAVE_SPS,
876 .ib = (492 * 8) * 1000000UL,
877 .ab = (492 * 8) * 100000UL,
878 },
879 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700880 .src = MSM_BUS_MASTER_SPDM,
881 .dst = MSM_BUS_SLAVE_SPDM,
882 .ib = 0,
883 .ab = 0,
884 },
885};
886
887static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
888 {
889 .src = MSM_BUS_MASTER_SPS,
890 .dst = MSM_BUS_SLAVE_EBI_CH0,
891 .ib = 0,
892 .ab = 0,
893 },
894 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -0700895 .src = MSM_BUS_MASTER_SPS,
896 .dst = MSM_BUS_SLAVE_SPS,
897 .ib = 0,
898 .ab = 0,
899 },
900 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700901 .src = MSM_BUS_MASTER_SPDM,
902 .dst = MSM_BUS_SLAVE_SPDM,
903 .ib = (64 * 8) * 1000000UL,
904 .ab = (64 * 8) * 100000UL,
905 },
906};
907
Ramesh Masavarapu8d756582012-10-03 10:18:06 -0700908static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
909 {
910 .src = MSM_BUS_MASTER_SPS,
911 .dst = MSM_BUS_SLAVE_EBI_CH0,
912 .ib = (492 * 8) * 1000000UL,
913 .ab = (492 * 8) * 100000UL,
914 },
915 {
916 .src = MSM_BUS_MASTER_SPS,
917 .dst = MSM_BUS_SLAVE_SPS,
918 .ib = (492 * 8) * 1000000UL,
919 .ab = (492 * 8) * 100000UL,
920 },
921 {
922 .src = MSM_BUS_MASTER_SPDM,
923 .dst = MSM_BUS_SLAVE_SPDM,
924 .ib = (64 * 8) * 1000000UL,
925 .ab = (64 * 8) * 100000UL,
926 },
927};
928
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700929static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
930 {
931 ARRAY_SIZE(qseecom_clks_init_vectors),
932 qseecom_clks_init_vectors,
933 },
934 {
935 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Mona Hossain56e430f2013-04-12 11:40:19 -0700936 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700937 },
938 {
939 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
940 qseecom_enable_sfpb_vectors,
941 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -0700942 {
943 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
944 qseecom_enable_dfab_sfpb_vectors,
945 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700946};
947
948static struct msm_bus_scale_pdata qseecom_bus_pdata = {
949 qseecom_hw_bus_scale_usecases,
950 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
951 .name = "qsee",
952};
953
954static struct platform_device qseecom_device = {
955 .name = "qseecom",
956 .id = 0,
957 .dev = {
958 .platform_data = &qseecom_bus_pdata,
959 },
960};
961#endif
962
Stepan Moskovchenko39236d72011-11-30 17:42:23 -0800963#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
964 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
965 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
966 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
967
968#define QCE_SIZE 0x10000
969#define QCE_0_BASE 0x18500000
970
971#define QCE_HW_KEY_SUPPORT 0
972#define QCE_SHA_HMAC_SUPPORT 1
973#define QCE_SHARE_CE_RESOURCE 1
974#define QCE_CE_SHARED 0
975
Ramesh Masavarapu992faf62012-06-15 20:21:39 -0700976/* Begin Bus scaling definitions */
977static struct msm_bus_vectors crypto_hw_init_vectors[] = {
978 {
979 .src = MSM_BUS_MASTER_ADM_PORT0,
980 .dst = MSM_BUS_SLAVE_EBI_CH0,
981 .ab = 0,
982 .ib = 0,
983 },
984 {
985 .src = MSM_BUS_MASTER_ADM_PORT1,
986 .dst = MSM_BUS_SLAVE_GSBI1_UART,
987 .ab = 0,
988 .ib = 0,
989 },
990};
991
992static struct msm_bus_vectors crypto_hw_active_vectors[] = {
993 {
994 .src = MSM_BUS_MASTER_ADM_PORT0,
995 .dst = MSM_BUS_SLAVE_EBI_CH0,
996 .ab = 70000000UL,
997 .ib = 70000000UL,
998 },
999 {
1000 .src = MSM_BUS_MASTER_ADM_PORT1,
1001 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1002 .ab = 2480000000UL,
1003 .ib = 2480000000UL,
1004 },
1005};
1006
1007static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1008 {
1009 ARRAY_SIZE(crypto_hw_init_vectors),
1010 crypto_hw_init_vectors,
1011 },
1012 {
1013 ARRAY_SIZE(crypto_hw_active_vectors),
1014 crypto_hw_active_vectors,
1015 },
1016};
1017
1018static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1019 crypto_hw_bus_scale_usecases,
1020 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1021 .name = "cryptohw",
1022};
1023/* End Bus Scaling Definitions*/
1024
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001025static struct resource qcrypto_resources[] = {
1026 [0] = {
1027 .start = QCE_0_BASE,
1028 .end = QCE_0_BASE + QCE_SIZE - 1,
1029 .flags = IORESOURCE_MEM,
1030 },
1031 [1] = {
1032 .name = "crypto_channels",
1033 .start = DMOV_CE_IN_CHAN,
1034 .end = DMOV_CE_OUT_CHAN,
1035 .flags = IORESOURCE_DMA,
1036 },
1037 [2] = {
1038 .name = "crypto_crci_in",
1039 .start = DMOV_CE_IN_CRCI,
1040 .end = DMOV_CE_IN_CRCI,
1041 .flags = IORESOURCE_DMA,
1042 },
1043 [3] = {
1044 .name = "crypto_crci_out",
1045 .start = DMOV_CE_OUT_CRCI,
1046 .end = DMOV_CE_OUT_CRCI,
1047 .flags = IORESOURCE_DMA,
1048 },
1049};
1050
1051static struct resource qcedev_resources[] = {
1052 [0] = {
1053 .start = QCE_0_BASE,
1054 .end = QCE_0_BASE + QCE_SIZE - 1,
1055 .flags = IORESOURCE_MEM,
1056 },
1057 [1] = {
1058 .name = "crypto_channels",
1059 .start = DMOV_CE_IN_CHAN,
1060 .end = DMOV_CE_OUT_CHAN,
1061 .flags = IORESOURCE_DMA,
1062 },
1063 [2] = {
1064 .name = "crypto_crci_in",
1065 .start = DMOV_CE_IN_CRCI,
1066 .end = DMOV_CE_IN_CRCI,
1067 .flags = IORESOURCE_DMA,
1068 },
1069 [3] = {
1070 .name = "crypto_crci_out",
1071 .start = DMOV_CE_OUT_CRCI,
1072 .end = DMOV_CE_OUT_CRCI,
1073 .flags = IORESOURCE_DMA,
1074 },
1075};
1076
1077#endif
1078
1079#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1080 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1081
1082static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1083 .ce_shared = QCE_CE_SHARED,
1084 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1085 .hw_key_support = QCE_HW_KEY_SUPPORT,
1086 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001087 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001088};
1089
1090static struct platform_device qcrypto_device = {
1091 .name = "qcrypto",
1092 .id = 0,
1093 .num_resources = ARRAY_SIZE(qcrypto_resources),
1094 .resource = qcrypto_resources,
1095 .dev = {
1096 .coherent_dma_mask = DMA_BIT_MASK(32),
1097 .platform_data = &qcrypto_ce_hw_suppport,
1098 },
1099};
1100#endif
1101
1102#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1103 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1104
1105static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1106 .ce_shared = QCE_CE_SHARED,
1107 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1108 .hw_key_support = QCE_HW_KEY_SUPPORT,
1109 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu992faf62012-06-15 20:21:39 -07001110 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001111};
1112
1113static struct platform_device qcedev_device = {
1114 .name = "qce",
1115 .id = 0,
1116 .num_resources = ARRAY_SIZE(qcedev_resources),
1117 .resource = qcedev_resources,
1118 .dev = {
1119 .coherent_dma_mask = DMA_BIT_MASK(32),
1120 .platform_data = &qcedev_ce_hw_suppport,
1121 },
1122};
1123#endif
1124
1125#define MDM2AP_ERRFATAL 70
1126#define AP2MDM_ERRFATAL 95
1127#define MDM2AP_STATUS 69
1128#define AP2MDM_STATUS 94
1129#define AP2MDM_PMIC_RESET_N 80
1130#define AP2MDM_KPDPWR_N 81
1131
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001132static struct resource mdm_resources[] = {
1133 {
1134 .start = MDM2AP_ERRFATAL,
1135 .end = MDM2AP_ERRFATAL,
1136 .name = "MDM2AP_ERRFATAL",
1137 .flags = IORESOURCE_IO,
1138 },
1139 {
1140 .start = AP2MDM_ERRFATAL,
1141 .end = AP2MDM_ERRFATAL,
1142 .name = "AP2MDM_ERRFATAL",
1143 .flags = IORESOURCE_IO,
1144 },
1145 {
1146 .start = MDM2AP_STATUS,
1147 .end = MDM2AP_STATUS,
1148 .name = "MDM2AP_STATUS",
1149 .flags = IORESOURCE_IO,
1150 },
1151 {
1152 .start = AP2MDM_STATUS,
1153 .end = AP2MDM_STATUS,
1154 .name = "AP2MDM_STATUS",
1155 .flags = IORESOURCE_IO,
1156 },
1157 {
1158 .start = AP2MDM_PMIC_RESET_N,
1159 .end = AP2MDM_PMIC_RESET_N,
1160 .name = "AP2MDM_PMIC_RESET_N",
1161 .flags = IORESOURCE_IO,
1162 },
1163 {
1164 .start = AP2MDM_KPDPWR_N,
1165 .end = AP2MDM_KPDPWR_N,
1166 .name = "AP2MDM_KPDPWR_N",
1167 .flags = IORESOURCE_IO,
1168 },
1169};
1170
1171static struct mdm_platform_data mdm_platform_data = {
1172 .mdm_version = "2.5",
1173};
1174
1175static struct platform_device mdm_device = {
1176 .name = "mdm2_modem",
1177 .id = -1,
1178 .num_resources = ARRAY_SIZE(mdm_resources),
1179 .resource = mdm_resources,
1180 .dev = {
1181 .platform_data = &mdm_platform_data,
1182 },
1183};
1184
1185static struct platform_device *mdm_devices[] __initdata = {
1186 &mdm_device,
1187};
1188
Praveen Chidambaram78499012011-11-01 17:15:17 -06001189#ifdef CONFIG_MSM_MPM
1190static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
1191 [1] = MSM_GPIO_TO_INT(46),
1192 [2] = MSM_GPIO_TO_INT(150),
1193 [4] = MSM_GPIO_TO_INT(103),
1194 [5] = MSM_GPIO_TO_INT(104),
1195 [6] = MSM_GPIO_TO_INT(105),
1196 [7] = MSM_GPIO_TO_INT(106),
1197 [8] = MSM_GPIO_TO_INT(107),
1198 [9] = MSM_GPIO_TO_INT(7),
1199 [10] = MSM_GPIO_TO_INT(11),
1200 [11] = MSM_GPIO_TO_INT(15),
1201 [12] = MSM_GPIO_TO_INT(19),
1202 [13] = MSM_GPIO_TO_INT(23),
1203 [14] = MSM_GPIO_TO_INT(27),
1204 [15] = MSM_GPIO_TO_INT(31),
1205 [16] = MSM_GPIO_TO_INT(35),
1206 [19] = MSM_GPIO_TO_INT(90),
1207 [20] = MSM_GPIO_TO_INT(92),
1208 [23] = MSM_GPIO_TO_INT(85),
1209 [24] = MSM_GPIO_TO_INT(83),
1210 [25] = USB1_HS_IRQ,
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001211 [26] = MSM_GPIO_TO_INT(6),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001212 [27] = HDMI_IRQ,
1213 [29] = MSM_GPIO_TO_INT(10),
1214 [30] = MSM_GPIO_TO_INT(102),
1215 [31] = MSM_GPIO_TO_INT(81),
1216 [32] = MSM_GPIO_TO_INT(78),
1217 [33] = MSM_GPIO_TO_INT(94),
1218 [34] = MSM_GPIO_TO_INT(72),
1219 [35] = MSM_GPIO_TO_INT(39),
1220 [36] = MSM_GPIO_TO_INT(43),
1221 [37] = MSM_GPIO_TO_INT(61),
1222 [38] = MSM_GPIO_TO_INT(50),
1223 [39] = MSM_GPIO_TO_INT(42),
1224 [41] = MSM_GPIO_TO_INT(62),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001225 [42] = MSM_GPIO_TO_INT(8),
1226 [43] = MSM_GPIO_TO_INT(33),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001227 [44] = MSM_GPIO_TO_INT(70),
1228 [45] = MSM_GPIO_TO_INT(69),
1229 [46] = MSM_GPIO_TO_INT(67),
1230 [47] = MSM_GPIO_TO_INT(65),
Mahesh Sivasubramanian47e38a82012-03-06 09:35:26 -07001231 [48] = MSM_GPIO_TO_INT(55),
1232 [49] = MSM_GPIO_TO_INT(74),
1233 [50] = MSM_GPIO_TO_INT(98),
Praveen Chidambaram78499012011-11-01 17:15:17 -06001234 [51] = MSM_GPIO_TO_INT(49),
1235 [52] = MSM_GPIO_TO_INT(40),
1236 [53] = MSM_GPIO_TO_INT(37),
1237 [54] = MSM_GPIO_TO_INT(24),
1238 [55] = MSM_GPIO_TO_INT(14),
1239};
1240
1241static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
1242 TLMM_MSM_SUMMARY_IRQ,
1243 RPM_APCC_CPU0_GP_HIGH_IRQ,
1244 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1245 RPM_APCC_CPU0_GP_LOW_IRQ,
1246 RPM_APCC_CPU0_WAKE_UP_IRQ,
1247 RPM_APCC_CPU1_GP_HIGH_IRQ,
1248 RPM_APCC_CPU1_GP_MEDIUM_IRQ,
1249 RPM_APCC_CPU1_GP_LOW_IRQ,
1250 RPM_APCC_CPU1_WAKE_UP_IRQ,
1251 MSS_TO_APPS_IRQ_0,
1252 MSS_TO_APPS_IRQ_1,
1253 MSS_TO_APPS_IRQ_2,
1254 MSS_TO_APPS_IRQ_3,
1255 MSS_TO_APPS_IRQ_4,
1256 MSS_TO_APPS_IRQ_5,
1257 MSS_TO_APPS_IRQ_6,
1258 MSS_TO_APPS_IRQ_7,
1259 MSS_TO_APPS_IRQ_8,
1260 MSS_TO_APPS_IRQ_9,
1261 LPASS_SCSS_GP_LOW_IRQ,
1262 LPASS_SCSS_GP_MEDIUM_IRQ,
1263 LPASS_SCSS_GP_HIGH_IRQ,
1264 SPS_MTI_30,
1265 SPS_MTI_31,
1266 RIVA_APSS_SPARE_IRQ,
1267 RIVA_APPS_WLAN_SMSM_IRQ,
1268 RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1269 RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1270};
1271
1272struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = {
1273 .irqs_m2a = msm_mpm_irqs_m2a,
1274 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1275 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1276 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1277 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1278 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1279 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1280 .mpm_apps_ipc_val = BIT(1),
1281 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1282
1283};
1284#endif
1285
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001286#define MSM_SHARED_RAM_PHYS 0x80000000
1287
1288static void __init msm8930_map_io(void)
1289{
1290 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1291 msm_map_msm8930_io();
1292
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -08001293 if (socinfo_init() < 0)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001294 pr_err("socinfo_init() failed!\n");
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001295
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001296}
1297
1298static void __init msm8930_init_irq(void)
1299{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001300 struct msm_mpm_device_data *data = NULL;
1301#ifdef CONFIG_MSM_MPM
1302 data = &msm8930_mpm_dev_data;
1303#endif
1304
1305 msm_mpm_irq_extn_init(data);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001306 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1307 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001308}
1309
1310static void __init msm8930_init_buses(void)
1311{
1312#ifdef CONFIG_MSM_BUS_SCALING
1313 msm_bus_rpm_set_mt_mask();
Gagan Maccd5b3272012-02-09 18:13:10 -07001314 msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1;
1315 msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1;
1316 msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1;
1317 msm_bus_8930_apps_fabric.dev.platform_data =
1318 &msm_bus_8930_apps_fabric_pdata;
1319 msm_bus_8930_sys_fabric.dev.platform_data =
1320 &msm_bus_8930_sys_fabric_pdata;
1321 msm_bus_8930_mm_fabric.dev.platform_data =
1322 &msm_bus_8930_mm_fabric_pdata;
1323 msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata;
1324 msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001325#endif
1326}
1327
1328static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1329 .max_clock_speed = 15060000,
1330};
1331
1332#ifdef CONFIG_USB_MSM_OTG_72K
1333static struct msm_otg_platform_data msm_otg_pdata;
1334#else
Mayank Rana7e574162013-01-08 15:10:51 +05301335static int enable_usb_host_mode;
1336static int __init usb_host_mode_with_pm8917(char *param)
1337{
1338 int ret;
1339
1340 ret = kstrtoint(param, 10, &enable_usb_host_mode);
1341 return ret;
1342}
1343early_param("usb_host_mode_pm8917", usb_host_mode_with_pm8917);
1344
Manu Gautam32ab9462012-02-20 12:33:01 +05301345#ifdef CONFIG_MSM_BUS_SCALING
1346/* Bandwidth requests (zero) if no vote placed */
1347static struct msm_bus_vectors usb_init_vectors[] = {
1348 {
1349 .src = MSM_BUS_MASTER_SPS,
1350 .dst = MSM_BUS_SLAVE_EBI_CH0,
1351 .ab = 0,
1352 .ib = 0,
1353 },
1354};
1355
1356/* Bus bandwidth requests in Bytes/sec */
1357static struct msm_bus_vectors usb_max_vectors[] = {
1358 {
1359 .src = MSM_BUS_MASTER_SPS,
1360 .dst = MSM_BUS_SLAVE_EBI_CH0,
1361 .ab = 60000000, /* At least 480Mbps on bus. */
1362 .ib = 960000000, /* MAX bursts rate */
1363 },
1364};
1365
1366static struct msm_bus_paths usb_bus_scale_usecases[] = {
1367 {
1368 ARRAY_SIZE(usb_init_vectors),
1369 usb_init_vectors,
1370 },
1371 {
1372 ARRAY_SIZE(usb_max_vectors),
1373 usb_max_vectors,
1374 },
1375};
1376
1377static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1378 usb_bus_scale_usecases,
1379 ARRAY_SIZE(usb_bus_scale_usecases),
1380 .name = "usb",
1381};
1382#endif
1383
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301384static int hsusb_phy_init_seq[] = {
1385 0x44, 0x80, /* set VBUS valid threshold
1386 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301387 0x68, 0x81, /* update DC voltage level */
Mayank Rana2fe1aec2012-06-07 18:00:12 +05301388 0x24, 0x82, /* set preemphasis and rise/fall time */
1389 0x13, 0x83, /* set source impedance adjusment */
1390 -1};
1391
Jack Pham87f202f2012-08-06 00:24:22 -07001392#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1393
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001394static struct msm_otg_platform_data msm_otg_pdata = {
1395 .mode = USB_OTG,
1396 .otg_control = OTG_PMIC_CONTROL,
1397 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001398 .power_budget = 750,
Manu Gautam32ab9462012-02-20 12:33:01 +05301399#ifdef CONFIG_MSM_BUS_SCALING
1400 .bus_scale_table = &usb_bus_scale_pdata,
1401#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301402#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1403 .mhl_dev_name = "sii8334",
1404#endif
Jack Pham87f202f2012-08-06 00:24:22 -07001405 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001406};
1407#endif
1408
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001409#define PID_MAGIC_ID 0x71432909
1410#define SERIAL_NUM_MAGIC_ID 0x61945374
1411#define SERIAL_NUMBER_LENGTH 127
1412#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1413
1414struct magic_num_struct {
1415 uint32_t pid;
1416 uint32_t serial_num;
1417};
1418
1419struct dload_struct {
1420 uint32_t reserved1;
1421 uint32_t reserved2;
1422 uint32_t reserved3;
1423 uint16_t reserved4;
1424 uint16_t pid;
1425 char serial_number[SERIAL_NUMBER_LENGTH];
1426 uint16_t reserved5;
1427 struct magic_num_struct magic_struct;
1428};
1429
1430static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1431{
1432 struct dload_struct __iomem *dload = 0;
1433
1434 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1435 if (!dload) {
1436 pr_err("%s: cannot remap I/O memory region: %08x\n",
1437 __func__, DLOAD_USB_BASE_ADD);
1438 return -ENXIO;
1439 }
1440
1441 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1442 __func__, dload, pid, snum);
1443 /* update pid */
1444 dload->magic_struct.pid = PID_MAGIC_ID;
1445 dload->pid = pid;
1446
1447 /* update serial number */
1448 dload->magic_struct.serial_num = 0;
1449 if (!snum) {
1450 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1451 goto out;
1452 }
1453
1454 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
1455 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
1456out:
1457 iounmap(dload);
1458 return 0;
1459}
1460
1461static struct android_usb_platform_data android_usb_pdata = {
1462 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1463};
1464
1465static struct platform_device android_usb_device = {
1466 .name = "android_usb",
1467 .id = -1,
1468 .dev = {
1469 .platform_data = &android_usb_pdata,
1470 },
1471};
1472
1473static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001474 0x03, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001475};
1476
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301477
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001478static uint8_t spm_retention_cmd_sequence[] __initdata = {
1479 0x00, 0x05, 0x03, 0x0D,
1480 0x0B, 0x00, 0x0f,
1481};
1482
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301483static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
1484 0x42, 0x1B, 0x00,
1485 0x05, 0x03, 0x01, 0x0B,
1486 0x00, 0x42, 0x1B,
1487 0x0f,
1488};
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001489static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001490 0x00, 0x24, 0x54, 0x10,
1491 0x09, 0x03, 0x01,
1492 0x10, 0x54, 0x30, 0x0C,
1493 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001494};
1495
1496static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001497 0x00, 0x24, 0x54, 0x10,
1498 0x09, 0x07, 0x01, 0x0B,
1499 0x10, 0x54, 0x30, 0x0C,
1500 0x24, 0x30, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001501};
1502
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001503static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1504 [0] = {
1505 .mode = MSM_SPM_MODE_CLOCK_GATING,
1506 .notify_rpm = false,
1507 .cmd = spm_wfi_cmd_sequence,
1508 },
1509 [1] = {
1510 .mode = MSM_SPM_MODE_POWER_RETENTION,
1511 .notify_rpm = false,
1512 .cmd = spm_retention_cmd_sequence,
1513 },
1514 [2] = {
1515 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1516 .notify_rpm = false,
1517 .cmd = spm_power_collapse_without_rpm,
1518 },
1519 [3] = {
1520 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1521 .notify_rpm = true,
1522 .cmd = spm_power_collapse_with_rpm,
1523 },
1524};
1525
1526static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001527 [0] = {
1528 .mode = MSM_SPM_MODE_CLOCK_GATING,
1529 .notify_rpm = false,
1530 .cmd = spm_wfi_cmd_sequence,
1531 },
1532 [1] = {
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301533 .mode = MSM_SPM_MODE_POWER_RETENTION,
1534 .notify_rpm = false,
1535 .cmd = spm_retention_cmd_sequence,
1536 },
1537 [2] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001538 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1539 .notify_rpm = false,
1540 .cmd = spm_power_collapse_without_rpm,
1541 },
Anji Jonnala1a1711a2013-01-29 13:34:10 +05301542 [3] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001543 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1544 .notify_rpm = true,
1545 .cmd = spm_power_collapse_with_rpm,
1546 },
1547};
1548
1549static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1550 [0] = {
1551 .reg_base_addr = MSM_SAW0_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001552 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001553#if defined(CONFIG_MSM_AVS_HW)
1554 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1555 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1556#endif
1557 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001558 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1559 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1560 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001561 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001562 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1563 .modes = msm_spm_boot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001564 },
1565 [1] = {
1566 .reg_base_addr = MSM_SAW1_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001567 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001568#if defined(CONFIG_MSM_AVS_HW)
1569 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1570 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1571#endif
1572 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001573 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001574 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1575 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1576 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001577 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1578 .modes = msm_spm_nonboot_cpu_seq_list,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001579 },
1580};
1581
1582static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001583 0x00, 0x20, 0x03, 0x20,
1584 0x00, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001585};
1586
1587static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001588 0x00, 0x20, 0x34, 0x64,
1589 0x48, 0x07, 0x48, 0x20,
1590 0x50, 0x64, 0x04, 0x34,
1591 0x50, 0x0f,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001592};
1593static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06001594 0x00, 0x10, 0x34, 0x64,
1595 0x48, 0x07, 0x48, 0x10,
1596 0x50, 0x64, 0x04, 0x34,
1597 0x50, 0x0F,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001598};
1599
1600static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1601 [0] = {
1602 .mode = MSM_SPM_L2_MODE_RETENTION,
1603 .notify_rpm = false,
1604 .cmd = l2_spm_wfi_cmd_sequence,
1605 },
1606 [1] = {
1607 .mode = MSM_SPM_L2_MODE_GDHS,
1608 .notify_rpm = true,
1609 .cmd = l2_spm_gdhs_cmd_sequence,
1610 },
1611 [2] = {
1612 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1613 .notify_rpm = true,
1614 .cmd = l2_spm_power_off_cmd_sequence,
1615 },
1616};
1617
1618static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1619 [0] = {
1620 .reg_base_addr = MSM_SAW_L2_BASE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001621 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001622 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001623 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1624 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1625 .modes = msm_spm_l2_seq_list,
1626 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1627 },
1628};
1629
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301630#define ISA1200_HAP_EN_GPIO 77
1631#define ISA1200_HAP_LEN_GPIO 78
David Collinsfd344aa2012-08-06 15:02:03 -07001632#define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7)
1633#define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38)
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001634
1635static int isa1200_power(int on)
1636{
David Collinsfd344aa2012-08-06 15:02:03 -07001637 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
1638 enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1;
Amy Malocheb20c1052012-04-11 10:36:13 -07001639 int rc = 0;
1640
David Collinsfd344aa2012-08-06 15:02:03 -07001641 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
1642 gpio = ISA1200_HAP_CLK_PM8917;
1643 clk_id = CLK_MP3_2;
1644 }
1645
1646 gpio_set_value_cansleep(gpio, !!on);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301647
Amy Malocheb20c1052012-04-11 10:36:13 -07001648 if (on)
David Collinsfd344aa2012-08-06 15:02:03 -07001649 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001650 else
David Collinsfd344aa2012-08-06 15:02:03 -07001651 rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true);
Amy Malocheb20c1052012-04-11 10:36:13 -07001652
1653 if (rc) {
1654 pr_err("%s: unable to write aux clock register(%d)\n",
1655 __func__, rc);
1656 }
1657
1658 return rc;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001659}
1660
1661static int isa1200_dev_setup(bool enable)
1662{
David Collinsfd344aa2012-08-06 15:02:03 -07001663 unsigned int gpio = ISA1200_HAP_CLK_PM8038;
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001664 int rc = 0;
1665
David Collinsfd344aa2012-08-06 15:02:03 -07001666 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1667 gpio = ISA1200_HAP_CLK_PM8917;
1668
Amy Malocheb20c1052012-04-11 10:36:13 -07001669 if (!enable)
1670 goto fail_gpio_dir;
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301671
David Collinsfd344aa2012-08-06 15:02:03 -07001672 rc = gpio_request(gpio, "haptics_clk");
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301673 if (rc) {
1674 pr_err("%s: gpio_request for %d gpio failed rc(%d)\n",
David Collinsfd344aa2012-08-06 15:02:03 -07001675 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301676 goto fail_gpio_req;
1677 }
1678
David Collinsfd344aa2012-08-06 15:02:03 -07001679 rc = gpio_direction_output(gpio, 0);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301680 if (rc) {
1681 pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n",
David Collinsfd344aa2012-08-06 15:02:03 -07001682 __func__, gpio, rc);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301683 goto fail_gpio_dir;
1684 }
1685
1686 return 0;
1687
1688fail_gpio_dir:
David Collinsfd344aa2012-08-06 15:02:03 -07001689 gpio_free(gpio);
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301690fail_gpio_req:
1691 return rc;
1692
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001693}
1694
1695static struct isa1200_regulator isa1200_reg_data[] = {
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301696 {
Amy Malochee8de95d2012-02-23 10:40:25 -08001697 .name = "vcc_i2c",
1698 .min_uV = ISA_I2C_VTG_MIN_UV,
1699 .max_uV = ISA_I2C_VTG_MAX_UV,
1700 .load_uA = ISA_I2C_CURR_UA,
1701 },
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001702};
1703
1704static struct isa1200_platform_data isa1200_1_pdata = {
1705 .name = "vibrator",
1706 .dev_setup = isa1200_dev_setup,
1707 .power_on = isa1200_power,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301708 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1709 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001710 .max_timeout = 15000,
1711 .mode_ctrl = PWM_GEN_MODE,
1712 .pwm_fd = {
1713 .pwm_div = 256,
1714 },
1715 .is_erm = false,
1716 .smart_en = true,
1717 .ext_clk_en = true,
1718 .chip_en = 1,
1719 .regulator_info = isa1200_reg_data,
1720 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1721};
1722
1723static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1724 {
1725 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1726 .platform_data = &isa1200_1_pdata,
1727 },
1728};
1729
Amy Malochef3c9db42011-12-08 15:17:35 -08001730#define MXT_TS_GPIO_IRQ 11
1731#define MXT_TS_RESET_GPIO 52
1732
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301733static const u8 mxt_config_data_8930_v1[] = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001734 /* T6 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001735 0, 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001736 /* T38 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301737 15, 3, 0, 15, 12, 11, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001738 /* T7 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301739 32, 16, 50,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001740 /* T8 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301741 30, 0, 5, 1, 0, 0, 8, 8, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001742 /* T9 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301743 131, 0, 0, 19, 11, 0, 16, 43, 2, 3,
1744 10, 7, 2, 0, 4, 5, 35, 10, 43, 4,
1745 54, 2, 15, 32, 38, 38, 143, 40, 143, 80,
1746 7, 9, 50, 50, 2,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001747 /* T15 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001748 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1749 0,
1750 /* T18 Object */
1751 0, 0,
1752 /* T19 Object */
1753 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1754 0, 0, 0, 0, 0, 0,
1755 /* T23 Object */
1756 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1757 0, 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001758 /* T25 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001759 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1760 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001761 /* T40 Object */
Amy Malochef3c9db42011-12-08 15:17:35 -08001762 0, 0, 0, 0, 0,
1763 /* T42 Object */
1764 0, 0, 0, 0, 0, 0, 0, 0,
1765 /* T46 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301766 0, 3, 8, 16, 0, 0, 1, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001767 /* T47 Object */
1768 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1769 /* T48 Object */
Mohan Pallaka84f725132012-05-17 16:38:56 +05301770 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
1771 0, 0, 0, 0, 0, 0, 0, 100, 4, 64,
1772 0, 0, 5, 42, 0, 0, 0, 0, 0, 0,
Amy Malochef3c9db42011-12-08 15:17:35 -08001773 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1774 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1775 0, 0, 0, 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001776};
1777
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301778static const u8 mxt_config_data_8930_v2[] = {
1779 /* T6 Object */
1780 0, 0, 0, 0, 0, 0,
1781 /* T38 Object */
1782 15, 4, 0, 9, 7, 12, 0, 0,
1783 /* T7 Object */
1784 32, 16, 50,
1785 /* T8 Object */
1786 30, 0, 5, 10, 0, 0, 10, 10, 0, 0,
1787 /* T9 Object */
1788 131, 0, 0, 19, 11, 0, 16, 50, 1, 3,
1789 12, 7, 2, 0, 4, 5, 2, 10, 43, 4,
1790 54, 2, -25, 29, 38, 18, 143, 40, 207, 80,
1791 17, 5, 50, 50, 0,
1792 /* T18 Object */
1793 0, 0,
1794 /* T19 Object */
1795 0, 0, 0, 0, 0, 0,
1796 /* T25 Object */
1797 0, 0, 0, 0, 0, 0,
1798 /* T42 Object */
1799 3, 60, 20, 20, 150, 0, 0, 0,
1800 /* T46 Object */
1801 0, 3, 28, 28, 0, 0, 1, 0, 0,
1802 /* T47 Object */
1803 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1804 /* T48 Object */
1805 1, 3, 82, 0, 0, 0, 0, 0, 0, 0,
1806 16, 30, 0, 6, 6, 0, 0, 124, 4, 100,
1807 0, 0, 0, 5, 0, 42, 0, 1, 0, 40,
1808 52, 20, 0, 0, 0, 50, 1, 5, 2, 1,
1809 4, 5, 3, -25, 29, 38, 18, 143, 40, 207,
1810 80, 10, 5, 2,
1811 /* T55 Object */
1812 0, 0, 0, 0,
1813};
1814
Amy Malochef3c9db42011-12-08 15:17:35 -08001815static ssize_t mxt224e_vkeys_show(struct kobject *kobj,
1816 struct kobj_attribute *attr, char *buf)
1817{
1818 return snprintf(buf, 200,
Amy Malochef8130f92012-02-01 10:38:59 +05301819 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90"
1820 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90"
1821 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90"
1822 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90"
Amy Malochef3c9db42011-12-08 15:17:35 -08001823 "\n");
1824}
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001825
Amy Malochef3c9db42011-12-08 15:17:35 -08001826static struct kobj_attribute mxt224e_vkeys_attr = {
1827 .attr = {
1828 .mode = S_IRUGO,
1829 },
1830 .show = &mxt224e_vkeys_show,
1831};
1832
1833static struct attribute *mxt224e_properties_attrs[] = {
1834 &mxt224e_vkeys_attr.attr,
1835 NULL
1836};
1837
1838static struct attribute_group mxt224e_properties_attr_group = {
1839 .attrs = mxt224e_properties_attrs,
1840};
1841
1842static void mxt_init_vkeys_8930(void)
1843{
Steve Mucklef132c6c2012-06-06 18:30:57 -07001844 int rc = 0;
Amy Malochef3c9db42011-12-08 15:17:35 -08001845 static struct kobject *mxt224e_properties_kobj;
1846
1847 mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts";
1848 mxt224e_properties_kobj = kobject_create_and_add("board_properties",
1849 NULL);
1850 if (mxt224e_properties_kobj)
1851 rc = sysfs_create_group(mxt224e_properties_kobj,
1852 &mxt224e_properties_attr_group);
1853 if (!mxt224e_properties_kobj || rc)
1854 pr_err("%s: failed to create board_properties\n",
1855 __func__);
1856
1857 return;
1858}
1859
Jing Lindc4413c2012-01-16 15:22:52 -08001860static struct mxt_config_info mxt_config_array[] = {
1861 {
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301862 .config = mxt_config_data_8930_v1,
1863 .config_length = ARRAY_SIZE(mxt_config_data_8930_v1),
Jing Lindc4413c2012-01-16 15:22:52 -08001864 .family_id = 0x81,
1865 .variant_id = 0x01,
1866 .version = 0x10,
1867 .build = 0xAA,
Mohan Pallaka204b6f72012-07-09 14:44:10 +05301868 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1869 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1870 },
1871 {
1872 .config = mxt_config_data_8930_v2,
1873 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1874 .family_id = 0x81,
1875 .variant_id = 0x15,
1876 .version = 0x11,
1877 .build = 0xAA,
1878 .bootldr_id = MXT_BOOTLOADER_ID_224E,
1879 .fw_name = "atmel_8930_fluid_v2_0_AB.hex",
1880 },
1881 {
1882 .config = mxt_config_data_8930_v2,
1883 .config_length = ARRAY_SIZE(mxt_config_data_8930_v2),
1884 .family_id = 0x81,
1885 .variant_id = 0x01,
1886 .version = 0x20,
1887 .build = 0xAB,
1888 .bootldr_id = MXT_BOOTLOADER_ID_224E,
Jing Lindc4413c2012-01-16 15:22:52 -08001889 },
1890};
1891
Amy Malochef3c9db42011-12-08 15:17:35 -08001892static struct mxt_platform_data mxt_platform_data_8930 = {
Jing Lindc4413c2012-01-16 15:22:52 -08001893 .config_array = mxt_config_array,
1894 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001895 .panel_minx = 0,
1896 .panel_maxx = 566,
1897 .panel_miny = 0,
1898 .panel_maxy = 1067,
1899 .disp_minx = 0,
1900 .disp_maxx = 540,
1901 .disp_miny = 0,
1902 .disp_maxy = 960,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001903 .irqflags = IRQF_TRIGGER_FALLING,
Anirudh Ghayald7ad84c2012-01-09 09:17:53 +05301904#ifdef MSM8930_PHASE_2
1905 .digital_pwr_regulator = true,
1906#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001907 .i2c_pull_up = true,
Amy Malochef3c9db42011-12-08 15:17:35 -08001908 .reset_gpio = MXT_TS_RESET_GPIO,
1909 .irq_gpio = MXT_TS_GPIO_IRQ,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001910};
1911
Amy Malochef3c9db42011-12-08 15:17:35 -08001912static struct i2c_board_info mxt_device_info_8930[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001913 {
Amy Malochef3c9db42011-12-08 15:17:35 -08001914 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1915 .platform_data = &mxt_platform_data_8930,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08001916 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1917 },
1918};
1919
David Collinsfd344aa2012-08-06 15:02:03 -07001920#define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN)
1921#define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25)
Manoj Raoc6d904c2012-06-22 00:32:14 -07001922static struct msm_mhl_platform_data mhl_platform_data = {
1923 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
1924 .gpio_mhl_int = MHL_GPIO_INT,
1925 .gpio_mhl_reset = MHL_GPIO_RESET,
David Collinsfd344aa2012-08-06 15:02:03 -07001926 .gpio_mhl_power = MHL_POWER_GPIO_PM8038,
Manoj Raoc6d904c2012-06-22 00:32:14 -07001927 .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO,
1928};
1929
1930static struct i2c_board_info sii_device_info[] __initdata = {
1931 {
1932 /*
1933 * keeps SI 8334 as the default
1934 * MHL TX
1935 */
1936 I2C_BOARD_INFO("sii8334", 0x39),
1937 .platform_data = &mhl_platform_data,
1938 .flags = I2C_CLIENT_WAKE,
1939 },
1940};
1941
1942
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301943#ifdef MSM8930_PHASE_2
1944
David Collinsfd344aa2012-08-06 15:02:03 -07001945#define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3)
1946#define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8)
1947#define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10)
1948#define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11)
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301949
David Collinsfd344aa2012-08-06 15:02:03 -07001950#define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27)
1951#define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28)
1952#define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36)
1953#define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37)
1954
1955static struct gpio_keys_button keys_8930_pm8038[] = {
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301956 {
1957 .code = KEY_VOLUMEUP,
1958 .type = EV_KEY,
1959 .desc = "volume_up",
David Collinsfd344aa2012-08-06 15:02:03 -07001960 .gpio = GPIO_VOLUME_UP_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301961 .wakeup = 1,
1962 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001963 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301964 },
1965 {
1966 .code = KEY_VOLUMEDOWN,
1967 .type = EV_KEY,
1968 .desc = "volume_down",
David Collinsfd344aa2012-08-06 15:02:03 -07001969 .gpio = GPIO_VOLUME_DOWN_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301970 .wakeup = 1,
1971 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001972 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301973 },
1974 {
1975 .code = KEY_CAMERA_FOCUS,
1976 .type = EV_KEY,
1977 .desc = "camera_focus",
David Collinsfd344aa2012-08-06 15:02:03 -07001978 .gpio = GPIO_CAMERA_FOCUS_PM8038,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301979 .wakeup = 1,
1980 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07001981 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05301982 },
1983 {
1984 .code = KEY_CAMERA_SNAPSHOT,
1985 .type = EV_KEY,
1986 .desc = "camera_snapshot",
David Collinsfd344aa2012-08-06 15:02:03 -07001987 .gpio = GPIO_CAMERA_SNAPSHOT_PM8038,
1988 .wakeup = 1,
1989 .active_low = 1,
1990 .debounce_interval = 15,
1991 },
1992};
1993
1994static struct gpio_keys_button keys_8930_pm8917[] = {
1995 {
1996 .code = KEY_VOLUMEUP,
1997 .type = EV_KEY,
1998 .desc = "volume_up",
1999 .gpio = GPIO_VOLUME_UP_PM8917,
2000 .wakeup = 1,
2001 .active_low = 1,
2002 .debounce_interval = 15,
2003 },
2004 {
2005 .code = KEY_VOLUMEDOWN,
2006 .type = EV_KEY,
2007 .desc = "volume_down",
2008 .gpio = GPIO_VOLUME_DOWN_PM8917,
2009 .wakeup = 1,
2010 .active_low = 1,
2011 .debounce_interval = 15,
2012 },
2013 {
2014 .code = KEY_CAMERA_FOCUS,
2015 .type = EV_KEY,
2016 .desc = "camera_focus",
2017 .gpio = GPIO_CAMERA_FOCUS_PM8917,
2018 .wakeup = 1,
2019 .active_low = 1,
2020 .debounce_interval = 15,
2021 },
2022 {
2023 .code = KEY_CAMERA_SNAPSHOT,
2024 .type = EV_KEY,
2025 .desc = "camera_snapshot",
2026 .gpio = GPIO_CAMERA_SNAPSHOT_PM8917,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302027 .wakeup = 1,
2028 .active_low = 1,
Amy Malocheff31a972012-06-06 15:28:54 -07002029 .debounce_interval = 15,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302030 },
2031};
2032
2033/* Add GPIO keys for 8930 */
2034static struct gpio_keys_platform_data gpio_keys_8930_pdata = {
David Collinsfd344aa2012-08-06 15:02:03 -07002035 .buttons = keys_8930_pm8038,
2036 .nbuttons = ARRAY_SIZE(keys_8930_pm8038),
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302037};
2038
2039static struct platform_device gpio_keys_8930 = {
2040 .name = "gpio-keys",
2041 .id = -1,
2042 .dev = {
2043 .platform_data = &gpio_keys_8930_pdata,
2044 },
2045};
2046#endif /* MSM8930_PHASE_2 */
2047
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002048static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2049 .clk_freq = 100000,
2050 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002051};
2052
2053static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2054 .clk_freq = 100000,
2055 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002056};
2057
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002058static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = {
2059 .clk_freq = 100000,
2060 .src_clk_rate = 24000000,
2061};
2062
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002063static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2064 .clk_freq = 100000,
2065 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002066};
2067
2068static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2069 .clk_freq = 100000,
2070 .src_clk_rate = 24000000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002071};
2072
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002073
2074static struct ks8851_pdata spi_eth_pdata = {
2075 .irq_gpio = KS8851_IRQ_GPIO,
2076 .rst_gpio = KS8851_RST_GPIO,
2077};
2078
2079static struct spi_board_info spi_board_info[] __initdata = {
2080 {
2081 .modalias = "ks8851",
2082 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2083 .max_speed_hz = 19200000,
2084 .bus_num = 0,
2085 .chip_select = 0,
2086 .mode = SPI_MODE_0,
2087 .platform_data = &spi_eth_pdata
2088 },
2089 {
2090 .modalias = "dsi_novatek_3d_panel_spi",
2091 .max_speed_hz = 10800000,
2092 .bus_num = 0,
2093 .chip_select = 1,
2094 .mode = SPI_MODE_0,
2095 },
2096};
2097
2098static struct platform_device msm_device_saw_core0 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002099 .name = "saw-regulator",
2100 .id = 0,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002101 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002102 .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002103 },
2104};
2105
2106static struct platform_device msm_device_saw_core1 = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002107 .name = "saw-regulator",
2108 .id = 1,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002109 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002110 .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002111 },
2112};
2113
2114static struct tsens_platform_data msm_tsens_pdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002115 .tsens_factor = 1000,
Siddartha Mohanadoss97425122012-03-09 12:06:54 -08002116 .hw_type = APQ_8064,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -07002117 .tsens_num_sensor = 10,
2118 .slope = {1132, 1135, 1137, 1135, 1157,
2119 1142, 1124, 1153, 1175, 1166},
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002120};
2121
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002122static struct platform_device msm_tsens_device = {
2123 .name = "tsens8960-tm",
2124 .id = -1,
2125};
2126
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002127static struct msm_thermal_data msm_thermal_pdata = {
2128 .sensor_id = 9,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002129 .poll_ms = 250,
2130 .limit_temp_degC = 60,
2131 .temp_hysteresis_degC = 10,
2132 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002133};
2134
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002135#ifdef CONFIG_MSM_FAKE_BATTERY
2136static struct platform_device fish_battery_device = {
2137 .name = "fish_battery",
2138};
2139#endif
2140
David Collins1d4061b2011-12-06 15:36:40 -08002141#ifndef MSM8930_PHASE_2
2142
2143/* 8930 Phase 1 */
Jay Chokshi06fa7542011-12-07 13:09:17 -08002144static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002145 .name = GPIO_REGULATOR_DEV_NAME,
2146 .id = PM8921_MPP_PM_TO_SYS(7),
2147 .dev = {
2148 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2149 },
2150};
2151
Jay Chokshi06fa7542011-12-07 13:09:17 -08002152static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002153 .name = GPIO_REGULATOR_DEV_NAME,
2154 .id = 91,
2155 .dev = {
2156 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2157 },
2158};
2159
David Collins1d4061b2011-12-06 15:36:40 -08002160#else
2161
2162/* 8930 Phase 2 */
2163static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = {
2164 .name = GPIO_REGULATOR_DEV_NAME,
2165 .id = 63,
2166 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002167 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2168 MSM8930_GPIO_VREG_ID_EXT_5V],
David Collins1d4061b2011-12-06 15:36:40 -08002169 },
2170};
2171
2172static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = {
2173 .name = GPIO_REGULATOR_DEV_NAME,
2174 .id = 97,
2175 .dev = {
David Collins4614cb92012-08-20 12:17:09 -07002176 .platform_data = &msm8930_pm8038_gpio_regulator_pdata[
2177 MSM8930_GPIO_VREG_ID_EXT_OTG_SW],
David Collins1d4061b2011-12-06 15:36:40 -08002178 },
2179};
2180
2181#endif
2182
Jay Chokshi06fa7542011-12-07 13:09:17 -08002183static struct platform_device msm8930_device_rpm_regulator __devinitdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002184 .name = "rpm-regulator",
2185 .id = -1,
2186 .dev = {
David Collins8af872e2012-01-06 11:31:56 -08002187#ifndef MSM8930_PHASE_2
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002188 .platform_data = &msm_rpm_regulator_pdata,
David Collins8af872e2012-01-06 11:31:56 -08002189#else
David Collins4614cb92012-08-20 12:17:09 -07002190 .platform_data = &msm8930_pm8038_rpm_regulator_pdata,
Jay Chokshi06fa7542011-12-07 13:09:17 -08002191#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002192 },
2193};
2194
David Collins4614cb92012-08-20 12:17:09 -07002195static struct platform_device *early_common_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002196 &msm8960_device_dmov,
2197 &msm_device_smd,
2198 &msm8960_device_uart_gsbi5,
2199 &msm_device_uart_dm6,
2200 &msm_device_saw_core0,
2201 &msm_device_saw_core1,
David Collins4614cb92012-08-20 12:17:09 -07002202};
2203
2204/* ext_5v and ext_otg_sw are present when using PM8038 */
2205static struct platform_device *pmic_pm8038_devices[] __initdata = {
Jay Chokshi06fa7542011-12-07 13:09:17 -08002206 &msm8930_device_ext_5v_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002207#ifndef MSM8930_PHASE_2
Jay Chokshi06fa7542011-12-07 13:09:17 -08002208 &msm8930_device_ext_l2_vreg,
David Collins1d4061b2011-12-06 15:36:40 -08002209#endif
Jay Chokshi33c044a2011-12-07 13:05:40 -08002210 &msm8960_device_ssbi_pmic,
David Collins1d4061b2011-12-06 15:36:40 -08002211#ifdef MSM8930_PHASE_2
2212 &msm8930_device_ext_otg_sw_vreg,
2213#endif
David Collins4614cb92012-08-20 12:17:09 -07002214};
2215
2216/* ext_5v and ext_otg_sw are not present when using PM8917 */
2217static struct platform_device *pmic_pm8917_devices[] __initdata = {
2218 &msm8960_device_ssbi_pmic,
2219};
2220
2221static struct platform_device *common_devices[] __initdata = {
Stephen Boyd28d54952011-12-16 13:19:51 -08002222 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002223 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002224 &msm_pil_tzapps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002225 &msm_pil_vidc,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002226 &msm8960_device_qup_spi_gsbi1,
2227 &msm8960_device_qup_i2c_gsbi3,
2228 &msm8960_device_qup_i2c_gsbi4,
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002229 &msm8960_device_qup_i2c_gsbi9,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002230 &msm8960_device_qup_i2c_gsbi10,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002231 &msm8960_device_qup_i2c_gsbi12,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002232 &msm_slim_ctrl,
2233 &msm_device_wcnss_wlan,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002234#if defined(CONFIG_QSEECOM)
2235 &qseecom_device,
2236#endif
2237
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002238#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2239 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2240 &qcrypto_device,
2241#endif
2242
2243#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2244 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2245 &qcedev_device,
2246#endif
2247#ifdef CONFIG_MSM_ROTATOR
2248 &msm_rotator_device,
2249#endif
2250 &msm_device_sps,
2251#ifdef CONFIG_MSM_FAKE_BATTERY
2252 &fish_battery_device,
2253#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002254 &msm_device_bam_dmux,
2255 &msm_fm_platform_init,
2256
2257#ifdef CONFIG_HW_RANDOM_MSM
2258 &msm_device_rng,
2259#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002260 &msm8930_rpm_device,
2261 &msm8930_rpm_log_device,
Girish Mahadevan898c56d2012-06-05 16:09:19 -06002262 &msm8930_rpm_rbcpr_device,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002263 &msm8930_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302264 &msm8930_rpm_master_stat_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002265#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002266 &msm8930_ion_dev,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002267#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002268 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002269 &coresight_tpiu_device,
2270 &coresight_etb_device,
2271 &coresight_funnel_device,
2272 &coresight_etm0_device,
2273 &coresight_etm1_device,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002274 &msm_device_dspcrashd_8960,
2275 &msm8960_device_watchdog,
Anirudh Ghayaleb3af972011-12-13 17:29:06 +05302276#ifdef MSM8930_PHASE_2
2277 &gpio_keys_8930,
2278#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002279 &msm8930_rtb_device,
Gagan Maccd5b3272012-02-09 18:13:10 -07002280 &msm_bus_8930_apps_fabric,
2281 &msm_bus_8930_sys_fabric,
2282 &msm_bus_8930_mm_fabric,
2283 &msm_bus_8930_sys_fpb,
2284 &msm_bus_8930_cpss_fpb,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002285 &msm8960_device_cache_erp,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002286 &msm8930_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002287 &msm_tsens_device,
Laura Abbottf3173042012-05-29 15:23:18 -07002288 &msm8930_cache_dump_device,
Anji Jonnalaf91d8972013-02-26 17:55:50 +05302289 &msm8930_cpu_slp_status,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002290};
2291
2292static struct platform_device *cdp_devices[] __initdata = {
2293 &msm8960_device_otg,
2294 &msm8960_device_gadget_peripheral,
2295 &msm_device_hsusb_host,
2296 &android_usb_device,
2297 &msm_pcm,
2298 &msm_pcm_routing,
2299 &msm_cpudai0,
2300 &msm_cpudai1,
2301 &msm_cpudai_hdmi_rx,
2302 &msm_cpudai_bt_rx,
2303 &msm_cpudai_bt_tx,
2304 &msm_cpudai_fm_rx,
2305 &msm_cpudai_fm_tx,
2306 &msm_cpudai_auxpcm_rx,
2307 &msm_cpudai_auxpcm_tx,
2308 &msm_cpu_fe,
2309 &msm_stub_codec,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002310#ifdef CONFIG_MSM_GEMINI
2311 &msm8960_gemini_device,
2312#endif
2313 &msm_voice,
2314 &msm_voip,
2315 &msm_lpa_pcm,
2316 &msm_cpudai_afe_01_rx,
2317 &msm_cpudai_afe_01_tx,
2318 &msm_cpudai_afe_02_rx,
2319 &msm_cpudai_afe_02_tx,
2320 &msm_pcm_afe,
Ajay Dudani79e268c2011-12-28 13:14:44 -08002321 &msm_compr_dsp,
2322 &msm_cpudai_incall_music_rx,
2323 &msm_cpudai_incall_record_rx,
2324 &msm_cpudai_incall_record_tx,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002325 &msm_pcm_hostless,
Asish Bhattacharya705c6732012-08-14 23:22:55 +05302326 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002327 &msm_lowlatency_pcm,
Damir Didjusto10925802013-04-23 14:21:53 -07002328 &msm_fm_loopback,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002329};
2330
2331static void __init msm8930_i2c_init(void)
2332{
2333 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2334 &msm8960_i2c_qup_gsbi4_pdata;
2335
2336 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2337 &msm8960_i2c_qup_gsbi3_pdata;
2338
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -06002339 msm8960_device_qup_i2c_gsbi9.dev.platform_data =
2340 &msm8960_i2c_qup_gsbi9_pdata;
2341
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002342 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2343 &msm8960_i2c_qup_gsbi10_pdata;
2344
2345 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2346 &msm8960_i2c_qup_gsbi12_pdata;
2347}
2348
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002349static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2350 {
2351 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2352 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2353 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002354 1, 784, 180000, 100,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002355 },
2356
2357 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002358 MSM_PM_SLEEP_MODE_RETENTION,
2359 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2360 true,
2361 415, 715, 340827, 475,
2362 },
2363
2364 {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002365 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2366 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2367 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002368 1300, 228, 1200000, 2000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002369 },
2370
2371 {
2372 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2373 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2374 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002375 2000, 138, 1208400, 3200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002376 },
2377
2378 {
2379 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002380 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2381 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002382 6000, 119, 1850300, 9000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002383 },
2384
2385 {
2386 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2387 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2388 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002389 9200, 68, 2839200, 16400,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002390 },
2391
2392 {
2393 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2394 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2395 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002396 10300, 63, 3128000, 18200,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002397 },
2398
2399 {
2400 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2401 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2402 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002403 18000, 10, 4602600, 27000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002404 },
2405
2406 {
2407 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2408 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2409 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002410 20000, 2, 5752000, 32000,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002411 },
2412};
2413
Praveen Chidambaram78499012011-11-01 17:15:17 -06002414static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2415 .levels = &msm_rpmrs_levels[0],
2416 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2417 .vdd_mem_levels = {
2418 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2419 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2420 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2421 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2422 },
2423 .vdd_dig_levels = {
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002424 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2425 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2426 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2427 [MSM_RPMRS_VDD_DIG_MAX] = 3,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002428 },
2429 .vdd_mask = 0x7FFFFF,
2430 .rpmrs_target_id = {
2431 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2432 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
Mahesh Sivasubramanian745e16e2012-05-21 11:52:04 -06002433 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2434 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002435 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0,
2436 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1,
2437 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2438 },
2439};
2440
Praveen Chidambaram75b8c812012-08-10 16:26:37 -06002441static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = {
2442 .levels = &msm_rpmrs_levels[0],
2443 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2444 .vdd_mem_levels = {
2445 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2446 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2447 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2448 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2449 },
2450 .vdd_dig_levels = {
2451 [MSM_RPMRS_VDD_DIG_RET_LOW] = 0,
2452 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0,
2453 [MSM_RPMRS_VDD_DIG_ACTIVE] = 1,
2454 [MSM_RPMRS_VDD_DIG_MAX] = 3,
2455 },
2456 .vdd_mask = 0x7FFFFF,
2457 .rpmrs_target_id = {
2458 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2459 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2460 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER,
2461 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST,
2462 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0,
2463 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1,
2464 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2465 },
2466};
2467
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002468static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2469 .mode = MSM_PM_BOOT_CONFIG_TZ,
2470};
2471
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002472#ifdef CONFIG_I2C
2473#define I2C_SURF 1
2474#define I2C_FFA (1 << 1)
2475#define I2C_RUMI (1 << 2)
2476#define I2C_SIM (1 << 3)
2477#define I2C_FLUID (1 << 4)
2478#define I2C_LIQUID (1 << 5)
2479
2480struct i2c_registry {
2481 u8 machs;
2482 int bus;
2483 struct i2c_board_info *info;
2484 int len;
2485};
2486
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002487#ifdef CONFIG_INPUT_MPU3050
2488#define MPU3050_INT_GPIO 69
2489
2490static struct mpu3050_gyro_platform_data mpu3050_gyro = {
2491 .gpio_int = MPU3050_INT_GPIO,
2492};
2493
2494static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = {
2495 {
2496 I2C_BOARD_INFO("mpu3050", 0x68),
Wentao Xuc7769c02012-08-03 15:06:41 -04002497 .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO),
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002498 .platform_data = &mpu3050_gyro,
2499 },
2500};
2501#endif
2502
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002503#ifdef CONFIG_ISL9519_CHARGER
2504static struct isl_platform_data isl_data __initdata = {
2505 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2506 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2507 .max_system_voltage = 4200,
2508 .min_system_voltage = 3200,
2509 .chgcurrent = 1000, /* 1900, */
2510 .term_current = 400, /* Need fine tuning */
2511 .input_current = 2048,
2512};
2513
2514static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2515 {
2516 I2C_BOARD_INFO("isl9519q", 0x9),
2517 .irq = 0, /* Not required when notify-by-pmic */
2518 .platform_data = &isl_data,
2519 },
2520};
2521#endif /* CONFIG_ISL9519_CHARGER */
2522
Wentao Xu114c0152012-06-12 11:40:38 -04002523#ifdef CONFIG_STM_LIS3DH
2524static struct lis3dh_acc_platform_data lis3dh_accel = {
2525 .poll_interval = 200,
2526 .min_interval = 10,
2527 .g_range = LIS3DH_ACC_G_2G,
2528 .axis_map_x = 1,
2529 .axis_map_y = 0,
2530 .axis_map_z = 2,
2531 .negate_x = 0,
2532 .negate_y = 0,
2533 .negate_z = 1,
2534 .init = NULL,
2535 .exit = NULL,
2536 .gpio_int1 = -EINVAL,
2537 .gpio_int2 = -EINVAL,
2538};
2539
2540static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = {
2541 {
2542 I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18),
2543 .platform_data = &lis3dh_accel,
2544 },
2545};
2546#endif /* CONFIG_STM_LIS3DH */
2547
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002548static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002549#ifdef CONFIG_ISL9519_CHARGER
2550 {
2551 I2C_LIQUID,
2552 MSM_8930_GSBI10_QUP_I2C_BUS_ID,
2553 isl_charger_i2c_info,
2554 ARRAY_SIZE(isl_charger_i2c_info),
2555 },
2556#endif /* CONFIG_ISL9519_CHARGER */
Wentao Xuf59ce4e2012-05-22 17:30:13 -04002557#ifdef CONFIG_INPUT_MPU3050
2558 {
2559 I2C_FFA | I2C_FLUID,
2560 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2561 mpu3050_i2c_boardinfo,
2562 ARRAY_SIZE(mpu3050_i2c_boardinfo),
2563 },
2564#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002565 {
Amy Malochee8de95d2012-02-23 10:40:25 -08002566 I2C_SURF | I2C_FFA | I2C_FLUID,
2567 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002568 msm_isa1200_board_info,
2569 ARRAY_SIZE(msm_isa1200_board_info),
2570 },
Amy Malochef3c9db42011-12-08 15:17:35 -08002571 {
Amy Maloche8eb91112012-03-30 10:22:37 -07002572 I2C_SURF | I2C_FFA | I2C_FLUID,
Amy Malochef3c9db42011-12-08 15:17:35 -08002573 MSM_8930_GSBI3_QUP_I2C_BUS_ID,
2574 mxt_device_info_8930,
2575 ARRAY_SIZE(mxt_device_info_8930),
2576 },
Manoj Raoc6d904c2012-06-22 00:32:14 -07002577 {
2578 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID,
2579 MSM_8930_GSBI9_QUP_I2C_BUS_ID,
2580 sii_device_info,
2581 ARRAY_SIZE(sii_device_info),
2582 },
Wentao Xu114c0152012-06-12 11:40:38 -04002583#ifdef CONFIG_STM_LIS3DH
2584 {
2585 I2C_FFA | I2C_FLUID,
2586 MSM_8930_GSBI12_QUP_I2C_BUS_ID,
2587 lis3dh_i2c_boardinfo,
2588 ARRAY_SIZE(lis3dh_i2c_boardinfo),
2589 },
2590#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002591};
2592#endif /* CONFIG_I2C */
2593
2594static void __init register_i2c_devices(void)
2595{
2596#ifdef CONFIG_I2C
2597 u8 mach_mask = 0;
2598 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08002599#ifdef CONFIG_MSM_CAMERA
2600 struct i2c_registry msm8930_camera_i2c_devices = {
2601 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
2602 MSM_8930_GSBI4_QUP_I2C_BUS_ID,
2603 msm8930_camera_board_info.board_info,
2604 msm8930_camera_board_info.num_i2c_board_info,
2605 };
2606#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002607
2608 /* Build the matching 'supported_machs' bitmask */
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002609 if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002610 mach_mask = I2C_SURF;
2611 else if (machine_is_msm8930_fluid())
2612 mach_mask = I2C_FLUID;
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002613 else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp())
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002614 mach_mask = I2C_FFA;
2615 else
2616 pr_err("unmatched machine ID in register_i2c_devices\n");
2617
2618 /* Run the array and install devices as appropriate */
2619 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2620 if (msm8960_i2c_devices[i].machs & mach_mask)
2621 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2622 msm8960_i2c_devices[i].info,
2623 msm8960_i2c_devices[i].len);
2624 }
Kevin Chan09f4e662011-12-16 08:17:02 -08002625#ifdef CONFIG_MSM_CAMERA
2626 if (msm8930_camera_i2c_devices.machs & mach_mask)
2627 i2c_register_board_info(msm8930_camera_i2c_devices.bus,
2628 msm8930_camera_i2c_devices.info,
2629 msm8930_camera_i2c_devices.len);
2630#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002631#endif
2632}
2633
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -07002634/*Modify the WCD9xxx platform data to support supplies from PM8917 */
2635static void __init msm8930_pm8917_wcd9xxx_pdata_fixup(
2636 struct wcd9xxx_pdata *cdc_pdata)
2637{
2638 int i;
2639
2640 for (i = 0; i < ARRAY_SIZE(cdc_pdata->regulator); i++) {
2641
2642 if (cdc_pdata->regulator[i].name != NULL
2643 && strncmp(cdc_pdata->regulator[i].name,
2644 "CDC_VDD_CP", 10) == 0) {
2645 cdc_pdata->regulator[i].min_uV =
2646 cdc_pdata->regulator[i].max_uV = 1800000;
2647 pr_info("%s: CDC_VDD_CP forced to 1.8 volts for PM8917\n",
2648 __func__);
2649 return;
2650 }
2651 }
2652}
2653
David Collinsfd344aa2012-08-06 15:02:03 -07002654/* Modify platform data values to match requirements for PM8917. */
2655static void __init msm8930_pm8917_pdata_fixup(void)
2656{
Bhalchandra Gajaree94bac22012-10-08 19:16:13 -07002657 msm8930_pm8917_wcd9xxx_pdata_fixup(&sitar_platform_data);
2658 msm8930_pm8917_wcd9xxx_pdata_fixup(&sitar1p1_platform_data);
2659
David Collinsfd344aa2012-08-06 15:02:03 -07002660 mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917;
2661
2662 gpio_keys_8930_pdata.buttons = keys_8930_pm8917;
2663 gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917);
David Collins4614cb92012-08-20 12:17:09 -07002664
2665 msm_device_saw_core0.dev.platform_data
2666 = &msm8930_pm8038_saw_regulator_core0_pdata;
2667 msm_device_saw_core1.dev.platform_data
2668 = &msm8930_pm8038_saw_regulator_core1_pdata;
2669
2670 msm8930_device_rpm_regulator.dev.platform_data
2671 = &msm8930_pm8917_rpm_regulator_pdata;
David Collinsfd344aa2012-08-06 15:02:03 -07002672}
2673
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302674static void __init msm8930ab_update_retention_spm(void)
2675{
2676 int i;
2677
2678 /* Update the SPM sequences for krait retention on all cores */
2679 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
2680 int j;
2681 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
2682 for (j = 0; j < pdata->num_modes; j++) {
2683 if (pdata->modes[j].cmd ==
2684 spm_retention_cmd_sequence)
2685 pdata->modes[j].cmd =
2686 spm_retention_with_krait_v3_cmd_sequence;
2687 }
2688 }
2689}
2690
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002691static void __init msm8930_cdp_init(void)
2692{
David Collinsfd344aa2012-08-06 15:02:03 -07002693 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2694 msm8930_pm8917_pdata_fixup();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002695 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2696 pr_err("meminfo_init() failed!\n");
2697
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07002698 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08002699 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002700 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram75b8c812012-08-10 16:26:37 -06002701 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
2702 BUG_ON(msm_rpm_init(&msm8930_rpm_data));
2703 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
2704 } else {
2705 BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917));
2706 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917));
2707 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002708
2709 regulator_suppress_info_printing();
2710 if (msm_xo_init())
2711 pr_err("Failed to initialize XO votes\n");
Jay Chokshi06fa7542011-12-07 13:09:17 -08002712 platform_device_register(&msm8930_device_rpm_regulator);
Patrick Daly8fad60d2012-08-27 16:25:07 -07002713 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2714 msm_clock_init(&msm8930_pm8917_clock_init_data);
2715 else
2716 msm_clock_init(&msm8930_clock_init_data);
Mayank Rana7e574162013-01-08 15:10:51 +05302717
2718 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
2719 /*
2720 * By default, set USB mode as USB Peripheral only due to
2721 * hardware rework requirement for USB Host Mode.
2722 * Provide pmic_id_irq number only if host mode is enable
2723 * by user assuming that hardware rework is available.
2724 */
2725 if (enable_usb_host_mode) {
2726 /* MPP01 IRQ number */
2727 msm_otg_pdata.pmic_id_irq =
2728 PM8921_MPP_IRQ(PM8917_IRQ_BASE, 1);
2729 } else {
2730 pr_err("Enabling USB Peripheral Only mode.\n");
2731 msm_otg_pdata.mode = USB_PERIPHERAL;
2732 }
2733 } else {
2734 msm_otg_pdata.pmic_id_irq =
2735 PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE);
2736 }
2737
Mayank Rana2fe1aec2012-06-07 18:00:12 +05302738 msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq;
Aravind Venkateswaran06a46352012-08-16 14:52:39 -07002739 if (msm8930_mhl_display_enabled()) {
2740 mhl_platform_data.mhl_enabled = true;
2741 msm_otg_pdata.mhl_enable = true;
2742 }
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002743 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Mayank Ranac64b6392012-05-21 14:05:23 +05302744 android_usb_pdata.swfi_latency =
2745 msm_rpmrs_levels[0].latency_us;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002746 msm8930_init_gpiomux();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002747 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2748 &msm8960_qup_spi_gsbi1_pdata;
2749 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2750
Jay Chokshi06fa7542011-12-07 13:09:17 -08002751 /*
2752 * TODO: When physical 8930/PM8038 hardware becomes
2753 * available, remove this block or add the config
2754 * option.
2755 */
2756#ifndef MSM8930_PHASE_2
2757 msm8960_init_pmic();
2758#else
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002759 msm8930_init_pmic();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002760#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002761 msm8930_i2c_init();
Sudhakara Rao Tentu8b5c8ed2012-03-05 14:48:41 +05302762 msm8930_init_gpu();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302763 if (cpu_is_krait_v3()) {
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07002764 struct msm_pm_init_data_type *pdata =
2765 msm8930_pm_8x60.dev.platform_data;
2766 pdata->retention_calls_tz = false;
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302767 msm8930ab_update_retention_spm();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302768 }
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07002769
2770 platform_device_register(&msm8930_pm_8x60);
2771
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002772 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2773 msm_spm_l2_init(msm_spm_l2_data);
2774 msm8930_init_buses();
Aravind Venkateswaran896d2f92012-10-29 17:54:55 -07002775 if (cpu_is_msm8627()) {
Tianyi Gou723843b2012-06-13 15:24:56 -07002776 platform_add_devices(msm8627_footswitch,
2777 msm8627_num_footswitch);
Aravind Venkateswaran896d2f92012-10-29 17:54:55 -07002778 } else {
2779 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
2780 platform_add_devices(msm8930_pm8917_footswitch,
2781 msm8930_pm8917_num_footswitch);
2782 else
2783 platform_add_devices(msm8930_footswitch,
2784 msm8930_num_footswitch);
2785 }
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002786 if (cpu_is_msm8627())
Matt Wagantallab730bd2012-06-07 20:13:51 -07002787 platform_device_register(&msm8627_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002788 else if (cpu_is_msm8930())
Matt Wagantall6dcfa922012-06-07 20:13:51 -07002789 platform_device_register(&msm8930_device_acpuclk);
Tianyi Gou12370f12012-07-23 19:13:57 -07002790 else if (cpu_is_msm8930aa())
2791 platform_device_register(&msm8930aa_device_acpuclk);
Tianyi Gou2520b6e2012-10-29 19:13:53 -07002792 else if (cpu_is_msm8930ab())
2793 platform_device_register(&msm8930ab_device_acpuclk);
David Collins4614cb92012-08-20 12:17:09 -07002794 platform_add_devices(early_common_devices,
2795 ARRAY_SIZE(early_common_devices));
2796 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2797 platform_add_devices(pmic_pm8038_devices,
2798 ARRAY_SIZE(pmic_pm8038_devices));
2799 else
2800 platform_add_devices(pmic_pm8917_devices,
2801 ARRAY_SIZE(pmic_pm8917_devices));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002802 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menonaabf2632012-02-24 15:30:47 -08002803 msm8930_add_vidc_device();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002804 /*
2805 * TODO: When physical 8930/PM8038 hardware becomes
2806 * available, remove this block or add the config
2807 * option.
2808 */
2809#ifndef MSM8930_PHASE_2
2810 msm8960_pm8921_gpio_mpp_init();
2811#else
David Collinsfd344aa2012-08-06 15:02:03 -07002812 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
2813 msm8930_pm8038_gpio_mpp_init();
2814 else
2815 msm8930_pm8917_gpio_mpp_init();
Jay Chokshi06fa7542011-12-07 13:09:17 -08002816#endif
Jin Hongd2e2d3b2012-11-01 14:16:33 -07002817 /* Don't add modem devices on APQ targets */
2818 if (socinfo_get_id() != 119 && socinfo_get_id() != 157
2819 && socinfo_get_id() != 160)
2820 platform_device_register(&msm_8960_q6_mss);
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002821 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Steve Mucklef132c6c2012-06-06 18:30:57 -07002822#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002823 msm8930_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07002824#endif
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002825 msm8930_init_mmc();
Amy Maloche8eb91112012-03-30 10:22:37 -07002826 mxt_init_vkeys_8930();
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002827 register_i2c_devices();
2828 msm8930_init_fb();
2829 slim_register_board_info(msm_slim_devices,
2830 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002831 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002832
2833 if (PLATFORM_IS_CHARM25())
2834 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
2835}
2836
2837MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
2838 .map_io = msm8930_map_io,
2839 .reserve = msm8930_reserve,
2840 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302841 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002842 .timer = &msm_timer,
2843 .init_machine = msm8930_cdp_init,
2844 .init_early = msm8930_allocate_memory_regions,
2845 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002846 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08002847 .smp = &msm8960_smp_ops,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002848MACHINE_END
2849
2850MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
2851 .map_io = msm8930_map_io,
2852 .reserve = msm8930_reserve,
2853 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302854 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002855 .timer = &msm_timer,
2856 .init_machine = msm8930_cdp_init,
2857 .init_early = msm8930_allocate_memory_regions,
2858 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002859 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08002860 .smp = &msm8960_smp_ops,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002861MACHINE_END
2862
2863MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
2864 .map_io = msm8930_map_io,
2865 .reserve = msm8930_reserve,
2866 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302867 .handle_irq = gic_handle_irq,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002868 .timer = &msm_timer,
2869 .init_machine = msm8930_cdp_init,
2870 .init_early = msm8930_allocate_memory_regions,
2871 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002872 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08002873 .smp = &msm8960_smp_ops,
Stepan Moskovchenko39236d72011-11-30 17:42:23 -08002874MACHINE_END
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002875
2876MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP")
2877 .map_io = msm8930_map_io,
2878 .reserve = msm8930_reserve,
2879 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302880 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002881 .timer = &msm_timer,
2882 .init_machine = msm8930_cdp_init,
2883 .init_early = msm8930_allocate_memory_regions,
2884 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002885 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08002886 .smp = &msm8960_smp_ops,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002887MACHINE_END
2888
2889MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP")
2890 .map_io = msm8930_map_io,
2891 .reserve = msm8930_reserve,
2892 .init_irq = msm8930_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05302893 .handle_irq = gic_handle_irq,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002894 .timer = &msm_timer,
2895 .init_machine = msm8930_cdp_init,
2896 .init_early = msm8930_allocate_memory_regions,
2897 .init_very_early = msm8930_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07002898 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08002899 .smp = &msm8960_smp_ops,
Stepan Moskovchenko8768eff2011-12-01 18:55:07 -08002900MACHINE_END