blob: 7e96edfc08366442819bca056c56e56fd55f0bae [file] [log] [blame]
Abhijeet Dharmapurikar44451662012-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 Humpheryscfa31af2012-09-06 11:34:03 -070080#include <linux/msm_ion.h>
Laura Abbottd6183792011-08-19 13:42:24 -070081#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080082#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080083#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080084#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080085#include <mach/msm_cache_dump.h>
86#include <mach/scm.h>
Olav Haugan8726caf2012-05-10 15:11:35 -070087#include <mach/iommu_domains.h>
Laura Abbottd6183792011-08-19 13:42:24 -070088
Jordan Crouse914de9b2012-07-09 13:49:46 -060089#include <mach/kgsl.h>
Larry Bassel41a055b2011-12-06 16:15:14 -080090#include <linux/fmem.h>
91
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080093#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080096#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080097#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080098#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070099#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530100#include <mach/mpm.h>
Matt Wagantall33d01f52012-02-23 23:27:44 -0800101#include "clock.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -0700102#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -0600103#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700104#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800105
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700106static struct platform_device msm_fm_platform_init = {
107 .name = "iris_fm",
108 .id = -1,
109};
110
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700111#define KS8851_RST_GPIO 89
112#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530113
Manoj Rao14648742012-03-30 19:42:12 -0700114#define MHL_GPIO_INT 4
115#define MHL_GPIO_RESET 15
116
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700117#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700118
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800119struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700120 [SX150X_CAM] = {
121 .gpio_base = GPIO_CAM_EXPANDER_BASE,
122 .oscio_is_gpo = false,
123 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530124 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700125 .io_open_drain_ena = 0x0,
126 .irq_summary = -1,
127 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200128 [SX150X_LIQUID] = {
129 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
130 .oscio_is_gpo = false,
131 .io_pullup_ena = 0x0c08,
132 .io_pulldn_ena = 0x4060,
133 .io_open_drain_ena = 0x000c,
134 .io_polarity = 0,
135 .irq_summary = -1,
136 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700137};
Nishant Pandit474f2252011-07-23 23:17:56 +0530138
139#endif
140
Olav Haugana21169d2012-01-04 09:17:06 -0800141#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700142#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800143#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800144#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800145#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700146
147#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur35825522012-06-06 15:49:14 -0700148#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700149#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700150#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700151#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700152#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700153#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700154#define MSM_ION_HEAP_NUM 7
155#else
156#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
157#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700158#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700159#define MSM_ION_HEAP_NUM 8
160#endif
Deepak Kotur35825522012-06-06 15:49:14 -0700161#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 128kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800162#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800163#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700164
Olav Hauganb5be7992011-11-18 14:29:02 -0800165#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800166#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
167#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700168
Deepak Kotur35825522012-06-06 15:49:14 -0700169#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2mb -128kb*/
170#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
171 HOLE_SIZE))
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700172#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur35825522012-06-06 15:49:14 -0700173#define MSM8960_FW_START MSM8960_FIXED_AREA_START
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700174
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800175static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700176#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700177#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800178#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700179#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700180
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700181#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
182static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
183static int __init msm_contig_mem_size_setup(char *p)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700184{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700185 msm_contig_mem_size = memparse(p, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700186 return 0;
187}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700188early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700189#endif
190
191#ifdef CONFIG_ANDROID_PMEM
192static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800193static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700194static int __init pmem_size_setup(char *p)
195{
196 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800197 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700198 return 0;
199}
200early_param("pmem_size", pmem_size_setup);
201
202static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
203
204static int __init pmem_adsp_size_setup(char *p)
205{
206 pmem_adsp_size = memparse(p, NULL);
207 return 0;
208}
209early_param("pmem_adsp_size", pmem_adsp_size_setup);
210
211static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
212
213static int __init pmem_audio_size_setup(char *p)
214{
215 pmem_audio_size = memparse(p, NULL);
216 return 0;
217}
218early_param("pmem_audio_size", pmem_audio_size_setup);
219#endif
220
221#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700222#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700223static struct android_pmem_platform_data android_pmem_pdata = {
224 .name = "pmem",
225 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
226 .cached = 1,
227 .memory_type = MEMTYPE_EBI1,
228};
229
Laura Abbottb93525f2012-04-12 09:57:19 -0700230static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700231 .name = "android_pmem",
232 .id = 0,
233 .dev = {.platform_data = &android_pmem_pdata},
234};
235
236static struct android_pmem_platform_data android_pmem_adsp_pdata = {
237 .name = "pmem_adsp",
238 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
239 .cached = 0,
240 .memory_type = MEMTYPE_EBI1,
241};
Laura Abbottb93525f2012-04-12 09:57:19 -0700242static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700243 .name = "android_pmem",
244 .id = 2,
245 .dev = { .platform_data = &android_pmem_adsp_pdata },
246};
247
248static struct android_pmem_platform_data android_pmem_audio_pdata = {
249 .name = "pmem_audio",
250 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
251 .cached = 0,
252 .memory_type = MEMTYPE_EBI1,
253};
254
Laura Abbottb93525f2012-04-12 09:57:19 -0700255static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700256 .name = "android_pmem",
257 .id = 4,
258 .dev = { .platform_data = &android_pmem_audio_pdata },
259};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700260#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
261#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700262
Laura Abbottb93525f2012-04-12 09:57:19 -0700263struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800264};
265
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700266#define DSP_RAM_BASE_8960 0x8da00000
267#define DSP_RAM_SIZE_8960 0x1800000
268static int dspcrashd_pdata_8960 = 0xDEADDEAD;
269
270static struct resource resources_dspcrashd_8960[] = {
271 {
272 .name = "msm_dspcrashd",
273 .start = DSP_RAM_BASE_8960,
274 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
275 .flags = IORESOURCE_DMA,
276 },
277};
278
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800279static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700280 .name = "msm_dspcrashd",
281 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
282 .resource = resources_dspcrashd_8960,
283 .dev = { .platform_data = &dspcrashd_pdata_8960 },
284};
285
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700286static struct memtype_reserve msm8960_reserve_table[] __initdata = {
287 [MEMTYPE_SMI] = {
288 },
289 [MEMTYPE_EBI0] = {
290 .flags = MEMTYPE_FLAGS_1M_ALIGN,
291 },
292 [MEMTYPE_EBI1] = {
293 .flags = MEMTYPE_FLAGS_1M_ALIGN,
294 },
295};
296
Laura Abbottf8c03b92012-02-16 14:57:58 -0800297static void __init reserve_rtb_memory(void)
298{
299#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700300 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800301#endif
302}
303
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700304static void __init size_pmem_devices(void)
305{
306#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700307#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800309
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800310 if (!pmem_param_set) {
311 if (machine_is_msm8960_liquid())
312 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700313 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800314 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
315 }
316
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317 android_pmem_pdata.size = pmem_size;
318 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700319#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
320#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700321}
322
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700323#ifdef CONFIG_ANDROID_PMEM
324#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700325static void __init reserve_memory_for(struct android_pmem_platform_data *p)
326{
327 msm8960_reserve_table[p->memory_type].size += p->size;
328}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700329#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
330#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331
332static void __init reserve_pmem_memory(void)
333{
334#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700335#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336 reserve_memory_for(&android_pmem_adsp_pdata);
337 reserve_memory_for(&android_pmem_pdata);
338 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700339#endif
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700340 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341#endif
342}
343
Larry Basselb4126da2011-07-18 14:31:33 -0700344static int msm8960_paddr_to_memtype(unsigned int paddr)
345{
346 return MEMTYPE_EBI1;
347}
348
Steve Mucklef132c6c2012-06-06 18:30:57 -0700349#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800350
Laura Abbottd6183792011-08-19 13:42:24 -0700351#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800352#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700353static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800354 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700355 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800356 .reusable = FMEM_ENABLED,
357 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700358 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700359 .iommu_map_all = 1,
360 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800361};
362
Laura Abbottb93525f2012-04-12 09:57:19 -0700363static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800364 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800365 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800366 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800367 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700368 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800369};
370
Laura Abbottb93525f2012-04-12 09:57:19 -0700371static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800372 .adjacent_mem_id = INVALID_HEAP_ID,
373 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800374 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800375};
376
Laura Abbottb93525f2012-04-12 09:57:19 -0700377static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800378 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
379 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800380 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700381 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800382};
383#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800384
385/**
386 * These heaps are listed in the order they will be allocated. Due to
387 * video hardware restrictions and content protection the FW heap has to
388 * be allocated adjacent (below) the MM heap and the MFC heap has to be
389 * allocated after the MM heap to ensure MFC heap is not more than 256MB
390 * away from the base address of the FW heap.
391 * However, the order of FW heap and MM heap doesn't matter since these
392 * two heaps are taken care of by separate code to ensure they are adjacent
393 * to each other.
394 * Don't swap the order unless you know what you are doing!
395 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700396static struct ion_platform_data msm8960_ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700397 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700398 .heaps = {
399 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800400 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700401 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700402 .name = ION_VMALLOC_HEAP_NAME,
403 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700404#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700405 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800406 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800407 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800408 .name = ION_MM_HEAP_NAME,
409 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700410 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700411 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700412 },
Laura Abbott8c017362011-09-22 20:59:12 -0700413 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800414 .id = ION_MM_FIRMWARE_HEAP_ID,
415 .type = ION_HEAP_TYPE_CARVEOUT,
416 .name = ION_MM_FIRMWARE_HEAP_NAME,
417 .size = MSM_ION_MM_FW_SIZE,
418 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700419 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800420 },
421 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800422 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800423 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800424 .name = ION_MFC_HEAP_NAME,
425 .size = MSM_ION_MFC_SIZE,
426 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700427 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800428 },
Olav Haugan32594552012-03-13 11:40:05 -0700429#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800430 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800431 .id = ION_SF_HEAP_ID,
432 .type = ION_HEAP_TYPE_CARVEOUT,
433 .name = ION_SF_HEAP_NAME,
434 .size = MSM_ION_SF_SIZE,
435 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700436 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800437 },
Olav Haugan32594552012-03-13 11:40:05 -0700438#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800439 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800440 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700441 .type = ION_HEAP_TYPE_IOMMU,
442 .name = ION_IOMMU_HEAP_NAME,
443 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800444 {
445 .id = ION_QSECOM_HEAP_ID,
446 .type = ION_HEAP_TYPE_CARVEOUT,
447 .name = ION_QSECOM_HEAP_NAME,
448 .size = MSM_ION_QSECOM_SIZE,
449 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700450 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800451 },
Olav Haugan7355db02012-01-13 16:59:13 -0800452 {
453 .id = ION_AUDIO_HEAP_ID,
454 .type = ION_HEAP_TYPE_CARVEOUT,
455 .name = ION_AUDIO_HEAP_NAME,
456 .size = MSM_ION_AUDIO_SIZE,
457 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700458 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800459 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700460#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700461 }
462};
463
Laura Abbottb93525f2012-04-12 09:57:19 -0700464static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700465 .name = "ion-msm",
466 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700467 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700468};
469#endif
470
Laura Abbottb93525f2012-04-12 09:57:19 -0700471struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800472 .name = "fmem",
473 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700474 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800475};
476
Olav Haugan65f4bd82011-12-13 11:50:08 -0800477static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700478{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800479 unsigned int i;
480
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800481 if (!pmem_param_set) {
482 if (machine_is_msm8960_liquid())
483 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
484
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700485 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800486 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
487
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700488 if (machine_is_msm8960_liquid() ||
489 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700490 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
491 if (msm8960_ion_pdata.heaps[i].id ==
492 ION_SF_HEAP_ID) {
493 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800494 msm_ion_sf_size;
495 pr_debug("msm_ion_sf_size 0x%x\n",
496 msm_ion_sf_size);
497 break;
498 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800499 }
500 }
501 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800502}
503
504static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
505 unsigned long size)
506{
507 msm8960_reserve_table[mem_type].size += size;
508}
509
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700510static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
511{
512#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
513 int ret;
514
515 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
516 panic("fixed area size is larger than %dM\n",
517 MAX_FIXED_AREA_SIZE >> 20);
518
519 reserve_info->fixed_area_size = fixed_area_size;
520 reserve_info->fixed_area_start = MSM8960_FW_START;
521
522 ret = memblock_remove(reserve_info->fixed_area_start,
523 reserve_info->fixed_area_size);
524 BUG_ON(ret);
525#endif
526}
527
Olav Haugan65f4bd82011-12-13 11:50:08 -0800528/**
529 * Reserve memory for ION and calculate amount of reusable memory for fmem.
530 * We only reserve memory for heaps that are not reusable. However, we only
531 * support one reusable heap at the moment so we ignore the reusable flag for
532 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800533 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
534 * at a higher address than FW in addition to not more than 256MB away from the
535 * base address of the firmware. This means that if MM is reusable the other
536 * two heaps must be allocated in the same region as FW. This is handled by the
537 * mem_is_fmem flag in the platform data. In addition the MM heap must be
538 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800539 */
540static void __init reserve_ion_memory(void)
541{
542#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
543 unsigned int i;
544 unsigned int reusable_count = 0;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700545 unsigned int fixed_size = 0;
546 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
547 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800548
549 adjust_mem_for_liquid();
Laura Abbottb93525f2012-04-12 09:57:19 -0700550 msm8960_fmem_pdata.size = 0;
551 msm8960_fmem_pdata.reserved_size_low = 0;
552 msm8960_fmem_pdata.reserved_size_high = 0;
Olav Haugan8726caf2012-05-10 15:11:35 -0700553 msm8960_fmem_pdata.align = PAGE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700554 fixed_low_size = 0;
555 fixed_middle_size = 0;
556 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800557
558 /* We only support 1 reusable heap. Check if more than one heap
559 * is specified as reusable and set as non-reusable if found.
560 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700561 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
562 const struct ion_platform_heap *heap =
563 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan65f4bd82011-12-13 11:50:08 -0800564
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700565 if (heap->type == (enum ion_heap_type) ION_HEAP_TYPE_CP
566 && heap->extra_data) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800567 struct ion_cp_heap_pdata *data = heap->extra_data;
568
569 reusable_count += (data->reusable) ? 1 : 0;
570
571 if (data->reusable && reusable_count > 1) {
572 pr_err("%s: Too many heaps specified as "
573 "reusable. Heap %s was not configured "
574 "as reusable.\n", __func__, heap->name);
575 data->reusable = 0;
576 }
577 }
578 }
579
Laura Abbottb93525f2012-04-12 09:57:19 -0700580 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700581 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700582 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700583 int align = SZ_4K;
584 int iommu_map_all = 0;
585 int adjacent_mem_id = INVALID_HEAP_ID;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800586
587 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700588 int fixed_position = NOT_FIXED;
589 int mem_is_fmem = 0;
590
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700591 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800592 case ION_HEAP_TYPE_CP:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800593 mem_is_fmem = ((struct ion_cp_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700594 heap->extra_data)->mem_is_fmem;
595 fixed_position = ((struct ion_cp_heap_pdata *)
596 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700597 align = ((struct ion_cp_heap_pdata *)
598 heap->extra_data)->align;
599 iommu_map_all =
600 ((struct ion_cp_heap_pdata *)
601 heap->extra_data)->iommu_map_all;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800602 break;
603 case ION_HEAP_TYPE_CARVEOUT:
Olav Hauganf6dc7742012-02-15 09:11:55 -0800604 mem_is_fmem = ((struct ion_co_heap_pdata *)
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700605 heap->extra_data)->mem_is_fmem;
606 fixed_position = ((struct ion_co_heap_pdata *)
607 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700608 adjacent_mem_id = ((struct ion_co_heap_pdata *)
609 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700610 break;
611 default:
612 break;
613 }
614
Olav Haugan8726caf2012-05-10 15:11:35 -0700615 if (iommu_map_all) {
616 if (heap->size & (SZ_64K-1)) {
617 heap->size = ALIGN(heap->size, SZ_64K);
618 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
619 heap->name, heap->size);
620 }
621 }
622
623 if (mem_is_fmem && adjacent_mem_id != INVALID_HEAP_ID)
624 msm8960_fmem_pdata.align = align;
625
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700626 if (fixed_position != NOT_FIXED)
627 fixed_size += heap->size;
628 else
629 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
630
631 if (fixed_position == FIXED_LOW)
632 fixed_low_size += heap->size;
633 else if (fixed_position == FIXED_MIDDLE)
634 fixed_middle_size += heap->size;
635 else if (fixed_position == FIXED_HIGH)
636 fixed_high_size += heap->size;
637
638 if (mem_is_fmem)
Laura Abbottb93525f2012-04-12 09:57:19 -0700639 msm8960_fmem_pdata.size += heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700640 }
641 }
642
643 if (!fixed_size)
644 return;
645
Laura Abbottb93525f2012-04-12 09:57:19 -0700646 if (msm8960_fmem_pdata.size) {
Deepak Kotur35825522012-06-06 15:49:14 -0700647 msm8960_fmem_pdata.reserved_size_low = fixed_low_size +
648 HOLE_SIZE;
Laura Abbottb93525f2012-04-12 09:57:19 -0700649 msm8960_fmem_pdata.reserved_size_high = fixed_high_size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700650 }
651
Larry Bassel4d4f4482012-04-04 11:26:09 -0700652 /* Since the fixed area may be carved out of lowmem,
653 * make sure the length is a multiple of 1M.
654 */
655 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
656 & SECTION_MASK;
657 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700658
659 fixed_low_start = MSM8960_FIXED_AREA_START;
Deepak Kotur35825522012-06-06 15:49:14 -0700660 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700661 fixed_high_start = fixed_middle_start + fixed_middle_size;
662
Laura Abbottb93525f2012-04-12 09:57:19 -0700663 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
664 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700665
666 if (heap->extra_data) {
667 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700668 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700669
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700670 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700671 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700672 pdata =
673 (struct ion_cp_heap_pdata *)heap->extra_data;
674 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700675 break;
676 case ION_HEAP_TYPE_CARVEOUT:
677 fixed_position = ((struct ion_co_heap_pdata *)
678 heap->extra_data)->fixed_position;
679 break;
680 default:
681 break;
682 }
683
684 switch (fixed_position) {
685 case FIXED_LOW:
686 heap->base = fixed_low_start;
687 break;
688 case FIXED_MIDDLE:
689 heap->base = fixed_middle_start;
Deepak Kotur35825522012-06-06 15:49:14 -0700690 pdata->secure_base = fixed_middle_start
691 - HOLE_SIZE;
692 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700693 break;
694 case FIXED_HIGH:
695 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800696 break;
697 default:
698 break;
699 }
700 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800701 }
Laura Abbottd6183792011-08-19 13:42:24 -0700702#endif
703}
Huaibin Yanga5419422011-12-08 23:52:10 -0800704
705static void __init reserve_mdp_memory(void)
706{
707 msm8960_mdp_writeback(msm8960_reserve_table);
708}
709
Stephen Boyd668d7652012-04-25 11:31:01 -0700710static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800711{
712#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800713 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800714
Laura Abbott155ab6f2012-05-25 08:52:18 -0700715 total = msm8960_cache_dump_pdata.l1_size +
716 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800717 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800718#endif
719}
720
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700721static void __init msm8960_calculate_reserve_sizes(void)
722{
723 size_pmem_devices();
724 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700725 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800726 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800727 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800728 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700729}
730
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700731static struct reserve_info msm8960_reserve_info __initdata = {
732 .memtype_reserve_table = msm8960_reserve_table,
733 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700734 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700735 .paddr_to_memtype = msm8960_paddr_to_memtype,
736};
737
Larry Basselb4126da2011-07-18 14:31:33 -0700738static int msm8960_memory_bank_size(void)
739{
740 return 1<<29;
741}
742
743static void __init locate_unstable_memory(void)
744{
745 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
746 unsigned long bank_size;
747 unsigned long low, high;
748
749 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700750 msm8960_reserve_info.bank_size = bank_size;
751
Larry Basselb4126da2011-07-18 14:31:33 -0700752 low = meminfo.bank[0].start;
753 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700754
755 /* Check if 32 bit overflow occured */
756 if (high < mb->start)
757 high = ~0UL;
758
Larry Bassel4d4f4482012-04-04 11:26:09 -0700759 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
760 panic("fixed area extends beyond end of memory\n");
761
Larry Basselb4126da2011-07-18 14:31:33 -0700762 low &= ~(bank_size - 1);
763
764 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700765 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800766
Larry Basselb8d61022012-02-24 10:49:45 -0800767#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800768 msm8960_reserve_info.low_unstable_address = mb->start -
769 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800770 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700771 pr_info("low unstable address %lx max size %lx bank size %lx\n",
772 msm8960_reserve_info.low_unstable_address,
773 msm8960_reserve_info.max_unstable_size,
774 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700775 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800776#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700777no_dmm:
778 msm8960_reserve_info.low_unstable_address = high;
779 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700780}
781
Larry Basselb830e182011-10-14 10:46:55 -0700782static void __init place_movable_zone(void)
783{
Larry Basselb8d61022012-02-24 10:49:45 -0800784#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700785 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
786 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
787 pr_info("movable zone start %lx size %lx\n",
788 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800789#endif
Larry Basselb830e182011-10-14 10:46:55 -0700790}
791
792static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700793{
794 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700795 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700796 place_movable_zone();
797}
798
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800799static char prim_panel_name[PANEL_NAME_MAX_LEN];
800static char ext_panel_name[PANEL_NAME_MAX_LEN];
801static int __init prim_display_setup(char *param)
802{
803 if (strnlen(param, PANEL_NAME_MAX_LEN))
804 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
805 return 0;
806}
807early_param("prim_display", prim_display_setup);
808
809static int __init ext_display_setup(char *param)
810{
811 if (strnlen(param, PANEL_NAME_MAX_LEN))
812 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
813 return 0;
814}
815early_param("ext_display", ext_display_setup);
816
Larry Basselb830e182011-10-14 10:46:55 -0700817static void __init msm8960_reserve(void)
818{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800819 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700820 msm_reserve();
Laura Abbottb93525f2012-04-12 09:57:19 -0700821 if (msm8960_fmem_pdata.size) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700822#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel861985f2012-05-02 15:54:52 -0700823 if (reserve_info->fixed_area_size) {
824 msm8960_fmem_pdata.phys =
825 reserve_info->fixed_area_start + MSM_MM_FW_SIZE;
826 pr_info("mm fw at %lx (fixed) size %x\n",
827 reserve_info->fixed_area_start, MSM_MM_FW_SIZE);
828 pr_info("fmem start %lx (fixed) size %lx\n",
829 msm8960_fmem_pdata.phys,
830 msm8960_fmem_pdata.size);
831 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700832#endif
833 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700834}
835
Larry Bassela4414b12011-08-04 11:11:02 -0700836static int msm8960_change_memory_power(u64 start, u64 size,
837 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700838{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700839 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700840}
841
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700842static void __init msm8960_allocate_memory_regions(void)
843{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800844 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700845}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800846
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700847#ifdef CONFIG_WCD9310_CODEC
848
849#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
850
Patrick Lai3043fba2011-08-01 14:15:57 -0700851/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
852 * 4 micbiases are used to power various analog and digital
853 * microphones operating at 1800 mV. Technically, all micbiases
854 * can source from single cfilter since all microphones operate
855 * at the same voltage level. The arrangement below is to make
856 * sure all cfilters are exercised. LDO_H regulator ouput level
857 * does not need to be as high as 2.85V. It is choosen for
858 * microphone sensitivity purpose.
859 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530860static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700861 .slimbus_slave_device = {
862 .name = "tabla-slave",
863 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
864 },
865 .irq = MSM_GPIO_TO_INT(62),
866 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530867 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700868 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700869 .micbias = {
870 .ldoh_v = TABLA_LDOH_2P85_V,
871 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700872 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700873 .cfilt3_mv = 1800,
874 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
875 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
876 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
877 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530878 },
879 .regulator = {
880 {
881 .name = "CDC_VDD_CP",
882 .min_uV = 1800000,
883 .max_uV = 1800000,
884 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
885 },
886 {
887 .name = "CDC_VDDA_RX",
888 .min_uV = 1800000,
889 .max_uV = 1800000,
890 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
891 },
892 {
893 .name = "CDC_VDDA_TX",
894 .min_uV = 1800000,
895 .max_uV = 1800000,
896 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
897 },
898 {
899 .name = "VDDIO_CDC",
900 .min_uV = 1800000,
901 .max_uV = 1800000,
902 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
903 },
904 {
905 .name = "VDDD_CDC_D",
906 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700907 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530908 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
909 },
910 {
911 .name = "CDC_VDDA_A_1P2V",
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_A_CUR_MAX,
915 },
916 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700917};
918
919static struct slim_device msm_slim_tabla = {
920 .name = "tabla-slim",
921 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
922 .dev = {
923 .platform_data = &tabla_platform_data,
924 },
925};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530926
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530927static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530928 .slimbus_slave_device = {
929 .name = "tabla-slave",
930 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
931 },
932 .irq = MSM_GPIO_TO_INT(62),
933 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530934 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530935 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
936 .micbias = {
937 .ldoh_v = TABLA_LDOH_2P85_V,
938 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700939 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530940 .cfilt3_mv = 1800,
941 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
942 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
943 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
944 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530945 },
946 .regulator = {
947 {
948 .name = "CDC_VDD_CP",
949 .min_uV = 1800000,
950 .max_uV = 1800000,
951 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
952 },
953 {
954 .name = "CDC_VDDA_RX",
955 .min_uV = 1800000,
956 .max_uV = 1800000,
957 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
958 },
959 {
960 .name = "CDC_VDDA_TX",
961 .min_uV = 1800000,
962 .max_uV = 1800000,
963 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
964 },
965 {
966 .name = "VDDIO_CDC",
967 .min_uV = 1800000,
968 .max_uV = 1800000,
969 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
970 },
971 {
972 .name = "VDDD_CDC_D",
973 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700974 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530975 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
976 },
977 {
978 .name = "CDC_VDDA_A_1P2V",
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_A_CUR_MAX,
982 },
983 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530984};
985
986static struct slim_device msm_slim_tabla20 = {
987 .name = "tabla2x-slim",
988 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
989 .dev = {
990 .platform_data = &tabla20_platform_data,
991 },
992};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700993#endif
994
995static struct slim_boardinfo msm_slim_devices[] = {
996#ifdef CONFIG_WCD9310_CODEC
997 {
998 .bus_num = 1,
999 .slim_slave = &msm_slim_tabla,
1000 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301001 {
1002 .bus_num = 1,
1003 .slim_slave = &msm_slim_tabla20,
1004 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001005#endif
1006 /* add more slimbus slaves as needed */
1007};
1008
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001009#define MSM_WCNSS_PHYS 0x03000000
1010#define MSM_WCNSS_SIZE 0x280000
1011
1012static struct resource resources_wcnss_wlan[] = {
1013 {
1014 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1015 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1016 .name = "wcnss_wlanrx_irq",
1017 .flags = IORESOURCE_IRQ,
1018 },
1019 {
1020 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1021 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1022 .name = "wcnss_wlantx_irq",
1023 .flags = IORESOURCE_IRQ,
1024 },
1025 {
1026 .start = MSM_WCNSS_PHYS,
1027 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1028 .name = "wcnss_mmio",
1029 .flags = IORESOURCE_MEM,
1030 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001031 {
1032 .start = 84,
1033 .end = 88,
1034 .name = "wcnss_gpios_5wire",
1035 .flags = IORESOURCE_IO,
1036 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001037};
1038
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001039static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1040 .has_48mhz_xo = 1,
1041};
1042
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001043static struct platform_device msm_device_wcnss_wlan = {
1044 .name = "wcnss_wlan",
1045 .id = 0,
1046 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1047 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001048 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001049};
1050
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001051#ifdef CONFIG_QSEECOM
1052/* qseecom bus scaling */
1053static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1054 {
1055 .src = MSM_BUS_MASTER_SPS,
1056 .dst = MSM_BUS_SLAVE_EBI_CH0,
1057 .ib = 0,
1058 .ab = 0,
1059 },
1060 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001061 .src = MSM_BUS_MASTER_SPS,
1062 .dst = MSM_BUS_SLAVE_SPS,
1063 .ib = 0,
1064 .ab = 0,
1065 },
1066 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001067 .src = MSM_BUS_MASTER_SPDM,
1068 .dst = MSM_BUS_SLAVE_SPDM,
1069 .ib = 0,
1070 .ab = 0,
1071 },
1072};
1073
1074static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1075 {
1076 .src = MSM_BUS_MASTER_SPS,
1077 .dst = MSM_BUS_SLAVE_EBI_CH0,
1078 .ib = (492 * 8) * 1000000UL,
1079 .ab = (492 * 8) * 100000UL,
1080 },
1081 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001082 .src = MSM_BUS_MASTER_SPS,
1083 .dst = MSM_BUS_SLAVE_SPS,
1084 .ib = (492 * 8) * 1000000UL,
1085 .ab = (492 * 8) * 100000UL,
1086 },
1087 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001088 .src = MSM_BUS_MASTER_SPDM,
1089 .dst = MSM_BUS_SLAVE_SPDM,
1090 .ib = 0,
1091 .ab = 0,
1092 },
1093};
1094
1095static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1096 {
1097 .src = MSM_BUS_MASTER_SPS,
1098 .dst = MSM_BUS_SLAVE_EBI_CH0,
1099 .ib = 0,
1100 .ab = 0,
1101 },
1102 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001103 .src = MSM_BUS_MASTER_SPS,
1104 .dst = MSM_BUS_SLAVE_SPS,
1105 .ib = 0,
1106 .ab = 0,
1107 },
1108 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001109 .src = MSM_BUS_MASTER_SPDM,
1110 .dst = MSM_BUS_SLAVE_SPDM,
1111 .ib = (64 * 8) * 1000000UL,
1112 .ab = (64 * 8) * 100000UL,
1113 },
1114};
1115
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001116static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1117 {
1118 .src = MSM_BUS_MASTER_SPS,
1119 .dst = MSM_BUS_SLAVE_EBI_CH0,
1120 .ib = (492 * 8) * 1000000UL,
1121 .ab = (492 * 8) * 100000UL,
1122 },
1123 {
1124 .src = MSM_BUS_MASTER_SPS,
1125 .dst = MSM_BUS_SLAVE_SPS,
1126 .ib = (492 * 8) * 1000000UL,
1127 .ab = (492 * 8) * 100000UL,
1128 },
1129 {
1130 .src = MSM_BUS_MASTER_SPDM,
1131 .dst = MSM_BUS_SLAVE_SPDM,
1132 .ib = (64 * 8) * 1000000UL,
1133 .ab = (64 * 8) * 100000UL,
1134 },
1135};
1136
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001137static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1138 {
1139 ARRAY_SIZE(qseecom_clks_init_vectors),
1140 qseecom_clks_init_vectors,
1141 },
1142 {
1143 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001144 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001145 },
1146 {
1147 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1148 qseecom_enable_sfpb_vectors,
1149 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001150 {
1151 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1152 qseecom_enable_dfab_sfpb_vectors,
1153 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001154};
1155
1156static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1157 qseecom_hw_bus_scale_usecases,
1158 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1159 .name = "qsee",
1160};
1161
1162static struct platform_device qseecom_device = {
1163 .name = "qseecom",
1164 .id = 0,
1165 .dev = {
1166 .platform_data = &qseecom_bus_pdata,
1167 },
1168};
1169#endif
1170
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001171#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1172 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1173 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1174 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1175
1176#define QCE_SIZE 0x10000
1177#define QCE_0_BASE 0x18500000
1178
1179#define QCE_HW_KEY_SUPPORT 0
1180#define QCE_SHA_HMAC_SUPPORT 1
1181#define QCE_SHARE_CE_RESOURCE 1
1182#define QCE_CE_SHARED 0
1183
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001184/* Begin Bus scaling definitions */
1185static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1186 {
1187 .src = MSM_BUS_MASTER_ADM_PORT0,
1188 .dst = MSM_BUS_SLAVE_EBI_CH0,
1189 .ab = 0,
1190 .ib = 0,
1191 },
1192 {
1193 .src = MSM_BUS_MASTER_ADM_PORT1,
1194 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1195 .ab = 0,
1196 .ib = 0,
1197 },
1198};
1199
1200static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1201 {
1202 .src = MSM_BUS_MASTER_ADM_PORT0,
1203 .dst = MSM_BUS_SLAVE_EBI_CH0,
1204 .ab = 70000000UL,
1205 .ib = 70000000UL,
1206 },
1207 {
1208 .src = MSM_BUS_MASTER_ADM_PORT1,
1209 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1210 .ab = 2480000000UL,
1211 .ib = 2480000000UL,
1212 },
1213};
1214
1215static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1216 {
1217 ARRAY_SIZE(crypto_hw_init_vectors),
1218 crypto_hw_init_vectors,
1219 },
1220 {
1221 ARRAY_SIZE(crypto_hw_active_vectors),
1222 crypto_hw_active_vectors,
1223 },
1224};
1225
1226static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1227 crypto_hw_bus_scale_usecases,
1228 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1229 .name = "cryptohw",
1230};
1231/* End Bus Scaling Definitions*/
1232
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001233static struct resource qcrypto_resources[] = {
1234 [0] = {
1235 .start = QCE_0_BASE,
1236 .end = QCE_0_BASE + QCE_SIZE - 1,
1237 .flags = IORESOURCE_MEM,
1238 },
1239 [1] = {
1240 .name = "crypto_channels",
1241 .start = DMOV_CE_IN_CHAN,
1242 .end = DMOV_CE_OUT_CHAN,
1243 .flags = IORESOURCE_DMA,
1244 },
1245 [2] = {
1246 .name = "crypto_crci_in",
1247 .start = DMOV_CE_IN_CRCI,
1248 .end = DMOV_CE_IN_CRCI,
1249 .flags = IORESOURCE_DMA,
1250 },
1251 [3] = {
1252 .name = "crypto_crci_out",
1253 .start = DMOV_CE_OUT_CRCI,
1254 .end = DMOV_CE_OUT_CRCI,
1255 .flags = IORESOURCE_DMA,
1256 },
1257};
1258
1259static struct resource qcedev_resources[] = {
1260 [0] = {
1261 .start = QCE_0_BASE,
1262 .end = QCE_0_BASE + QCE_SIZE - 1,
1263 .flags = IORESOURCE_MEM,
1264 },
1265 [1] = {
1266 .name = "crypto_channels",
1267 .start = DMOV_CE_IN_CHAN,
1268 .end = DMOV_CE_OUT_CHAN,
1269 .flags = IORESOURCE_DMA,
1270 },
1271 [2] = {
1272 .name = "crypto_crci_in",
1273 .start = DMOV_CE_IN_CRCI,
1274 .end = DMOV_CE_IN_CRCI,
1275 .flags = IORESOURCE_DMA,
1276 },
1277 [3] = {
1278 .name = "crypto_crci_out",
1279 .start = DMOV_CE_OUT_CRCI,
1280 .end = DMOV_CE_OUT_CRCI,
1281 .flags = IORESOURCE_DMA,
1282 },
1283};
1284
1285#endif
1286
1287#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1288 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1289
1290static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1291 .ce_shared = QCE_CE_SHARED,
1292 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1293 .hw_key_support = QCE_HW_KEY_SUPPORT,
1294 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001295 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001296};
1297
1298static struct platform_device qcrypto_device = {
1299 .name = "qcrypto",
1300 .id = 0,
1301 .num_resources = ARRAY_SIZE(qcrypto_resources),
1302 .resource = qcrypto_resources,
1303 .dev = {
1304 .coherent_dma_mask = DMA_BIT_MASK(32),
1305 .platform_data = &qcrypto_ce_hw_suppport,
1306 },
1307};
1308#endif
1309
1310#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1311 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1312
1313static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1314 .ce_shared = QCE_CE_SHARED,
1315 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1316 .hw_key_support = QCE_HW_KEY_SUPPORT,
1317 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001318 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001319};
1320
1321static struct platform_device qcedev_device = {
1322 .name = "qce",
1323 .id = 0,
1324 .num_resources = ARRAY_SIZE(qcedev_resources),
1325 .resource = qcedev_resources,
1326 .dev = {
1327 .coherent_dma_mask = DMA_BIT_MASK(32),
1328 .platform_data = &qcedev_ce_hw_suppport,
1329 },
1330};
1331#endif
1332
Joel King0cbf5d82012-05-24 15:21:38 -07001333static struct mdm_platform_data sglte_platform_data = {
1334 .mdm_version = "4.0",
1335 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001336 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001337 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001338 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001339 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001340 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001341};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001342
Joel Nider266a2642011-10-16 10:58:05 +02001343#define MSM_TSIF0_PHYS (0x18200000)
1344#define MSM_TSIF1_PHYS (0x18201000)
1345#define MSM_TSIF_SIZE (0x200)
1346#define MSM_TSPP_PHYS (0x18202000)
1347#define MSM_TSPP_SIZE (0x1000)
1348#define MSM_TSPP_BAM_PHYS (0x18204000)
1349#define MSM_TSPP_BAM_SIZE (0x2000)
1350
1351#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1352 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1353#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1354 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1355#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1356 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1357#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1358 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1359#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1360 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1361#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1362 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1363#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1364 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1365#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1366 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1367
1368static const struct msm_gpio tsif_gpios[] = {
1369 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1370 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1371 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1372 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1373 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1374 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1375 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1376 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1377};
1378
1379static struct resource tspp_resources[] = {
1380 [0] = {
1381 .flags = IORESOURCE_IRQ,
1382 .start = TSIF_TSPP_IRQ,
1383 .end = TSIF1_IRQ,
1384 },
1385 [1] = {
1386 .flags = IORESOURCE_MEM,
1387 .start = MSM_TSIF0_PHYS,
1388 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1389 },
1390 [2] = {
1391 .flags = IORESOURCE_MEM,
1392 .start = MSM_TSIF1_PHYS,
1393 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1394 },
1395 [3] = {
1396 .flags = IORESOURCE_MEM,
1397 .start = MSM_TSPP_PHYS,
1398 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1399 },
1400 [4] = {
1401 .flags = IORESOURCE_MEM,
1402 .start = MSM_TSPP_BAM_PHYS,
1403 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1404 },
1405};
1406
1407static struct msm_tspp_platform_data tspp_platform_data = {
1408 .num_gpios = ARRAY_SIZE(tsif_gpios),
1409 .gpios = tsif_gpios,
1410 .tsif_pclk = "tsif_pclk",
1411 .tsif_ref_clk = "tsif_ref_clk",
1412};
1413
1414static struct platform_device msm_device_tspp = {
1415 .name = "msm_tspp",
1416 .id = 0,
1417 .num_resources = ARRAY_SIZE(tspp_resources),
1418 .resource = tspp_resources,
1419 .dev = {
1420 .platform_data = &tspp_platform_data
1421 },
1422};
1423
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001424#define MSM_SHARED_RAM_PHYS 0x80000000
1425
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001426static void __init msm8960_map_io(void)
1427{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001428 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001429 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001430
1431 if (socinfo_init() < 0)
1432 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001433}
1434
1435static void __init msm8960_init_irq(void)
1436{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001437 struct msm_mpm_device_data *data = NULL;
1438
1439#ifdef CONFIG_MSM_MPM
1440 data = &msm8960_mpm_dev_data;
1441#endif
1442
1443 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001444 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001445 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001446}
1447
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001448static void __init msm8960_init_buses(void)
1449{
1450#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001451 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001452 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1453 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001454 msm_bus_apps_fabric.dev.platform_data =
1455 &msm_bus_8960_apps_fabric_pdata;
1456 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001457 if (cpu_is_msm8960ab()) {
1458 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1459 msm_bus_mm_fabric.dev.platform_data =
1460 &msm_bus_8960_sg_mm_fabric_pdata;
1461 } else {
1462 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1463 msm_bus_mm_fabric.dev.platform_data =
1464 &msm_bus_8960_mm_fabric_pdata;
1465 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001466 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1467 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001468#endif
1469}
1470
1471static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1472 .max_clock_speed = 15060000,
Kiran Gundac5fbd7f2012-07-30 13:22:39 +05301473 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001474};
1475
1476#ifdef CONFIG_USB_MSM_OTG_72K
1477static struct msm_otg_platform_data msm_otg_pdata;
1478#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301479static int wr_phy_init_seq[] = {
1480 0x44, 0x80, /* set VBUS valid threshold
1481 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301482 0x68, 0x81, /* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301483 0x14, 0x82, /* set preemphasis and rise/fall time */
1484 0x13, 0x83, /* set source impedance adjusment */
1485 -1};
1486
1487static int liquid_v1_phy_init_seq[] = {
1488 0x44, 0x80,/* set VBUS valid threshold
1489 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301490 0x6C, 0x81,/* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301491 0x18, 0x82,/* set preemphasis and rise/fall time */
1492 0x23, 0x83,/* set source impedance sdjusment */
1493 -1};
1494
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301495static int sglte_phy_init_seq[] = {
1496 0x44, 0x80, /* set VBUS valid threshold
1497 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301498 0x6A, 0x81, /* update DC voltage level */
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301499 0x24, 0x82, /* set preemphasis and rise/fall time */
1500 0x13, 0x83, /* set source impedance adjusment */
1501 -1};
1502
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301503#ifdef CONFIG_MSM_BUS_SCALING
1504/* Bandwidth requests (zero) if no vote placed */
1505static struct msm_bus_vectors usb_init_vectors[] = {
1506 {
1507 .src = MSM_BUS_MASTER_SPS,
1508 .dst = MSM_BUS_SLAVE_EBI_CH0,
1509 .ab = 0,
1510 .ib = 0,
1511 },
1512};
1513
1514/* Bus bandwidth requests in Bytes/sec */
1515static struct msm_bus_vectors usb_max_vectors[] = {
1516 {
1517 .src = MSM_BUS_MASTER_SPS,
1518 .dst = MSM_BUS_SLAVE_EBI_CH0,
1519 .ab = 60000000, /* At least 480Mbps on bus. */
1520 .ib = 960000000, /* MAX bursts rate */
1521 },
1522};
1523
1524static struct msm_bus_paths usb_bus_scale_usecases[] = {
1525 {
1526 ARRAY_SIZE(usb_init_vectors),
1527 usb_init_vectors,
1528 },
1529 {
1530 ARRAY_SIZE(usb_max_vectors),
1531 usb_max_vectors,
1532 },
1533};
1534
1535static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1536 usb_bus_scale_usecases,
1537 ARRAY_SIZE(usb_bus_scale_usecases),
1538 .name = "usb",
1539};
1540#endif
1541
Jack Pham87f202f2012-08-06 00:24:22 -07001542#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1543
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001544static struct msm_otg_platform_data msm_otg_pdata = {
1545 .mode = USB_OTG,
1546 .otg_control = OTG_PMIC_CONTROL,
1547 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001548 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301549 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301550#ifdef CONFIG_MSM_BUS_SCALING
1551 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001552 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301553#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301554#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1555 .mhl_dev_name = "sii8334",
1556#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001557};
1558#endif
1559
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301560#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301561#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301562static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1563 .strobe = 150,
1564 .data = 151,
1565};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301566
1567static struct smsc_hub_platform_data hsic_hub_pdata = {
1568 .hub_reset = HSIC_HUB_RESET_GPIO,
1569};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301570#else
1571static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301572static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301573#endif
1574
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301575static struct platform_device smsc_hub_device = {
1576 .name = "msm_smsc_hub",
1577 .id = -1,
1578 .dev = {
1579 .platform_data = &hsic_hub_pdata,
1580 },
1581};
1582
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001583#define PID_MAGIC_ID 0x71432909
1584#define SERIAL_NUM_MAGIC_ID 0x61945374
1585#define SERIAL_NUMBER_LENGTH 127
1586#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1587
1588struct magic_num_struct {
1589 uint32_t pid;
1590 uint32_t serial_num;
1591};
1592
1593struct dload_struct {
1594 uint32_t reserved1;
1595 uint32_t reserved2;
1596 uint32_t reserved3;
1597 uint16_t reserved4;
1598 uint16_t pid;
1599 char serial_number[SERIAL_NUMBER_LENGTH];
1600 uint16_t reserved5;
1601 struct magic_num_struct magic_struct;
1602};
1603
1604static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1605{
1606 struct dload_struct __iomem *dload = 0;
1607
1608 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1609 if (!dload) {
1610 pr_err("%s: cannot remap I/O memory region: %08x\n",
1611 __func__, DLOAD_USB_BASE_ADD);
1612 return -ENXIO;
1613 }
1614
1615 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1616 __func__, dload, pid, snum);
1617 /* update pid */
1618 dload->magic_struct.pid = PID_MAGIC_ID;
1619 dload->pid = pid;
1620
1621 /* update serial number */
1622 dload->magic_struct.serial_num = 0;
1623 if (!snum) {
1624 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1625 goto out;
1626 }
1627
1628 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001629 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001630out:
1631 iounmap(dload);
1632 return 0;
1633}
1634
1635static struct android_usb_platform_data android_usb_pdata = {
1636 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1637};
1638
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001639static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001640 .name = "android_usb",
1641 .id = -1,
1642 .dev = {
1643 .platform_data = &android_usb_pdata,
1644 },
1645};
1646
1647static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1648 0x03, 0x0f,
1649};
1650
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001651static uint8_t spm_retention_cmd_sequence[] __initdata = {
1652 0x00, 0x05, 0x03, 0x0D,
1653 0x0B, 0x00, 0x0f,
1654};
1655
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001656static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1657 0x00, 0x24, 0x54, 0x10,
1658 0x09, 0x03, 0x01,
1659 0x10, 0x54, 0x30, 0x0C,
1660 0x24, 0x30, 0x0f,
1661};
1662
1663static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1664 0x00, 0x24, 0x54, 0x10,
1665 0x09, 0x07, 0x01, 0x0B,
1666 0x10, 0x54, 0x30, 0x0C,
1667 0x24, 0x30, 0x0f,
1668};
1669
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001670static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1671 [0] = {
1672 .mode = MSM_SPM_MODE_CLOCK_GATING,
1673 .notify_rpm = false,
1674 .cmd = spm_wfi_cmd_sequence,
1675 },
1676
1677 [1] = {
1678 .mode = MSM_SPM_MODE_POWER_RETENTION,
1679 .notify_rpm = false,
1680 .cmd = spm_retention_cmd_sequence,
1681 },
1682
1683 [2] = {
1684 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1685 .notify_rpm = false,
1686 .cmd = spm_power_collapse_without_rpm,
1687 },
1688 [3] = {
1689 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1690 .notify_rpm = true,
1691 .cmd = spm_power_collapse_with_rpm,
1692 },
1693};
1694
1695static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001696 [0] = {
1697 .mode = MSM_SPM_MODE_CLOCK_GATING,
1698 .notify_rpm = false,
1699 .cmd = spm_wfi_cmd_sequence,
1700 },
1701 [1] = {
1702 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1703 .notify_rpm = false,
1704 .cmd = spm_power_collapse_without_rpm,
1705 },
1706 [2] = {
1707 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1708 .notify_rpm = true,
1709 .cmd = spm_power_collapse_with_rpm,
1710 },
1711};
1712
1713static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1714 [0] = {
1715 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001717#if defined(CONFIG_MSM_AVS_HW)
Praveen Chidambaram631f2822012-03-16 12:08:42 -06001718 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x50589464,
1719 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001720#endif
1721 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001722 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1723 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1724 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001725 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001726 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1727 .modes = msm_spm_boot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001728 },
1729 [1] = {
1730 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001731 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001732#if defined(CONFIG_MSM_AVS_HW)
Praveen Chidambaram631f2822012-03-16 12:08:42 -06001733 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x50589464,
1734 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001735#endif
1736 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
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] = 0x0060009C,
1739 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1740 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001741 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1742 .modes = msm_spm_nonboot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001743 },
1744};
1745
1746static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1747 0x00, 0x20, 0x03, 0x20,
1748 0x00, 0x0f,
1749};
1750
1751static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1752 0x00, 0x20, 0x34, 0x64,
1753 0x48, 0x07, 0x48, 0x20,
1754 0x50, 0x64, 0x04, 0x34,
1755 0x50, 0x0f,
1756};
1757static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1758 0x00, 0x10, 0x34, 0x64,
1759 0x48, 0x07, 0x48, 0x10,
1760 0x50, 0x64, 0x04, 0x34,
1761 0x50, 0x0F,
1762};
1763
1764static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1765 [0] = {
1766 .mode = MSM_SPM_L2_MODE_RETENTION,
1767 .notify_rpm = false,
1768 .cmd = l2_spm_wfi_cmd_sequence,
1769 },
1770 [1] = {
1771 .mode = MSM_SPM_L2_MODE_GDHS,
1772 .notify_rpm = true,
1773 .cmd = l2_spm_gdhs_cmd_sequence,
1774 },
1775 [2] = {
1776 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1777 .notify_rpm = true,
1778 .cmd = l2_spm_power_off_cmd_sequence,
1779 },
1780};
1781
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001782static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1783 [0] = {
1784 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001785 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001786 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001787 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1788 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1789 .modes = msm_spm_l2_seq_list,
1790 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1791 },
1792};
1793
Anirudh Ghayal15698162012-07-31 11:51:32 +05301794#define HAP_SHIFT_LVL_OE_GPIO 47
1795#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301796#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1797#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1798
1799static struct msm_xo_voter *xo_handle_d1;
1800
1801static int isa1200_power(int on)
1802{
1803 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301804 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301805
Anirudh Ghayal15698162012-07-31 11:51:32 +05301806 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1807 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1808
1809
1810 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301811
1812 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1813 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1814 if (rc < 0) {
1815 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1816 __func__, on ? "" : "de-", rc);
1817 goto err_xo_vote;
1818 }
1819
1820 return 0;
1821
1822err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301823 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301824 return rc;
1825}
1826
1827static int isa1200_dev_setup(bool enable)
1828{
1829 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301830 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301831
1832 struct pm_gpio hap_gpio_config = {
1833 .direction = PM_GPIO_DIR_OUT,
1834 .pull = PM_GPIO_PULL_NO,
1835 .out_strength = PM_GPIO_STRENGTH_HIGH,
1836 .function = PM_GPIO_FUNC_NORMAL,
1837 .inv_int_pol = 0,
1838 .vin_sel = 2,
1839 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1840 .output_value = 0,
1841 };
1842
Anirudh Ghayal15698162012-07-31 11:51:32 +05301843 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1844 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1845
Mohan Pallaka5e490392011-09-09 15:18:41 +05301846 if (enable == true) {
1847 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1848 if (rc) {
1849 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1850 __func__, PM_HAP_EN_GPIO, rc);
1851 return rc;
1852 }
1853
1854 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1855 if (rc) {
1856 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1857 __func__, PM_HAP_LEN_GPIO, rc);
1858 return rc;
1859 }
1860
Anirudh Ghayal15698162012-07-31 11:51:32 +05301861 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301862 if (rc) {
1863 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301864 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301865 return rc;
1866 }
1867
Anirudh Ghayal15698162012-07-31 11:51:32 +05301868 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301869 if (rc) {
1870 pr_err("%s: Unable to set direction\n", __func__);
1871 goto free_gpio;
1872 }
1873
1874 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1875 if (IS_ERR(xo_handle_d1)) {
1876 rc = PTR_ERR(xo_handle_d1);
1877 pr_err("%s: failed to get the handle for D1(%d)\n",
1878 __func__, rc);
1879 goto gpio_set_dir;
1880 }
1881 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301882 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301883
1884 msm_xo_put(xo_handle_d1);
1885 }
1886
1887 return 0;
1888
1889gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301890 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301891free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301892 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301893 return rc;
1894}
1895
1896static struct isa1200_regulator isa1200_reg_data[] = {
1897 {
1898 .name = "vcc_i2c",
1899 .min_uV = ISA_I2C_VTG_MIN_UV,
1900 .max_uV = ISA_I2C_VTG_MAX_UV,
1901 .load_uA = ISA_I2C_CURR_UA,
1902 },
1903};
1904
1905static struct isa1200_platform_data isa1200_1_pdata = {
1906 .name = "vibrator",
1907 .dev_setup = isa1200_dev_setup,
1908 .power_on = isa1200_power,
1909 .hap_en_gpio = PM_HAP_EN_GPIO,
1910 .hap_len_gpio = PM_HAP_LEN_GPIO,
1911 .max_timeout = 15000,
1912 .mode_ctrl = PWM_GEN_MODE,
1913 .pwm_fd = {
1914 .pwm_div = 256,
1915 },
1916 .is_erm = false,
1917 .smart_en = true,
1918 .ext_clk_en = true,
1919 .chip_en = 1,
1920 .regulator_info = isa1200_reg_data,
1921 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1922};
1923
1924static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1925 {
1926 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301927 },
1928};
1929
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001930#define CYTTSP_TS_GPIO_IRQ 11
1931#define CYTTSP_TS_SLEEP_GPIO 50
1932#define CYTTSP_TS_RESOUT_N_GPIO 52
1933
1934/*virtual key support */
1935static ssize_t tma340_vkeys_show(struct kobject *kobj,
1936 struct kobj_attribute *attr, char *buf)
1937{
1938 return snprintf(buf, 200,
1939 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1940 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1941 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1942 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1943 "\n");
1944}
1945
1946static struct kobj_attribute tma340_vkeys_attr = {
1947 .attr = {
1948 .mode = S_IRUGO,
1949 },
1950 .show = &tma340_vkeys_show,
1951};
1952
1953static struct attribute *tma340_properties_attrs[] = {
1954 &tma340_vkeys_attr.attr,
1955 NULL
1956};
1957
1958static struct attribute_group tma340_properties_attr_group = {
1959 .attrs = tma340_properties_attrs,
1960};
1961
1962
1963static int cyttsp_platform_init(struct i2c_client *client)
1964{
1965 int rc = 0;
1966 static struct kobject *tma340_properties_kobj;
1967
1968 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1969 tma340_properties_kobj = kobject_create_and_add("board_properties",
1970 NULL);
1971 if (tma340_properties_kobj)
1972 rc = sysfs_create_group(tma340_properties_kobj,
1973 &tma340_properties_attr_group);
1974 if (!tma340_properties_kobj || rc)
1975 pr_err("%s: failed to create board_properties\n",
1976 __func__);
1977
1978 return 0;
1979}
1980
1981static struct cyttsp_regulator regulator_data[] = {
1982 {
1983 .name = "vdd",
1984 .min_uV = CY_TMA300_VTG_MIN_UV,
1985 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301986 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1987 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001988 },
1989 /* TODO: Remove after runtime PM is enabled in I2C driver */
1990 {
1991 .name = "vcc_i2c",
1992 .min_uV = CY_I2C_VTG_MIN_UV,
1993 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301994 .hpm_load_uA = CY_I2C_CURR_UA,
1995 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001996 },
1997};
1998
1999static struct cyttsp_platform_data cyttsp_pdata = {
2000 .panel_maxx = 634,
2001 .panel_maxy = 1166,
2002 .disp_maxx = 616,
2003 .disp_maxy = 1023,
2004 .disp_minx = 0,
2005 .disp_miny = 16,
2006 .flags = 0x01,
2007 .gen = CY_GEN3, /* or */
2008 .use_st = CY_USE_ST,
2009 .use_mt = CY_USE_MT,
2010 .use_hndshk = CY_SEND_HNDSHK,
2011 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302012 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002013 .use_gestures = CY_USE_GESTURES,
2014 .fw_fname = "cyttsp_8960_cdp.hex",
2015 /* activate up to 4 groups
2016 * and set active distance
2017 */
2018 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2019 CY_GEST_GRP3 | CY_GEST_GRP4 |
2020 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07002021 .act_intrvl = 10,
2022 .tch_tmout = 200,
2023 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002024 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2025 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2026 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2027 .regulator_info = regulator_data,
2028 .num_regulators = ARRAY_SIZE(regulator_data),
2029 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302030 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002031};
2032
2033static struct i2c_board_info cyttsp_info[] __initdata = {
2034 {
2035 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2036 .platform_data = &cyttsp_pdata,
2037#ifndef CY_USE_TIMER
2038 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2039#endif /* CY_USE_TIMER */
2040 },
2041};
2042
Jing Lindc4413c2012-01-16 15:22:52 -08002043/* configuration data for mxt1386 */
2044static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05302045 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002046 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302047 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002048 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002049 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, 0, 0, 0, 0, 0, 0,
2053 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2054 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302055 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002056 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302057 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002058 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302059 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002060 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2061 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2062 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2063 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302064 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002065 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2066 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302067 /* T18 Object */
2068 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302069 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002070 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2071 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302072 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2074 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302075 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002076 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2077 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302078 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002079 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302080 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002081 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302082 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002083 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302084 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002085 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302086 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002087 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302088};
2089
Jing Lin33b007d2011-12-21 17:40:23 -08002090/* configuration data for mxt1386e using V1.0 firmware */
2091static const u8 mxt1386e_config_data_v1_0[] = {
2092 /* T6 Object */
2093 0, 0, 0, 0, 0, 0,
2094 /* T38 Object */
2095 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2096 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2097 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2098 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2099 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2100 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2101 0, 0, 0, 0,
2102 /* T7 Object */
2103 100, 16, 50,
2104 /* T8 Object */
2105 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2106 /* T9 Object */
2107 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2108 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2109 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2110 10, 5, 0, 0, 0,
2111 /* T18 Object */
2112 0, 0,
2113 /* T24 Object */
2114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2115 0, 0, 0, 0, 0, 0, 0, 0, 0,
2116 /* T25 Object */
2117 3, 0, 60, 115, 156, 99,
2118 /* T27 Object */
2119 0, 0, 0, 0, 0, 0, 0,
2120 /* T40 Object */
2121 0, 0, 0, 0, 0,
2122 /* T42 Object */
2123 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2124 /* T43 Object */
2125 0, 0, 0, 0, 0, 0, 0,
2126 /* T46 Object */
2127 64, 0, 20, 20, 0, 0, 0, 0, 0,
2128 /* T47 Object */
2129 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2130 /* T48 Object */
2131 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2132 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2133 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2134 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2135 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2136 0, 0, 0, 0,
2137 /* T56 Object */
2138 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2139 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2140 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2142 2, 99, 33,
2143};
2144
2145/* configuration data for mxt1386e using V2.1 firmware */
2146static const u8 mxt1386e_config_data_v2_1[] = {
2147 /* T6 Object */
2148 0, 0, 0, 0, 0, 0,
2149 /* T38 Object */
Jing Lin4a8a3e42012-09-12 10:08:22 -07002150 12, 5, 0, 28, 8, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2156 0, 0, 0, 0,
2157 /* T7 Object */
Jing Lin4a8a3e42012-09-12 10:08:22 -07002158 32, 16, 50,
Jing Lin33b007d2011-12-21 17:40:23 -08002159 /* T8 Object */
2160 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2161 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002162 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002163 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002164 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2165 10, 5, 0, 0, 0,
2166 /* T18 Object */
2167 0, 0,
2168 /* T24 Object */
2169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2170 0, 0, 0, 0, 0, 0, 0, 0, 0,
2171 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002172 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002173 /* T27 Object */
2174 0, 0, 0, 0, 0, 0, 0,
2175 /* T40 Object */
2176 0, 0, 0, 0, 0,
2177 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002178 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002179 /* T43 Object */
2180 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2181 16,
2182 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002183 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002184 /* T47 Object */
2185 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2186 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002187 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002188 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2189 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2190 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2191 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2192 0, 0, 0, 0,
2193 /* T56 Object */
2194 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2195 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2196 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2198 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2199 255,
2200};
2201
Jing Lineec88ca2012-02-08 11:18:30 -08002202/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2203static const u8 mxt1386e_config_data_3d[] = {
2204 /* T6 Object */
2205 0, 0, 0, 0, 0, 0,
2206 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002207 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002208 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2213 0, 0, 0, 0,
2214 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002215 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002216 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002217 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002218 /* T9 Object */
2219 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2220 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002221 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2222 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002223 /* T18 Object */
2224 0, 0,
2225 /* T24 Object */
2226 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2227 0, 0, 0, 0, 0, 0, 0, 0, 0,
2228 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002229 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002230 /* T27 Object */
2231 0, 0, 0, 0, 0, 0, 0,
2232 /* T40 Object */
2233 0, 0, 0, 0, 0,
2234 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002235 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002236 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002237 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2238 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002239 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002240 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002241 /* T47 Object */
2242 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2243 /* T48 Object */
2244 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002245 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2246 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2247 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2249 0, 0, 0, 0,
2250 /* T56 Object */
2251 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2256 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002257};
2258
Amy Maloche08266db2011-11-04 11:07:16 -07002259#define MXT_TS_GPIO_IRQ 11
2260#define MXT_TS_LDO_EN_GPIO 50
2261#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302262
2263static void mxt_init_hw_liquid(void)
2264{
2265 int rc;
2266
Mohan Pallaka50837382011-09-07 11:00:57 +05302267 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2268 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002269 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2270 __func__, MXT_TS_LDO_EN_GPIO);
2271 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302272 }
2273
2274 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2275 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002276 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2277 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302278 goto err_ldo_gpio_req;
2279 }
2280
Mohan Pallaka50837382011-09-07 11:00:57 +05302281 return;
2282
Mohan Pallaka50837382011-09-07 11:00:57 +05302283err_ldo_gpio_req:
2284 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302285}
2286
Jing Lineec88ca2012-02-08 11:18:30 -08002287static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002288 {
2289 .config = mxt1386_config_data,
2290 .config_length = ARRAY_SIZE(mxt1386_config_data),
2291 .family_id = 0xA0,
2292 .variant_id = 0x0,
2293 .version = 0x10,
2294 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002295 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002296 },
Jing Lin33b007d2011-12-21 17:40:23 -08002297 {
2298 .config = mxt1386e_config_data_v1_0,
2299 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2300 .family_id = 0xA0,
2301 .variant_id = 0x2,
2302 .version = 0x10,
2303 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002304 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002305 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002306 },
2307 {
2308 .config = mxt1386e_config_data_v2_1,
2309 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2310 .family_id = 0xA0,
2311 .variant_id = 0x7,
2312 .version = 0x21,
2313 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002314 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002315 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2316 },
2317 {
2318 /* The config data for V2.2.AA is the same as for V2.1.AA */
2319 .config = mxt1386e_config_data_v2_1,
2320 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2321 .family_id = 0xA0,
2322 .variant_id = 0x7,
2323 .version = 0x22,
2324 .build = 0xAA,
2325 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002326 },
Jing Lindc4413c2012-01-16 15:22:52 -08002327};
2328
Jing Lineec88ca2012-02-08 11:18:30 -08002329static struct mxt_platform_data mxt_platform_data_2d = {
2330 .config_array = mxt_config_array_2d,
2331 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002332 .panel_minx = 0,
2333 .panel_maxx = 1365,
2334 .panel_miny = 0,
2335 .panel_maxy = 767,
2336 .disp_minx = 0,
2337 .disp_maxx = 1365,
2338 .disp_miny = 0,
2339 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302340 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002341 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002342 .reset_gpio = MXT_TS_RESET_GPIO,
2343 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302344};
2345
Jing Lineec88ca2012-02-08 11:18:30 -08002346static struct mxt_config_info mxt_config_array_3d[] = {
2347 {
2348 .config = mxt1386e_config_data_3d,
2349 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2350 .family_id = 0xA0,
2351 .variant_id = 0x7,
2352 .version = 0x21,
2353 .build = 0xAA,
2354 },
2355};
2356
2357static struct mxt_platform_data mxt_platform_data_3d = {
2358 .config_array = mxt_config_array_3d,
2359 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002360 .panel_minx = 0,
2361 .panel_maxx = 1919,
2362 .panel_miny = 0,
2363 .panel_maxy = 1199,
2364 .disp_minx = 0,
2365 .disp_maxx = 1919,
2366 .disp_miny = 0,
2367 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002368 .irqflags = IRQF_TRIGGER_FALLING,
2369 .i2c_pull_up = true,
2370 .reset_gpio = MXT_TS_RESET_GPIO,
2371 .irq_gpio = MXT_TS_GPIO_IRQ,
2372};
2373
Mohan Pallaka50837382011-09-07 11:00:57 +05302374static struct i2c_board_info mxt_device_info[] __initdata = {
2375 {
2376 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302377 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2378 },
2379};
2380
Manoj Rao14648742012-03-30 19:42:12 -07002381static struct msm_mhl_platform_data mhl_platform_data = {
2382 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002383 .gpio_mhl_int = MHL_GPIO_INT,
2384 .gpio_mhl_reset = MHL_GPIO_RESET,
2385 .gpio_mhl_power = 0,
2386 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002387};
Manoj Rao14648742012-03-30 19:42:12 -07002388
Eugene Yasmand2316b82011-12-07 18:23:48 +02002389static struct i2c_board_info sii_device_info[] __initdata = {
2390 {
Manoj Rao14648742012-03-30 19:42:12 -07002391#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2392 /*
2393 * keeps SI 8334 as the default
2394 * MHL TX
2395 */
2396 I2C_BOARD_INFO("sii8334", 0x39),
2397 .platform_data = &mhl_platform_data,
2398#endif
2399#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002400 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002401 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002402#endif /* CONFIG_MSM_HDMI_MHL */
2403 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002404 },
2405};
2406
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002407static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2408 .clk_freq = 100000,
2409 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002410};
2411
2412static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2413 .clk_freq = 100000,
2414 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002415};
2416
2417static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2418 .clk_freq = 100000,
2419 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002420};
2421
2422static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2423 .clk_freq = 100000,
2424 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002425};
2426
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002427static struct ks8851_pdata spi_eth_pdata = {
2428 .irq_gpio = KS8851_IRQ_GPIO,
2429 .rst_gpio = KS8851_RST_GPIO,
2430};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002431
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302432static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002433 {
2434 .modalias = "ks8851",
2435 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2436 .max_speed_hz = 19200000,
2437 .bus_num = 0,
2438 .chip_select = 0,
2439 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002440 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002441 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302442};
2443static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002444 {
2445 .modalias = "dsi_novatek_3d_panel_spi",
2446 .max_speed_hz = 10800000,
2447 .bus_num = 0,
2448 .chip_select = 1,
2449 .mode = SPI_MODE_0,
2450 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002451};
2452
2453static struct platform_device msm_device_saw_core0 = {
2454 .name = "saw-regulator",
2455 .id = 0,
2456 .dev = {
2457 .platform_data = &msm_saw_regulator_pdata_s5,
2458 },
2459};
2460
2461static struct platform_device msm_device_saw_core1 = {
2462 .name = "saw-regulator",
2463 .id = 1,
2464 .dev = {
2465 .platform_data = &msm_saw_regulator_pdata_s6,
2466 },
2467};
2468
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002469static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002470 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002471 .tsens_factor = 1000,
2472 .hw_type = MSM_8960,
2473 .tsens_num_sensor = 5,
2474};
2475
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002476static struct platform_device msm_tsens_device = {
2477 .name = "tsens8960-tm",
2478 .id = -1,
2479};
2480
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002481static struct msm_thermal_data msm_thermal_pdata = {
2482 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002483 .poll_ms = 250,
2484 .limit_temp_degC = 60,
2485 .temp_hysteresis_degC = 10,
2486 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002487};
2488
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002489#ifdef CONFIG_MSM_FAKE_BATTERY
2490static struct platform_device fish_battery_device = {
2491 .name = "fish_battery",
2492};
2493#endif
2494
Binqiang Qiuf165c922012-08-15 18:00:18 -07002495#ifdef CONFIG_BATTERY_BCL
2496static struct platform_device battery_bcl_device = {
2497 .name = "battery_current_limit",
2498 .id = -1,
2499};
2500#endif
2501
David Collins26f05562011-06-20 09:56:28 -07002502static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002503 .name = GPIO_REGULATOR_DEV_NAME,
2504 .id = PM8921_MPP_PM_TO_SYS(7),
2505 .dev = {
2506 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2507 },
2508};
2509
David Collins26f05562011-06-20 09:56:28 -07002510static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002511 .name = GPIO_REGULATOR_DEV_NAME,
2512 .id = 91,
2513 .dev = {
2514 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2515 },
2516};
2517
David Collinsb10be1d2011-09-02 10:29:31 -07002518static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2519 .name = GPIO_REGULATOR_DEV_NAME,
2520 .id = PM8921_GPIO_PM_TO_SYS(17),
2521 .dev = {
2522 .platform_data =
2523 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2524 },
2525};
2526
David Collins35a78f52011-12-14 15:54:25 -08002527static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2528 .name = GPIO_REGULATOR_DEV_NAME,
2529 .id = PM8921_GPIO_PM_TO_SYS(42),
2530 .dev = {
2531 .platform_data =
2532 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2533 },
2534};
2535
David Collins26f05562011-06-20 09:56:28 -07002536static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2537 .name = "rpm-regulator",
2538 .id = -1,
2539 .dev = {
2540 .platform_data = &msm_rpm_regulator_pdata,
2541 },
2542};
Mayank Ranae009c922012-03-22 03:02:06 +05302543#ifdef CONFIG_SERIAL_MSM_HS
2544static int configure_uart_gpios(int on)
2545{
2546 int ret = 0, i;
2547 int uart_gpios[] = {93, 94, 95, 96};
2548
2549 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2550 if (on) {
2551 ret = gpio_request(uart_gpios[i], NULL);
2552 if (ret) {
2553 pr_err("%s: unable to request uart gpio[%d]\n",
2554 __func__, uart_gpios[i]);
2555 break;
2556 }
2557 } else {
2558 gpio_free(uart_gpios[i]);
2559 }
2560 }
2561
2562 if (ret && on && i)
2563 for (; i >= 0; i--)
2564 gpio_free(uart_gpios[i]);
2565 return ret;
2566}
2567
2568static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002569 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302570};
Mayank Rana1f02d952012-07-04 19:11:20 +05302571
2572static int configure_gsbi8_uart_gpios(int on)
2573{
2574 int ret = 0, i;
2575 int uart_gpios[] = {34, 35, 36, 37};
2576
2577 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2578 if (on) {
2579 ret = gpio_request(uart_gpios[i], NULL);
2580 if (ret) {
2581 pr_err("%s: unable to request uart gpio[%d]\n",
2582 __func__, uart_gpios[i]);
2583 break;
2584 }
2585 } else {
2586 gpio_free(uart_gpios[i]);
2587 }
2588 }
2589
2590 if (ret && on && i)
2591 for (; i >= 0; i--)
2592 gpio_free(uart_gpios[i]);
2593 return ret;
2594}
2595
2596static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2597 .gpio_config = configure_gsbi8_uart_gpios,
2598};
Mayank Ranae009c922012-03-22 03:02:06 +05302599#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302600static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302601static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2602#endif
David Collins26f05562011-06-20 09:56:28 -07002603
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302604#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2605static struct resource bluesleep_resources[] = {
2606 {
2607 .name = "gpio_host_wake",
2608 .start = 27,
2609 .end = 27,
2610 .flags = IORESOURCE_IO,
2611 },
2612 {
2613 .name = "gpio_ext_wake",
2614 .start = 29,
2615 .end = 29,
2616 .flags = IORESOURCE_IO,
2617 },
2618 {
2619 .name = "host_wake",
2620 .start = MSM_GPIO_TO_INT(27),
2621 .end = MSM_GPIO_TO_INT(27),
2622 .flags = IORESOURCE_IRQ,
2623 },
2624};
2625
2626static struct platform_device msm_bluesleep_device = {
2627 .name = "bluesleep",
2628 .id = -1,
2629 .num_resources = ARRAY_SIZE(bluesleep_resources),
2630 .resource = bluesleep_resources,
2631};
2632
2633static struct platform_device msm_bt_power_device = {
2634 .name = "bt_power",
2635};
2636
2637int gpio_bt_sys_rest_en = 28;
2638
2639static int bluetooth_power(int on)
2640{
2641 int rc;
2642
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302643 pr_debug("%s on= %d\n", __func__, on);
2644
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302645 if (on) {
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302646 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2647 if (rc) {
2648 pr_err("%s: unable to request gpio %d (%d)\n",
2649 __func__, gpio_bt_sys_rest_en, rc);
2650 goto out;
2651 }
2652 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
2653 if (rc) {
2654 pr_err("%s: Unable to set gpio %d direction\n",
2655 __func__, gpio_bt_sys_rest_en);
2656 goto free_gpio;
2657 }
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302658 msleep(100);
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302659 gpio_set_value(gpio_bt_sys_rest_en, 1);
2660 msleep(100);
2661 goto out;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302662 } else {
2663 gpio_set_value(gpio_bt_sys_rest_en, 0);
2664 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2665 msleep(100);
2666 }
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302667
2668free_gpio:
2669 gpio_free(gpio_bt_sys_rest_en);
2670out:
2671 return rc;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302672}
2673
2674static void __init bt_power_init(void)
2675{
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302676 pr_debug("%s enter\n", __func__);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302677 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302678
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302679 return;
2680}
2681#else
2682#define bt_power_init(x) do {} while (0)
2683#endif
2684
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002685static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002686 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002687 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302688 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002689 &msm_device_saw_core0,
2690 &msm_device_saw_core1,
2691 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002692 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002693 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002694 &msm8960_device_qup_spi_gsbi1,
2695 &msm8960_device_qup_i2c_gsbi3,
2696 &msm8960_device_qup_i2c_gsbi4,
2697 &msm8960_device_qup_i2c_gsbi10,
2698#ifndef CONFIG_MSM_DSPS
2699 &msm8960_device_qup_i2c_gsbi12,
2700#endif
2701 &msm_slim_ctrl,
2702 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302703#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2704 &msm_bluesleep_device,
2705 &msm_bt_power_device,
2706#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002707#if defined(CONFIG_QSEECOM)
2708 &qseecom_device,
2709#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002710#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2711 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2712 &qcrypto_device,
2713#endif
2714
2715#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2716 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2717 &qcedev_device,
2718#endif
2719#ifdef CONFIG_MSM_ROTATOR
2720 &msm_rotator_device,
2721#endif
2722 &msm_device_sps,
2723#ifdef CONFIG_MSM_FAKE_BATTERY
2724 &fish_battery_device,
2725#endif
Binqiang Qiuf165c922012-08-15 18:00:18 -07002726#ifdef CONFIG_BATTERY_BCL
2727 &battery_bcl_device,
2728#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002729 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002730#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002731#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002732 &msm8960_android_pmem_device,
2733 &msm8960_android_pmem_adsp_device,
2734 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002735#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002736#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002737 &msm_device_bam_dmux,
2738 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002739#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2740#ifdef CONFIG_MSM_USE_TSIF1
2741 &msm_device_tsif[1],
2742#else
2743 &msm_device_tsif[0],
2744#endif
2745#endif
Joel Nider266a2642011-10-16 10:58:05 +02002746 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002747#ifdef CONFIG_HW_RANDOM_MSM
2748 &msm_device_rng,
2749#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002750#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002751 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002752#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002753 &msm8960_rpm_device,
2754 &msm8960_rpm_log_device,
2755 &msm8960_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302756 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002757 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002758 &coresight_tpiu_device,
2759 &coresight_etb_device,
2760 &coresight_funnel_device,
2761 &coresight_etm0_device,
2762 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002763 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002764 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002765 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002766 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002767 &msm8960_device_ebi1_ch0_erp,
2768 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002769 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002770 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002771 &msm_tsens_device,
Anji Jonnala6c2b6852012-09-21 13:34:44 +05302772 &msm8960_pc_cntr,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002773};
2774
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002775static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002776 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002777 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002778 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002779 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002780 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002781 &msm8960_device_otg,
2782 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002783 &msm_device_hsusb_host,
2784 &android_usb_device,
2785 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002786 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002787 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002788 &msm_pcm_routing,
2789 &msm_cpudai0,
2790 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002791 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002792 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002793 &msm_cpudai_hdmi_rx,
2794 &msm_cpudai_bt_rx,
2795 &msm_cpudai_bt_tx,
2796 &msm_cpudai_fm_rx,
2797 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002798 &msm_cpudai_auxpcm_rx,
2799 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002800 &msm_cpu_fe,
2801 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002802#ifdef CONFIG_MSM_GEMINI
2803 &msm8960_gemini_device,
2804#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002805#ifdef CONFIG_MSM_MERCURY
2806 &msm8960_mercury_device,
2807#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002808 &msm_voice,
2809 &msm_voip,
2810 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302811 &msm_cpudai_afe_01_rx,
2812 &msm_cpudai_afe_01_tx,
2813 &msm_cpudai_afe_02_rx,
2814 &msm_cpudai_afe_02_tx,
2815 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302816 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002817 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002818 &msm_cpudai_incall_record_rx,
2819 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002820 &msm_pcm_hostless,
2821 &msm_bus_apps_fabric,
2822 &msm_bus_sys_fabric,
2823 &msm_bus_mm_fabric,
2824 &msm_bus_sys_fpb,
2825 &msm_bus_cpss_fpb,
2826};
2827
2828static void __init msm8960_i2c_init(void)
2829{
Kiran Gundaaf3b3562012-08-31 14:00:05 +05302830 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
2831 msm8960_i2c_qup_gsbi4_pdata.keep_ahb_clk_on = 1;
2832
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002833 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2834 &msm8960_i2c_qup_gsbi4_pdata;
2835
2836 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2837 &msm8960_i2c_qup_gsbi3_pdata;
2838
2839 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2840 &msm8960_i2c_qup_gsbi10_pdata;
2841
2842 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2843 &msm8960_i2c_qup_gsbi12_pdata;
2844}
2845
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002846static void __init msm8960_gfx_init(void)
2847{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002848 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2849 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002850 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002851
Carter Coopera4a7ed22012-08-20 22:11:42 -06002852 /* Fixup data that needs to change based on GPU ID */
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002853 if (cpu_is_msm8960ab()) {
2854 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Carter Cooper9be5c4d2012-08-22 13:27:58 -06002855 /* 8960PRO nominal clock rate is 325Mhz instead of 320Mhz */
2856 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 325000000;
Carter Coopera4a7ed22012-08-20 22:11:42 -06002857 } else {
2858 kgsl_3d0_pdata->iommu_count = 1;
2859 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2860 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2861 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2862 }
2863 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2864 /* 8960v3 GPU registers returns 5 for patch release
2865 * but it should be 6, so dummy up the chipid here
2866 * based the platform type
2867 */
2868 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2869 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002870 }
Carter Cooper83e9dab2012-08-20 15:17:23 -06002871
2872 /* Register the 3D core */
2873 platform_device_register(&msm_kgsl_3d0);
2874
2875 /* Register the 2D cores if we are not 8960PRO */
2876 if (!cpu_is_msm8960ab()) {
2877 platform_device_register(&msm_kgsl_2d0);
2878 platform_device_register(&msm_kgsl_2d1);
2879 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002880}
2881
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302882static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002883 {
2884 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2885 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2886 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002887 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002888 },
2889
2890 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002891 MSM_PM_SLEEP_MODE_RETENTION,
2892 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2893 true,
2894 415, 715, 340827, 475,
2895 },
2896
2897 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002898 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2899 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2900 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002901 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002902 },
2903
2904 {
2905 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2906 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2907 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002908 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002909 },
2910
2911 {
2912 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002913 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2914 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002915 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002916 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002917
2918 {
2919 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2920 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2921 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002922 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002923 },
2924
2925 {
2926 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2927 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2928 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002929 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002930 },
2931
2932 {
2933 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2934 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2935 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002936 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002937 },
2938
2939 {
2940 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2941 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2942 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002943 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002944 },
2945};
2946
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002947
Praveen Chidambaram78499012011-11-01 17:15:17 -06002948static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2949 .levels = &msm_rpmrs_levels[0],
2950 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2951 .vdd_mem_levels = {
2952 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2953 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2954 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2955 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2956 },
2957 .vdd_dig_levels = {
2958 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2959 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2960 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2961 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2962 },
2963 .vdd_mask = 0x7FFFFF,
2964 .rpmrs_target_id = {
2965 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2966 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2967 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2968 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2969 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2970 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2971 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2972 },
2973};
2974
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002975static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2976 .mode = MSM_PM_BOOT_CONFIG_TZ,
2977};
2978
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002979#ifdef CONFIG_I2C
2980#define I2C_SURF 1
2981#define I2C_FFA (1 << 1)
2982#define I2C_RUMI (1 << 2)
2983#define I2C_SIM (1 << 3)
2984#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002985#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002986
2987struct i2c_registry {
2988 u8 machs;
2989 int bus;
2990 struct i2c_board_info *info;
2991 int len;
2992};
2993
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002994/* Sensors DSPS platform data */
2995#ifdef CONFIG_MSM_DSPS
2996#define DSPS_PIL_GENERIC_NAME "dsps"
2997#endif /* CONFIG_MSM_DSPS */
2998
2999static void __init msm8960_init_dsps(void)
3000{
3001#ifdef CONFIG_MSM_DSPS
3002 struct msm_dsps_platform_data *pdata =
3003 msm_dsps_device.dev.platform_data;
3004 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3005 pdata->gpios = NULL;
3006 pdata->gpios_num = 0;
3007
3008 platform_device_register(&msm_dsps_device);
3009#endif /* CONFIG_MSM_DSPS */
3010}
3011
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003012static int hsic_peripheral_status = 1;
3013static DEFINE_MUTEX(hsic_status_lock);
3014
3015void peripheral_connect()
3016{
3017 mutex_lock(&hsic_status_lock);
3018 if (hsic_peripheral_status)
3019 goto out;
3020 platform_device_add(&msm_device_hsic_host);
3021 hsic_peripheral_status = 1;
3022out:
3023 mutex_unlock(&hsic_status_lock);
3024}
3025EXPORT_SYMBOL(peripheral_connect);
3026
3027void peripheral_disconnect()
3028{
3029 mutex_lock(&hsic_status_lock);
3030 if (!hsic_peripheral_status)
3031 goto out;
3032 platform_device_del(&msm_device_hsic_host);
3033 hsic_peripheral_status = 0;
3034out:
3035 mutex_unlock(&hsic_status_lock);
3036}
3037EXPORT_SYMBOL(peripheral_disconnect);
3038
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303039static void __init msm8960_init_smsc_hub(void)
3040{
3041 uint32_t version = socinfo_get_version();
3042
3043 if (SOCINFO_VERSION_MAJOR(version) == 1)
3044 return;
3045
3046 if (machine_is_msm8960_liquid())
3047 platform_device_register(&smsc_hub_device);
3048}
3049
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003050static void __init msm8960_init_hsic(void)
3051{
3052#ifdef CONFIG_USB_EHCI_MSM_HSIC
3053 uint32_t version = socinfo_get_version();
3054
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003055 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003056 return;
3057
Joel King0cbf5d82012-05-24 15:21:38 -07003058 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003059 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003060#endif
3061}
3062
Amir Samuelov5137e392011-09-21 17:31:25 +03003063#ifdef CONFIG_ISL9519_CHARGER
3064static struct isl_platform_data isl_data __initdata = {
3065 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3066 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3067 .max_system_voltage = 4200,
3068 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003069 .chgcurrent = 1900,
3070 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003071 .input_current = 2048,
3072};
3073
3074static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3075 {
3076 I2C_BOARD_INFO("isl9519q", 0x9),
3077 .irq = 0, /* Not required when notify-by-pmic */
3078 .platform_data = &isl_data,
3079 },
3080};
3081#endif /* CONFIG_ISL9519_CHARGER */
3082
Amir Samuelov755616d2011-12-13 16:34:46 +02003083static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3084 {
3085 I2C_BOARD_INFO("sx1508q", 0x20),
3086 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3087 },
3088};
3089
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003090static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003091#ifdef CONFIG_ISL9519_CHARGER
3092 {
3093 I2C_LIQUID,
3094 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3095 isl_charger_i2c_info,
3096 ARRAY_SIZE(isl_charger_i2c_info),
3097 },
3098#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003099 {
3100 I2C_SURF | I2C_FFA | I2C_FLUID,
3101 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3102 cyttsp_info,
3103 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003104 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303105 {
3106 I2C_LIQUID,
3107 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3108 mxt_device_info,
3109 ARRAY_SIZE(mxt_device_info),
3110 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303111 {
Manoj Rao14648742012-03-30 19:42:12 -07003112 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303113 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003114 sii_device_info,
3115 ARRAY_SIZE(sii_device_info),
3116 },
3117 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303118 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003119 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303120 msm_isa1200_board_info,
3121 ARRAY_SIZE(msm_isa1200_board_info),
3122 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003123 {
3124 I2C_LIQUID,
3125 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3126 liquid_io_expander_i2c_info,
3127 ARRAY_SIZE(liquid_io_expander_i2c_info),
3128 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003129};
3130#endif /* CONFIG_I2C */
3131
3132static void __init register_i2c_devices(void)
3133{
3134#ifdef CONFIG_I2C
3135 u8 mach_mask = 0;
3136 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003137#ifdef CONFIG_MSM_CAMERA
3138 struct i2c_registry msm8960_camera_i2c_devices = {
3139 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3140 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3141 msm8960_camera_board_info.board_info,
3142 msm8960_camera_board_info.num_i2c_board_info,
3143 };
3144#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003145
3146 /* Build the matching 'supported_machs' bitmask */
3147 if (machine_is_msm8960_cdp())
3148 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003149 else if (machine_is_msm8960_fluid())
3150 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003151 else if (machine_is_msm8960_liquid())
3152 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003153 else if (machine_is_msm8960_mtp())
3154 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003155 else
3156 pr_err("unmatched machine ID in register_i2c_devices\n");
3157
Jing Lineec88ca2012-02-08 11:18:30 -08003158 if (machine_is_msm8960_liquid()) {
3159 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3160 mxt_device_info[0].platform_data =
3161 &mxt_platform_data_3d;
3162 else
3163 mxt_device_info[0].platform_data =
3164 &mxt_platform_data_2d;
3165 }
3166
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003167 /* Run the array and install devices as appropriate */
3168 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3169 if (msm8960_i2c_devices[i].machs & mach_mask)
3170 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3171 msm8960_i2c_devices[i].info,
3172 msm8960_i2c_devices[i].len);
3173 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003174
3175 if (!mhl_platform_data.gpio_mhl_power)
3176 pr_debug("mhl device configured for ext debug board\n");
3177
Kevin Chan09f4e662011-12-16 08:17:02 -08003178#ifdef CONFIG_MSM_CAMERA
3179 if (msm8960_camera_i2c_devices.machs & mach_mask)
3180 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3181 msm8960_camera_i2c_devices.info,
3182 msm8960_camera_i2c_devices.len);
3183#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003184#endif
3185}
3186
Siddartha Mohanadoss30447fe2012-09-26 09:42:32 -07003187static void __init msm8960_tsens_init(void)
3188{
3189 if (cpu_is_msm8960())
3190 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3191 return;
3192
3193 msm_tsens_early_init(&msm_tsens_pdata);
3194}
3195
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003196static void __init msm8960_cdp_init(void)
3197{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003198 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3199 pr_err("meminfo_init() failed!\n");
3200
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003201 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss30447fe2012-09-26 09:42:32 -07003202 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003203 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003204 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3205 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003206
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003207 regulator_suppress_info_printing();
3208 if (msm_xo_init())
3209 pr_err("Failed to initialize XO votes\n");
David Collinse68647e2012-09-04 15:44:19 -07003210 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003211 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003212 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303213 if (machine_is_msm8960_liquid())
3214 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003215 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303216 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3217 machine_is_msm8960_cdp()) {
Mayank Ranaa61da7a2012-08-14 10:57:00 +05303218 /* Due to availability of USB Switch in SGLTE Platform
3219 * it requires different HSUSB PHY settings compare to
3220 * 8960 MTP/CDP platform.
3221 */
3222 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3223 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3224 else
3225 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303226 } else if (machine_is_msm8960_liquid()) {
3227 msm_otg_pdata.phy_init_seq =
3228 liquid_v1_phy_init_seq;
3229 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003230 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303231 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303232 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303233 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3234 machine_is_msm8960_liquid())
3235 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003236 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003237 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3238 &msm8960_qup_spi_gsbi1_pdata;
3239 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303240 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3241 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003242
3243 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303244 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
3245 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303246 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003247 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003248 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003249 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3250 msm_spm_l2_init(msm_spm_l2_data);
3251 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003252 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003253 if (machine_is_msm8960_liquid())
3254 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003255 if (machine_is_msm8960_cdp())
3256 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003257
3258 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3259 platform_device_register(&msm8960_device_uart_gsbi8);
3260 else
3261 platform_device_register(&msm8960_device_uart_gsbi5);
3262
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003263 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003264 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3265 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003266 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303267 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003268 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003269
Mayank Rana1f02d952012-07-04 19:11:20 +05303270 /* For 8960 Standalone External Bluetooth Interface */
3271 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3272 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3273 platform_device_register(&msm_device_uart_dm8);
3274 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003275 if (cpu_is_msm8960ab())
3276 platform_device_register(&msm8960ab_device_acpuclk);
3277 else
3278 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003279 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menon697e91b2012-08-20 15:25:50 -07003280 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003281
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003282 msm8960_pm8921_gpio_mpp_init();
Stephen Boyded035682012-09-13 12:41:31 -07003283 /* Don't add modem devices on APQ targets */
Stephen Boydbdb53f32012-06-05 18:39:47 -07003284 if (socinfo_get_id() != 124)
3285 platform_device_register(&msm_8960_q6_mss);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003286 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303287 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003288 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003289#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003290 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003291#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003292 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303293 if (machine_is_msm8960_liquid())
3294 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003295 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003296 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003297 slim_register_board_info(msm_slim_devices,
3298 ARRAY_SIZE(msm_slim_devices));
3299 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003300 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003301 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303302 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003303 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3304 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3305 platform_device_register(&mdm_sglte_device);
3306 }
Girish Mahadevan3bc98772012-08-15 10:01:27 -06003307 msm_pm_set_tz_retention_flag(1);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003308}
3309
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003310MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3311 .map_io = msm8960_map_io,
3312 .reserve = msm8960_reserve,
3313 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303314 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003315 .timer = &msm_timer,
3316 .init_machine = msm8960_cdp_init,
3317 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003318 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003319 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003320MACHINE_END
3321
3322MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3323 .map_io = msm8960_map_io,
3324 .reserve = msm8960_reserve,
3325 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303326 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003327 .timer = &msm_timer,
3328 .init_machine = msm8960_cdp_init,
3329 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003330 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003331 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003332MACHINE_END
3333
3334MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3335 .map_io = msm8960_map_io,
3336 .reserve = msm8960_reserve,
3337 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303338 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003339 .timer = &msm_timer,
3340 .init_machine = msm8960_cdp_init,
3341 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003342 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003343 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003344MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003345
3346MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3347 .map_io = msm8960_map_io,
3348 .reserve = msm8960_reserve,
3349 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303350 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003351 .timer = &msm_timer,
3352 .init_machine = msm8960_cdp_init,
3353 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003354 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003355 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003356MACHINE_END