blob: d3b3cf937130b64510f12a6546e8f5ab4d788145 [file] [log] [blame]
Abhijeet Dharmapurikar7e37e6e2012-08-23 18:58:44 -07001/* Copyright (c) 2011-2012, The Linux Foundation. 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 Humpherys9dc32cf2012-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
Ming-yi Lin2d43cd52012-10-17 11:50:15 +0800105#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
106#include <linux/wlan_plat.h>
107#include <linux/mutex.h>
108#endif
109
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700110static struct platform_device msm_fm_platform_init = {
111 .name = "iris_fm",
112 .id = -1,
113};
114
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700115#define KS8851_RST_GPIO 89
116#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530117
Manoj Rao14648742012-03-30 19:42:12 -0700118#define MHL_GPIO_INT 4
119#define MHL_GPIO_RESET 15
120
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700121#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700122
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800123struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700124 [SX150X_CAM] = {
125 .gpio_base = GPIO_CAM_EXPANDER_BASE,
126 .oscio_is_gpo = false,
127 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530128 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700129 .io_open_drain_ena = 0x0,
130 .irq_summary = -1,
131 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200132 [SX150X_LIQUID] = {
133 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
134 .oscio_is_gpo = false,
135 .io_pullup_ena = 0x0c08,
136 .io_pulldn_ena = 0x4060,
137 .io_open_drain_ena = 0x000c,
138 .io_polarity = 0,
139 .irq_summary = -1,
140 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700141};
Nishant Pandit474f2252011-07-23 23:17:56 +0530142
143#endif
144
Olav Haugana21169d2012-01-04 09:17:06 -0800145#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700146#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800147#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800148#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800149#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700150
151#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur35825522012-06-06 15:49:14 -0700152#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700153#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700154#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700155#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700156#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700157#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700158#define MSM_ION_HEAP_NUM 7
159#else
160#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
161#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700162#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700163#define MSM_ION_HEAP_NUM 8
164#endif
Deepak Kotur35825522012-06-06 15:49:14 -0700165#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 128kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800166#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800167#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700168
Olav Hauganb5be7992011-11-18 14:29:02 -0800169#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800170#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
171#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700172
Deepak Kotur35825522012-06-06 15:49:14 -0700173#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2mb -128kb*/
174#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
175 HOLE_SIZE))
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700176#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur35825522012-06-06 15:49:14 -0700177#define MSM8960_FW_START MSM8960_FIXED_AREA_START
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700178
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800179static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700180#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700181#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800182#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700183#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700184
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700185#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
186static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
187static int __init msm_contig_mem_size_setup(char *p)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700188{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700189 msm_contig_mem_size = memparse(p, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700190 return 0;
191}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700192early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700193#endif
194
195#ifdef CONFIG_ANDROID_PMEM
196static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800197static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700198static int __init pmem_size_setup(char *p)
199{
200 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800201 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700202 return 0;
203}
204early_param("pmem_size", pmem_size_setup);
205
206static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
207
208static int __init pmem_adsp_size_setup(char *p)
209{
210 pmem_adsp_size = memparse(p, NULL);
211 return 0;
212}
213early_param("pmem_adsp_size", pmem_adsp_size_setup);
214
215static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
216
217static int __init pmem_audio_size_setup(char *p)
218{
219 pmem_audio_size = memparse(p, NULL);
220 return 0;
221}
222early_param("pmem_audio_size", pmem_audio_size_setup);
223#endif
224
225#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700226#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700227static struct android_pmem_platform_data android_pmem_pdata = {
228 .name = "pmem",
229 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
230 .cached = 1,
231 .memory_type = MEMTYPE_EBI1,
232};
233
Laura Abbottb93525f2012-04-12 09:57:19 -0700234static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700235 .name = "android_pmem",
236 .id = 0,
237 .dev = {.platform_data = &android_pmem_pdata},
238};
239
240static struct android_pmem_platform_data android_pmem_adsp_pdata = {
241 .name = "pmem_adsp",
242 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
243 .cached = 0,
244 .memory_type = MEMTYPE_EBI1,
245};
Laura Abbottb93525f2012-04-12 09:57:19 -0700246static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700247 .name = "android_pmem",
248 .id = 2,
249 .dev = { .platform_data = &android_pmem_adsp_pdata },
250};
251
252static struct android_pmem_platform_data android_pmem_audio_pdata = {
253 .name = "pmem_audio",
254 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
255 .cached = 0,
256 .memory_type = MEMTYPE_EBI1,
257};
258
Laura Abbottb93525f2012-04-12 09:57:19 -0700259static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700260 .name = "android_pmem",
261 .id = 4,
262 .dev = { .platform_data = &android_pmem_audio_pdata },
263};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700264#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
265#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700266
Laura Abbottb93525f2012-04-12 09:57:19 -0700267struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800268};
269
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700270#define DSP_RAM_BASE_8960 0x8da00000
271#define DSP_RAM_SIZE_8960 0x1800000
272static int dspcrashd_pdata_8960 = 0xDEADDEAD;
273
274static struct resource resources_dspcrashd_8960[] = {
275 {
276 .name = "msm_dspcrashd",
277 .start = DSP_RAM_BASE_8960,
278 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
279 .flags = IORESOURCE_DMA,
280 },
281};
282
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800283static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700284 .name = "msm_dspcrashd",
285 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
286 .resource = resources_dspcrashd_8960,
287 .dev = { .platform_data = &dspcrashd_pdata_8960 },
288};
289
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700290static struct memtype_reserve msm8960_reserve_table[] __initdata = {
291 [MEMTYPE_SMI] = {
292 },
293 [MEMTYPE_EBI0] = {
294 .flags = MEMTYPE_FLAGS_1M_ALIGN,
295 },
296 [MEMTYPE_EBI1] = {
297 .flags = MEMTYPE_FLAGS_1M_ALIGN,
298 },
299};
300
Laura Abbottf8c03b92012-02-16 14:57:58 -0800301static void __init reserve_rtb_memory(void)
302{
303#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700304 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800305#endif
306}
307
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308static void __init size_pmem_devices(void)
309{
310#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700311#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700312 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800313
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800314 if (!pmem_param_set) {
315 if (machine_is_msm8960_liquid())
316 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700317 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800318 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
319 }
320
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700321 android_pmem_pdata.size = pmem_size;
322 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700323#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
324#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700325}
326
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700327#ifdef CONFIG_ANDROID_PMEM
328#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329static void __init reserve_memory_for(struct android_pmem_platform_data *p)
330{
331 msm8960_reserve_table[p->memory_type].size += p->size;
332}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700333#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
334#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700335
336static void __init reserve_pmem_memory(void)
337{
338#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700339#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700340 reserve_memory_for(&android_pmem_adsp_pdata);
341 reserve_memory_for(&android_pmem_pdata);
342 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700343#endif
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700344 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345#endif
346}
347
Larry Basselb4126da2011-07-18 14:31:33 -0700348static int msm8960_paddr_to_memtype(unsigned int paddr)
349{
350 return MEMTYPE_EBI1;
351}
352
Steve Mucklef132c6c2012-06-06 18:30:57 -0700353#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800354
Laura Abbottd6183792011-08-19 13:42:24 -0700355#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800356#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700357static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800358 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700359 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800360 .reusable = FMEM_ENABLED,
361 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700362 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700363 .iommu_map_all = 1,
364 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800365};
366
Laura Abbottb93525f2012-04-12 09:57:19 -0700367static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800368 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800369 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800370 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800371 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700372 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800373};
374
Laura Abbottb93525f2012-04-12 09:57:19 -0700375static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800376 .adjacent_mem_id = INVALID_HEAP_ID,
377 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800378 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800379};
380
Laura Abbottb93525f2012-04-12 09:57:19 -0700381static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800382 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
383 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800384 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700385 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800386};
387#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800388
389/**
390 * These heaps are listed in the order they will be allocated. Due to
391 * video hardware restrictions and content protection the FW heap has to
392 * be allocated adjacent (below) the MM heap and the MFC heap has to be
393 * allocated after the MM heap to ensure MFC heap is not more than 256MB
394 * away from the base address of the FW heap.
395 * However, the order of FW heap and MM heap doesn't matter since these
396 * two heaps are taken care of by separate code to ensure they are adjacent
397 * to each other.
398 * Don't swap the order unless you know what you are doing!
399 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700400struct ion_platform_heap msm8960_heaps[] = {
Laura Abbottd6183792011-08-19 13:42:24 -0700401 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800402 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700403 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700404 .name = ION_VMALLOC_HEAP_NAME,
405 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700406#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700407 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800408 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800409 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800410 .name = ION_MM_HEAP_NAME,
411 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700412 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700413 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700414 },
Laura Abbott8c017362011-09-22 20:59:12 -0700415 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800416 .id = ION_MM_FIRMWARE_HEAP_ID,
417 .type = ION_HEAP_TYPE_CARVEOUT,
418 .name = ION_MM_FIRMWARE_HEAP_NAME,
419 .size = MSM_ION_MM_FW_SIZE,
420 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700421 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800422 },
423 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800424 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800425 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800426 .name = ION_MFC_HEAP_NAME,
427 .size = MSM_ION_MFC_SIZE,
428 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700429 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800430 },
Olav Haugan32594552012-03-13 11:40:05 -0700431#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800432 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800433 .id = ION_SF_HEAP_ID,
434 .type = ION_HEAP_TYPE_CARVEOUT,
435 .name = ION_SF_HEAP_NAME,
436 .size = MSM_ION_SF_SIZE,
437 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700438 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800439 },
Olav Haugan32594552012-03-13 11:40:05 -0700440#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800441 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800442 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700443 .type = ION_HEAP_TYPE_IOMMU,
444 .name = ION_IOMMU_HEAP_NAME,
445 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800446 {
447 .id = ION_QSECOM_HEAP_ID,
448 .type = ION_HEAP_TYPE_CARVEOUT,
449 .name = ION_QSECOM_HEAP_NAME,
450 .size = MSM_ION_QSECOM_SIZE,
451 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700452 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800453 },
Olav Haugan7355db02012-01-13 16:59:13 -0800454 {
455 .id = ION_AUDIO_HEAP_ID,
456 .type = ION_HEAP_TYPE_CARVEOUT,
457 .name = ION_AUDIO_HEAP_NAME,
458 .size = MSM_ION_AUDIO_SIZE,
459 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700460 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800461 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700462#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700463};
464
465static struct ion_platform_data msm8960_ion_pdata = {
466 .nr = MSM_ION_HEAP_NUM,
467 .heaps = msm8960_heaps,
Laura Abbottd6183792011-08-19 13:42:24 -0700468};
469
Laura Abbottb93525f2012-04-12 09:57:19 -0700470static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700471 .name = "ion-msm",
472 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700473 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700474};
475#endif
476
Laura Abbottb93525f2012-04-12 09:57:19 -0700477struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800478 .name = "fmem",
479 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700480 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800481};
482
Olav Haugan65f4bd82011-12-13 11:50:08 -0800483static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700484{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800485 unsigned int i;
486
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800487 if (!pmem_param_set) {
488 if (machine_is_msm8960_liquid())
489 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
490
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700491 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800492 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
493
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700494 if (machine_is_msm8960_liquid() ||
495 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700496 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
497 if (msm8960_ion_pdata.heaps[i].id ==
498 ION_SF_HEAP_ID) {
499 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800500 msm_ion_sf_size;
501 pr_debug("msm_ion_sf_size 0x%x\n",
502 msm_ion_sf_size);
503 break;
504 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800505 }
506 }
507 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800508}
509
510static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
511 unsigned long size)
512{
513 msm8960_reserve_table[mem_type].size += size;
514}
515
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700516static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
517{
518#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
519 int ret;
520
521 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
522 panic("fixed area size is larger than %dM\n",
523 MAX_FIXED_AREA_SIZE >> 20);
524
525 reserve_info->fixed_area_size = fixed_area_size;
526 reserve_info->fixed_area_start = MSM8960_FW_START;
527
528 ret = memblock_remove(reserve_info->fixed_area_start,
529 reserve_info->fixed_area_size);
530 BUG_ON(ret);
531#endif
532}
533
Olav Haugan65f4bd82011-12-13 11:50:08 -0800534/**
535 * Reserve memory for ION and calculate amount of reusable memory for fmem.
536 * We only reserve memory for heaps that are not reusable. However, we only
537 * support one reusable heap at the moment so we ignore the reusable flag for
538 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800539 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
540 * at a higher address than FW in addition to not more than 256MB away from the
541 * base address of the firmware. This means that if MM is reusable the other
542 * two heaps must be allocated in the same region as FW. This is handled by the
543 * mem_is_fmem flag in the platform data. In addition the MM heap must be
544 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800545 */
546static void __init reserve_ion_memory(void)
547{
548#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
549 unsigned int i;
550 unsigned int reusable_count = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700551 unsigned int fixed_size = 0;
552 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
553 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800554
555 adjust_mem_for_liquid();
Laura Abbottb93525f2012-04-12 09:57:19 -0700556 msm8960_fmem_pdata.size = 0;
557 msm8960_fmem_pdata.reserved_size_low = 0;
558 msm8960_fmem_pdata.reserved_size_high = 0;
Olav Haugan8726caf2012-05-10 15:11:35 -0700559 msm8960_fmem_pdata.align = PAGE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700560 fixed_low_size = 0;
561 fixed_middle_size = 0;
562 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800563
564 /* We only support 1 reusable heap. Check if more than one heap
565 * is specified as reusable and set as non-reusable if found.
566 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700567 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
568 const struct ion_platform_heap *heap =
569 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800570
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700571 if (heap->type == (enum ion_heap_type) ION_HEAP_TYPE_CP
572 && heap->extra_data) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800573 struct ion_cp_heap_pdata *data = heap->extra_data;
574
575 reusable_count += (data->reusable) ? 1 : 0;
576
577 if (data->reusable && reusable_count > 1) {
578 pr_err("%s: Too many heaps specified as "
579 "reusable. Heap %s was not configured "
580 "as reusable.\n", __func__, heap->name);
581 data->reusable = 0;
582 }
583 }
584 }
585
Laura Abbottb93525f2012-04-12 09:57:19 -0700586 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700587 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700588 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700589 int align = SZ_4K;
590 int iommu_map_all = 0;
591 int adjacent_mem_id = INVALID_HEAP_ID;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800592
593 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700594 int fixed_position = NOT_FIXED;
595 int mem_is_fmem = 0;
596
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700597 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800598 case ION_HEAP_TYPE_CP:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800599 mem_is_fmem = ((struct ion_cp_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700600 heap->extra_data)->mem_is_fmem;
601 fixed_position = ((struct ion_cp_heap_pdata *)
602 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700603 align = ((struct ion_cp_heap_pdata *)
604 heap->extra_data)->align;
605 iommu_map_all =
606 ((struct ion_cp_heap_pdata *)
607 heap->extra_data)->iommu_map_all;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800608 break;
609 case ION_HEAP_TYPE_CARVEOUT:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800610 mem_is_fmem = ((struct ion_co_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700611 heap->extra_data)->mem_is_fmem;
612 fixed_position = ((struct ion_co_heap_pdata *)
613 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700614 adjacent_mem_id = ((struct ion_co_heap_pdata *)
615 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700616 break;
617 default:
618 break;
619 }
620
Olav Haugan8726caf2012-05-10 15:11:35 -0700621 if (iommu_map_all) {
622 if (heap->size & (SZ_64K-1)) {
623 heap->size = ALIGN(heap->size, SZ_64K);
624 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
625 heap->name, heap->size);
626 }
627 }
628
629 if (mem_is_fmem && adjacent_mem_id != INVALID_HEAP_ID)
630 msm8960_fmem_pdata.align = align;
631
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700632 if (fixed_position != NOT_FIXED)
633 fixed_size += heap->size;
634 else
635 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
636
637 if (fixed_position == FIXED_LOW)
638 fixed_low_size += heap->size;
639 else if (fixed_position == FIXED_MIDDLE)
640 fixed_middle_size += heap->size;
641 else if (fixed_position == FIXED_HIGH)
642 fixed_high_size += heap->size;
643
644 if (mem_is_fmem)
Laura Abbottb93525f2012-04-12 09:57:19 -0700645 msm8960_fmem_pdata.size += heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700646 }
647 }
648
649 if (!fixed_size)
650 return;
651
Laura Abbottb93525f2012-04-12 09:57:19 -0700652 if (msm8960_fmem_pdata.size) {
Deepak Kotur35825522012-06-06 15:49:14 -0700653 msm8960_fmem_pdata.reserved_size_low = fixed_low_size +
654 HOLE_SIZE;
Laura Abbottb93525f2012-04-12 09:57:19 -0700655 msm8960_fmem_pdata.reserved_size_high = fixed_high_size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700656 }
657
Larry Bassel4d4f4482012-04-04 11:26:09 -0700658 /* Since the fixed area may be carved out of lowmem,
659 * make sure the length is a multiple of 1M.
660 */
661 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
662 & SECTION_MASK;
663 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700664
665 fixed_low_start = MSM8960_FIXED_AREA_START;
Deepak Kotur35825522012-06-06 15:49:14 -0700666 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700667 fixed_high_start = fixed_middle_start + fixed_middle_size;
668
Laura Abbottb93525f2012-04-12 09:57:19 -0700669 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
670 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700671
672 if (heap->extra_data) {
673 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700674 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700675
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700676 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700677 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700678 pdata =
679 (struct ion_cp_heap_pdata *)heap->extra_data;
680 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700681 break;
682 case ION_HEAP_TYPE_CARVEOUT:
683 fixed_position = ((struct ion_co_heap_pdata *)
684 heap->extra_data)->fixed_position;
685 break;
686 default:
687 break;
688 }
689
690 switch (fixed_position) {
691 case FIXED_LOW:
692 heap->base = fixed_low_start;
693 break;
694 case FIXED_MIDDLE:
695 heap->base = fixed_middle_start;
Deepak Kotur35825522012-06-06 15:49:14 -0700696 pdata->secure_base = fixed_middle_start
697 - HOLE_SIZE;
698 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700699 break;
700 case FIXED_HIGH:
701 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800702 break;
703 default:
704 break;
705 }
706 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800707 }
Laura Abbottd6183792011-08-19 13:42:24 -0700708#endif
709}
Huaibin Yanga5419422011-12-08 23:52:10 -0800710
711static void __init reserve_mdp_memory(void)
712{
713 msm8960_mdp_writeback(msm8960_reserve_table);
714}
715
Stephen Boyd668d7652012-04-25 11:31:01 -0700716static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800717{
718#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800719 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800720
Laura Abbott155ab6f2012-05-25 08:52:18 -0700721 total = msm8960_cache_dump_pdata.l1_size +
722 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800723 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800724#endif
725}
726
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700727static void __init msm8960_calculate_reserve_sizes(void)
728{
729 size_pmem_devices();
730 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700731 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800732 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800733 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800734 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700735}
736
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700737static struct reserve_info msm8960_reserve_info __initdata = {
738 .memtype_reserve_table = msm8960_reserve_table,
739 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700740 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700741 .paddr_to_memtype = msm8960_paddr_to_memtype,
742};
743
Larry Basselb4126da2011-07-18 14:31:33 -0700744static int msm8960_memory_bank_size(void)
745{
746 return 1<<29;
747}
748
749static void __init locate_unstable_memory(void)
750{
751 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
752 unsigned long bank_size;
753 unsigned long low, high;
754
755 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700756 msm8960_reserve_info.bank_size = bank_size;
757
Larry Basselb4126da2011-07-18 14:31:33 -0700758 low = meminfo.bank[0].start;
759 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700760
761 /* Check if 32 bit overflow occured */
762 if (high < mb->start)
763 high = ~0UL;
764
Larry Bassel4d4f4482012-04-04 11:26:09 -0700765 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
766 panic("fixed area extends beyond end of memory\n");
767
Larry Basselb4126da2011-07-18 14:31:33 -0700768 low &= ~(bank_size - 1);
769
770 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700771 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800772
Larry Basselb8d61022012-02-24 10:49:45 -0800773#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800774 msm8960_reserve_info.low_unstable_address = mb->start -
775 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800776 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700777 pr_info("low unstable address %lx max size %lx bank size %lx\n",
778 msm8960_reserve_info.low_unstable_address,
779 msm8960_reserve_info.max_unstable_size,
780 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700781 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800782#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700783no_dmm:
784 msm8960_reserve_info.low_unstable_address = high;
785 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700786}
787
Larry Basselb830e182011-10-14 10:46:55 -0700788static void __init place_movable_zone(void)
789{
Larry Basselb8d61022012-02-24 10:49:45 -0800790#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700791 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
792 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
793 pr_info("movable zone start %lx size %lx\n",
794 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800795#endif
Larry Basselb830e182011-10-14 10:46:55 -0700796}
797
798static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700799{
800 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700801 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700802 place_movable_zone();
803}
804
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800805static char prim_panel_name[PANEL_NAME_MAX_LEN];
806static char ext_panel_name[PANEL_NAME_MAX_LEN];
807static int __init prim_display_setup(char *param)
808{
809 if (strnlen(param, PANEL_NAME_MAX_LEN))
810 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
811 return 0;
812}
813early_param("prim_display", prim_display_setup);
814
815static int __init ext_display_setup(char *param)
816{
817 if (strnlen(param, PANEL_NAME_MAX_LEN))
818 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
819 return 0;
820}
821early_param("ext_display", ext_display_setup);
822
Larry Basselb830e182011-10-14 10:46:55 -0700823static void __init msm8960_reserve(void)
824{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800825 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700826 msm_reserve();
Laura Abbottb93525f2012-04-12 09:57:19 -0700827 if (msm8960_fmem_pdata.size) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700828#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel861985f2012-05-02 15:54:52 -0700829 if (reserve_info->fixed_area_size) {
830 msm8960_fmem_pdata.phys =
831 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
832 pr_info("mm fw at %lx (fixed) size %x\n",
833 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
834 pr_info("fmem start %lx (fixed) size %lx\n",
835 msm8960_fmem_pdata.phys,
836 msm8960_fmem_pdata.size);
837 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700838#endif
839 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700840}
841
Larry Bassela4414b12011-08-04 11:11:02 -0700842static int msm8960_change_memory_power(u64 start, u64 size,
843 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700844{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700845 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700846}
847
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700848static void __init msm8960_allocate_memory_regions(void)
849{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800850 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700851}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800852
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700853#ifdef CONFIG_WCD9310_CODEC
854
855#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
856
Patrick Lai3043fba2011-08-01 14:15:57 -0700857/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
858 * 4 micbiases are used to power various analog and digital
859 * microphones operating at 1800 mV. Technically, all micbiases
860 * can source from single cfilter since all microphones operate
861 * at the same voltage level. The arrangement below is to make
862 * sure all cfilters are exercised. LDO_H regulator ouput level
863 * does not need to be as high as 2.85V. It is choosen for
864 * microphone sensitivity purpose.
865 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530866static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700867 .slimbus_slave_device = {
868 .name = "tabla-slave",
869 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
870 },
871 .irq = MSM_GPIO_TO_INT(62),
872 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530873 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700874 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700875 .micbias = {
876 .ldoh_v = TABLA_LDOH_2P85_V,
877 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700878 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700879 .cfilt3_mv = 1800,
880 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
881 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
882 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
883 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530884 },
885 .regulator = {
886 {
887 .name = "CDC_VDD_CP",
888 .min_uV = 1800000,
889 .max_uV = 1800000,
890 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
891 },
892 {
893 .name = "CDC_VDDA_RX",
894 .min_uV = 1800000,
895 .max_uV = 1800000,
896 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
897 },
898 {
899 .name = "CDC_VDDA_TX",
900 .min_uV = 1800000,
901 .max_uV = 1800000,
902 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
903 },
904 {
905 .name = "VDDIO_CDC",
906 .min_uV = 1800000,
907 .max_uV = 1800000,
908 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
909 },
910 {
911 .name = "VDDD_CDC_D",
912 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700913 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530914 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
915 },
916 {
917 .name = "CDC_VDDA_A_1P2V",
918 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700919 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530920 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
921 },
922 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700923};
924
925static struct slim_device msm_slim_tabla = {
926 .name = "tabla-slim",
927 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
928 .dev = {
929 .platform_data = &tabla_platform_data,
930 },
931};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530932
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530933static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530934 .slimbus_slave_device = {
935 .name = "tabla-slave",
936 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
937 },
938 .irq = MSM_GPIO_TO_INT(62),
939 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530940 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530941 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
942 .micbias = {
943 .ldoh_v = TABLA_LDOH_2P85_V,
944 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700945 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530946 .cfilt3_mv = 1800,
947 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
948 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
949 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
950 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530951 },
952 .regulator = {
953 {
954 .name = "CDC_VDD_CP",
955 .min_uV = 1800000,
956 .max_uV = 1800000,
957 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
958 },
959 {
960 .name = "CDC_VDDA_RX",
961 .min_uV = 1800000,
962 .max_uV = 1800000,
963 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
964 },
965 {
966 .name = "CDC_VDDA_TX",
967 .min_uV = 1800000,
968 .max_uV = 1800000,
969 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
970 },
971 {
972 .name = "VDDIO_CDC",
973 .min_uV = 1800000,
974 .max_uV = 1800000,
975 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
976 },
977 {
978 .name = "VDDD_CDC_D",
979 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700980 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530981 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
982 },
983 {
984 .name = "CDC_VDDA_A_1P2V",
985 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700986 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530987 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
988 },
989 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530990};
991
992static struct slim_device msm_slim_tabla20 = {
993 .name = "tabla2x-slim",
994 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
995 .dev = {
996 .platform_data = &tabla20_platform_data,
997 },
998};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999#endif
1000
1001static struct slim_boardinfo msm_slim_devices[] = {
1002#ifdef CONFIG_WCD9310_CODEC
1003 {
1004 .bus_num = 1,
1005 .slim_slave = &msm_slim_tabla,
1006 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301007 {
1008 .bus_num = 1,
1009 .slim_slave = &msm_slim_tabla20,
1010 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001011#endif
1012 /* add more slimbus slaves as needed */
1013};
1014
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001015#define MSM_WCNSS_PHYS 0x03000000
1016#define MSM_WCNSS_SIZE 0x280000
1017
1018static struct resource resources_wcnss_wlan[] = {
1019 {
1020 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1021 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1022 .name = "wcnss_wlanrx_irq",
1023 .flags = IORESOURCE_IRQ,
1024 },
1025 {
1026 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1027 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1028 .name = "wcnss_wlantx_irq",
1029 .flags = IORESOURCE_IRQ,
1030 },
1031 {
1032 .start = MSM_WCNSS_PHYS,
1033 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1034 .name = "wcnss_mmio",
1035 .flags = IORESOURCE_MEM,
1036 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001037 {
1038 .start = 84,
1039 .end = 88,
1040 .name = "wcnss_gpios_5wire",
1041 .flags = IORESOURCE_IO,
1042 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001043};
1044
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001045static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1046 .has_48mhz_xo = 1,
1047};
1048
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001049static struct platform_device msm_device_wcnss_wlan = {
1050 .name = "wcnss_wlan",
1051 .id = 0,
1052 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1053 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001054 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001055};
1056
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001057#ifdef CONFIG_QSEECOM
1058/* qseecom bus scaling */
1059static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1060 {
1061 .src = MSM_BUS_MASTER_SPS,
1062 .dst = MSM_BUS_SLAVE_EBI_CH0,
1063 .ib = 0,
1064 .ab = 0,
1065 },
1066 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001067 .src = MSM_BUS_MASTER_SPS,
1068 .dst = MSM_BUS_SLAVE_SPS,
1069 .ib = 0,
1070 .ab = 0,
1071 },
1072 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001073 .src = MSM_BUS_MASTER_SPDM,
1074 .dst = MSM_BUS_SLAVE_SPDM,
1075 .ib = 0,
1076 .ab = 0,
1077 },
1078};
1079
1080static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1081 {
1082 .src = MSM_BUS_MASTER_SPS,
1083 .dst = MSM_BUS_SLAVE_EBI_CH0,
1084 .ib = (492 * 8) * 1000000UL,
1085 .ab = (492 * 8) * 100000UL,
1086 },
1087 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001088 .src = MSM_BUS_MASTER_SPS,
1089 .dst = MSM_BUS_SLAVE_SPS,
1090 .ib = (492 * 8) * 1000000UL,
1091 .ab = (492 * 8) * 100000UL,
1092 },
1093 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001094 .src = MSM_BUS_MASTER_SPDM,
1095 .dst = MSM_BUS_SLAVE_SPDM,
1096 .ib = 0,
1097 .ab = 0,
1098 },
1099};
1100
1101static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1102 {
1103 .src = MSM_BUS_MASTER_SPS,
1104 .dst = MSM_BUS_SLAVE_EBI_CH0,
1105 .ib = 0,
1106 .ab = 0,
1107 },
1108 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001109 .src = MSM_BUS_MASTER_SPS,
1110 .dst = MSM_BUS_SLAVE_SPS,
1111 .ib = 0,
1112 .ab = 0,
1113 },
1114 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001115 .src = MSM_BUS_MASTER_SPDM,
1116 .dst = MSM_BUS_SLAVE_SPDM,
1117 .ib = (64 * 8) * 1000000UL,
1118 .ab = (64 * 8) * 100000UL,
1119 },
1120};
1121
1122static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1123 {
1124 ARRAY_SIZE(qseecom_clks_init_vectors),
1125 qseecom_clks_init_vectors,
1126 },
1127 {
1128 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001129 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001130 },
1131 {
1132 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1133 qseecom_enable_sfpb_vectors,
1134 },
1135};
1136
1137static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1138 qseecom_hw_bus_scale_usecases,
1139 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1140 .name = "qsee",
1141};
1142
1143static struct platform_device qseecom_device = {
1144 .name = "qseecom",
1145 .id = 0,
1146 .dev = {
1147 .platform_data = &qseecom_bus_pdata,
1148 },
1149};
1150#endif
1151
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001152#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1153 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1154 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1155 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1156
1157#define QCE_SIZE 0x10000
1158#define QCE_0_BASE 0x18500000
1159
1160#define QCE_HW_KEY_SUPPORT 0
1161#define QCE_SHA_HMAC_SUPPORT 1
1162#define QCE_SHARE_CE_RESOURCE 1
1163#define QCE_CE_SHARED 0
1164
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001165/* Begin Bus scaling definitions */
1166static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1167 {
1168 .src = MSM_BUS_MASTER_ADM_PORT0,
1169 .dst = MSM_BUS_SLAVE_EBI_CH0,
1170 .ab = 0,
1171 .ib = 0,
1172 },
1173 {
1174 .src = MSM_BUS_MASTER_ADM_PORT1,
1175 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1176 .ab = 0,
1177 .ib = 0,
1178 },
1179};
1180
1181static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1182 {
1183 .src = MSM_BUS_MASTER_ADM_PORT0,
1184 .dst = MSM_BUS_SLAVE_EBI_CH0,
1185 .ab = 70000000UL,
1186 .ib = 70000000UL,
1187 },
1188 {
1189 .src = MSM_BUS_MASTER_ADM_PORT1,
1190 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1191 .ab = 2480000000UL,
1192 .ib = 2480000000UL,
1193 },
1194};
1195
1196static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1197 {
1198 ARRAY_SIZE(crypto_hw_init_vectors),
1199 crypto_hw_init_vectors,
1200 },
1201 {
1202 ARRAY_SIZE(crypto_hw_active_vectors),
1203 crypto_hw_active_vectors,
1204 },
1205};
1206
1207static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1208 crypto_hw_bus_scale_usecases,
1209 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1210 .name = "cryptohw",
1211};
1212/* End Bus Scaling Definitions*/
1213
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001214static struct resource qcrypto_resources[] = {
1215 [0] = {
1216 .start = QCE_0_BASE,
1217 .end = QCE_0_BASE + QCE_SIZE - 1,
1218 .flags = IORESOURCE_MEM,
1219 },
1220 [1] = {
1221 .name = "crypto_channels",
1222 .start = DMOV_CE_IN_CHAN,
1223 .end = DMOV_CE_OUT_CHAN,
1224 .flags = IORESOURCE_DMA,
1225 },
1226 [2] = {
1227 .name = "crypto_crci_in",
1228 .start = DMOV_CE_IN_CRCI,
1229 .end = DMOV_CE_IN_CRCI,
1230 .flags = IORESOURCE_DMA,
1231 },
1232 [3] = {
1233 .name = "crypto_crci_out",
1234 .start = DMOV_CE_OUT_CRCI,
1235 .end = DMOV_CE_OUT_CRCI,
1236 .flags = IORESOURCE_DMA,
1237 },
1238};
1239
1240static struct resource qcedev_resources[] = {
1241 [0] = {
1242 .start = QCE_0_BASE,
1243 .end = QCE_0_BASE + QCE_SIZE - 1,
1244 .flags = IORESOURCE_MEM,
1245 },
1246 [1] = {
1247 .name = "crypto_channels",
1248 .start = DMOV_CE_IN_CHAN,
1249 .end = DMOV_CE_OUT_CHAN,
1250 .flags = IORESOURCE_DMA,
1251 },
1252 [2] = {
1253 .name = "crypto_crci_in",
1254 .start = DMOV_CE_IN_CRCI,
1255 .end = DMOV_CE_IN_CRCI,
1256 .flags = IORESOURCE_DMA,
1257 },
1258 [3] = {
1259 .name = "crypto_crci_out",
1260 .start = DMOV_CE_OUT_CRCI,
1261 .end = DMOV_CE_OUT_CRCI,
1262 .flags = IORESOURCE_DMA,
1263 },
1264};
1265
1266#endif
1267
1268#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1269 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1270
1271static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1272 .ce_shared = QCE_CE_SHARED,
1273 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1274 .hw_key_support = QCE_HW_KEY_SUPPORT,
1275 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001276 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001277};
1278
1279static struct platform_device qcrypto_device = {
1280 .name = "qcrypto",
1281 .id = 0,
1282 .num_resources = ARRAY_SIZE(qcrypto_resources),
1283 .resource = qcrypto_resources,
1284 .dev = {
1285 .coherent_dma_mask = DMA_BIT_MASK(32),
1286 .platform_data = &qcrypto_ce_hw_suppport,
1287 },
1288};
1289#endif
1290
1291#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1292 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1293
1294static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1295 .ce_shared = QCE_CE_SHARED,
1296 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1297 .hw_key_support = QCE_HW_KEY_SUPPORT,
1298 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001299 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300};
1301
1302static struct platform_device qcedev_device = {
1303 .name = "qce",
1304 .id = 0,
1305 .num_resources = ARRAY_SIZE(qcedev_resources),
1306 .resource = qcedev_resources,
1307 .dev = {
1308 .coherent_dma_mask = DMA_BIT_MASK(32),
1309 .platform_data = &qcedev_ce_hw_suppport,
1310 },
1311};
1312#endif
1313
Joel King0cbf5d82012-05-24 15:21:38 -07001314static struct mdm_platform_data sglte_platform_data = {
1315 .mdm_version = "4.0",
1316 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001317 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001318 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001319 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001320 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001321 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001322};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001323
Joel Nider266a2642011-10-16 10:58:05 +02001324#define MSM_TSIF0_PHYS (0x18200000)
1325#define MSM_TSIF1_PHYS (0x18201000)
1326#define MSM_TSIF_SIZE (0x200)
1327#define MSM_TSPP_PHYS (0x18202000)
1328#define MSM_TSPP_SIZE (0x1000)
1329#define MSM_TSPP_BAM_PHYS (0x18204000)
1330#define MSM_TSPP_BAM_SIZE (0x2000)
1331
1332#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1333 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1334#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1335 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1336#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1337 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1338#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1339 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1340#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1341 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1342#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1343 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1344#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1345 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1346#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1347 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1348
1349static const struct msm_gpio tsif_gpios[] = {
1350 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1351 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1352 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1353 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1354 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1355 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1356 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1357 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1358};
1359
1360static struct resource tspp_resources[] = {
1361 [0] = {
1362 .flags = IORESOURCE_IRQ,
1363 .start = TSIF_TSPP_IRQ,
1364 .end = TSIF1_IRQ,
1365 },
1366 [1] = {
1367 .flags = IORESOURCE_MEM,
1368 .start = MSM_TSIF0_PHYS,
1369 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1370 },
1371 [2] = {
1372 .flags = IORESOURCE_MEM,
1373 .start = MSM_TSIF1_PHYS,
1374 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1375 },
1376 [3] = {
1377 .flags = IORESOURCE_MEM,
1378 .start = MSM_TSPP_PHYS,
1379 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1380 },
1381 [4] = {
1382 .flags = IORESOURCE_MEM,
1383 .start = MSM_TSPP_BAM_PHYS,
1384 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1385 },
1386};
1387
1388static struct msm_tspp_platform_data tspp_platform_data = {
1389 .num_gpios = ARRAY_SIZE(tsif_gpios),
1390 .gpios = tsif_gpios,
1391 .tsif_pclk = "tsif_pclk",
1392 .tsif_ref_clk = "tsif_ref_clk",
1393};
1394
1395static struct platform_device msm_device_tspp = {
1396 .name = "msm_tspp",
1397 .id = 0,
1398 .num_resources = ARRAY_SIZE(tspp_resources),
1399 .resource = tspp_resources,
1400 .dev = {
1401 .platform_data = &tspp_platform_data
1402 },
1403};
1404
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001405#define MSM_SHARED_RAM_PHYS 0x80000000
1406
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001407static void __init msm8960_map_io(void)
1408{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001409 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001410 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001411
1412 if (socinfo_init() < 0)
1413 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001414}
1415
1416static void __init msm8960_init_irq(void)
1417{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001418 struct msm_mpm_device_data *data = NULL;
1419
1420#ifdef CONFIG_MSM_MPM
1421 data = &msm8960_mpm_dev_data;
1422#endif
1423
1424 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001425 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001426 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001427}
1428
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001429static void __init msm8960_init_buses(void)
1430{
1431#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001432 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001433 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1434 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001435 msm_bus_apps_fabric.dev.platform_data =
1436 &msm_bus_8960_apps_fabric_pdata;
1437 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001438 if (cpu_is_msm8960ab()) {
1439 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1440 msm_bus_mm_fabric.dev.platform_data =
1441 &msm_bus_8960_sg_mm_fabric_pdata;
1442 } else {
1443 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1444 msm_bus_mm_fabric.dev.platform_data =
1445 &msm_bus_8960_mm_fabric_pdata;
1446 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001447 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1448 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001449#endif
1450}
1451
1452static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1453 .max_clock_speed = 15060000,
Kiran Gunda2b285652012-07-30 13:22:39 +05301454 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455};
1456
1457#ifdef CONFIG_USB_MSM_OTG_72K
1458static struct msm_otg_platform_data msm_otg_pdata;
1459#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301460static int wr_phy_init_seq[] = {
1461 0x44, 0x80, /* set VBUS valid threshold
1462 and disconnect valid threshold */
1463 0x38, 0x81, /* update DC voltage level */
1464 0x14, 0x82, /* set preemphasis and rise/fall time */
1465 0x13, 0x83, /* set source impedance adjusment */
1466 -1};
1467
1468static int liquid_v1_phy_init_seq[] = {
1469 0x44, 0x80,/* set VBUS valid threshold
1470 and disconnect valid threshold */
1471 0x3C, 0x81,/* update DC voltage level */
1472 0x18, 0x82,/* set preemphasis and rise/fall time */
1473 0x23, 0x83,/* set source impedance sdjusment */
1474 -1};
1475
Mayank Ranaa1f507b2012-08-14 10:57:00 +05301476static int sglte_phy_init_seq[] = {
1477 0x44, 0x80, /* set VBUS valid threshold
1478 and disconnect valid threshold */
1479 0x3A, 0x81, /* update DC voltage level */
1480 0x24, 0x82, /* set preemphasis and rise/fall time */
1481 0x13, 0x83, /* set source impedance adjusment */
1482 -1};
1483
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301484#ifdef CONFIG_MSM_BUS_SCALING
1485/* Bandwidth requests (zero) if no vote placed */
1486static struct msm_bus_vectors usb_init_vectors[] = {
1487 {
1488 .src = MSM_BUS_MASTER_SPS,
1489 .dst = MSM_BUS_SLAVE_EBI_CH0,
1490 .ab = 0,
1491 .ib = 0,
1492 },
1493};
1494
1495/* Bus bandwidth requests in Bytes/sec */
1496static struct msm_bus_vectors usb_max_vectors[] = {
1497 {
1498 .src = MSM_BUS_MASTER_SPS,
1499 .dst = MSM_BUS_SLAVE_EBI_CH0,
1500 .ab = 60000000, /* At least 480Mbps on bus. */
1501 .ib = 960000000, /* MAX bursts rate */
1502 },
1503};
1504
1505static struct msm_bus_paths usb_bus_scale_usecases[] = {
1506 {
1507 ARRAY_SIZE(usb_init_vectors),
1508 usb_init_vectors,
1509 },
1510 {
1511 ARRAY_SIZE(usb_max_vectors),
1512 usb_max_vectors,
1513 },
1514};
1515
1516static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1517 usb_bus_scale_usecases,
1518 ARRAY_SIZE(usb_bus_scale_usecases),
1519 .name = "usb",
1520};
1521#endif
1522
Jack Pham87f202f2012-08-06 00:24:22 -07001523#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1524
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001525static struct msm_otg_platform_data msm_otg_pdata = {
1526 .mode = USB_OTG,
1527 .otg_control = OTG_PMIC_CONTROL,
1528 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001529 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301530 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301531#ifdef CONFIG_MSM_BUS_SCALING
1532 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001533 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301534#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301535#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1536 .mhl_dev_name = "sii8334",
1537#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001538};
1539#endif
1540
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301541#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301542#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301543static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1544 .strobe = 150,
1545 .data = 151,
1546};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301547
1548static struct smsc_hub_platform_data hsic_hub_pdata = {
1549 .hub_reset = HSIC_HUB_RESET_GPIO,
1550};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301551#else
1552static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301553static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301554#endif
1555
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301556static struct platform_device smsc_hub_device = {
1557 .name = "msm_smsc_hub",
1558 .id = -1,
1559 .dev = {
1560 .platform_data = &hsic_hub_pdata,
1561 },
1562};
1563
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001564#define PID_MAGIC_ID 0x71432909
1565#define SERIAL_NUM_MAGIC_ID 0x61945374
1566#define SERIAL_NUMBER_LENGTH 127
1567#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1568
1569struct magic_num_struct {
1570 uint32_t pid;
1571 uint32_t serial_num;
1572};
1573
1574struct dload_struct {
1575 uint32_t reserved1;
1576 uint32_t reserved2;
1577 uint32_t reserved3;
1578 uint16_t reserved4;
1579 uint16_t pid;
1580 char serial_number[SERIAL_NUMBER_LENGTH];
1581 uint16_t reserved5;
1582 struct magic_num_struct magic_struct;
1583};
1584
1585static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1586{
1587 struct dload_struct __iomem *dload = 0;
1588
1589 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1590 if (!dload) {
1591 pr_err("%s: cannot remap I/O memory region: %08x\n",
1592 __func__, DLOAD_USB_BASE_ADD);
1593 return -ENXIO;
1594 }
1595
1596 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1597 __func__, dload, pid, snum);
1598 /* update pid */
1599 dload->magic_struct.pid = PID_MAGIC_ID;
1600 dload->pid = pid;
1601
1602 /* update serial number */
1603 dload->magic_struct.serial_num = 0;
1604 if (!snum) {
1605 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1606 goto out;
1607 }
1608
1609 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001610 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001611out:
1612 iounmap(dload);
1613 return 0;
1614}
1615
1616static struct android_usb_platform_data android_usb_pdata = {
1617 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1618};
1619
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001620static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001621 .name = "android_usb",
1622 .id = -1,
1623 .dev = {
1624 .platform_data = &android_usb_pdata,
1625 },
1626};
1627
1628static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1629 0x03, 0x0f,
1630};
1631
1632static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1633 0x00, 0x24, 0x54, 0x10,
1634 0x09, 0x03, 0x01,
1635 0x10, 0x54, 0x30, 0x0C,
1636 0x24, 0x30, 0x0f,
1637};
1638
1639static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1640 0x00, 0x24, 0x54, 0x10,
1641 0x09, 0x07, 0x01, 0x0B,
1642 0x10, 0x54, 0x30, 0x0C,
1643 0x24, 0x30, 0x0f,
1644};
1645
1646static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1647 [0] = {
1648 .mode = MSM_SPM_MODE_CLOCK_GATING,
1649 .notify_rpm = false,
1650 .cmd = spm_wfi_cmd_sequence,
1651 },
1652 [1] = {
1653 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1654 .notify_rpm = false,
1655 .cmd = spm_power_collapse_without_rpm,
1656 },
1657 [2] = {
1658 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1659 .notify_rpm = true,
1660 .cmd = spm_power_collapse_with_rpm,
1661 },
1662};
1663
1664static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1665 [0] = {
1666 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001667 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001668#if defined(CONFIG_MSM_AVS_HW)
1669 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1670 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1671#endif
1672 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001673 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001674 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1675 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1676 .vctl_timeout_us = 50,
1677 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1678 .modes = msm_spm_seq_list,
1679 },
1680 [1] = {
1681 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001682 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683#if defined(CONFIG_MSM_AVS_HW)
1684 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1685 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1686#endif
1687 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001688 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1690 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1691 .vctl_timeout_us = 50,
1692 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1693 .modes = msm_spm_seq_list,
1694 },
1695};
1696
1697static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1698 0x00, 0x20, 0x03, 0x20,
1699 0x00, 0x0f,
1700};
1701
1702static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1703 0x00, 0x20, 0x34, 0x64,
1704 0x48, 0x07, 0x48, 0x20,
1705 0x50, 0x64, 0x04, 0x34,
1706 0x50, 0x0f,
1707};
1708static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1709 0x00, 0x10, 0x34, 0x64,
1710 0x48, 0x07, 0x48, 0x10,
1711 0x50, 0x64, 0x04, 0x34,
1712 0x50, 0x0F,
1713};
1714
1715static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1716 [0] = {
1717 .mode = MSM_SPM_L2_MODE_RETENTION,
1718 .notify_rpm = false,
1719 .cmd = l2_spm_wfi_cmd_sequence,
1720 },
1721 [1] = {
1722 .mode = MSM_SPM_L2_MODE_GDHS,
1723 .notify_rpm = true,
1724 .cmd = l2_spm_gdhs_cmd_sequence,
1725 },
1726 [2] = {
1727 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1728 .notify_rpm = true,
1729 .cmd = l2_spm_power_off_cmd_sequence,
1730 },
1731};
1732
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001733static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1734 [0] = {
1735 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001736 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001737 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001738 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1739 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1740 .modes = msm_spm_l2_seq_list,
1741 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1742 },
1743};
1744
Anirudh Ghayal15698162012-07-31 11:51:32 +05301745#define HAP_SHIFT_LVL_OE_GPIO 47
1746#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301747#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1748#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1749
1750static struct msm_xo_voter *xo_handle_d1;
1751
1752static int isa1200_power(int on)
1753{
1754 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301755 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301756
Anirudh Ghayal15698162012-07-31 11:51:32 +05301757 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1758 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1759
1760
1761 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301762
1763 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1764 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1765 if (rc < 0) {
1766 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1767 __func__, on ? "" : "de-", rc);
1768 goto err_xo_vote;
1769 }
1770
1771 return 0;
1772
1773err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301774 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301775 return rc;
1776}
1777
1778static int isa1200_dev_setup(bool enable)
1779{
1780 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301781 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301782
1783 struct pm_gpio hap_gpio_config = {
1784 .direction = PM_GPIO_DIR_OUT,
1785 .pull = PM_GPIO_PULL_NO,
1786 .out_strength = PM_GPIO_STRENGTH_HIGH,
1787 .function = PM_GPIO_FUNC_NORMAL,
1788 .inv_int_pol = 0,
1789 .vin_sel = 2,
1790 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1791 .output_value = 0,
1792 };
1793
Anirudh Ghayal15698162012-07-31 11:51:32 +05301794 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1795 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1796
Mohan Pallaka5e490392011-09-09 15:18:41 +05301797 if (enable == true) {
1798 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1799 if (rc) {
1800 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1801 __func__, PM_HAP_EN_GPIO, rc);
1802 return rc;
1803 }
1804
1805 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1806 if (rc) {
1807 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1808 __func__, PM_HAP_LEN_GPIO, rc);
1809 return rc;
1810 }
1811
Anirudh Ghayal15698162012-07-31 11:51:32 +05301812 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301813 if (rc) {
1814 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301815 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301816 return rc;
1817 }
1818
Anirudh Ghayal15698162012-07-31 11:51:32 +05301819 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301820 if (rc) {
1821 pr_err("%s: Unable to set direction\n", __func__);
1822 goto free_gpio;
1823 }
1824
1825 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1826 if (IS_ERR(xo_handle_d1)) {
1827 rc = PTR_ERR(xo_handle_d1);
1828 pr_err("%s: failed to get the handle for D1(%d)\n",
1829 __func__, rc);
1830 goto gpio_set_dir;
1831 }
1832 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301833 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301834
1835 msm_xo_put(xo_handle_d1);
1836 }
1837
1838 return 0;
1839
1840gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301841 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301842free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301843 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301844 return rc;
1845}
1846
1847static struct isa1200_regulator isa1200_reg_data[] = {
1848 {
1849 .name = "vcc_i2c",
1850 .min_uV = ISA_I2C_VTG_MIN_UV,
1851 .max_uV = ISA_I2C_VTG_MAX_UV,
1852 .load_uA = ISA_I2C_CURR_UA,
1853 },
1854};
1855
1856static struct isa1200_platform_data isa1200_1_pdata = {
1857 .name = "vibrator",
1858 .dev_setup = isa1200_dev_setup,
1859 .power_on = isa1200_power,
1860 .hap_en_gpio = PM_HAP_EN_GPIO,
1861 .hap_len_gpio = PM_HAP_LEN_GPIO,
1862 .max_timeout = 15000,
1863 .mode_ctrl = PWM_GEN_MODE,
1864 .pwm_fd = {
1865 .pwm_div = 256,
1866 },
1867 .is_erm = false,
1868 .smart_en = true,
1869 .ext_clk_en = true,
1870 .chip_en = 1,
1871 .regulator_info = isa1200_reg_data,
1872 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1873};
1874
1875static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1876 {
1877 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301878 },
1879};
1880
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001881#define CYTTSP_TS_GPIO_IRQ 11
1882#define CYTTSP_TS_SLEEP_GPIO 50
1883#define CYTTSP_TS_RESOUT_N_GPIO 52
1884
1885/*virtual key support */
1886static ssize_t tma340_vkeys_show(struct kobject *kobj,
1887 struct kobj_attribute *attr, char *buf)
1888{
1889 return snprintf(buf, 200,
1890 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1891 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1892 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1893 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1894 "\n");
1895}
1896
1897static struct kobj_attribute tma340_vkeys_attr = {
1898 .attr = {
1899 .mode = S_IRUGO,
1900 },
1901 .show = &tma340_vkeys_show,
1902};
1903
1904static struct attribute *tma340_properties_attrs[] = {
1905 &tma340_vkeys_attr.attr,
1906 NULL
1907};
1908
1909static struct attribute_group tma340_properties_attr_group = {
1910 .attrs = tma340_properties_attrs,
1911};
1912
1913
1914static int cyttsp_platform_init(struct i2c_client *client)
1915{
1916 int rc = 0;
1917 static struct kobject *tma340_properties_kobj;
1918
1919 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1920 tma340_properties_kobj = kobject_create_and_add("board_properties",
1921 NULL);
1922 if (tma340_properties_kobj)
1923 rc = sysfs_create_group(tma340_properties_kobj,
1924 &tma340_properties_attr_group);
1925 if (!tma340_properties_kobj || rc)
1926 pr_err("%s: failed to create board_properties\n",
1927 __func__);
1928
1929 return 0;
1930}
1931
1932static struct cyttsp_regulator regulator_data[] = {
1933 {
1934 .name = "vdd",
1935 .min_uV = CY_TMA300_VTG_MIN_UV,
1936 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301937 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1938 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001939 },
1940 /* TODO: Remove after runtime PM is enabled in I2C driver */
1941 {
1942 .name = "vcc_i2c",
1943 .min_uV = CY_I2C_VTG_MIN_UV,
1944 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301945 .hpm_load_uA = CY_I2C_CURR_UA,
1946 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001947 },
1948};
1949
1950static struct cyttsp_platform_data cyttsp_pdata = {
1951 .panel_maxx = 634,
1952 .panel_maxy = 1166,
1953 .disp_maxx = 616,
1954 .disp_maxy = 1023,
1955 .disp_minx = 0,
1956 .disp_miny = 16,
1957 .flags = 0x01,
1958 .gen = CY_GEN3, /* or */
1959 .use_st = CY_USE_ST,
1960 .use_mt = CY_USE_MT,
1961 .use_hndshk = CY_SEND_HNDSHK,
1962 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301963 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001964 .use_gestures = CY_USE_GESTURES,
1965 .fw_fname = "cyttsp_8960_cdp.hex",
1966 /* activate up to 4 groups
1967 * and set active distance
1968 */
1969 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1970 CY_GEST_GRP3 | CY_GEST_GRP4 |
1971 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07001972 .act_intrvl = 10,
1973 .tch_tmout = 200,
1974 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001975 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1976 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1977 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1978 .regulator_info = regulator_data,
1979 .num_regulators = ARRAY_SIZE(regulator_data),
1980 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301981 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982};
1983
1984static struct i2c_board_info cyttsp_info[] __initdata = {
1985 {
1986 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1987 .platform_data = &cyttsp_pdata,
1988#ifndef CY_USE_TIMER
1989 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1990#endif /* CY_USE_TIMER */
1991 },
1992};
1993
Jing Lindc4413c2012-01-16 15:22:52 -08001994/* configuration data for mxt1386 */
1995static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301996 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001997 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301998 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001999 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2001 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2002 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2003 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2004 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2005 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302006 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002007 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302008 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002009 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302010 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002011 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2012 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2013 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2014 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302015 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002016 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2017 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302018 /* T18 Object */
2019 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302020 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002021 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2022 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302023 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2025 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302026 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002027 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2028 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302029 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002030 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302031 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002032 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302033 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002034 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302035 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002036 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302037 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002038 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302039};
2040
Jing Lin33b007d2011-12-21 17:40:23 -08002041/* configuration data for mxt1386e using V1.0 firmware */
2042static const u8 mxt1386e_config_data_v1_0[] = {
2043 /* T6 Object */
2044 0, 0, 0, 0, 0, 0,
2045 /* T38 Object */
2046 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2047 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2048 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2049 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2050 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2051 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2052 0, 0, 0, 0,
2053 /* T7 Object */
2054 100, 16, 50,
2055 /* T8 Object */
2056 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2057 /* T9 Object */
2058 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2059 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2060 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2061 10, 5, 0, 0, 0,
2062 /* T18 Object */
2063 0, 0,
2064 /* T24 Object */
2065 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2066 0, 0, 0, 0, 0, 0, 0, 0, 0,
2067 /* T25 Object */
2068 3, 0, 60, 115, 156, 99,
2069 /* T27 Object */
2070 0, 0, 0, 0, 0, 0, 0,
2071 /* T40 Object */
2072 0, 0, 0, 0, 0,
2073 /* T42 Object */
2074 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2075 /* T43 Object */
2076 0, 0, 0, 0, 0, 0, 0,
2077 /* T46 Object */
2078 64, 0, 20, 20, 0, 0, 0, 0, 0,
2079 /* T47 Object */
2080 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2081 /* T48 Object */
2082 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2083 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2084 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2085 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2086 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2087 0, 0, 0, 0,
2088 /* T56 Object */
2089 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2090 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2091 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2092 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2093 2, 99, 33,
2094};
2095
2096/* configuration data for mxt1386e using V2.1 firmware */
2097static const u8 mxt1386e_config_data_v2_1[] = {
2098 /* T6 Object */
2099 0, 0, 0, 0, 0, 0,
2100 /* T38 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002101 12, 4, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2107 0, 0, 0, 0,
2108 /* T7 Object */
2109 100, 16, 50,
2110 /* T8 Object */
2111 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2112 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002113 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002114 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002115 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2116 10, 5, 0, 0, 0,
2117 /* T18 Object */
2118 0, 0,
2119 /* T24 Object */
2120 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2121 0, 0, 0, 0, 0, 0, 0, 0, 0,
2122 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002123 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002124 /* T27 Object */
2125 0, 0, 0, 0, 0, 0, 0,
2126 /* T40 Object */
2127 0, 0, 0, 0, 0,
2128 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002129 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002130 /* T43 Object */
2131 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2132 16,
2133 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002134 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002135 /* T47 Object */
2136 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2137 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002138 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002139 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2140 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2141 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2143 0, 0, 0, 0,
2144 /* T56 Object */
2145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2149 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2150 255,
2151};
2152
Jing Lineec88ca2012-02-08 11:18:30 -08002153/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2154static const u8 mxt1386e_config_data_3d[] = {
2155 /* T6 Object */
2156 0, 0, 0, 0, 0, 0,
2157 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002158 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2162 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2164 0, 0, 0, 0,
2165 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002166 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002167 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002168 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002169 /* T9 Object */
2170 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2171 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002172 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2173 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002174 /* T18 Object */
2175 0, 0,
2176 /* T24 Object */
2177 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2178 0, 0, 0, 0, 0, 0, 0, 0, 0,
2179 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002180 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002181 /* T27 Object */
2182 0, 0, 0, 0, 0, 0, 0,
2183 /* T40 Object */
2184 0, 0, 0, 0, 0,
2185 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002186 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002187 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002188 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2189 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002190 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002191 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002192 /* T47 Object */
2193 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2194 /* T48 Object */
2195 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002196 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2197 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2198 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2200 0, 0, 0, 0,
2201 /* T56 Object */
2202 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2203 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2204 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2205 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002206 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2207 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002208};
2209
Amy Maloche08266db2011-11-04 11:07:16 -07002210#define MXT_TS_GPIO_IRQ 11
2211#define MXT_TS_LDO_EN_GPIO 50
2212#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302213
2214static void mxt_init_hw_liquid(void)
2215{
2216 int rc;
2217
Mohan Pallaka50837382011-09-07 11:00:57 +05302218 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2219 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002220 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2221 __func__, MXT_TS_LDO_EN_GPIO);
2222 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302223 }
2224
2225 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2226 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002227 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2228 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302229 goto err_ldo_gpio_req;
2230 }
2231
Mohan Pallaka50837382011-09-07 11:00:57 +05302232 return;
2233
Mohan Pallaka50837382011-09-07 11:00:57 +05302234err_ldo_gpio_req:
2235 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302236}
2237
Jing Lineec88ca2012-02-08 11:18:30 -08002238static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002239 {
2240 .config = mxt1386_config_data,
2241 .config_length = ARRAY_SIZE(mxt1386_config_data),
2242 .family_id = 0xA0,
2243 .variant_id = 0x0,
2244 .version = 0x10,
2245 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002246 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002247 },
Jing Lin33b007d2011-12-21 17:40:23 -08002248 {
2249 .config = mxt1386e_config_data_v1_0,
2250 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2251 .family_id = 0xA0,
2252 .variant_id = 0x2,
2253 .version = 0x10,
2254 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002255 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002256 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002257 },
2258 {
2259 .config = mxt1386e_config_data_v2_1,
2260 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2261 .family_id = 0xA0,
2262 .variant_id = 0x7,
2263 .version = 0x21,
2264 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002265 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002266 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2267 },
2268 {
2269 /* The config data for V2.2.AA is the same as for V2.1.AA */
2270 .config = mxt1386e_config_data_v2_1,
2271 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2272 .family_id = 0xA0,
2273 .variant_id = 0x7,
2274 .version = 0x22,
2275 .build = 0xAA,
2276 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002277 },
Jing Lindc4413c2012-01-16 15:22:52 -08002278};
2279
Jing Lineec88ca2012-02-08 11:18:30 -08002280static struct mxt_platform_data mxt_platform_data_2d = {
2281 .config_array = mxt_config_array_2d,
2282 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002283 .panel_minx = 0,
2284 .panel_maxx = 1365,
2285 .panel_miny = 0,
2286 .panel_maxy = 767,
2287 .disp_minx = 0,
2288 .disp_maxx = 1365,
2289 .disp_miny = 0,
2290 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302291 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002292 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002293 .reset_gpio = MXT_TS_RESET_GPIO,
2294 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302295};
2296
Jing Lineec88ca2012-02-08 11:18:30 -08002297static struct mxt_config_info mxt_config_array_3d[] = {
2298 {
2299 .config = mxt1386e_config_data_3d,
2300 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2301 .family_id = 0xA0,
2302 .variant_id = 0x7,
2303 .version = 0x21,
2304 .build = 0xAA,
2305 },
2306};
2307
2308static struct mxt_platform_data mxt_platform_data_3d = {
2309 .config_array = mxt_config_array_3d,
2310 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002311 .panel_minx = 0,
2312 .panel_maxx = 1919,
2313 .panel_miny = 0,
2314 .panel_maxy = 1199,
2315 .disp_minx = 0,
2316 .disp_maxx = 1919,
2317 .disp_miny = 0,
2318 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002319 .irqflags = IRQF_TRIGGER_FALLING,
2320 .i2c_pull_up = true,
2321 .reset_gpio = MXT_TS_RESET_GPIO,
2322 .irq_gpio = MXT_TS_GPIO_IRQ,
2323};
2324
Mohan Pallaka50837382011-09-07 11:00:57 +05302325static struct i2c_board_info mxt_device_info[] __initdata = {
2326 {
2327 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302328 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2329 },
2330};
2331
Manoj Rao14648742012-03-30 19:42:12 -07002332static struct msm_mhl_platform_data mhl_platform_data = {
2333 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002334 .gpio_mhl_int = MHL_GPIO_INT,
2335 .gpio_mhl_reset = MHL_GPIO_RESET,
2336 .gpio_mhl_power = 0,
2337 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002338};
Manoj Rao14648742012-03-30 19:42:12 -07002339
Eugene Yasmand2316b82011-12-07 18:23:48 +02002340static struct i2c_board_info sii_device_info[] __initdata = {
2341 {
Manoj Rao14648742012-03-30 19:42:12 -07002342#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2343 /*
2344 * keeps SI 8334 as the default
2345 * MHL TX
2346 */
2347 I2C_BOARD_INFO("sii8334", 0x39),
2348 .platform_data = &mhl_platform_data,
2349#endif
2350#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002351 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002352 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002353#endif /* CONFIG_MSM_HDMI_MHL */
2354 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002355 },
2356};
2357
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002358static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2359 .clk_freq = 100000,
2360 .src_clk_rate = 24000000,
Kiran Gundab4696c72012-08-16 18:37:46 +05302361 .keep_ahb_clk_on = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002362};
2363
2364static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2365 .clk_freq = 100000,
2366 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002367};
2368
2369static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2370 .clk_freq = 100000,
2371 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002372};
2373
2374static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2375 .clk_freq = 100000,
2376 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002377};
2378
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002379static struct ks8851_pdata spi_eth_pdata = {
2380 .irq_gpio = KS8851_IRQ_GPIO,
2381 .rst_gpio = KS8851_RST_GPIO,
2382};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002383
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302384static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002385 {
2386 .modalias = "ks8851",
2387 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2388 .max_speed_hz = 19200000,
2389 .bus_num = 0,
2390 .chip_select = 0,
2391 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002392 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002393 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302394};
2395static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002396 {
2397 .modalias = "dsi_novatek_3d_panel_spi",
2398 .max_speed_hz = 10800000,
2399 .bus_num = 0,
2400 .chip_select = 1,
2401 .mode = SPI_MODE_0,
2402 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002403};
2404
2405static struct platform_device msm_device_saw_core0 = {
2406 .name = "saw-regulator",
2407 .id = 0,
2408 .dev = {
2409 .platform_data = &msm_saw_regulator_pdata_s5,
2410 },
2411};
2412
2413static struct platform_device msm_device_saw_core1 = {
2414 .name = "saw-regulator",
2415 .id = 1,
2416 .dev = {
2417 .platform_data = &msm_saw_regulator_pdata_s6,
2418 },
2419};
2420
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002421static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002422 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002423 .tsens_factor = 1000,
2424 .hw_type = MSM_8960,
2425 .tsens_num_sensor = 5,
2426};
2427
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002428static struct platform_device msm_tsens_device = {
2429 .name = "tsens8960-tm",
2430 .id = -1,
2431};
2432
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002433static struct msm_thermal_data msm_thermal_pdata = {
2434 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002435 .poll_ms = 250,
2436 .limit_temp_degC = 60,
2437 .temp_hysteresis_degC = 10,
2438 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002439};
2440
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002441#ifdef CONFIG_MSM_FAKE_BATTERY
2442static struct platform_device fish_battery_device = {
2443 .name = "fish_battery",
2444};
2445#endif
2446
David Collins26f05562011-06-20 09:56:28 -07002447static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002448 .name = GPIO_REGULATOR_DEV_NAME,
2449 .id = PM8921_MPP_PM_TO_SYS(7),
2450 .dev = {
2451 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2452 },
2453};
2454
David Collins26f05562011-06-20 09:56:28 -07002455static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002456 .name = GPIO_REGULATOR_DEV_NAME,
2457 .id = 91,
2458 .dev = {
2459 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2460 },
2461};
2462
David Collinsb10be1d2011-09-02 10:29:31 -07002463static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2464 .name = GPIO_REGULATOR_DEV_NAME,
2465 .id = PM8921_GPIO_PM_TO_SYS(17),
2466 .dev = {
2467 .platform_data =
2468 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2469 },
2470};
2471
David Collins35a78f52011-12-14 15:54:25 -08002472static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2473 .name = GPIO_REGULATOR_DEV_NAME,
2474 .id = PM8921_GPIO_PM_TO_SYS(42),
2475 .dev = {
2476 .platform_data =
2477 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2478 },
2479};
2480
David Collins26f05562011-06-20 09:56:28 -07002481static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2482 .name = "rpm-regulator",
2483 .id = -1,
2484 .dev = {
2485 .platform_data = &msm_rpm_regulator_pdata,
2486 },
2487};
Mayank Ranae009c922012-03-22 03:02:06 +05302488#ifdef CONFIG_SERIAL_MSM_HS
2489static int configure_uart_gpios(int on)
2490{
2491 int ret = 0, i;
2492 int uart_gpios[] = {93, 94, 95, 96};
2493
2494 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2495 if (on) {
2496 ret = gpio_request(uart_gpios[i], NULL);
2497 if (ret) {
2498 pr_err("%s: unable to request uart gpio[%d]\n",
2499 __func__, uart_gpios[i]);
2500 break;
2501 }
2502 } else {
2503 gpio_free(uart_gpios[i]);
2504 }
2505 }
2506
2507 if (ret && on && i)
2508 for (; i >= 0; i--)
2509 gpio_free(uart_gpios[i]);
2510 return ret;
2511}
2512
2513static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002514 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302515};
Mayank Rana1f02d952012-07-04 19:11:20 +05302516
2517static int configure_gsbi8_uart_gpios(int on)
2518{
2519 int ret = 0, i;
2520 int uart_gpios[] = {34, 35, 36, 37};
2521
2522 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2523 if (on) {
2524 ret = gpio_request(uart_gpios[i], NULL);
2525 if (ret) {
2526 pr_err("%s: unable to request uart gpio[%d]\n",
2527 __func__, uart_gpios[i]);
2528 break;
2529 }
2530 } else {
2531 gpio_free(uart_gpios[i]);
2532 }
2533 }
2534
2535 if (ret && on && i)
2536 for (; i >= 0; i--)
2537 gpio_free(uart_gpios[i]);
2538 return ret;
2539}
2540
2541static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2542 .gpio_config = configure_gsbi8_uart_gpios,
2543};
Mayank Ranae009c922012-03-22 03:02:06 +05302544#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302545static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302546static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2547#endif
David Collins26f05562011-06-20 09:56:28 -07002548
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302549#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002550enum WLANBT_STATUS {
2551 WLANOFF_BTOFF = 1,
2552 WLANOFF_BTON,
2553 WLANON_BTOFF,
2554 WLANON_BTON
2555};
2556
2557static DEFINE_MUTEX(ath_wlanbt_mutex);
2558static int gpio_wlan_sys_rest_en = 26;
2559static int ath_wlanbt_status = WLANOFF_BTOFF;
2560
2561static int ath6kl_power_control(int on)
2562{
2563 int rc;
2564
2565 if (on) {
2566 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2567 if (rc) {
2568 pr_err("%s: unable to request gpio %d (%d)\n",
2569 __func__, gpio_wlan_sys_rest_en, rc);
2570 return rc;
2571 }
2572 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2573 msleep(200);
2574 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2575 msleep(100);
2576 } else {
2577 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2578 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2579 msleep(100);
2580 gpio_free(gpio_wlan_sys_rest_en);
2581 }
2582 return 0;
2583};
2584
2585static int ath6kl_wlan_power(int on)
2586{
2587 int ret = 0;
2588
2589 mutex_lock(&ath_wlanbt_mutex);
2590 if (on) {
2591 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2592 ret = ath6kl_power_control(1);
2593 ath_wlanbt_status = WLANON_BTOFF;
2594 } else if (ath_wlanbt_status == WLANOFF_BTON)
2595 ath_wlanbt_status = WLANON_BTON;
2596 } else {
2597 if (ath_wlanbt_status == WLANON_BTOFF) {
2598 ret = ath6kl_power_control(0);
2599 ath_wlanbt_status = WLANOFF_BTOFF;
2600 } else if (ath_wlanbt_status == WLANON_BTON)
2601 ath_wlanbt_status = WLANOFF_BTON;
2602 }
2603 mutex_unlock(&ath_wlanbt_mutex);
2604 pr_debug("%s on= %d, wlan_status= %d\n",
2605 __func__, on, ath_wlanbt_status);
2606 return ret;
2607};
2608
2609static struct wifi_platform_data ath6kl_wifi_control = {
2610 .set_power = ath6kl_wlan_power,
2611};
2612
2613static struct platform_device msm_wlan_power_device = {
2614 .name = "ath6kl_power",
2615 .dev = {
2616 .platform_data = &ath6kl_wifi_control,
2617 },
2618};
2619
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302620static struct resource bluesleep_resources[] = {
2621 {
2622 .name = "gpio_host_wake",
2623 .start = 27,
2624 .end = 27,
2625 .flags = IORESOURCE_IO,
2626 },
2627 {
2628 .name = "gpio_ext_wake",
2629 .start = 29,
2630 .end = 29,
2631 .flags = IORESOURCE_IO,
2632 },
2633 {
2634 .name = "host_wake",
2635 .start = MSM_GPIO_TO_INT(27),
2636 .end = MSM_GPIO_TO_INT(27),
2637 .flags = IORESOURCE_IRQ,
2638 },
2639};
2640
2641static struct platform_device msm_bluesleep_device = {
2642 .name = "bluesleep",
2643 .id = -1,
2644 .num_resources = ARRAY_SIZE(bluesleep_resources),
2645 .resource = bluesleep_resources,
2646};
2647
2648static struct platform_device msm_bt_power_device = {
2649 .name = "bt_power",
2650};
2651
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002652static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302653
2654static int bluetooth_power(int on)
2655{
2656 int rc;
2657
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002658 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302659 if (on) {
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002660 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2661 ath6kl_power_control(1);
2662 ath_wlanbt_status = WLANOFF_BTON;
2663 } else if (ath_wlanbt_status == WLANON_BTOFF)
2664 ath_wlanbt_status = WLANON_BTON;
2665
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302666 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2667 if (rc) {
2668 pr_err("%s: unable to request gpio %d (%d)\n",
2669 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002670 mutex_unlock(&ath_wlanbt_mutex);
2671 return rc;
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302672 }
2673 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002674 msleep(20);
2675 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302676 msleep(100);
2677 } else {
2678 gpio_set_value(gpio_bt_sys_rest_en, 0);
2679 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2680 msleep(100);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002681 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302682
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002683 if (ath_wlanbt_status == WLANOFF_BTON) {
2684 ath6kl_power_control(0);
2685 ath_wlanbt_status = WLANOFF_BTOFF;
2686 } else if (ath_wlanbt_status == WLANON_BTON)
2687 ath_wlanbt_status = WLANON_BTOFF;
2688 }
2689 mutex_unlock(&ath_wlanbt_mutex);
2690 pr_debug("%s on= %d, wlan_status= %d\n",
2691 __func__, on, ath_wlanbt_status);
2692 return 0;
2693};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302694
2695static void __init bt_power_init(void)
2696{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302697 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302698 return;
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002699};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302700#else
2701#define bt_power_init(x) do {} while (0)
2702#endif
2703
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002704static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002705 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002706 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302707 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002708 &msm_device_saw_core0,
2709 &msm_device_saw_core1,
2710 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002711 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002712 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002713 &msm8960_device_qup_spi_gsbi1,
2714 &msm8960_device_qup_i2c_gsbi3,
2715 &msm8960_device_qup_i2c_gsbi4,
2716 &msm8960_device_qup_i2c_gsbi10,
2717#ifndef CONFIG_MSM_DSPS
2718 &msm8960_device_qup_i2c_gsbi12,
2719#endif
2720 &msm_slim_ctrl,
2721 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302722#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2723 &msm_bluesleep_device,
2724 &msm_bt_power_device,
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002725 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302726#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002727#if defined(CONFIG_QSEECOM)
2728 &qseecom_device,
2729#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002730#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2731 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2732 &qcrypto_device,
2733#endif
2734
2735#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2736 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2737 &qcedev_device,
2738#endif
2739#ifdef CONFIG_MSM_ROTATOR
2740 &msm_rotator_device,
2741#endif
2742 &msm_device_sps,
2743#ifdef CONFIG_MSM_FAKE_BATTERY
2744 &fish_battery_device,
2745#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002746 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002747#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002748#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002749 &msm8960_android_pmem_device,
2750 &msm8960_android_pmem_adsp_device,
2751 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002752#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002753#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002754 &msm_device_bam_dmux,
2755 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002756#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2757#ifdef CONFIG_MSM_USE_TSIF1
2758 &msm_device_tsif[1],
2759#else
2760 &msm_device_tsif[0],
2761#endif
2762#endif
Joel Nider266a2642011-10-16 10:58:05 +02002763 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002764#ifdef CONFIG_HW_RANDOM_MSM
2765 &msm_device_rng,
2766#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002767#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002768 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002769#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002770 &msm8960_rpm_device,
2771 &msm8960_rpm_log_device,
2772 &msm8960_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302773 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002774 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002775 &coresight_tpiu_device,
2776 &coresight_etb_device,
2777 &coresight_funnel_device,
2778 &coresight_etm0_device,
2779 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002780 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002781 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002782 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002783 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002784 &msm8960_device_ebi1_ch0_erp,
2785 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002786 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002787 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002788 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002789};
2790
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002791static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002792 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002793 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002794 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002795 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002796 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002797 &msm8960_device_otg,
2798 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002799 &msm_device_hsusb_host,
2800 &android_usb_device,
2801 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002802 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002803 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002804 &msm_pcm_routing,
2805 &msm_cpudai0,
2806 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002807 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002808 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002809 &msm_cpudai_hdmi_rx,
2810 &msm_cpudai_bt_rx,
2811 &msm_cpudai_bt_tx,
2812 &msm_cpudai_fm_rx,
2813 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002814 &msm_cpudai_auxpcm_rx,
2815 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002816 &msm_cpu_fe,
2817 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002818#ifdef CONFIG_MSM_GEMINI
2819 &msm8960_gemini_device,
2820#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002821#ifdef CONFIG_MSM_MERCURY
2822 &msm8960_mercury_device,
2823#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002824 &msm_voice,
2825 &msm_voip,
2826 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302827 &msm_cpudai_afe_01_rx,
2828 &msm_cpudai_afe_01_tx,
2829 &msm_cpudai_afe_02_rx,
2830 &msm_cpudai_afe_02_tx,
2831 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302832 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002833 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002834 &msm_cpudai_incall_record_rx,
2835 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002836 &msm_pcm_hostless,
2837 &msm_bus_apps_fabric,
2838 &msm_bus_sys_fabric,
2839 &msm_bus_mm_fabric,
2840 &msm_bus_sys_fpb,
2841 &msm_bus_cpss_fpb,
2842};
2843
2844static void __init msm8960_i2c_init(void)
2845{
2846 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2847 &msm8960_i2c_qup_gsbi4_pdata;
2848
2849 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2850 &msm8960_i2c_qup_gsbi3_pdata;
2851
2852 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2853 &msm8960_i2c_qup_gsbi10_pdata;
2854
2855 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2856 &msm8960_i2c_qup_gsbi12_pdata;
2857}
2858
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002859static void __init msm8960_gfx_init(void)
2860{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002861 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2862 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002863 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002864
Carter Cooper3852cbb2012-08-20 22:11:42 -06002865 /* Fixup data that needs to change based on GPU ID */
Carter Cooperffe7ea12012-08-22 13:27:58 -06002866 if (cpu_is_msm8960ab()) {
2867 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Carter Cooper3852cbb2012-08-20 22:11:42 -06002868 /* 8960PRO nominal clock rate is 325Mhz instead of 320Mhz */
2869 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 325000000;
2870 } else {
2871 kgsl_3d0_pdata->iommu_count = 1;
2872 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2873 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2874 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2875 }
2876 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2877 /* 8960v3 GPU registers returns 5 for patch release
2878 * but it should be 6, so dummy up the chipid here
2879 * based the platform type
2880 */
2881 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2882 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002883 }
Carter Cooper6307eb992012-08-20 15:17:23 -06002884
2885 /* Register the 3D core */
2886 platform_device_register(&msm_kgsl_3d0);
2887
2888 /* Register the 2D cores if we are not 8960PRO */
2889 if (!cpu_is_msm8960ab()) {
2890 platform_device_register(&msm_kgsl_2d0);
2891 platform_device_register(&msm_kgsl_2d1);
2892 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002893}
2894
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302895static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002896 {
2897 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2898 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2899 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002900 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002901 },
2902
2903 {
2904 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2905 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2906 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002907 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002908 },
2909
2910 {
2911 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2912 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2913 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002914 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002915 },
2916
2917 {
2918 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002919 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2920 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002921 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002922 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002923
2924 {
2925 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2926 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2927 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002928 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002929 },
2930
2931 {
2932 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2933 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2934 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002935 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002936 },
2937
2938 {
2939 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2940 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2941 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002942 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002943 },
2944
2945 {
2946 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2947 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2948 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002949 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002950 },
2951};
2952
Praveen Chidambaram78499012011-11-01 17:15:17 -06002953static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2954 .levels = &msm_rpmrs_levels[0],
2955 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2956 .vdd_mem_levels = {
2957 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2958 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2959 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2960 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2961 },
2962 .vdd_dig_levels = {
2963 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2964 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2965 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2966 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2967 },
2968 .vdd_mask = 0x7FFFFF,
2969 .rpmrs_target_id = {
2970 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2971 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2972 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2973 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2974 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2975 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2976 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2977 },
2978};
2979
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002980static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2981 .mode = MSM_PM_BOOT_CONFIG_TZ,
2982};
2983
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002984#ifdef CONFIG_I2C
2985#define I2C_SURF 1
2986#define I2C_FFA (1 << 1)
2987#define I2C_RUMI (1 << 2)
2988#define I2C_SIM (1 << 3)
2989#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002990#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002991
2992struct i2c_registry {
2993 u8 machs;
2994 int bus;
2995 struct i2c_board_info *info;
2996 int len;
2997};
2998
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002999/* Sensors DSPS platform data */
3000#ifdef CONFIG_MSM_DSPS
3001#define DSPS_PIL_GENERIC_NAME "dsps"
3002#endif /* CONFIG_MSM_DSPS */
3003
3004static void __init msm8960_init_dsps(void)
3005{
3006#ifdef CONFIG_MSM_DSPS
3007 struct msm_dsps_platform_data *pdata =
3008 msm_dsps_device.dev.platform_data;
3009 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3010 pdata->gpios = NULL;
3011 pdata->gpios_num = 0;
3012
3013 platform_device_register(&msm_dsps_device);
3014#endif /* CONFIG_MSM_DSPS */
3015}
3016
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003017static int hsic_peripheral_status = 1;
3018static DEFINE_MUTEX(hsic_status_lock);
3019
3020void peripheral_connect()
3021{
3022 mutex_lock(&hsic_status_lock);
3023 if (hsic_peripheral_status)
3024 goto out;
3025 platform_device_add(&msm_device_hsic_host);
3026 hsic_peripheral_status = 1;
3027out:
3028 mutex_unlock(&hsic_status_lock);
3029}
3030EXPORT_SYMBOL(peripheral_connect);
3031
3032void peripheral_disconnect()
3033{
3034 mutex_lock(&hsic_status_lock);
3035 if (!hsic_peripheral_status)
3036 goto out;
3037 platform_device_del(&msm_device_hsic_host);
3038 hsic_peripheral_status = 0;
3039out:
3040 mutex_unlock(&hsic_status_lock);
3041}
3042EXPORT_SYMBOL(peripheral_disconnect);
3043
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303044static void __init msm8960_init_smsc_hub(void)
3045{
3046 uint32_t version = socinfo_get_version();
3047
3048 if (SOCINFO_VERSION_MAJOR(version) == 1)
3049 return;
3050
3051 if (machine_is_msm8960_liquid())
3052 platform_device_register(&smsc_hub_device);
3053}
3054
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003055static void __init msm8960_init_hsic(void)
3056{
3057#ifdef CONFIG_USB_EHCI_MSM_HSIC
3058 uint32_t version = socinfo_get_version();
3059
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003060 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003061 return;
3062
Joel King0cbf5d82012-05-24 15:21:38 -07003063 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003064 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003065#endif
3066}
3067
Amir Samuelov5137e392011-09-21 17:31:25 +03003068#ifdef CONFIG_ISL9519_CHARGER
3069static struct isl_platform_data isl_data __initdata = {
3070 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3071 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3072 .max_system_voltage = 4200,
3073 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003074 .chgcurrent = 1900,
3075 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003076 .input_current = 2048,
3077};
3078
3079static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3080 {
3081 I2C_BOARD_INFO("isl9519q", 0x9),
3082 .irq = 0, /* Not required when notify-by-pmic */
3083 .platform_data = &isl_data,
3084 },
3085};
3086#endif /* CONFIG_ISL9519_CHARGER */
3087
Amir Samuelov755616d2011-12-13 16:34:46 +02003088static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3089 {
3090 I2C_BOARD_INFO("sx1508q", 0x20),
3091 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3092 },
3093};
3094
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003095static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003096#ifdef CONFIG_ISL9519_CHARGER
3097 {
3098 I2C_LIQUID,
3099 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3100 isl_charger_i2c_info,
3101 ARRAY_SIZE(isl_charger_i2c_info),
3102 },
3103#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003104 {
3105 I2C_SURF | I2C_FFA | I2C_FLUID,
3106 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3107 cyttsp_info,
3108 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003109 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303110 {
3111 I2C_LIQUID,
3112 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3113 mxt_device_info,
3114 ARRAY_SIZE(mxt_device_info),
3115 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303116 {
Manoj Rao14648742012-03-30 19:42:12 -07003117 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303118 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003119 sii_device_info,
3120 ARRAY_SIZE(sii_device_info),
3121 },
3122 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303123 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003124 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303125 msm_isa1200_board_info,
3126 ARRAY_SIZE(msm_isa1200_board_info),
3127 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003128 {
3129 I2C_LIQUID,
3130 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3131 liquid_io_expander_i2c_info,
3132 ARRAY_SIZE(liquid_io_expander_i2c_info),
3133 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003134};
3135#endif /* CONFIG_I2C */
3136
3137static void __init register_i2c_devices(void)
3138{
3139#ifdef CONFIG_I2C
3140 u8 mach_mask = 0;
3141 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003142#ifdef CONFIG_MSM_CAMERA
3143 struct i2c_registry msm8960_camera_i2c_devices = {
3144 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3145 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3146 msm8960_camera_board_info.board_info,
3147 msm8960_camera_board_info.num_i2c_board_info,
3148 };
3149#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003150
3151 /* Build the matching 'supported_machs' bitmask */
3152 if (machine_is_msm8960_cdp())
3153 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003154 else if (machine_is_msm8960_fluid())
3155 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003156 else if (machine_is_msm8960_liquid())
3157 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003158 else if (machine_is_msm8960_mtp())
3159 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003160 else
3161 pr_err("unmatched machine ID in register_i2c_devices\n");
3162
Jing Lineec88ca2012-02-08 11:18:30 -08003163 if (machine_is_msm8960_liquid()) {
3164 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3165 mxt_device_info[0].platform_data =
3166 &mxt_platform_data_3d;
3167 else
3168 mxt_device_info[0].platform_data =
3169 &mxt_platform_data_2d;
3170 }
3171
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003172 /* Run the array and install devices as appropriate */
3173 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3174 if (msm8960_i2c_devices[i].machs & mach_mask)
3175 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3176 msm8960_i2c_devices[i].info,
3177 msm8960_i2c_devices[i].len);
3178 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003179
3180 if (!mhl_platform_data.gpio_mhl_power)
3181 pr_debug("mhl device configured for ext debug board\n");
3182
Kevin Chan09f4e662011-12-16 08:17:02 -08003183#ifdef CONFIG_MSM_CAMERA
3184 if (msm8960_camera_i2c_devices.machs & mach_mask)
3185 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3186 msm8960_camera_i2c_devices.info,
3187 msm8960_camera_i2c_devices.len);
3188#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003189#endif
3190}
3191
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003192static void __init msm8960_tsens_init(void)
3193{
3194 if (cpu_is_msm8960())
3195 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3196 return;
3197
3198 msm_tsens_early_init(&msm_tsens_pdata);
3199}
3200
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003201static void __init msm8960_cdp_init(void)
3202{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003203 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3204 pr_err("meminfo_init() failed!\n");
3205
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003206 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003207 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003208 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003209 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3210 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003211
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003212 regulator_suppress_info_printing();
3213 if (msm_xo_init())
3214 pr_err("Failed to initialize XO votes\n");
David Collins4c93ce92012-09-04 15:44:19 -07003215 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003216 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003217 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303218 if (machine_is_msm8960_liquid())
3219 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003220 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303221 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3222 machine_is_msm8960_cdp()) {
Mayank Ranaa1f507b2012-08-14 10:57:00 +05303223 /* Due to availability of USB Switch in SGLTE Platform
3224 * it requires different HSUSB PHY settings compare to
3225 * 8960 MTP/CDP platform.
3226 */
3227 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3228 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3229 else
3230 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303231 } else if (machine_is_msm8960_liquid()) {
3232 msm_otg_pdata.phy_init_seq =
3233 liquid_v1_phy_init_seq;
3234 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003235 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303236 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303237 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303238 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3239 machine_is_msm8960_liquid())
3240 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003241 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003242 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3243 &msm8960_qup_spi_gsbi1_pdata;
3244 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303245 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3246 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003247
3248 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303249 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
3250 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303251 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003252 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003253 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003254 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3255 msm_spm_l2_init(msm_spm_l2_data);
3256 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003257 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003258 if (machine_is_msm8960_liquid())
3259 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003260 if (machine_is_msm8960_cdp())
3261 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003262
3263 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3264 platform_device_register(&msm8960_device_uart_gsbi8);
3265 else
3266 platform_device_register(&msm8960_device_uart_gsbi5);
3267
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003268 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003269 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3270 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003271 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303272 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003273 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003274
Mayank Rana1f02d952012-07-04 19:11:20 +05303275 /* For 8960 Standalone External Bluetooth Interface */
3276 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3277 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3278 platform_device_register(&msm_device_uart_dm8);
3279 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003280 if (cpu_is_msm8960ab())
3281 platform_device_register(&msm8960ab_device_acpuclk);
3282 else
3283 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003284 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menond4837f62012-08-20 15:25:50 -07003285 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003286
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003287 msm8960_pm8921_gpio_mpp_init();
Stephen Boyd0ea1b762012-09-13 12:41:31 -07003288 /* Don't add modem devices on APQ targets */
3289 if (socinfo_get_id() != 124) {
3290 platform_device_register(&msm_8960_q6_mss_fw);
3291 platform_device_register(&msm_8960_q6_mss_sw);
3292 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003293 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303294 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003295 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003296#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003297 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003298#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003299 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303300 if (machine_is_msm8960_liquid())
3301 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003302 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003303 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003304 slim_register_board_info(msm_slim_devices,
3305 ARRAY_SIZE(msm_slim_devices));
3306 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003307 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003308 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303309 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003310 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3311 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3312 platform_device_register(&mdm_sglte_device);
3313 }
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003314}
3315
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003316MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3317 .map_io = msm8960_map_io,
3318 .reserve = msm8960_reserve,
3319 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303320 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003321 .timer = &msm_timer,
3322 .init_machine = msm8960_cdp_init,
3323 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003324 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003325 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003326MACHINE_END
3327
3328MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3329 .map_io = msm8960_map_io,
3330 .reserve = msm8960_reserve,
3331 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303332 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003333 .timer = &msm_timer,
3334 .init_machine = msm8960_cdp_init,
3335 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003336 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003337 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003338MACHINE_END
3339
3340MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3341 .map_io = msm8960_map_io,
3342 .reserve = msm8960_reserve,
3343 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303344 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003345 .timer = &msm_timer,
3346 .init_machine = msm8960_cdp_init,
3347 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003348 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003349 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003350MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003351
3352MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3353 .map_io = msm8960_map_io,
3354 .reserve = msm8960_reserve,
3355 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303356 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003357 .timer = &msm_timer,
3358 .init_machine = msm8960_cdp_init,
3359 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003360 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003361 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003362MACHINE_END