blob: 9bbdaa6b437c77de9a81010ea32f03e4cad2c5a8 [file] [log] [blame]
Harini Jayaramana9873ab2011-12-20 17:29:48 -07001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -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 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070022#include <linux/regulator/msm-gpio-regulator.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
29#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
Steve Mucklef132c6c2012-06-06 18:30:57 -070032#include <linux/cyttsp-qc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070033#include <linux/dma-mapping.h>
34#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070035#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036#include <linux/leds.h>
37#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053038#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070039#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070040#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053041#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080042#include <linux/memory.h>
Larry Bassel2d8b42d2012-03-12 10:41:26 -070043#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060044#include <linux/msm_thermal.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080045
46#include <asm/mach-types.h>
47#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070048#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080049#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080051
52#include <mach/board.h>
Joel Nider266a2642011-10-16 10:58:05 +020053#include <mach/msm_tspp.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080054#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070055#include <mach/msm_spi.h>
Mayank Ranae009c922012-03-22 03:02:06 +053056#include <mach/msm_serial_hs.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057#ifdef CONFIG_USB_MSM_OTG_72K
58#include <mach/msm_hsusb.h>
59#else
60#include <linux/usb/msm_hsusb.h>
61#endif
62#include <linux/usb/android.h>
63#include <mach/usbdiag.h>
64#include <mach/socinfo.h>
65#include <mach/rpm.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070066#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070067#include <mach/msm_bus_board.h>
68#include <mach/msm_memtypes.h>
69#include <mach/dma.h>
70#include <mach/msm_dsps.h>
71#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070072#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080073
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053075#include <linux/mfd/wcd9xxx/core.h>
76#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#endif
78
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +053079#include <linux/smsc3503.h>
Mitchel Humpheryscfa31af2012-09-06 11:34:03 -070080#include <linux/msm_ion.h>
Laura Abbottd6183792011-08-19 13:42:24 -070081#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080082#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080083#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080084#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080085#include <mach/msm_cache_dump.h>
86#include <mach/scm.h>
Olav Haugan8726caf2012-05-10 15:11:35 -070087#include <mach/iommu_domains.h>
Laura Abbottd6183792011-08-19 13:42:24 -070088
Jordan Crouse914de9b2012-07-09 13:49:46 -060089#include <mach/kgsl.h>
Larry Bassel41a055b2011-12-06 16:15:14 -080090#include <linux/fmem.h>
91
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080093#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080096#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080097#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080098#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070099#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530100#include <mach/mpm.h>
Naveen Ramaraj76483ad2011-09-06 14:25:44 -0700101#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -0600102#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700103#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800104
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700105static struct platform_device msm_fm_platform_init = {
106 .name = "iris_fm",
107 .id = -1,
108};
109
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700110#define KS8851_RST_GPIO 89
111#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530112
Manoj Rao14648742012-03-30 19:42:12 -0700113#define MHL_GPIO_INT 4
114#define MHL_GPIO_RESET 15
115
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700116#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700117
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800118struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700119 [SX150X_CAM] = {
120 .gpio_base = GPIO_CAM_EXPANDER_BASE,
121 .oscio_is_gpo = false,
122 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530123 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700124 .io_open_drain_ena = 0x0,
125 .irq_summary = -1,
126 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200127 [SX150X_LIQUID] = {
128 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
129 .oscio_is_gpo = false,
130 .io_pullup_ena = 0x0c08,
131 .io_pulldn_ena = 0x4060,
132 .io_open_drain_ena = 0x000c,
133 .io_polarity = 0,
134 .irq_summary = -1,
135 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700136};
Nishant Pandit474f2252011-07-23 23:17:56 +0530137
138#endif
139
Olav Haugana21169d2012-01-04 09:17:06 -0800140#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700141#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800142#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800143#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800144#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700145
146#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur35825522012-06-06 15:49:14 -0700147#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700148#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700149#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700150#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700151#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700152#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700153#define MSM_ION_HEAP_NUM 7
154#else
155#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
156#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700157#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700158#define MSM_ION_HEAP_NUM 8
159#endif
Deepak Kotur35825522012-06-06 15:49:14 -0700160#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 128kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800161#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800162#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700163
Olav Hauganb5be7992011-11-18 14:29:02 -0800164#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800165#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
166#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700167
Deepak Kotur35825522012-06-06 15:49:14 -0700168#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2mb -128kb*/
169#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
170 HOLE_SIZE))
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700171#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur35825522012-06-06 15:49:14 -0700172#define MSM8960_FW_START MSM8960_FIXED_AREA_START
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700173
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800174static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700175#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700176#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800177#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700178#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700179
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700180#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
181static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
182static int __init msm_contig_mem_size_setup(char *p)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700183{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700184 msm_contig_mem_size = memparse(p, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700185 return 0;
186}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700187early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700188#endif
189
190#ifdef CONFIG_ANDROID_PMEM
191static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800192static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700193static int __init pmem_size_setup(char *p)
194{
195 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800196 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700197 return 0;
198}
199early_param("pmem_size", pmem_size_setup);
200
201static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
202
203static int __init pmem_adsp_size_setup(char *p)
204{
205 pmem_adsp_size = memparse(p, NULL);
206 return 0;
207}
208early_param("pmem_adsp_size", pmem_adsp_size_setup);
209
210static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
211
212static int __init pmem_audio_size_setup(char *p)
213{
214 pmem_audio_size = memparse(p, NULL);
215 return 0;
216}
217early_param("pmem_audio_size", pmem_audio_size_setup);
218#endif
219
220#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700221#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700222static struct android_pmem_platform_data android_pmem_pdata = {
223 .name = "pmem",
224 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
225 .cached = 1,
226 .memory_type = MEMTYPE_EBI1,
227};
228
Laura Abbottb93525f2012-04-12 09:57:19 -0700229static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700230 .name = "android_pmem",
231 .id = 0,
232 .dev = {.platform_data = &android_pmem_pdata},
233};
234
235static struct android_pmem_platform_data android_pmem_adsp_pdata = {
236 .name = "pmem_adsp",
237 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
238 .cached = 0,
239 .memory_type = MEMTYPE_EBI1,
240};
Laura Abbottb93525f2012-04-12 09:57:19 -0700241static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242 .name = "android_pmem",
243 .id = 2,
244 .dev = { .platform_data = &android_pmem_adsp_pdata },
245};
246
247static struct android_pmem_platform_data android_pmem_audio_pdata = {
248 .name = "pmem_audio",
249 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
250 .cached = 0,
251 .memory_type = MEMTYPE_EBI1,
252};
253
Laura Abbottb93525f2012-04-12 09:57:19 -0700254static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700255 .name = "android_pmem",
256 .id = 4,
257 .dev = { .platform_data = &android_pmem_audio_pdata },
258};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700259#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
260#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700261
Laura Abbottb93525f2012-04-12 09:57:19 -0700262struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800263};
264
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700265#define DSP_RAM_BASE_8960 0x8da00000
266#define DSP_RAM_SIZE_8960 0x1800000
267static int dspcrashd_pdata_8960 = 0xDEADDEAD;
268
269static struct resource resources_dspcrashd_8960[] = {
270 {
271 .name = "msm_dspcrashd",
272 .start = DSP_RAM_BASE_8960,
273 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
274 .flags = IORESOURCE_DMA,
275 },
276};
277
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800278static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700279 .name = "msm_dspcrashd",
280 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
281 .resource = resources_dspcrashd_8960,
282 .dev = { .platform_data = &dspcrashd_pdata_8960 },
283};
284
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700285static struct memtype_reserve msm8960_reserve_table[] __initdata = {
286 [MEMTYPE_SMI] = {
287 },
288 [MEMTYPE_EBI0] = {
289 .flags = MEMTYPE_FLAGS_1M_ALIGN,
290 },
291 [MEMTYPE_EBI1] = {
292 .flags = MEMTYPE_FLAGS_1M_ALIGN,
293 },
294};
295
Laura Abbottf8c03b92012-02-16 14:57:58 -0800296static void __init reserve_rtb_memory(void)
297{
298#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700299 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800300#endif
301}
302
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700303static void __init size_pmem_devices(void)
304{
305#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700306#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700307 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800308
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800309 if (!pmem_param_set) {
310 if (machine_is_msm8960_liquid())
311 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700312 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800313 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
314 }
315
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316 android_pmem_pdata.size = pmem_size;
317 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700318#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
319#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320}
321
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700322#ifdef CONFIG_ANDROID_PMEM
323#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324static void __init reserve_memory_for(struct android_pmem_platform_data *p)
325{
326 msm8960_reserve_table[p->memory_type].size += p->size;
327}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700328#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
329#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330
331static void __init reserve_pmem_memory(void)
332{
333#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700334#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700335 reserve_memory_for(&android_pmem_adsp_pdata);
336 reserve_memory_for(&android_pmem_pdata);
337 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700338#endif
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700339 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700340#endif
341}
342
Larry Basselb4126da2011-07-18 14:31:33 -0700343static int msm8960_paddr_to_memtype(unsigned int paddr)
344{
345 return MEMTYPE_EBI1;
346}
347
Steve Mucklef132c6c2012-06-06 18:30:57 -0700348#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800349
Laura Abbottd6183792011-08-19 13:42:24 -0700350#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800351#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700352static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800353 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700354 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800355 .reusable = FMEM_ENABLED,
356 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700357 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700358 .iommu_map_all = 1,
359 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800360};
361
Laura Abbottb93525f2012-04-12 09:57:19 -0700362static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800363 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800364 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800365 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800366 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700367 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800368};
369
Laura Abbottb93525f2012-04-12 09:57:19 -0700370static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800371 .adjacent_mem_id = INVALID_HEAP_ID,
372 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800373 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800374};
375
Laura Abbottb93525f2012-04-12 09:57:19 -0700376static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800377 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
378 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800379 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700380 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800381};
382#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800383
384/**
385 * These heaps are listed in the order they will be allocated. Due to
386 * video hardware restrictions and content protection the FW heap has to
387 * be allocated adjacent (below) the MM heap and the MFC heap has to be
388 * allocated after the MM heap to ensure MFC heap is not more than 256MB
389 * away from the base address of the FW heap.
390 * However, the order of FW heap and MM heap doesn't matter since these
391 * two heaps are taken care of by separate code to ensure they are adjacent
392 * to each other.
393 * Don't swap the order unless you know what you are doing!
394 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700395static struct ion_platform_data msm8960_ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700396 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700397 .heaps = {
398 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800399 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700400 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700401 .name = ION_VMALLOC_HEAP_NAME,
402 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700403#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700404 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800405 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800406 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800407 .name = ION_MM_HEAP_NAME,
408 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700409 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700410 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700411 },
Laura Abbott8c017362011-09-22 20:59:12 -0700412 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800413 .id = ION_MM_FIRMWARE_HEAP_ID,
414 .type = ION_HEAP_TYPE_CARVEOUT,
415 .name = ION_MM_FIRMWARE_HEAP_NAME,
416 .size = MSM_ION_MM_FW_SIZE,
417 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700418 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800419 },
420 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800421 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800422 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800423 .name = ION_MFC_HEAP_NAME,
424 .size = MSM_ION_MFC_SIZE,
425 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700426 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800427 },
Olav Haugan32594552012-03-13 11:40:05 -0700428#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800429 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800430 .id = ION_SF_HEAP_ID,
431 .type = ION_HEAP_TYPE_CARVEOUT,
432 .name = ION_SF_HEAP_NAME,
433 .size = MSM_ION_SF_SIZE,
434 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700435 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800436 },
Olav Haugan32594552012-03-13 11:40:05 -0700437#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800438 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800439 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700440 .type = ION_HEAP_TYPE_IOMMU,
441 .name = ION_IOMMU_HEAP_NAME,
442 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800443 {
444 .id = ION_QSECOM_HEAP_ID,
445 .type = ION_HEAP_TYPE_CARVEOUT,
446 .name = ION_QSECOM_HEAP_NAME,
447 .size = MSM_ION_QSECOM_SIZE,
448 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700449 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800450 },
Olav Haugan7355db02012-01-13 16:59:13 -0800451 {
452 .id = ION_AUDIO_HEAP_ID,
453 .type = ION_HEAP_TYPE_CARVEOUT,
454 .name = ION_AUDIO_HEAP_NAME,
455 .size = MSM_ION_AUDIO_SIZE,
456 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700457 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800458 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700459#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700460 }
461};
462
Laura Abbottb93525f2012-04-12 09:57:19 -0700463static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700464 .name = "ion-msm",
465 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700466 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700467};
468#endif
469
Laura Abbottb93525f2012-04-12 09:57:19 -0700470struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800471 .name = "fmem",
472 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700473 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800474};
475
Olav Haugan65f4bd82011-12-13 11:50:08 -0800476static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700477{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800478 unsigned int i;
479
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800480 if (!pmem_param_set) {
481 if (machine_is_msm8960_liquid())
482 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
483
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700484 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800485 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
486
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700487 if (machine_is_msm8960_liquid() ||
488 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700489 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
490 if (msm8960_ion_pdata.heaps[i].id ==
491 ION_SF_HEAP_ID) {
492 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800493 msm_ion_sf_size;
494 pr_debug("msm_ion_sf_size 0x%x\n",
495 msm_ion_sf_size);
496 break;
497 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800498 }
499 }
500 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800501}
502
503static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
504 unsigned long size)
505{
506 msm8960_reserve_table[mem_type].size += size;
507}
508
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700509static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
510{
511#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
512 int ret;
513
514 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
515 panic("fixed area size is larger than %dM\n",
516 MAX_FIXED_AREA_SIZE >> 20);
517
518 reserve_info->fixed_area_size = fixed_area_size;
519 reserve_info->fixed_area_start = MSM8960_FW_START;
520
521 ret = memblock_remove(reserve_info->fixed_area_start,
522 reserve_info->fixed_area_size);
523 BUG_ON(ret);
524#endif
525}
526
Olav Haugan65f4bd82011-12-13 11:50:08 -0800527/**
528 * Reserve memory for ION and calculate amount of reusable memory for fmem.
529 * We only reserve memory for heaps that are not reusable. However, we only
530 * support one reusable heap at the moment so we ignore the reusable flag for
531 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800532 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
533 * at a higher address than FW in addition to not more than 256MB away from the
534 * base address of the firmware. This means that if MM is reusable the other
535 * two heaps must be allocated in the same region as FW. This is handled by the
536 * mem_is_fmem flag in the platform data. In addition the MM heap must be
537 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800538 */
539static void __init reserve_ion_memory(void)
540{
541#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
542 unsigned int i;
543 unsigned int reusable_count = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700544 unsigned int fixed_size = 0;
545 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
546 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800547
548 adjust_mem_for_liquid();
Laura Abbottb93525f2012-04-12 09:57:19 -0700549 msm8960_fmem_pdata.size = 0;
550 msm8960_fmem_pdata.reserved_size_low = 0;
551 msm8960_fmem_pdata.reserved_size_high = 0;
Olav Haugan8726caf2012-05-10 15:11:35 -0700552 msm8960_fmem_pdata.align = PAGE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700553 fixed_low_size = 0;
554 fixed_middle_size = 0;
555 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800556
557 /* We only support 1 reusable heap. Check if more than one heap
558 * is specified as reusable and set as non-reusable if found.
559 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700560 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
561 const struct ion_platform_heap *heap =
562 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800563
564 if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) {
565 struct ion_cp_heap_pdata *data = heap->extra_data;
566
567 reusable_count += (data->reusable) ? 1 : 0;
568
569 if (data->reusable && reusable_count > 1) {
570 pr_err("%s: Too many heaps specified as "
571 "reusable. Heap %s was not configured "
572 "as reusable.\n", __func__, heap->name);
573 data->reusable = 0;
574 }
575 }
576 }
577
Laura Abbottb93525f2012-04-12 09:57:19 -0700578 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700579 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700580 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700581 int align = SZ_4K;
582 int iommu_map_all = 0;
583 int adjacent_mem_id = INVALID_HEAP_ID;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800584
585 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700586 int fixed_position = NOT_FIXED;
587 int mem_is_fmem = 0;
588
Olav Haugan65f4bd82011-12-13 11:50:08 -0800589 switch (heap->type) {
590 case ION_HEAP_TYPE_CP:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800591 mem_is_fmem = ((struct ion_cp_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700592 heap->extra_data)->mem_is_fmem;
593 fixed_position = ((struct ion_cp_heap_pdata *)
594 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700595 align = ((struct ion_cp_heap_pdata *)
596 heap->extra_data)->align;
597 iommu_map_all =
598 ((struct ion_cp_heap_pdata *)
599 heap->extra_data)->iommu_map_all;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800600 break;
601 case ION_HEAP_TYPE_CARVEOUT:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800602 mem_is_fmem = ((struct ion_co_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700603 heap->extra_data)->mem_is_fmem;
604 fixed_position = ((struct ion_co_heap_pdata *)
605 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700606 adjacent_mem_id = ((struct ion_co_heap_pdata *)
607 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700608 break;
609 default:
610 break;
611 }
612
Olav Haugan8726caf2012-05-10 15:11:35 -0700613 if (iommu_map_all) {
614 if (heap->size & (SZ_64K-1)) {
615 heap->size = ALIGN(heap->size, SZ_64K);
616 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
617 heap->name, heap->size);
618 }
619 }
620
621 if (mem_is_fmem && adjacent_mem_id != INVALID_HEAP_ID)
622 msm8960_fmem_pdata.align = align;
623
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700624 if (fixed_position != NOT_FIXED)
625 fixed_size += heap->size;
626 else
627 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
628
629 if (fixed_position == FIXED_LOW)
630 fixed_low_size += heap->size;
631 else if (fixed_position == FIXED_MIDDLE)
632 fixed_middle_size += heap->size;
633 else if (fixed_position == FIXED_HIGH)
634 fixed_high_size += heap->size;
635
636 if (mem_is_fmem)
Laura Abbottb93525f2012-04-12 09:57:19 -0700637 msm8960_fmem_pdata.size += heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700638 }
639 }
640
641 if (!fixed_size)
642 return;
643
Laura Abbottb93525f2012-04-12 09:57:19 -0700644 if (msm8960_fmem_pdata.size) {
Deepak Kotur35825522012-06-06 15:49:14 -0700645 msm8960_fmem_pdata.reserved_size_low = fixed_low_size +
646 HOLE_SIZE;
Laura Abbottb93525f2012-04-12 09:57:19 -0700647 msm8960_fmem_pdata.reserved_size_high = fixed_high_size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700648 }
649
Larry Bassel4d4f4482012-04-04 11:26:09 -0700650 /* Since the fixed area may be carved out of lowmem,
651 * make sure the length is a multiple of 1M.
652 */
653 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
654 & SECTION_MASK;
655 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700656
657 fixed_low_start = MSM8960_FIXED_AREA_START;
Deepak Kotur35825522012-06-06 15:49:14 -0700658 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700659 fixed_high_start = fixed_middle_start + fixed_middle_size;
660
Laura Abbottb93525f2012-04-12 09:57:19 -0700661 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
662 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700663
664 if (heap->extra_data) {
665 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700666 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700667
668 switch (heap->type) {
669 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700670 pdata =
671 (struct ion_cp_heap_pdata *)heap->extra_data;
672 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700673 break;
674 case ION_HEAP_TYPE_CARVEOUT:
675 fixed_position = ((struct ion_co_heap_pdata *)
676 heap->extra_data)->fixed_position;
677 break;
678 default:
679 break;
680 }
681
682 switch (fixed_position) {
683 case FIXED_LOW:
684 heap->base = fixed_low_start;
685 break;
686 case FIXED_MIDDLE:
687 heap->base = fixed_middle_start;
Deepak Kotur35825522012-06-06 15:49:14 -0700688 pdata->secure_base = fixed_middle_start
689 - HOLE_SIZE;
690 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700691 break;
692 case FIXED_HIGH:
693 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800694 break;
695 default:
696 break;
697 }
698 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800699 }
Laura Abbottd6183792011-08-19 13:42:24 -0700700#endif
701}
Huaibin Yanga5419422011-12-08 23:52:10 -0800702
703static void __init reserve_mdp_memory(void)
704{
705 msm8960_mdp_writeback(msm8960_reserve_table);
706}
707
Stephen Boyd668d7652012-04-25 11:31:01 -0700708static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800709{
710#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800711 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800712
Laura Abbott155ab6f2012-05-25 08:52:18 -0700713 total = msm8960_cache_dump_pdata.l1_size +
714 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800715 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800716#endif
717}
718
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700719static void __init msm8960_calculate_reserve_sizes(void)
720{
721 size_pmem_devices();
722 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700723 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800724 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800725 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800726 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700727}
728
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700729static struct reserve_info msm8960_reserve_info __initdata = {
730 .memtype_reserve_table = msm8960_reserve_table,
731 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700732 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700733 .paddr_to_memtype = msm8960_paddr_to_memtype,
734};
735
Larry Basselb4126da2011-07-18 14:31:33 -0700736static int msm8960_memory_bank_size(void)
737{
738 return 1<<29;
739}
740
741static void __init locate_unstable_memory(void)
742{
743 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
744 unsigned long bank_size;
745 unsigned long low, high;
746
747 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700748 msm8960_reserve_info.bank_size = bank_size;
749
Larry Basselb4126da2011-07-18 14:31:33 -0700750 low = meminfo.bank[0].start;
751 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700752
753 /* Check if 32 bit overflow occured */
754 if (high < mb->start)
755 high = ~0UL;
756
Larry Bassel4d4f4482012-04-04 11:26:09 -0700757 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
758 panic("fixed area extends beyond end of memory\n");
759
Larry Basselb4126da2011-07-18 14:31:33 -0700760 low &= ~(bank_size - 1);
761
762 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700763 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800764
Larry Basselb8d61022012-02-24 10:49:45 -0800765#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800766 msm8960_reserve_info.low_unstable_address = mb->start -
767 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800768 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700769 pr_info("low unstable address %lx max size %lx bank size %lx\n",
770 msm8960_reserve_info.low_unstable_address,
771 msm8960_reserve_info.max_unstable_size,
772 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700773 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800774#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700775no_dmm:
776 msm8960_reserve_info.low_unstable_address = high;
777 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700778}
779
Larry Basselb830e182011-10-14 10:46:55 -0700780static void __init place_movable_zone(void)
781{
Larry Basselb8d61022012-02-24 10:49:45 -0800782#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700783 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
784 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
785 pr_info("movable zone start %lx size %lx\n",
786 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800787#endif
Larry Basselb830e182011-10-14 10:46:55 -0700788}
789
790static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700791{
792 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700793 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700794 place_movable_zone();
795}
796
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800797static char prim_panel_name[PANEL_NAME_MAX_LEN];
798static char ext_panel_name[PANEL_NAME_MAX_LEN];
799static int __init prim_display_setup(char *param)
800{
801 if (strnlen(param, PANEL_NAME_MAX_LEN))
802 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
803 return 0;
804}
805early_param("prim_display", prim_display_setup);
806
807static int __init ext_display_setup(char *param)
808{
809 if (strnlen(param, PANEL_NAME_MAX_LEN))
810 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
811 return 0;
812}
813early_param("ext_display", ext_display_setup);
814
Larry Basselb830e182011-10-14 10:46:55 -0700815static void __init msm8960_reserve(void)
816{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800817 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700818 msm_reserve();
Laura Abbottb93525f2012-04-12 09:57:19 -0700819 if (msm8960_fmem_pdata.size) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700820#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel861985f2012-05-02 15:54:52 -0700821 if (reserve_info->fixed_area_size) {
822 msm8960_fmem_pdata.phys =
823 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
824 pr_info("mm fw at %lx (fixed) size %x\n",
825 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
826 pr_info("fmem start %lx (fixed) size %lx\n",
827 msm8960_fmem_pdata.phys,
828 msm8960_fmem_pdata.size);
829 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700830#endif
831 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700832}
833
Larry Bassela4414b12011-08-04 11:11:02 -0700834static int msm8960_change_memory_power(u64 start, u64 size,
835 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700836{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700837 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700838}
839
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700840static void __init msm8960_allocate_memory_regions(void)
841{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800842 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700843}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800844
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700845#ifdef CONFIG_WCD9310_CODEC
846
847#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
848
Patrick Lai3043fba2011-08-01 14:15:57 -0700849/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
850 * 4 micbiases are used to power various analog and digital
851 * microphones operating at 1800 mV. Technically, all micbiases
852 * can source from single cfilter since all microphones operate
853 * at the same voltage level. The arrangement below is to make
854 * sure all cfilters are exercised. LDO_H regulator ouput level
855 * does not need to be as high as 2.85V. It is choosen for
856 * microphone sensitivity purpose.
857 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530858static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700859 .slimbus_slave_device = {
860 .name = "tabla-slave",
861 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
862 },
863 .irq = MSM_GPIO_TO_INT(62),
864 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530865 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700866 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700867 .micbias = {
868 .ldoh_v = TABLA_LDOH_2P85_V,
869 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700870 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700871 .cfilt3_mv = 1800,
872 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
873 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
874 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
875 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530876 },
877 .regulator = {
878 {
879 .name = "CDC_VDD_CP",
880 .min_uV = 1800000,
881 .max_uV = 1800000,
882 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
883 },
884 {
885 .name = "CDC_VDDA_RX",
886 .min_uV = 1800000,
887 .max_uV = 1800000,
888 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
889 },
890 {
891 .name = "CDC_VDDA_TX",
892 .min_uV = 1800000,
893 .max_uV = 1800000,
894 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
895 },
896 {
897 .name = "VDDIO_CDC",
898 .min_uV = 1800000,
899 .max_uV = 1800000,
900 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
901 },
902 {
903 .name = "VDDD_CDC_D",
904 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700905 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530906 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
907 },
908 {
909 .name = "CDC_VDDA_A_1P2V",
910 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700911 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530912 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
913 },
914 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700915};
916
917static struct slim_device msm_slim_tabla = {
918 .name = "tabla-slim",
919 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
920 .dev = {
921 .platform_data = &tabla_platform_data,
922 },
923};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530924
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530925static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530926 .slimbus_slave_device = {
927 .name = "tabla-slave",
928 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
929 },
930 .irq = MSM_GPIO_TO_INT(62),
931 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530932 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530933 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
934 .micbias = {
935 .ldoh_v = TABLA_LDOH_2P85_V,
936 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700937 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530938 .cfilt3_mv = 1800,
939 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
940 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
941 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
942 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530943 },
944 .regulator = {
945 {
946 .name = "CDC_VDD_CP",
947 .min_uV = 1800000,
948 .max_uV = 1800000,
949 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
950 },
951 {
952 .name = "CDC_VDDA_RX",
953 .min_uV = 1800000,
954 .max_uV = 1800000,
955 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
956 },
957 {
958 .name = "CDC_VDDA_TX",
959 .min_uV = 1800000,
960 .max_uV = 1800000,
961 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
962 },
963 {
964 .name = "VDDIO_CDC",
965 .min_uV = 1800000,
966 .max_uV = 1800000,
967 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
968 },
969 {
970 .name = "VDDD_CDC_D",
971 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700972 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530973 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
974 },
975 {
976 .name = "CDC_VDDA_A_1P2V",
977 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700978 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530979 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
980 },
981 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530982};
983
984static struct slim_device msm_slim_tabla20 = {
985 .name = "tabla2x-slim",
986 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
987 .dev = {
988 .platform_data = &tabla20_platform_data,
989 },
990};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700991#endif
992
993static struct slim_boardinfo msm_slim_devices[] = {
994#ifdef CONFIG_WCD9310_CODEC
995 {
996 .bus_num = 1,
997 .slim_slave = &msm_slim_tabla,
998 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530999 {
1000 .bus_num = 1,
1001 .slim_slave = &msm_slim_tabla20,
1002 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001003#endif
1004 /* add more slimbus slaves as needed */
1005};
1006
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001007#define MSM_WCNSS_PHYS 0x03000000
1008#define MSM_WCNSS_SIZE 0x280000
1009
1010static struct resource resources_wcnss_wlan[] = {
1011 {
1012 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1013 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1014 .name = "wcnss_wlanrx_irq",
1015 .flags = IORESOURCE_IRQ,
1016 },
1017 {
1018 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1019 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1020 .name = "wcnss_wlantx_irq",
1021 .flags = IORESOURCE_IRQ,
1022 },
1023 {
1024 .start = MSM_WCNSS_PHYS,
1025 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1026 .name = "wcnss_mmio",
1027 .flags = IORESOURCE_MEM,
1028 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001029 {
1030 .start = 84,
1031 .end = 88,
1032 .name = "wcnss_gpios_5wire",
1033 .flags = IORESOURCE_IO,
1034 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001035};
1036
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001037static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1038 .has_48mhz_xo = 1,
1039};
1040
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001041static struct platform_device msm_device_wcnss_wlan = {
1042 .name = "wcnss_wlan",
1043 .id = 0,
1044 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1045 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001046 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001047};
1048
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001049#ifdef CONFIG_QSEECOM
1050/* qseecom bus scaling */
1051static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1052 {
1053 .src = MSM_BUS_MASTER_SPS,
1054 .dst = MSM_BUS_SLAVE_EBI_CH0,
1055 .ib = 0,
1056 .ab = 0,
1057 },
1058 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001059 .src = MSM_BUS_MASTER_SPS,
1060 .dst = MSM_BUS_SLAVE_SPS,
1061 .ib = 0,
1062 .ab = 0,
1063 },
1064 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001065 .src = MSM_BUS_MASTER_SPDM,
1066 .dst = MSM_BUS_SLAVE_SPDM,
1067 .ib = 0,
1068 .ab = 0,
1069 },
1070};
1071
1072static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1073 {
1074 .src = MSM_BUS_MASTER_SPS,
1075 .dst = MSM_BUS_SLAVE_EBI_CH0,
1076 .ib = (492 * 8) * 1000000UL,
1077 .ab = (492 * 8) * 100000UL,
1078 },
1079 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001080 .src = MSM_BUS_MASTER_SPS,
1081 .dst = MSM_BUS_SLAVE_SPS,
1082 .ib = (492 * 8) * 1000000UL,
1083 .ab = (492 * 8) * 100000UL,
1084 },
1085 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001086 .src = MSM_BUS_MASTER_SPDM,
1087 .dst = MSM_BUS_SLAVE_SPDM,
1088 .ib = 0,
1089 .ab = 0,
1090 },
1091};
1092
1093static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1094 {
1095 .src = MSM_BUS_MASTER_SPS,
1096 .dst = MSM_BUS_SLAVE_EBI_CH0,
1097 .ib = 0,
1098 .ab = 0,
1099 },
1100 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001101 .src = MSM_BUS_MASTER_SPS,
1102 .dst = MSM_BUS_SLAVE_SPS,
1103 .ib = 0,
1104 .ab = 0,
1105 },
1106 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001107 .src = MSM_BUS_MASTER_SPDM,
1108 .dst = MSM_BUS_SLAVE_SPDM,
1109 .ib = (64 * 8) * 1000000UL,
1110 .ab = (64 * 8) * 100000UL,
1111 },
1112};
1113
1114static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1115 {
1116 ARRAY_SIZE(qseecom_clks_init_vectors),
1117 qseecom_clks_init_vectors,
1118 },
1119 {
1120 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001121 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001122 },
1123 {
1124 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1125 qseecom_enable_sfpb_vectors,
1126 },
1127};
1128
1129static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1130 qseecom_hw_bus_scale_usecases,
1131 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1132 .name = "qsee",
1133};
1134
1135static struct platform_device qseecom_device = {
1136 .name = "qseecom",
1137 .id = 0,
1138 .dev = {
1139 .platform_data = &qseecom_bus_pdata,
1140 },
1141};
1142#endif
1143
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001144#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1145 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1146 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1147 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1148
1149#define QCE_SIZE 0x10000
1150#define QCE_0_BASE 0x18500000
1151
1152#define QCE_HW_KEY_SUPPORT 0
1153#define QCE_SHA_HMAC_SUPPORT 1
1154#define QCE_SHARE_CE_RESOURCE 1
1155#define QCE_CE_SHARED 0
1156
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001157/* Begin Bus scaling definitions */
1158static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1159 {
1160 .src = MSM_BUS_MASTER_ADM_PORT0,
1161 .dst = MSM_BUS_SLAVE_EBI_CH0,
1162 .ab = 0,
1163 .ib = 0,
1164 },
1165 {
1166 .src = MSM_BUS_MASTER_ADM_PORT1,
1167 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1168 .ab = 0,
1169 .ib = 0,
1170 },
1171};
1172
1173static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1174 {
1175 .src = MSM_BUS_MASTER_ADM_PORT0,
1176 .dst = MSM_BUS_SLAVE_EBI_CH0,
1177 .ab = 70000000UL,
1178 .ib = 70000000UL,
1179 },
1180 {
1181 .src = MSM_BUS_MASTER_ADM_PORT1,
1182 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1183 .ab = 2480000000UL,
1184 .ib = 2480000000UL,
1185 },
1186};
1187
1188static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1189 {
1190 ARRAY_SIZE(crypto_hw_init_vectors),
1191 crypto_hw_init_vectors,
1192 },
1193 {
1194 ARRAY_SIZE(crypto_hw_active_vectors),
1195 crypto_hw_active_vectors,
1196 },
1197};
1198
1199static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1200 crypto_hw_bus_scale_usecases,
1201 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1202 .name = "cryptohw",
1203};
1204/* End Bus Scaling Definitions*/
1205
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001206static struct resource qcrypto_resources[] = {
1207 [0] = {
1208 .start = QCE_0_BASE,
1209 .end = QCE_0_BASE + QCE_SIZE - 1,
1210 .flags = IORESOURCE_MEM,
1211 },
1212 [1] = {
1213 .name = "crypto_channels",
1214 .start = DMOV_CE_IN_CHAN,
1215 .end = DMOV_CE_OUT_CHAN,
1216 .flags = IORESOURCE_DMA,
1217 },
1218 [2] = {
1219 .name = "crypto_crci_in",
1220 .start = DMOV_CE_IN_CRCI,
1221 .end = DMOV_CE_IN_CRCI,
1222 .flags = IORESOURCE_DMA,
1223 },
1224 [3] = {
1225 .name = "crypto_crci_out",
1226 .start = DMOV_CE_OUT_CRCI,
1227 .end = DMOV_CE_OUT_CRCI,
1228 .flags = IORESOURCE_DMA,
1229 },
1230};
1231
1232static struct resource qcedev_resources[] = {
1233 [0] = {
1234 .start = QCE_0_BASE,
1235 .end = QCE_0_BASE + QCE_SIZE - 1,
1236 .flags = IORESOURCE_MEM,
1237 },
1238 [1] = {
1239 .name = "crypto_channels",
1240 .start = DMOV_CE_IN_CHAN,
1241 .end = DMOV_CE_OUT_CHAN,
1242 .flags = IORESOURCE_DMA,
1243 },
1244 [2] = {
1245 .name = "crypto_crci_in",
1246 .start = DMOV_CE_IN_CRCI,
1247 .end = DMOV_CE_IN_CRCI,
1248 .flags = IORESOURCE_DMA,
1249 },
1250 [3] = {
1251 .name = "crypto_crci_out",
1252 .start = DMOV_CE_OUT_CRCI,
1253 .end = DMOV_CE_OUT_CRCI,
1254 .flags = IORESOURCE_DMA,
1255 },
1256};
1257
1258#endif
1259
1260#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1261 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1262
1263static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1264 .ce_shared = QCE_CE_SHARED,
1265 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1266 .hw_key_support = QCE_HW_KEY_SUPPORT,
1267 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001268 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001269};
1270
1271static struct platform_device qcrypto_device = {
1272 .name = "qcrypto",
1273 .id = 0,
1274 .num_resources = ARRAY_SIZE(qcrypto_resources),
1275 .resource = qcrypto_resources,
1276 .dev = {
1277 .coherent_dma_mask = DMA_BIT_MASK(32),
1278 .platform_data = &qcrypto_ce_hw_suppport,
1279 },
1280};
1281#endif
1282
1283#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1284 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1285
1286static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1287 .ce_shared = QCE_CE_SHARED,
1288 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1289 .hw_key_support = QCE_HW_KEY_SUPPORT,
1290 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001291 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001292};
1293
1294static struct platform_device qcedev_device = {
1295 .name = "qce",
1296 .id = 0,
1297 .num_resources = ARRAY_SIZE(qcedev_resources),
1298 .resource = qcedev_resources,
1299 .dev = {
1300 .coherent_dma_mask = DMA_BIT_MASK(32),
1301 .platform_data = &qcedev_ce_hw_suppport,
1302 },
1303};
1304#endif
1305
Joel King0cbf5d82012-05-24 15:21:38 -07001306static struct mdm_platform_data sglte_platform_data = {
1307 .mdm_version = "4.0",
1308 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001309 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001310 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001311 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001312 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001313 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001314};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001315
Joel Nider266a2642011-10-16 10:58:05 +02001316#define MSM_TSIF0_PHYS (0x18200000)
1317#define MSM_TSIF1_PHYS (0x18201000)
1318#define MSM_TSIF_SIZE (0x200)
1319#define MSM_TSPP_PHYS (0x18202000)
1320#define MSM_TSPP_SIZE (0x1000)
1321#define MSM_TSPP_BAM_PHYS (0x18204000)
1322#define MSM_TSPP_BAM_SIZE (0x2000)
1323
1324#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1325 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1326#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1327 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1328#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1329 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1330#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1331 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1332#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1333 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1334#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1335 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1336#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1337 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1338#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1339 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1340
1341static const struct msm_gpio tsif_gpios[] = {
1342 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1343 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1344 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1345 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1346 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1347 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1348 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1349 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1350};
1351
1352static struct resource tspp_resources[] = {
1353 [0] = {
1354 .flags = IORESOURCE_IRQ,
1355 .start = TSIF_TSPP_IRQ,
1356 .end = TSIF1_IRQ,
1357 },
1358 [1] = {
1359 .flags = IORESOURCE_MEM,
1360 .start = MSM_TSIF0_PHYS,
1361 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1362 },
1363 [2] = {
1364 .flags = IORESOURCE_MEM,
1365 .start = MSM_TSIF1_PHYS,
1366 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1367 },
1368 [3] = {
1369 .flags = IORESOURCE_MEM,
1370 .start = MSM_TSPP_PHYS,
1371 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1372 },
1373 [4] = {
1374 .flags = IORESOURCE_MEM,
1375 .start = MSM_TSPP_BAM_PHYS,
1376 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1377 },
1378};
1379
1380static struct msm_tspp_platform_data tspp_platform_data = {
1381 .num_gpios = ARRAY_SIZE(tsif_gpios),
1382 .gpios = tsif_gpios,
1383 .tsif_pclk = "tsif_pclk",
1384 .tsif_ref_clk = "tsif_ref_clk",
1385};
1386
1387static struct platform_device msm_device_tspp = {
1388 .name = "msm_tspp",
1389 .id = 0,
1390 .num_resources = ARRAY_SIZE(tspp_resources),
1391 .resource = tspp_resources,
1392 .dev = {
1393 .platform_data = &tspp_platform_data
1394 },
1395};
1396
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001397#define MSM_SHARED_RAM_PHYS 0x80000000
1398
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001399static void __init msm8960_map_io(void)
1400{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001401 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001402 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001403
1404 if (socinfo_init() < 0)
1405 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001406}
1407
1408static void __init msm8960_init_irq(void)
1409{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001410 struct msm_mpm_device_data *data = NULL;
1411
1412#ifdef CONFIG_MSM_MPM
1413 data = &msm8960_mpm_dev_data;
1414#endif
1415
1416 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001417 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001418 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001419}
1420
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001421static void __init msm8960_init_buses(void)
1422{
1423#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001424 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001425 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1426 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001427 msm_bus_apps_fabric.dev.platform_data =
1428 &msm_bus_8960_apps_fabric_pdata;
1429 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001430 if (cpu_is_msm8960ab()) {
1431 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1432 msm_bus_mm_fabric.dev.platform_data =
1433 &msm_bus_8960_sg_mm_fabric_pdata;
1434 } else {
1435 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1436 msm_bus_mm_fabric.dev.platform_data =
1437 &msm_bus_8960_mm_fabric_pdata;
1438 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001439 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1440 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001441#endif
1442}
1443
1444static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1445 .max_clock_speed = 15060000,
Kiran Gundac5fbd7f2012-07-30 13:22:39 +05301446 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001447};
1448
1449#ifdef CONFIG_USB_MSM_OTG_72K
1450static struct msm_otg_platform_data msm_otg_pdata;
1451#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301452static int wr_phy_init_seq[] = {
1453 0x44, 0x80, /* set VBUS valid threshold
1454 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301455 0x68, 0x81, /* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301456 0x14, 0x82, /* set preemphasis and rise/fall time */
1457 0x13, 0x83, /* set source impedance adjusment */
1458 -1};
1459
1460static int liquid_v1_phy_init_seq[] = {
1461 0x44, 0x80,/* set VBUS valid threshold
1462 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301463 0x6C, 0x81,/* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301464 0x18, 0x82,/* set preemphasis and rise/fall time */
1465 0x23, 0x83,/* set source impedance sdjusment */
1466 -1};
1467
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301468static int sglte_phy_init_seq[] = {
1469 0x44, 0x80, /* set VBUS valid threshold
1470 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301471 0x6A, 0x81, /* update DC voltage level */
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301472 0x24, 0x82, /* set preemphasis and rise/fall time */
1473 0x13, 0x83, /* set source impedance adjusment */
1474 -1};
1475
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301476#ifdef CONFIG_MSM_BUS_SCALING
1477/* Bandwidth requests (zero) if no vote placed */
1478static struct msm_bus_vectors usb_init_vectors[] = {
1479 {
1480 .src = MSM_BUS_MASTER_SPS,
1481 .dst = MSM_BUS_SLAVE_EBI_CH0,
1482 .ab = 0,
1483 .ib = 0,
1484 },
1485};
1486
1487/* Bus bandwidth requests in Bytes/sec */
1488static struct msm_bus_vectors usb_max_vectors[] = {
1489 {
1490 .src = MSM_BUS_MASTER_SPS,
1491 .dst = MSM_BUS_SLAVE_EBI_CH0,
1492 .ab = 60000000, /* At least 480Mbps on bus. */
1493 .ib = 960000000, /* MAX bursts rate */
1494 },
1495};
1496
1497static struct msm_bus_paths usb_bus_scale_usecases[] = {
1498 {
1499 ARRAY_SIZE(usb_init_vectors),
1500 usb_init_vectors,
1501 },
1502 {
1503 ARRAY_SIZE(usb_max_vectors),
1504 usb_max_vectors,
1505 },
1506};
1507
1508static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1509 usb_bus_scale_usecases,
1510 ARRAY_SIZE(usb_bus_scale_usecases),
1511 .name = "usb",
1512};
1513#endif
1514
Jack Pham87f202f2012-08-06 00:24:22 -07001515#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1516
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001517static struct msm_otg_platform_data msm_otg_pdata = {
1518 .mode = USB_OTG,
1519 .otg_control = OTG_PMIC_CONTROL,
1520 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001521 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301522 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301523#ifdef CONFIG_MSM_BUS_SCALING
1524 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001525 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301526#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301527#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1528 .mhl_dev_name = "sii8334",
1529#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001530};
1531#endif
1532
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301533#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301534#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301535static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1536 .strobe = 150,
1537 .data = 151,
1538};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301539
1540static struct smsc_hub_platform_data hsic_hub_pdata = {
1541 .hub_reset = HSIC_HUB_RESET_GPIO,
1542};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301543#else
1544static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301545static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301546#endif
1547
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301548static struct platform_device smsc_hub_device = {
1549 .name = "msm_smsc_hub",
1550 .id = -1,
1551 .dev = {
1552 .platform_data = &hsic_hub_pdata,
1553 },
1554};
1555
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001556#define PID_MAGIC_ID 0x71432909
1557#define SERIAL_NUM_MAGIC_ID 0x61945374
1558#define SERIAL_NUMBER_LENGTH 127
1559#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1560
1561struct magic_num_struct {
1562 uint32_t pid;
1563 uint32_t serial_num;
1564};
1565
1566struct dload_struct {
1567 uint32_t reserved1;
1568 uint32_t reserved2;
1569 uint32_t reserved3;
1570 uint16_t reserved4;
1571 uint16_t pid;
1572 char serial_number[SERIAL_NUMBER_LENGTH];
1573 uint16_t reserved5;
1574 struct magic_num_struct magic_struct;
1575};
1576
1577static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1578{
1579 struct dload_struct __iomem *dload = 0;
1580
1581 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1582 if (!dload) {
1583 pr_err("%s: cannot remap I/O memory region: %08x\n",
1584 __func__, DLOAD_USB_BASE_ADD);
1585 return -ENXIO;
1586 }
1587
1588 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1589 __func__, dload, pid, snum);
1590 /* update pid */
1591 dload->magic_struct.pid = PID_MAGIC_ID;
1592 dload->pid = pid;
1593
1594 /* update serial number */
1595 dload->magic_struct.serial_num = 0;
1596 if (!snum) {
1597 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1598 goto out;
1599 }
1600
1601 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001602 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001603out:
1604 iounmap(dload);
1605 return 0;
1606}
1607
1608static struct android_usb_platform_data android_usb_pdata = {
1609 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1610};
1611
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001612static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001613 .name = "android_usb",
1614 .id = -1,
1615 .dev = {
1616 .platform_data = &android_usb_pdata,
1617 },
1618};
1619
1620static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1621 0x03, 0x0f,
1622};
1623
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001624static uint8_t spm_retention_cmd_sequence[] __initdata = {
1625 0x00, 0x05, 0x03, 0x0D,
1626 0x0B, 0x00, 0x0f,
1627};
1628
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001629static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1630 0x00, 0x24, 0x54, 0x10,
1631 0x09, 0x03, 0x01,
1632 0x10, 0x54, 0x30, 0x0C,
1633 0x24, 0x30, 0x0f,
1634};
1635
1636static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1637 0x00, 0x24, 0x54, 0x10,
1638 0x09, 0x07, 0x01, 0x0B,
1639 0x10, 0x54, 0x30, 0x0C,
1640 0x24, 0x30, 0x0f,
1641};
1642
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001643static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1644 [0] = {
1645 .mode = MSM_SPM_MODE_CLOCK_GATING,
1646 .notify_rpm = false,
1647 .cmd = spm_wfi_cmd_sequence,
1648 },
1649
1650 [1] = {
1651 .mode = MSM_SPM_MODE_POWER_RETENTION,
1652 .notify_rpm = false,
1653 .cmd = spm_retention_cmd_sequence,
1654 },
1655
1656 [2] = {
1657 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1658 .notify_rpm = false,
1659 .cmd = spm_power_collapse_without_rpm,
1660 },
1661 [3] = {
1662 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1663 .notify_rpm = true,
1664 .cmd = spm_power_collapse_with_rpm,
1665 },
1666};
1667
1668static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001669 [0] = {
1670 .mode = MSM_SPM_MODE_CLOCK_GATING,
1671 .notify_rpm = false,
1672 .cmd = spm_wfi_cmd_sequence,
1673 },
1674 [1] = {
1675 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1676 .notify_rpm = false,
1677 .cmd = spm_power_collapse_without_rpm,
1678 },
1679 [2] = {
1680 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1681 .notify_rpm = true,
1682 .cmd = spm_power_collapse_with_rpm,
1683 },
1684};
1685
1686static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1687 [0] = {
1688 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001690#if defined(CONFIG_MSM_AVS_HW)
1691 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1692 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1693#endif
1694 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001695 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1696 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1697 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001699 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1700 .modes = msm_spm_boot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001701 },
1702 [1] = {
1703 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001704 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001705#if defined(CONFIG_MSM_AVS_HW)
1706 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1707 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1708#endif
1709 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001710 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001711 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1712 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1713 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001714 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1715 .modes = msm_spm_nonboot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716 },
1717};
1718
1719static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1720 0x00, 0x20, 0x03, 0x20,
1721 0x00, 0x0f,
1722};
1723
1724static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1725 0x00, 0x20, 0x34, 0x64,
1726 0x48, 0x07, 0x48, 0x20,
1727 0x50, 0x64, 0x04, 0x34,
1728 0x50, 0x0f,
1729};
1730static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1731 0x00, 0x10, 0x34, 0x64,
1732 0x48, 0x07, 0x48, 0x10,
1733 0x50, 0x64, 0x04, 0x34,
1734 0x50, 0x0F,
1735};
1736
1737static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1738 [0] = {
1739 .mode = MSM_SPM_L2_MODE_RETENTION,
1740 .notify_rpm = false,
1741 .cmd = l2_spm_wfi_cmd_sequence,
1742 },
1743 [1] = {
1744 .mode = MSM_SPM_L2_MODE_GDHS,
1745 .notify_rpm = true,
1746 .cmd = l2_spm_gdhs_cmd_sequence,
1747 },
1748 [2] = {
1749 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1750 .notify_rpm = true,
1751 .cmd = l2_spm_power_off_cmd_sequence,
1752 },
1753};
1754
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001755static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1756 [0] = {
1757 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001758 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001759 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001760 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1761 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1762 .modes = msm_spm_l2_seq_list,
1763 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1764 },
1765};
1766
Anirudh Ghayal15698162012-07-31 11:51:32 +05301767#define HAP_SHIFT_LVL_OE_GPIO 47
1768#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301769#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1770#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1771
1772static struct msm_xo_voter *xo_handle_d1;
1773
1774static int isa1200_power(int on)
1775{
1776 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301777 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301778
Anirudh Ghayal15698162012-07-31 11:51:32 +05301779 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1780 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1781
1782
1783 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301784
1785 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1786 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1787 if (rc < 0) {
1788 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1789 __func__, on ? "" : "de-", rc);
1790 goto err_xo_vote;
1791 }
1792
1793 return 0;
1794
1795err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301796 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301797 return rc;
1798}
1799
1800static int isa1200_dev_setup(bool enable)
1801{
1802 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301803 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301804
1805 struct pm_gpio hap_gpio_config = {
1806 .direction = PM_GPIO_DIR_OUT,
1807 .pull = PM_GPIO_PULL_NO,
1808 .out_strength = PM_GPIO_STRENGTH_HIGH,
1809 .function = PM_GPIO_FUNC_NORMAL,
1810 .inv_int_pol = 0,
1811 .vin_sel = 2,
1812 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1813 .output_value = 0,
1814 };
1815
Anirudh Ghayal15698162012-07-31 11:51:32 +05301816 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1817 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1818
Mohan Pallaka5e490392011-09-09 15:18:41 +05301819 if (enable == true) {
1820 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1821 if (rc) {
1822 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1823 __func__, PM_HAP_EN_GPIO, rc);
1824 return rc;
1825 }
1826
1827 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1828 if (rc) {
1829 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1830 __func__, PM_HAP_LEN_GPIO, rc);
1831 return rc;
1832 }
1833
Anirudh Ghayal15698162012-07-31 11:51:32 +05301834 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301835 if (rc) {
1836 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301837 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301838 return rc;
1839 }
1840
Anirudh Ghayal15698162012-07-31 11:51:32 +05301841 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301842 if (rc) {
1843 pr_err("%s: Unable to set direction\n", __func__);
1844 goto free_gpio;
1845 }
1846
1847 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1848 if (IS_ERR(xo_handle_d1)) {
1849 rc = PTR_ERR(xo_handle_d1);
1850 pr_err("%s: failed to get the handle for D1(%d)\n",
1851 __func__, rc);
1852 goto gpio_set_dir;
1853 }
1854 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301855 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301856
1857 msm_xo_put(xo_handle_d1);
1858 }
1859
1860 return 0;
1861
1862gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301863 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301864free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301865 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301866 return rc;
1867}
1868
1869static struct isa1200_regulator isa1200_reg_data[] = {
1870 {
1871 .name = "vcc_i2c",
1872 .min_uV = ISA_I2C_VTG_MIN_UV,
1873 .max_uV = ISA_I2C_VTG_MAX_UV,
1874 .load_uA = ISA_I2C_CURR_UA,
1875 },
1876};
1877
1878static struct isa1200_platform_data isa1200_1_pdata = {
1879 .name = "vibrator",
1880 .dev_setup = isa1200_dev_setup,
1881 .power_on = isa1200_power,
1882 .hap_en_gpio = PM_HAP_EN_GPIO,
1883 .hap_len_gpio = PM_HAP_LEN_GPIO,
1884 .max_timeout = 15000,
1885 .mode_ctrl = PWM_GEN_MODE,
1886 .pwm_fd = {
1887 .pwm_div = 256,
1888 },
1889 .is_erm = false,
1890 .smart_en = true,
1891 .ext_clk_en = true,
1892 .chip_en = 1,
1893 .regulator_info = isa1200_reg_data,
1894 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1895};
1896
1897static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1898 {
1899 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301900 },
1901};
1902
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903#define CYTTSP_TS_GPIO_IRQ 11
1904#define CYTTSP_TS_SLEEP_GPIO 50
1905#define CYTTSP_TS_RESOUT_N_GPIO 52
1906
1907/*virtual key support */
1908static ssize_t tma340_vkeys_show(struct kobject *kobj,
1909 struct kobj_attribute *attr, char *buf)
1910{
1911 return snprintf(buf, 200,
1912 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1913 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1914 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1915 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1916 "\n");
1917}
1918
1919static struct kobj_attribute tma340_vkeys_attr = {
1920 .attr = {
1921 .mode = S_IRUGO,
1922 },
1923 .show = &tma340_vkeys_show,
1924};
1925
1926static struct attribute *tma340_properties_attrs[] = {
1927 &tma340_vkeys_attr.attr,
1928 NULL
1929};
1930
1931static struct attribute_group tma340_properties_attr_group = {
1932 .attrs = tma340_properties_attrs,
1933};
1934
1935
1936static int cyttsp_platform_init(struct i2c_client *client)
1937{
1938 int rc = 0;
1939 static struct kobject *tma340_properties_kobj;
1940
1941 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1942 tma340_properties_kobj = kobject_create_and_add("board_properties",
1943 NULL);
1944 if (tma340_properties_kobj)
1945 rc = sysfs_create_group(tma340_properties_kobj,
1946 &tma340_properties_attr_group);
1947 if (!tma340_properties_kobj || rc)
1948 pr_err("%s: failed to create board_properties\n",
1949 __func__);
1950
1951 return 0;
1952}
1953
1954static struct cyttsp_regulator regulator_data[] = {
1955 {
1956 .name = "vdd",
1957 .min_uV = CY_TMA300_VTG_MIN_UV,
1958 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301959 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1960 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961 },
1962 /* TODO: Remove after runtime PM is enabled in I2C driver */
1963 {
1964 .name = "vcc_i2c",
1965 .min_uV = CY_I2C_VTG_MIN_UV,
1966 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301967 .hpm_load_uA = CY_I2C_CURR_UA,
1968 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001969 },
1970};
1971
1972static struct cyttsp_platform_data cyttsp_pdata = {
1973 .panel_maxx = 634,
1974 .panel_maxy = 1166,
1975 .disp_maxx = 616,
1976 .disp_maxy = 1023,
1977 .disp_minx = 0,
1978 .disp_miny = 16,
1979 .flags = 0x01,
1980 .gen = CY_GEN3, /* or */
1981 .use_st = CY_USE_ST,
1982 .use_mt = CY_USE_MT,
1983 .use_hndshk = CY_SEND_HNDSHK,
1984 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301985 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001986 .use_gestures = CY_USE_GESTURES,
1987 .fw_fname = "cyttsp_8960_cdp.hex",
1988 /* activate up to 4 groups
1989 * and set active distance
1990 */
1991 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1992 CY_GEST_GRP3 | CY_GEST_GRP4 |
1993 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07001994 .act_intrvl = 10,
1995 .tch_tmout = 200,
1996 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001997 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1998 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1999 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2000 .regulator_info = regulator_data,
2001 .num_regulators = ARRAY_SIZE(regulator_data),
2002 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302003 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002004};
2005
2006static struct i2c_board_info cyttsp_info[] __initdata = {
2007 {
2008 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2009 .platform_data = &cyttsp_pdata,
2010#ifndef CY_USE_TIMER
2011 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2012#endif /* CY_USE_TIMER */
2013 },
2014};
2015
Jing Lindc4413c2012-01-16 15:22:52 -08002016/* configuration data for mxt1386 */
2017static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05302018 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002019 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302020 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002021 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002022 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2023 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2025 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2026 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2027 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302028 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002029 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302030 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002031 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302032 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002033 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2034 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2035 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2036 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302037 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002038 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2039 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302040 /* T18 Object */
2041 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302042 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002043 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2044 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302045 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002046 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2047 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302048 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002049 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2050 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302051 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002052 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302053 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002054 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302055 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002056 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302057 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002058 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302059 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002060 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302061};
2062
Jing Lin33b007d2011-12-21 17:40:23 -08002063/* configuration data for mxt1386e using V1.0 firmware */
2064static const u8 mxt1386e_config_data_v1_0[] = {
2065 /* T6 Object */
2066 0, 0, 0, 0, 0, 0,
2067 /* T38 Object */
2068 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2069 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2070 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2071 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2072 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2074 0, 0, 0, 0,
2075 /* T7 Object */
2076 100, 16, 50,
2077 /* T8 Object */
2078 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2079 /* T9 Object */
2080 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2081 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2082 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2083 10, 5, 0, 0, 0,
2084 /* T18 Object */
2085 0, 0,
2086 /* T24 Object */
2087 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2088 0, 0, 0, 0, 0, 0, 0, 0, 0,
2089 /* T25 Object */
2090 3, 0, 60, 115, 156, 99,
2091 /* T27 Object */
2092 0, 0, 0, 0, 0, 0, 0,
2093 /* T40 Object */
2094 0, 0, 0, 0, 0,
2095 /* T42 Object */
2096 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2097 /* T43 Object */
2098 0, 0, 0, 0, 0, 0, 0,
2099 /* T46 Object */
2100 64, 0, 20, 20, 0, 0, 0, 0, 0,
2101 /* T47 Object */
2102 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2103 /* T48 Object */
2104 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2105 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2106 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2107 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2109 0, 0, 0, 0,
2110 /* T56 Object */
2111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2115 2, 99, 33,
2116};
2117
2118/* configuration data for mxt1386e using V2.1 firmware */
2119static const u8 mxt1386e_config_data_v2_1[] = {
2120 /* T6 Object */
2121 0, 0, 0, 0, 0, 0,
2122 /* T38 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002123 12, 4, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2126 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2127 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2128 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2129 0, 0, 0, 0,
2130 /* T7 Object */
2131 100, 16, 50,
2132 /* T8 Object */
2133 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2134 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002135 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002136 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002137 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2138 10, 5, 0, 0, 0,
2139 /* T18 Object */
2140 0, 0,
2141 /* T24 Object */
2142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2143 0, 0, 0, 0, 0, 0, 0, 0, 0,
2144 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002145 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002146 /* T27 Object */
2147 0, 0, 0, 0, 0, 0, 0,
2148 /* T40 Object */
2149 0, 0, 0, 0, 0,
2150 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002151 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002152 /* T43 Object */
2153 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2154 16,
2155 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002156 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002157 /* T47 Object */
2158 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2159 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002160 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002161 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2162 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2163 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2165 0, 0, 0, 0,
2166 /* T56 Object */
2167 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2168 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2170 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2171 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2172 255,
2173};
2174
Jing Lineec88ca2012-02-08 11:18:30 -08002175/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2176static const u8 mxt1386e_config_data_3d[] = {
2177 /* T6 Object */
2178 0, 0, 0, 0, 0, 0,
2179 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002180 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002181 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2182 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2183 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2186 0, 0, 0, 0,
2187 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002188 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002189 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002190 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002191 /* T9 Object */
2192 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2193 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002194 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2195 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002196 /* T18 Object */
2197 0, 0,
2198 /* T24 Object */
2199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2200 0, 0, 0, 0, 0, 0, 0, 0, 0,
2201 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002202 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002203 /* T27 Object */
2204 0, 0, 0, 0, 0, 0, 0,
2205 /* T40 Object */
2206 0, 0, 0, 0, 0,
2207 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002208 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002209 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2211 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002212 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002213 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002214 /* T47 Object */
2215 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2216 /* T48 Object */
2217 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002218 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2219 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2220 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002221 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2222 0, 0, 0, 0,
2223 /* T56 Object */
2224 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2226 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2229 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002230};
2231
Amy Maloche08266db2011-11-04 11:07:16 -07002232#define MXT_TS_GPIO_IRQ 11
2233#define MXT_TS_LDO_EN_GPIO 50
2234#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302235
2236static void mxt_init_hw_liquid(void)
2237{
2238 int rc;
2239
Mohan Pallaka50837382011-09-07 11:00:57 +05302240 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2241 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002242 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2243 __func__, MXT_TS_LDO_EN_GPIO);
2244 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302245 }
2246
2247 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2248 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002249 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2250 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302251 goto err_ldo_gpio_req;
2252 }
2253
Mohan Pallaka50837382011-09-07 11:00:57 +05302254 return;
2255
Mohan Pallaka50837382011-09-07 11:00:57 +05302256err_ldo_gpio_req:
2257 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302258}
2259
Jing Lineec88ca2012-02-08 11:18:30 -08002260static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002261 {
2262 .config = mxt1386_config_data,
2263 .config_length = ARRAY_SIZE(mxt1386_config_data),
2264 .family_id = 0xA0,
2265 .variant_id = 0x0,
2266 .version = 0x10,
2267 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002268 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002269 },
Jing Lin33b007d2011-12-21 17:40:23 -08002270 {
2271 .config = mxt1386e_config_data_v1_0,
2272 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2273 .family_id = 0xA0,
2274 .variant_id = 0x2,
2275 .version = 0x10,
2276 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002277 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002278 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002279 },
2280 {
2281 .config = mxt1386e_config_data_v2_1,
2282 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2283 .family_id = 0xA0,
2284 .variant_id = 0x7,
2285 .version = 0x21,
2286 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002287 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002288 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2289 },
2290 {
2291 /* The config data for V2.2.AA is the same as for V2.1.AA */
2292 .config = mxt1386e_config_data_v2_1,
2293 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2294 .family_id = 0xA0,
2295 .variant_id = 0x7,
2296 .version = 0x22,
2297 .build = 0xAA,
2298 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002299 },
Jing Lindc4413c2012-01-16 15:22:52 -08002300};
2301
Jing Lineec88ca2012-02-08 11:18:30 -08002302static struct mxt_platform_data mxt_platform_data_2d = {
2303 .config_array = mxt_config_array_2d,
2304 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002305 .panel_minx = 0,
2306 .panel_maxx = 1365,
2307 .panel_miny = 0,
2308 .panel_maxy = 767,
2309 .disp_minx = 0,
2310 .disp_maxx = 1365,
2311 .disp_miny = 0,
2312 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302313 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002314 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002315 .reset_gpio = MXT_TS_RESET_GPIO,
2316 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302317};
2318
Jing Lineec88ca2012-02-08 11:18:30 -08002319static struct mxt_config_info mxt_config_array_3d[] = {
2320 {
2321 .config = mxt1386e_config_data_3d,
2322 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2323 .family_id = 0xA0,
2324 .variant_id = 0x7,
2325 .version = 0x21,
2326 .build = 0xAA,
2327 },
2328};
2329
2330static struct mxt_platform_data mxt_platform_data_3d = {
2331 .config_array = mxt_config_array_3d,
2332 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002333 .panel_minx = 0,
2334 .panel_maxx = 1919,
2335 .panel_miny = 0,
2336 .panel_maxy = 1199,
2337 .disp_minx = 0,
2338 .disp_maxx = 1919,
2339 .disp_miny = 0,
2340 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002341 .irqflags = IRQF_TRIGGER_FALLING,
2342 .i2c_pull_up = true,
2343 .reset_gpio = MXT_TS_RESET_GPIO,
2344 .irq_gpio = MXT_TS_GPIO_IRQ,
2345};
2346
Mohan Pallaka50837382011-09-07 11:00:57 +05302347static struct i2c_board_info mxt_device_info[] __initdata = {
2348 {
2349 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302350 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2351 },
2352};
2353
Manoj Rao14648742012-03-30 19:42:12 -07002354static struct msm_mhl_platform_data mhl_platform_data = {
2355 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002356 .gpio_mhl_int = MHL_GPIO_INT,
2357 .gpio_mhl_reset = MHL_GPIO_RESET,
2358 .gpio_mhl_power = 0,
2359 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002360};
Manoj Rao14648742012-03-30 19:42:12 -07002361
Eugene Yasmand2316b82011-12-07 18:23:48 +02002362static struct i2c_board_info sii_device_info[] __initdata = {
2363 {
Manoj Rao14648742012-03-30 19:42:12 -07002364#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2365 /*
2366 * keeps SI 8334 as the default
2367 * MHL TX
2368 */
2369 I2C_BOARD_INFO("sii8334", 0x39),
2370 .platform_data = &mhl_platform_data,
2371#endif
2372#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002373 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002374 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002375#endif /* CONFIG_MSM_HDMI_MHL */
2376 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002377 },
2378};
2379
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002380static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2381 .clk_freq = 100000,
2382 .src_clk_rate = 24000000,
Kiran Gunda9aa5e912012-08-16 18:37:46 +05302383 .keep_ahb_clk_on = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002384};
2385
2386static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2387 .clk_freq = 100000,
2388 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002389};
2390
2391static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2392 .clk_freq = 100000,
2393 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002394};
2395
2396static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2397 .clk_freq = 100000,
2398 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002399};
2400
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002401static struct ks8851_pdata spi_eth_pdata = {
2402 .irq_gpio = KS8851_IRQ_GPIO,
2403 .rst_gpio = KS8851_RST_GPIO,
2404};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002405
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302406static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002407 {
2408 .modalias = "ks8851",
2409 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2410 .max_speed_hz = 19200000,
2411 .bus_num = 0,
2412 .chip_select = 0,
2413 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002414 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002415 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302416};
2417static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002418 {
2419 .modalias = "dsi_novatek_3d_panel_spi",
2420 .max_speed_hz = 10800000,
2421 .bus_num = 0,
2422 .chip_select = 1,
2423 .mode = SPI_MODE_0,
2424 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002425};
2426
2427static struct platform_device msm_device_saw_core0 = {
2428 .name = "saw-regulator",
2429 .id = 0,
2430 .dev = {
2431 .platform_data = &msm_saw_regulator_pdata_s5,
2432 },
2433};
2434
2435static struct platform_device msm_device_saw_core1 = {
2436 .name = "saw-regulator",
2437 .id = 1,
2438 .dev = {
2439 .platform_data = &msm_saw_regulator_pdata_s6,
2440 },
2441};
2442
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002443static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002444 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002445 .tsens_factor = 1000,
2446 .hw_type = MSM_8960,
2447 .tsens_num_sensor = 5,
2448};
2449
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002450static struct platform_device msm_tsens_device = {
2451 .name = "tsens8960-tm",
2452 .id = -1,
2453};
2454
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002455static struct msm_thermal_data msm_thermal_pdata = {
2456 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002457 .poll_ms = 250,
2458 .limit_temp_degC = 60,
2459 .temp_hysteresis_degC = 10,
2460 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002461};
2462
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002463#ifdef CONFIG_MSM_FAKE_BATTERY
2464static struct platform_device fish_battery_device = {
2465 .name = "fish_battery",
2466};
2467#endif
2468
David Collins26f05562011-06-20 09:56:28 -07002469static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002470 .name = GPIO_REGULATOR_DEV_NAME,
2471 .id = PM8921_MPP_PM_TO_SYS(7),
2472 .dev = {
2473 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2474 },
2475};
2476
David Collins26f05562011-06-20 09:56:28 -07002477static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002478 .name = GPIO_REGULATOR_DEV_NAME,
2479 .id = 91,
2480 .dev = {
2481 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2482 },
2483};
2484
David Collinsb10be1d2011-09-02 10:29:31 -07002485static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2486 .name = GPIO_REGULATOR_DEV_NAME,
2487 .id = PM8921_GPIO_PM_TO_SYS(17),
2488 .dev = {
2489 .platform_data =
2490 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2491 },
2492};
2493
David Collins35a78f52011-12-14 15:54:25 -08002494static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2495 .name = GPIO_REGULATOR_DEV_NAME,
2496 .id = PM8921_GPIO_PM_TO_SYS(42),
2497 .dev = {
2498 .platform_data =
2499 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2500 },
2501};
2502
David Collins26f05562011-06-20 09:56:28 -07002503static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2504 .name = "rpm-regulator",
2505 .id = -1,
2506 .dev = {
2507 .platform_data = &msm_rpm_regulator_pdata,
2508 },
2509};
Mayank Ranae009c922012-03-22 03:02:06 +05302510#ifdef CONFIG_SERIAL_MSM_HS
2511static int configure_uart_gpios(int on)
2512{
2513 int ret = 0, i;
2514 int uart_gpios[] = {93, 94, 95, 96};
2515
2516 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2517 if (on) {
2518 ret = gpio_request(uart_gpios[i], NULL);
2519 if (ret) {
2520 pr_err("%s: unable to request uart gpio[%d]\n",
2521 __func__, uart_gpios[i]);
2522 break;
2523 }
2524 } else {
2525 gpio_free(uart_gpios[i]);
2526 }
2527 }
2528
2529 if (ret && on && i)
2530 for (; i >= 0; i--)
2531 gpio_free(uart_gpios[i]);
2532 return ret;
2533}
2534
2535static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002536 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302537};
Mayank Rana1f02d952012-07-04 19:11:20 +05302538
2539static int configure_gsbi8_uart_gpios(int on)
2540{
2541 int ret = 0, i;
2542 int uart_gpios[] = {34, 35, 36, 37};
2543
2544 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2545 if (on) {
2546 ret = gpio_request(uart_gpios[i], NULL);
2547 if (ret) {
2548 pr_err("%s: unable to request uart gpio[%d]\n",
2549 __func__, uart_gpios[i]);
2550 break;
2551 }
2552 } else {
2553 gpio_free(uart_gpios[i]);
2554 }
2555 }
2556
2557 if (ret && on && i)
2558 for (; i >= 0; i--)
2559 gpio_free(uart_gpios[i]);
2560 return ret;
2561}
2562
2563static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2564 .gpio_config = configure_gsbi8_uart_gpios,
2565};
Mayank Ranae009c922012-03-22 03:02:06 +05302566#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302567static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302568static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2569#endif
David Collins26f05562011-06-20 09:56:28 -07002570
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302571#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2572static struct resource bluesleep_resources[] = {
2573 {
2574 .name = "gpio_host_wake",
2575 .start = 27,
2576 .end = 27,
2577 .flags = IORESOURCE_IO,
2578 },
2579 {
2580 .name = "gpio_ext_wake",
2581 .start = 29,
2582 .end = 29,
2583 .flags = IORESOURCE_IO,
2584 },
2585 {
2586 .name = "host_wake",
2587 .start = MSM_GPIO_TO_INT(27),
2588 .end = MSM_GPIO_TO_INT(27),
2589 .flags = IORESOURCE_IRQ,
2590 },
2591};
2592
2593static struct platform_device msm_bluesleep_device = {
2594 .name = "bluesleep",
2595 .id = -1,
2596 .num_resources = ARRAY_SIZE(bluesleep_resources),
2597 .resource = bluesleep_resources,
2598};
2599
2600static struct platform_device msm_bt_power_device = {
2601 .name = "bt_power",
2602};
2603
2604int gpio_bt_sys_rest_en = 28;
2605
2606static int bluetooth_power(int on)
2607{
2608 int rc;
2609
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302610 pr_debug("%s on= %d\n", __func__, on);
2611
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302612 if (on) {
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302613 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2614 if (rc) {
2615 pr_err("%s: unable to request gpio %d (%d)\n",
2616 __func__, gpio_bt_sys_rest_en, rc);
2617 goto out;
2618 }
2619 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
2620 if (rc) {
2621 pr_err("%s: Unable to set gpio %d direction\n",
2622 __func__, gpio_bt_sys_rest_en);
2623 goto free_gpio;
2624 }
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302625 msleep(100);
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302626 gpio_set_value(gpio_bt_sys_rest_en, 1);
2627 msleep(100);
2628 goto out;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302629 } else {
2630 gpio_set_value(gpio_bt_sys_rest_en, 0);
2631 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2632 msleep(100);
2633 }
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302634
2635free_gpio:
2636 gpio_free(gpio_bt_sys_rest_en);
2637out:
2638 return rc;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302639}
2640
2641static void __init bt_power_init(void)
2642{
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302643 pr_debug("%s enter\n", __func__);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302644 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302645
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302646 return;
2647}
2648#else
2649#define bt_power_init(x) do {} while (0)
2650#endif
2651
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002652static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002653 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002654 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302655 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002656 &msm_device_saw_core0,
2657 &msm_device_saw_core1,
2658 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002659 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002660 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002661 &msm8960_device_qup_spi_gsbi1,
2662 &msm8960_device_qup_i2c_gsbi3,
2663 &msm8960_device_qup_i2c_gsbi4,
2664 &msm8960_device_qup_i2c_gsbi10,
2665#ifndef CONFIG_MSM_DSPS
2666 &msm8960_device_qup_i2c_gsbi12,
2667#endif
2668 &msm_slim_ctrl,
2669 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302670#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2671 &msm_bluesleep_device,
2672 &msm_bt_power_device,
2673#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002674#if defined(CONFIG_QSEECOM)
2675 &qseecom_device,
2676#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002677#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2678 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2679 &qcrypto_device,
2680#endif
2681
2682#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2683 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2684 &qcedev_device,
2685#endif
2686#ifdef CONFIG_MSM_ROTATOR
2687 &msm_rotator_device,
2688#endif
2689 &msm_device_sps,
2690#ifdef CONFIG_MSM_FAKE_BATTERY
2691 &fish_battery_device,
2692#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002693 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002694#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002695#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002696 &msm8960_android_pmem_device,
2697 &msm8960_android_pmem_adsp_device,
2698 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002699#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002700#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002701 &msm_device_bam_dmux,
2702 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002703#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2704#ifdef CONFIG_MSM_USE_TSIF1
2705 &msm_device_tsif[1],
2706#else
2707 &msm_device_tsif[0],
2708#endif
2709#endif
Joel Nider266a2642011-10-16 10:58:05 +02002710 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002711#ifdef CONFIG_HW_RANDOM_MSM
2712 &msm_device_rng,
2713#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002714#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002715 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002716#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002717 &msm8960_rpm_device,
2718 &msm8960_rpm_log_device,
2719 &msm8960_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002720 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002721 &coresight_tpiu_device,
2722 &coresight_etb_device,
2723 &coresight_funnel_device,
2724 &coresight_etm0_device,
2725 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002726 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002727 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002728 &msm8960_rtb_device,
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -07002729 &msm8960_cpu_idle_device,
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -07002730 &msm8960_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002731 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002732 &msm8960_device_ebi1_ch0_erp,
2733 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002734 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002735 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002736 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002737};
2738
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002739static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002740 &msm_8960_q6_lpass,
2741 &msm_8960_q6_mss_fw,
2742 &msm_8960_q6_mss_sw,
Stephen Boyd322a9922011-09-20 01:05:54 -07002743 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002744 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002745 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002746 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002747 &msm8960_device_otg,
2748 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002749 &msm_device_hsusb_host,
2750 &android_usb_device,
2751 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002752 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002753 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002754 &msm_pcm_routing,
2755 &msm_cpudai0,
2756 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002757 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002758 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002759 &msm_cpudai_hdmi_rx,
2760 &msm_cpudai_bt_rx,
2761 &msm_cpudai_bt_tx,
2762 &msm_cpudai_fm_rx,
2763 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002764 &msm_cpudai_auxpcm_rx,
2765 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002766 &msm_cpu_fe,
2767 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002768#ifdef CONFIG_MSM_GEMINI
2769 &msm8960_gemini_device,
2770#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002771#ifdef CONFIG_MSM_MERCURY
2772 &msm8960_mercury_device,
2773#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002774 &msm_voice,
2775 &msm_voip,
2776 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302777 &msm_cpudai_afe_01_rx,
2778 &msm_cpudai_afe_01_tx,
2779 &msm_cpudai_afe_02_rx,
2780 &msm_cpudai_afe_02_tx,
2781 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302782 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002783 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002784 &msm_cpudai_incall_record_rx,
2785 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002786 &msm_pcm_hostless,
2787 &msm_bus_apps_fabric,
2788 &msm_bus_sys_fabric,
2789 &msm_bus_mm_fabric,
2790 &msm_bus_sys_fpb,
2791 &msm_bus_cpss_fpb,
2792};
2793
2794static void __init msm8960_i2c_init(void)
2795{
2796 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2797 &msm8960_i2c_qup_gsbi4_pdata;
2798
2799 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2800 &msm8960_i2c_qup_gsbi3_pdata;
2801
2802 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2803 &msm8960_i2c_qup_gsbi10_pdata;
2804
2805 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2806 &msm8960_i2c_qup_gsbi12_pdata;
2807}
2808
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002809static void __init msm8960_gfx_init(void)
2810{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002811 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2812 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002813 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002814
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002815 if (cpu_is_msm8960ab()) {
2816 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Carter Cooper9be5c4d2012-08-22 13:27:58 -06002817 /* 8960PRO nominal clock rate is 325Mhz instead of 320Mhz */
2818 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 325000000;
Carter Coopera7e0e662012-08-19 13:40:34 -06002819 } else if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2820 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2821 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2822 } else if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002823 /* 8960v3 GPU registers returns 5 for patch release
2824 * but it should be 6, so dummy up the chipid here
2825 * based the platform type
2826 */
Carter Coopera7e0e662012-08-19 13:40:34 -06002827 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002828 }
Carter Cooper83e9dab2012-08-20 15:17:23 -06002829
2830 /* Register the 3D core */
2831 platform_device_register(&msm_kgsl_3d0);
2832
2833 /* Register the 2D cores if we are not 8960PRO */
2834 if (!cpu_is_msm8960ab()) {
2835 platform_device_register(&msm_kgsl_2d0);
2836 platform_device_register(&msm_kgsl_2d1);
2837 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002838}
2839
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302840static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002841 {
2842 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2843 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2844 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002845 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002846 },
2847
2848 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002849 MSM_PM_SLEEP_MODE_RETENTION,
2850 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2851 true,
2852 415, 715, 340827, 475,
2853 },
2854
2855 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002856 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2857 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2858 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002859 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002860 },
2861
2862 {
2863 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2864 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2865 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002866 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002867 },
2868
2869 {
2870 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002871 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2872 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002873 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002874 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002875
2876 {
2877 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2878 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2879 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002880 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002881 },
2882
2883 {
2884 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2885 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2886 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002887 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002888 },
2889
2890 {
2891 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2892 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2893 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002894 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002895 },
2896
2897 {
2898 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2899 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2900 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002901 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002902 },
2903};
2904
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002905
Praveen Chidambaram78499012011-11-01 17:15:17 -06002906static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2907 .levels = &msm_rpmrs_levels[0],
2908 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2909 .vdd_mem_levels = {
2910 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2911 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2912 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2913 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2914 },
2915 .vdd_dig_levels = {
2916 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2917 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2918 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2919 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2920 },
2921 .vdd_mask = 0x7FFFFF,
2922 .rpmrs_target_id = {
2923 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2924 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2925 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2926 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2927 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2928 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2929 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2930 },
2931};
2932
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002933static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2934 .mode = MSM_PM_BOOT_CONFIG_TZ,
2935};
2936
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002937#ifdef CONFIG_I2C
2938#define I2C_SURF 1
2939#define I2C_FFA (1 << 1)
2940#define I2C_RUMI (1 << 2)
2941#define I2C_SIM (1 << 3)
2942#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002943#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002944
2945struct i2c_registry {
2946 u8 machs;
2947 int bus;
2948 struct i2c_board_info *info;
2949 int len;
2950};
2951
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002952/* Sensors DSPS platform data */
2953#ifdef CONFIG_MSM_DSPS
2954#define DSPS_PIL_GENERIC_NAME "dsps"
2955#endif /* CONFIG_MSM_DSPS */
2956
2957static void __init msm8960_init_dsps(void)
2958{
2959#ifdef CONFIG_MSM_DSPS
2960 struct msm_dsps_platform_data *pdata =
2961 msm_dsps_device.dev.platform_data;
2962 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2963 pdata->gpios = NULL;
2964 pdata->gpios_num = 0;
2965
2966 platform_device_register(&msm_dsps_device);
2967#endif /* CONFIG_MSM_DSPS */
2968}
2969
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08002970static int hsic_peripheral_status = 1;
2971static DEFINE_MUTEX(hsic_status_lock);
2972
2973void peripheral_connect()
2974{
2975 mutex_lock(&hsic_status_lock);
2976 if (hsic_peripheral_status)
2977 goto out;
2978 platform_device_add(&msm_device_hsic_host);
2979 hsic_peripheral_status = 1;
2980out:
2981 mutex_unlock(&hsic_status_lock);
2982}
2983EXPORT_SYMBOL(peripheral_connect);
2984
2985void peripheral_disconnect()
2986{
2987 mutex_lock(&hsic_status_lock);
2988 if (!hsic_peripheral_status)
2989 goto out;
2990 platform_device_del(&msm_device_hsic_host);
2991 hsic_peripheral_status = 0;
2992out:
2993 mutex_unlock(&hsic_status_lock);
2994}
2995EXPORT_SYMBOL(peripheral_disconnect);
2996
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05302997static void __init msm8960_init_smsc_hub(void)
2998{
2999 uint32_t version = socinfo_get_version();
3000
3001 if (SOCINFO_VERSION_MAJOR(version) == 1)
3002 return;
3003
3004 if (machine_is_msm8960_liquid())
3005 platform_device_register(&smsc_hub_device);
3006}
3007
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003008static void __init msm8960_init_hsic(void)
3009{
3010#ifdef CONFIG_USB_EHCI_MSM_HSIC
3011 uint32_t version = socinfo_get_version();
3012
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003013 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003014 return;
3015
Joel King0cbf5d82012-05-24 15:21:38 -07003016 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003017 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003018#endif
3019}
3020
Amir Samuelov5137e392011-09-21 17:31:25 +03003021#ifdef CONFIG_ISL9519_CHARGER
3022static struct isl_platform_data isl_data __initdata = {
3023 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3024 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3025 .max_system_voltage = 4200,
3026 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003027 .chgcurrent = 1900,
3028 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003029 .input_current = 2048,
3030};
3031
3032static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3033 {
3034 I2C_BOARD_INFO("isl9519q", 0x9),
3035 .irq = 0, /* Not required when notify-by-pmic */
3036 .platform_data = &isl_data,
3037 },
3038};
3039#endif /* CONFIG_ISL9519_CHARGER */
3040
Amir Samuelov755616d2011-12-13 16:34:46 +02003041static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3042 {
3043 I2C_BOARD_INFO("sx1508q", 0x20),
3044 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3045 },
3046};
3047
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003048static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003049#ifdef CONFIG_ISL9519_CHARGER
3050 {
3051 I2C_LIQUID,
3052 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3053 isl_charger_i2c_info,
3054 ARRAY_SIZE(isl_charger_i2c_info),
3055 },
3056#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003057 {
3058 I2C_SURF | I2C_FFA | I2C_FLUID,
3059 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3060 cyttsp_info,
3061 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003062 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303063 {
3064 I2C_LIQUID,
3065 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3066 mxt_device_info,
3067 ARRAY_SIZE(mxt_device_info),
3068 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303069 {
Manoj Rao14648742012-03-30 19:42:12 -07003070 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303071 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003072 sii_device_info,
3073 ARRAY_SIZE(sii_device_info),
3074 },
3075 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303076 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003077 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303078 msm_isa1200_board_info,
3079 ARRAY_SIZE(msm_isa1200_board_info),
3080 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003081 {
3082 I2C_LIQUID,
3083 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3084 liquid_io_expander_i2c_info,
3085 ARRAY_SIZE(liquid_io_expander_i2c_info),
3086 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003087};
3088#endif /* CONFIG_I2C */
3089
3090static void __init register_i2c_devices(void)
3091{
3092#ifdef CONFIG_I2C
3093 u8 mach_mask = 0;
3094 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003095#ifdef CONFIG_MSM_CAMERA
3096 struct i2c_registry msm8960_camera_i2c_devices = {
3097 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3098 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3099 msm8960_camera_board_info.board_info,
3100 msm8960_camera_board_info.num_i2c_board_info,
3101 };
3102#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003103
3104 /* Build the matching 'supported_machs' bitmask */
3105 if (machine_is_msm8960_cdp())
3106 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003107 else if (machine_is_msm8960_fluid())
3108 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003109 else if (machine_is_msm8960_liquid())
3110 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003111 else if (machine_is_msm8960_mtp())
3112 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003113 else
3114 pr_err("unmatched machine ID in register_i2c_devices\n");
3115
Jing Lineec88ca2012-02-08 11:18:30 -08003116 if (machine_is_msm8960_liquid()) {
3117 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3118 mxt_device_info[0].platform_data =
3119 &mxt_platform_data_3d;
3120 else
3121 mxt_device_info[0].platform_data =
3122 &mxt_platform_data_2d;
3123 }
3124
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003125 /* Run the array and install devices as appropriate */
3126 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3127 if (msm8960_i2c_devices[i].machs & mach_mask)
3128 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3129 msm8960_i2c_devices[i].info,
3130 msm8960_i2c_devices[i].len);
3131 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003132
3133 if (!mhl_platform_data.gpio_mhl_power)
3134 pr_debug("mhl device configured for ext debug board\n");
3135
Kevin Chan09f4e662011-12-16 08:17:02 -08003136#ifdef CONFIG_MSM_CAMERA
3137 if (msm8960_camera_i2c_devices.machs & mach_mask)
3138 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3139 msm8960_camera_i2c_devices.info,
3140 msm8960_camera_i2c_devices.len);
3141#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003142#endif
3143}
3144
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003145static void __init msm8960_cdp_init(void)
3146{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003147 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3148 pr_err("meminfo_init() failed!\n");
3149
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003150 platform_device_register(&msm_gpio_device);
Siddartha Mohanadossfad0af12012-01-20 15:08:38 -08003151 msm_tsens_early_init(&msm_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003152 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003153 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3154 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003155
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003156 regulator_suppress_info_printing();
3157 if (msm_xo_init())
3158 pr_err("Failed to initialize XO votes\n");
David Collinse68647e2012-09-04 15:44:19 -07003159 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003160 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003161 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303162 if (machine_is_msm8960_liquid())
3163 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003164 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303165 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3166 machine_is_msm8960_cdp()) {
Mayank Ranaa61da7a2012-08-14 10:57:00 +05303167 /* Due to availability of USB Switch in SGLTE Platform
3168 * it requires different HSUSB PHY settings compare to
3169 * 8960 MTP/CDP platform.
3170 */
3171 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3172 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3173 else
3174 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303175 } else if (machine_is_msm8960_liquid()) {
3176 msm_otg_pdata.phy_init_seq =
3177 liquid_v1_phy_init_seq;
3178 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003179 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303180 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303181 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303182 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3183 machine_is_msm8960_liquid())
3184 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003185 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003186 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3187 &msm8960_qup_spi_gsbi1_pdata;
3188 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303189 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3190 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003191
3192 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303193 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
3194 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303195 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003196 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003197 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003198 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3199 msm_spm_l2_init(msm_spm_l2_data);
3200 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003201 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003202 if (machine_is_msm8960_liquid())
3203 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003204 if (machine_is_msm8960_cdp())
3205 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003206
3207 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3208 platform_device_register(&msm8960_device_uart_gsbi8);
3209 else
3210 platform_device_register(&msm8960_device_uart_gsbi5);
3211
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003212 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003213 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3214 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003215 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303216 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003217 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003218
Mayank Rana1f02d952012-07-04 19:11:20 +05303219 /* For 8960 Standalone External Bluetooth Interface */
3220 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3221 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3222 platform_device_register(&msm_device_uart_dm8);
3223 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003224 if (cpu_is_msm8960ab())
3225 platform_device_register(&msm8960ab_device_acpuclk);
3226 else
3227 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003228 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menon697e91b2012-08-20 15:25:50 -07003229 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003230
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003231 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003232 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303233 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003234 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003235#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003236 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003237#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003238 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303239 if (machine_is_msm8960_liquid())
3240 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003241 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003242 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003243 slim_register_board_info(msm_slim_devices,
3244 ARRAY_SIZE(msm_slim_devices));
3245 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003246 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003247 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303248 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003249 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3250 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3251 platform_device_register(&mdm_sglte_device);
3252 }
Girish Mahadevan3bc98772012-08-15 10:01:27 -06003253 msm_pm_set_tz_retention_flag(1);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003254}
3255
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003256MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3257 .map_io = msm8960_map_io,
3258 .reserve = msm8960_reserve,
3259 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303260 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003261 .timer = &msm_timer,
3262 .init_machine = msm8960_cdp_init,
3263 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003264 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003265 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003266MACHINE_END
3267
3268MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3269 .map_io = msm8960_map_io,
3270 .reserve = msm8960_reserve,
3271 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303272 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003273 .timer = &msm_timer,
3274 .init_machine = msm8960_cdp_init,
3275 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003276 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003277 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003278MACHINE_END
3279
3280MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3281 .map_io = msm8960_map_io,
3282 .reserve = msm8960_reserve,
3283 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303284 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003285 .timer = &msm_timer,
3286 .init_machine = msm8960_cdp_init,
3287 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003288 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003289 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003290MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003291
3292MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3293 .map_io = msm8960_map_io,
3294 .reserve = msm8960_reserve,
3295 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303296 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003297 .timer = &msm_timer,
3298 .init_machine = msm8960_cdp_init,
3299 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003300 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003301 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003302MACHINE_END