blob: e919d78bc3fdce4e116050af5ddcf4f4ca0efa72 [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
Ming-yi Lin9baad172012-10-17 11:50:15 +0800106#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
107#include <linux/wlan_plat.h>
108#include <linux/mutex.h>
109#endif
110
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700111static struct platform_device msm_fm_platform_init = {
112 .name = "iris_fm",
113 .id = -1,
114};
115
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700116#define KS8851_RST_GPIO 89
117#define KS8851_IRQ_GPIO 90
Mohan Pallaka5e490392011-09-09 15:18:41 +0530118
Manoj Rao14648742012-03-30 19:42:12 -0700119#define MHL_GPIO_INT 4
120#define MHL_GPIO_RESET 15
121
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700122#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700123
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800124struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700125 [SX150X_CAM] = {
126 .gpio_base = GPIO_CAM_EXPANDER_BASE,
127 .oscio_is_gpo = false,
128 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530129 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700130 .io_open_drain_ena = 0x0,
131 .irq_summary = -1,
132 },
Amir Samuelov755616d2011-12-13 16:34:46 +0200133 [SX150X_LIQUID] = {
134 .gpio_base = GPIO_LIQUID_EXPANDER_BASE,
135 .oscio_is_gpo = false,
136 .io_pullup_ena = 0x0c08,
137 .io_pulldn_ena = 0x4060,
138 .io_open_drain_ena = 0x000c,
139 .io_polarity = 0,
140 .irq_summary = -1,
141 },
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700142};
Nishant Pandit474f2252011-07-23 23:17:56 +0530143
144#endif
145
Olav Haugana21169d2012-01-04 09:17:06 -0800146#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -0700147#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Mathew Karimpanal15fa5c42011-12-14 21:28:10 -0800148#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800149#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800150#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Laura Abbott2d1760b2011-09-29 21:31:24 -0700151
152#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Deepak Kotur35825522012-06-06 15:49:14 -0700153#define HOLE_SIZE 0x20000
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700154#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan32594552012-03-13 11:40:05 -0700155#ifdef CONFIG_MSM_IOMMU
Olav Haugan8726caf2012-05-10 15:11:35 -0700156#define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */
Olav Haugan32594552012-03-13 11:40:05 -0700157#define MSM_ION_SF_SIZE 0x0
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700158#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700159#define MSM_ION_HEAP_NUM 7
160#else
161#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
162#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Hauganfbbf05b2012-04-05 14:33:41 -0700163#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan32594552012-03-13 11:40:05 -0700164#define MSM_ION_HEAP_NUM 8
165#endif
Deepak Kotur35825522012-06-06 15:49:14 -0700166#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 128kb */
Olav Hauganb5be7992011-11-18 14:29:02 -0800167#define MSM_ION_MFC_SIZE SZ_8K
Olav Haugan7355db02012-01-13 16:59:13 -0800168#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan32594552012-03-13 11:40:05 -0700169
Olav Hauganb5be7992011-11-18 14:29:02 -0800170#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800171#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
172#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700173
Deepak Kotur35825522012-06-06 15:49:14 -0700174#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2mb -128kb*/
175#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
176 HOLE_SIZE))
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700177#define MAX_FIXED_AREA_SIZE 0x10000000
Deepak Kotur35825522012-06-06 15:49:14 -0700178#define MSM8960_FW_START MSM8960_FIXED_AREA_START
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700179
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800180static unsigned msm_ion_sf_size = MSM_ION_SF_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700181#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700182#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Hauganb5be7992011-11-18 14:29:02 -0800183#define MSM_ION_HEAP_NUM 1
Laura Abbott2d1760b2011-09-29 21:31:24 -0700184#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700185
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700186#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
187static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
188static int __init msm_contig_mem_size_setup(char *p)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700189{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700190 msm_contig_mem_size = memparse(p, NULL);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191 return 0;
192}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700193early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700194#endif
195
196#ifdef CONFIG_ANDROID_PMEM
197static unsigned pmem_size = MSM_PMEM_SIZE;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800198static unsigned pmem_param_set;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700199static int __init pmem_size_setup(char *p)
200{
201 pmem_size = memparse(p, NULL);
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800202 pmem_param_set = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700203 return 0;
204}
205early_param("pmem_size", pmem_size_setup);
206
207static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
208
209static int __init pmem_adsp_size_setup(char *p)
210{
211 pmem_adsp_size = memparse(p, NULL);
212 return 0;
213}
214early_param("pmem_adsp_size", pmem_adsp_size_setup);
215
216static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
217
218static int __init pmem_audio_size_setup(char *p)
219{
220 pmem_audio_size = memparse(p, NULL);
221 return 0;
222}
223early_param("pmem_audio_size", pmem_audio_size_setup);
224#endif
225
226#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700227#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228static struct android_pmem_platform_data android_pmem_pdata = {
229 .name = "pmem",
230 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
231 .cached = 1,
232 .memory_type = MEMTYPE_EBI1,
233};
234
Laura Abbottb93525f2012-04-12 09:57:19 -0700235static struct platform_device msm8960_android_pmem_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236 .name = "android_pmem",
237 .id = 0,
238 .dev = {.platform_data = &android_pmem_pdata},
239};
240
241static struct android_pmem_platform_data android_pmem_adsp_pdata = {
242 .name = "pmem_adsp",
243 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
244 .cached = 0,
245 .memory_type = MEMTYPE_EBI1,
246};
Laura Abbottb93525f2012-04-12 09:57:19 -0700247static struct platform_device msm8960_android_pmem_adsp_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700248 .name = "android_pmem",
249 .id = 2,
250 .dev = { .platform_data = &android_pmem_adsp_pdata },
251};
252
253static struct android_pmem_platform_data android_pmem_audio_pdata = {
254 .name = "pmem_audio",
255 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
256 .cached = 0,
257 .memory_type = MEMTYPE_EBI1,
258};
259
Laura Abbottb93525f2012-04-12 09:57:19 -0700260static struct platform_device msm8960_android_pmem_audio_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700261 .name = "android_pmem",
262 .id = 4,
263 .dev = { .platform_data = &android_pmem_audio_pdata },
264};
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700265#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
266#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267
Laura Abbottb93525f2012-04-12 09:57:19 -0700268struct fmem_platform_data msm8960_fmem_pdata = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800269};
270
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700271#define DSP_RAM_BASE_8960 0x8da00000
272#define DSP_RAM_SIZE_8960 0x1800000
273static int dspcrashd_pdata_8960 = 0xDEADDEAD;
274
275static struct resource resources_dspcrashd_8960[] = {
276 {
277 .name = "msm_dspcrashd",
278 .start = DSP_RAM_BASE_8960,
279 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
280 .flags = IORESOURCE_DMA,
281 },
282};
283
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800284static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700285 .name = "msm_dspcrashd",
286 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
287 .resource = resources_dspcrashd_8960,
288 .dev = { .platform_data = &dspcrashd_pdata_8960 },
289};
290
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700291static struct memtype_reserve msm8960_reserve_table[] __initdata = {
292 [MEMTYPE_SMI] = {
293 },
294 [MEMTYPE_EBI0] = {
295 .flags = MEMTYPE_FLAGS_1M_ALIGN,
296 },
297 [MEMTYPE_EBI1] = {
298 .flags = MEMTYPE_FLAGS_1M_ALIGN,
299 },
300};
301
Laura Abbottf8c03b92012-02-16 14:57:58 -0800302static void __init reserve_rtb_memory(void)
303{
304#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700305 msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
Laura Abbottf8c03b92012-02-16 14:57:58 -0800306#endif
307}
308
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309static void __init size_pmem_devices(void)
310{
311#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700312#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313 android_pmem_adsp_pdata.size = pmem_adsp_size;
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800314
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800315 if (!pmem_param_set) {
316 if (machine_is_msm8960_liquid())
317 pmem_size = MSM_LIQUID_PMEM_SIZE;
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700318 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800319 pmem_size = MSM_HDMI_PRIM_PMEM_SIZE;
320 }
321
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322 android_pmem_pdata.size = pmem_size;
323 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700324#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
325#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700326}
327
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700328#ifdef CONFIG_ANDROID_PMEM
329#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330static void __init reserve_memory_for(struct android_pmem_platform_data *p)
331{
332 msm8960_reserve_table[p->memory_type].size += p->size;
333}
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700334#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
335#endif /*CONFIG_ANDROID_PMEM*/
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336
337static void __init reserve_pmem_memory(void)
338{
339#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700340#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341 reserve_memory_for(&android_pmem_adsp_pdata);
342 reserve_memory_for(&android_pmem_pdata);
343 reserve_memory_for(&android_pmem_audio_pdata);
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -0700344#endif
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700345 msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700346#endif
347}
348
Larry Basselb4126da2011-07-18 14:31:33 -0700349static int msm8960_paddr_to_memtype(unsigned int paddr)
350{
351 return MEMTYPE_EBI1;
352}
353
Steve Mucklef132c6c2012-06-06 18:30:57 -0700354#define FMEM_ENABLED 0
Olav Hauganf6dc7742012-02-15 09:11:55 -0800355
Laura Abbottd6183792011-08-19 13:42:24 -0700356#ifdef CONFIG_ION_MSM
Olav Haugan0703dbf2011-12-19 17:53:38 -0800357#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700358static struct ion_cp_heap_pdata cp_mm_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800359 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugan8726caf2012-05-10 15:11:35 -0700360 .align = SZ_64K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800361 .reusable = FMEM_ENABLED,
362 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700363 .fixed_position = FIXED_MIDDLE,
Olav Haugan8726caf2012-05-10 15:11:35 -0700364 .iommu_map_all = 1,
365 .iommu_2x_map_domain = VIDEO_DOMAIN,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800366};
367
Laura Abbottb93525f2012-04-12 09:57:19 -0700368static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800369 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800370 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800371 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800372 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700373 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800374};
375
Laura Abbottb93525f2012-04-12 09:57:19 -0700376static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800377 .adjacent_mem_id = INVALID_HEAP_ID,
378 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800379 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800380};
381
Laura Abbottb93525f2012-04-12 09:57:19 -0700382static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800383 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
384 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800385 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700386 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800387};
388#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800389
390/**
391 * These heaps are listed in the order they will be allocated. Due to
392 * video hardware restrictions and content protection the FW heap has to
393 * be allocated adjacent (below) the MM heap and the MFC heap has to be
394 * allocated after the MM heap to ensure MFC heap is not more than 256MB
395 * away from the base address of the FW heap.
396 * However, the order of FW heap and MM heap doesn't matter since these
397 * two heaps are taken care of by separate code to ensure they are adjacent
398 * to each other.
399 * Don't swap the order unless you know what you are doing!
400 */
Laura Abbottb93525f2012-04-12 09:57:19 -0700401static struct ion_platform_data msm8960_ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700402 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700403 .heaps = {
404 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800405 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700406 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700407 .name = ION_VMALLOC_HEAP_NAME,
408 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700409#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700410 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800411 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800412 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800413 .name = ION_MM_HEAP_NAME,
414 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700415 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700416 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700417 },
Laura Abbott8c017362011-09-22 20:59:12 -0700418 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800419 .id = ION_MM_FIRMWARE_HEAP_ID,
420 .type = ION_HEAP_TYPE_CARVEOUT,
421 .name = ION_MM_FIRMWARE_HEAP_NAME,
422 .size = MSM_ION_MM_FW_SIZE,
423 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700424 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800425 },
426 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800427 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800428 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800429 .name = ION_MFC_HEAP_NAME,
430 .size = MSM_ION_MFC_SIZE,
431 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700432 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800433 },
Olav Haugan32594552012-03-13 11:40:05 -0700434#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800435 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800436 .id = ION_SF_HEAP_ID,
437 .type = ION_HEAP_TYPE_CARVEOUT,
438 .name = ION_SF_HEAP_NAME,
439 .size = MSM_ION_SF_SIZE,
440 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700441 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800442 },
Olav Haugan32594552012-03-13 11:40:05 -0700443#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800444 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800445 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700446 .type = ION_HEAP_TYPE_IOMMU,
447 .name = ION_IOMMU_HEAP_NAME,
448 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800449 {
450 .id = ION_QSECOM_HEAP_ID,
451 .type = ION_HEAP_TYPE_CARVEOUT,
452 .name = ION_QSECOM_HEAP_NAME,
453 .size = MSM_ION_QSECOM_SIZE,
454 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700455 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800456 },
Olav Haugan7355db02012-01-13 16:59:13 -0800457 {
458 .id = ION_AUDIO_HEAP_ID,
459 .type = ION_HEAP_TYPE_CARVEOUT,
460 .name = ION_AUDIO_HEAP_NAME,
461 .size = MSM_ION_AUDIO_SIZE,
462 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700463 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800464 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700465#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700466 }
467};
468
Laura Abbottb93525f2012-04-12 09:57:19 -0700469static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700470 .name = "ion-msm",
471 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700472 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700473};
474#endif
475
Laura Abbottb93525f2012-04-12 09:57:19 -0700476struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800477 .name = "fmem",
478 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700479 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800480};
481
Olav Haugan65f4bd82011-12-13 11:50:08 -0800482static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700483{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800484 unsigned int i;
485
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800486 if (!pmem_param_set) {
487 if (machine_is_msm8960_liquid())
488 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
489
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700490 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800491 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
492
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700493 if (machine_is_msm8960_liquid() ||
494 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700495 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
496 if (msm8960_ion_pdata.heaps[i].id ==
497 ION_SF_HEAP_ID) {
498 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800499 msm_ion_sf_size;
500 pr_debug("msm_ion_sf_size 0x%x\n",
501 msm_ion_sf_size);
502 break;
503 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800504 }
505 }
506 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800507}
508
509static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
510 unsigned long size)
511{
512 msm8960_reserve_table[mem_type].size += size;
513}
514
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700515static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
516{
517#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
518 int ret;
519
520 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
521 panic("fixed area size is larger than %dM\n",
522 MAX_FIXED_AREA_SIZE >> 20);
523
524 reserve_info->fixed_area_size = fixed_area_size;
525 reserve_info->fixed_area_start = MSM8960_FW_START;
526
527 ret = memblock_remove(reserve_info->fixed_area_start,
528 reserve_info->fixed_area_size);
529 BUG_ON(ret);
530#endif
531}
532
Olav Haugan65f4bd82011-12-13 11:50:08 -0800533/**
534 * Reserve memory for ION and calculate amount of reusable memory for fmem.
535 * We only reserve memory for heaps that are not reusable. However, we only
536 * support one reusable heap at the moment so we ignore the reusable flag for
537 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800538 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
539 * at a higher address than FW in addition to not more than 256MB away from the
540 * base address of the firmware. This means that if MM is reusable the other
541 * two heaps must be allocated in the same region as FW. This is handled by the
542 * mem_is_fmem flag in the platform data. In addition the MM heap must be
543 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800544 */
545static void __init reserve_ion_memory(void)
546{
547#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
548 unsigned int i;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700549 unsigned int fixed_size = 0;
550 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
551 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800552
553 adjust_mem_for_liquid();
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
Laura Abbottb93525f2012-04-12 09:57:19 -0700558 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700559 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700560 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700561 int align = SZ_4K;
562 int iommu_map_all = 0;
563 int adjacent_mem_id = INVALID_HEAP_ID;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800564
565 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700566 int fixed_position = NOT_FIXED;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700567
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700568 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800569 case ION_HEAP_TYPE_CP:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700570 fixed_position = ((struct ion_cp_heap_pdata *)
571 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700572 align = ((struct ion_cp_heap_pdata *)
573 heap->extra_data)->align;
574 iommu_map_all =
575 ((struct ion_cp_heap_pdata *)
576 heap->extra_data)->iommu_map_all;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800577 break;
578 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700579 fixed_position = ((struct ion_co_heap_pdata *)
580 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700581 adjacent_mem_id = ((struct ion_co_heap_pdata *)
582 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700583 break;
584 default:
585 break;
586 }
587
Olav Haugan8726caf2012-05-10 15:11:35 -0700588 if (iommu_map_all) {
589 if (heap->size & (SZ_64K-1)) {
590 heap->size = ALIGN(heap->size, SZ_64K);
591 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
592 heap->name, heap->size);
593 }
594 }
595
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700596 if (fixed_position != NOT_FIXED)
597 fixed_size += heap->size;
598 else
599 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
600
601 if (fixed_position == FIXED_LOW)
602 fixed_low_size += heap->size;
603 else if (fixed_position == FIXED_MIDDLE)
604 fixed_middle_size += heap->size;
605 else if (fixed_position == FIXED_HIGH)
606 fixed_high_size += heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700607 }
608 }
609
610 if (!fixed_size)
611 return;
612
Larry Bassel4d4f4482012-04-04 11:26:09 -0700613 /* Since the fixed area may be carved out of lowmem,
614 * make sure the length is a multiple of 1M.
615 */
616 fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1)
617 & SECTION_MASK;
618 msm8960_reserve_fixed_area(fixed_size);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700619
620 fixed_low_start = MSM8960_FIXED_AREA_START;
Deepak Kotur35825522012-06-06 15:49:14 -0700621 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700622 fixed_high_start = fixed_middle_start + fixed_middle_size;
623
Laura Abbottb93525f2012-04-12 09:57:19 -0700624 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
625 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700626
627 if (heap->extra_data) {
628 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700629 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700630
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700631 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700632 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700633 pdata =
634 (struct ion_cp_heap_pdata *)heap->extra_data;
635 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700636 break;
637 case ION_HEAP_TYPE_CARVEOUT:
638 fixed_position = ((struct ion_co_heap_pdata *)
639 heap->extra_data)->fixed_position;
640 break;
641 default:
642 break;
643 }
644
645 switch (fixed_position) {
646 case FIXED_LOW:
647 heap->base = fixed_low_start;
648 break;
649 case FIXED_MIDDLE:
650 heap->base = fixed_middle_start;
Deepak Kotur35825522012-06-06 15:49:14 -0700651 pdata->secure_base = fixed_middle_start
652 - HOLE_SIZE;
653 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700654 break;
655 case FIXED_HIGH:
656 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800657 break;
658 default:
659 break;
660 }
661 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800662 }
Laura Abbottd6183792011-08-19 13:42:24 -0700663#endif
664}
Huaibin Yanga5419422011-12-08 23:52:10 -0800665
666static void __init reserve_mdp_memory(void)
667{
668 msm8960_mdp_writeback(msm8960_reserve_table);
669}
670
Stephen Boyd668d7652012-04-25 11:31:01 -0700671static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800672{
673#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800674 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800675
Laura Abbott155ab6f2012-05-25 08:52:18 -0700676 total = msm8960_cache_dump_pdata.l1_size +
677 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800678 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800679#endif
680}
681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700682static void __init msm8960_calculate_reserve_sizes(void)
683{
684 size_pmem_devices();
685 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700686 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800687 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800688 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800689 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700690}
691
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700692static struct reserve_info msm8960_reserve_info __initdata = {
693 .memtype_reserve_table = msm8960_reserve_table,
694 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700695 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700696 .paddr_to_memtype = msm8960_paddr_to_memtype,
697};
698
Larry Basselb4126da2011-07-18 14:31:33 -0700699static int msm8960_memory_bank_size(void)
700{
701 return 1<<29;
702}
703
704static void __init locate_unstable_memory(void)
705{
706 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
707 unsigned long bank_size;
708 unsigned long low, high;
709
710 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700711 msm8960_reserve_info.bank_size = bank_size;
712
Larry Basselb4126da2011-07-18 14:31:33 -0700713 low = meminfo.bank[0].start;
714 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700715
716 /* Check if 32 bit overflow occured */
717 if (high < mb->start)
718 high = ~0UL;
719
Larry Bassel4d4f4482012-04-04 11:26:09 -0700720 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
721 panic("fixed area extends beyond end of memory\n");
722
Larry Basselb4126da2011-07-18 14:31:33 -0700723 low &= ~(bank_size - 1);
724
725 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700726 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800727
Larry Basselb8d61022012-02-24 10:49:45 -0800728#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800729 msm8960_reserve_info.low_unstable_address = mb->start -
730 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800731 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700732 pr_info("low unstable address %lx max size %lx bank size %lx\n",
733 msm8960_reserve_info.low_unstable_address,
734 msm8960_reserve_info.max_unstable_size,
735 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700736 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800737#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700738no_dmm:
739 msm8960_reserve_info.low_unstable_address = high;
740 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700741}
742
Larry Basselb830e182011-10-14 10:46:55 -0700743static void __init place_movable_zone(void)
744{
Larry Basselb8d61022012-02-24 10:49:45 -0800745#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700746 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
747 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
748 pr_info("movable zone start %lx size %lx\n",
749 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800750#endif
Larry Basselb830e182011-10-14 10:46:55 -0700751}
752
753static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700754{
755 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700756 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700757 place_movable_zone();
758}
759
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800760static char prim_panel_name[PANEL_NAME_MAX_LEN];
761static char ext_panel_name[PANEL_NAME_MAX_LEN];
762static int __init prim_display_setup(char *param)
763{
764 if (strnlen(param, PANEL_NAME_MAX_LEN))
765 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
766 return 0;
767}
768early_param("prim_display", prim_display_setup);
769
770static int __init ext_display_setup(char *param)
771{
772 if (strnlen(param, PANEL_NAME_MAX_LEN))
773 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
774 return 0;
775}
776early_param("ext_display", ext_display_setup);
777
Larry Basselb830e182011-10-14 10:46:55 -0700778static void __init msm8960_reserve(void)
779{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800780 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700781 msm_reserve();
782}
783
Larry Bassela4414b12011-08-04 11:11:02 -0700784static int msm8960_change_memory_power(u64 start, u64 size,
785 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700786{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700787 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700788}
789
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700790static void __init msm8960_allocate_memory_regions(void)
791{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800792 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700793}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800794
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700795#ifdef CONFIG_WCD9310_CODEC
796
797#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
798
Patrick Lai3043fba2011-08-01 14:15:57 -0700799/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
800 * 4 micbiases are used to power various analog and digital
801 * microphones operating at 1800 mV. Technically, all micbiases
802 * can source from single cfilter since all microphones operate
803 * at the same voltage level. The arrangement below is to make
804 * sure all cfilters are exercised. LDO_H regulator ouput level
805 * does not need to be as high as 2.85V. It is choosen for
806 * microphone sensitivity purpose.
807 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530808static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700809 .slimbus_slave_device = {
810 .name = "tabla-slave",
811 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
812 },
813 .irq = MSM_GPIO_TO_INT(62),
814 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530815 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700816 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700817 .micbias = {
818 .ldoh_v = TABLA_LDOH_2P85_V,
819 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700820 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700821 .cfilt3_mv = 1800,
822 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
823 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
824 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
825 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530826 },
827 .regulator = {
828 {
829 .name = "CDC_VDD_CP",
830 .min_uV = 1800000,
831 .max_uV = 1800000,
832 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
833 },
834 {
835 .name = "CDC_VDDA_RX",
836 .min_uV = 1800000,
837 .max_uV = 1800000,
838 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
839 },
840 {
841 .name = "CDC_VDDA_TX",
842 .min_uV = 1800000,
843 .max_uV = 1800000,
844 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
845 },
846 {
847 .name = "VDDIO_CDC",
848 .min_uV = 1800000,
849 .max_uV = 1800000,
850 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
851 },
852 {
853 .name = "VDDD_CDC_D",
854 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700855 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530856 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
857 },
858 {
859 .name = "CDC_VDDA_A_1P2V",
860 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700861 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530862 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
863 },
864 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700865};
866
867static struct slim_device msm_slim_tabla = {
868 .name = "tabla-slim",
869 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
870 .dev = {
871 .platform_data = &tabla_platform_data,
872 },
873};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530874
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530875static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530876 .slimbus_slave_device = {
877 .name = "tabla-slave",
878 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
879 },
880 .irq = MSM_GPIO_TO_INT(62),
881 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530882 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530883 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
884 .micbias = {
885 .ldoh_v = TABLA_LDOH_2P85_V,
886 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700887 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530888 .cfilt3_mv = 1800,
889 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
890 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
891 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
892 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530893 },
894 .regulator = {
895 {
896 .name = "CDC_VDD_CP",
897 .min_uV = 1800000,
898 .max_uV = 1800000,
899 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
900 },
901 {
902 .name = "CDC_VDDA_RX",
903 .min_uV = 1800000,
904 .max_uV = 1800000,
905 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
906 },
907 {
908 .name = "CDC_VDDA_TX",
909 .min_uV = 1800000,
910 .max_uV = 1800000,
911 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
912 },
913 {
914 .name = "VDDIO_CDC",
915 .min_uV = 1800000,
916 .max_uV = 1800000,
917 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
918 },
919 {
920 .name = "VDDD_CDC_D",
921 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700922 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530923 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
924 },
925 {
926 .name = "CDC_VDDA_A_1P2V",
927 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700928 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530929 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
930 },
931 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530932};
933
934static struct slim_device msm_slim_tabla20 = {
935 .name = "tabla2x-slim",
936 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
937 .dev = {
938 .platform_data = &tabla20_platform_data,
939 },
940};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700941#endif
942
943static struct slim_boardinfo msm_slim_devices[] = {
944#ifdef CONFIG_WCD9310_CODEC
945 {
946 .bus_num = 1,
947 .slim_slave = &msm_slim_tabla,
948 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530949 {
950 .bus_num = 1,
951 .slim_slave = &msm_slim_tabla20,
952 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700953#endif
954 /* add more slimbus slaves as needed */
955};
956
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700957#define MSM_WCNSS_PHYS 0x03000000
958#define MSM_WCNSS_SIZE 0x280000
959
960static struct resource resources_wcnss_wlan[] = {
961 {
962 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
963 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
964 .name = "wcnss_wlanrx_irq",
965 .flags = IORESOURCE_IRQ,
966 },
967 {
968 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
969 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
970 .name = "wcnss_wlantx_irq",
971 .flags = IORESOURCE_IRQ,
972 },
973 {
974 .start = MSM_WCNSS_PHYS,
975 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
976 .name = "wcnss_mmio",
977 .flags = IORESOURCE_MEM,
978 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700979 {
980 .start = 84,
981 .end = 88,
982 .name = "wcnss_gpios_5wire",
983 .flags = IORESOURCE_IO,
984 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700985};
986
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700987static struct qcom_wcnss_opts qcom_wcnss_pdata = {
988 .has_48mhz_xo = 1,
989};
990
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700991static struct platform_device msm_device_wcnss_wlan = {
992 .name = "wcnss_wlan",
993 .id = 0,
994 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
995 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700996 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700997};
998
Ramesh Masavarapua26cce72012-04-09 12:32:25 -0700999#ifdef CONFIG_QSEECOM
1000/* qseecom bus scaling */
1001static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1002 {
1003 .src = MSM_BUS_MASTER_SPS,
1004 .dst = MSM_BUS_SLAVE_EBI_CH0,
1005 .ib = 0,
1006 .ab = 0,
1007 },
1008 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001009 .src = MSM_BUS_MASTER_SPS,
1010 .dst = MSM_BUS_SLAVE_SPS,
1011 .ib = 0,
1012 .ab = 0,
1013 },
1014 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001015 .src = MSM_BUS_MASTER_SPDM,
1016 .dst = MSM_BUS_SLAVE_SPDM,
1017 .ib = 0,
1018 .ab = 0,
1019 },
1020};
1021
1022static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1023 {
1024 .src = MSM_BUS_MASTER_SPS,
1025 .dst = MSM_BUS_SLAVE_EBI_CH0,
1026 .ib = (492 * 8) * 1000000UL,
1027 .ab = (492 * 8) * 100000UL,
1028 },
1029 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001030 .src = MSM_BUS_MASTER_SPS,
1031 .dst = MSM_BUS_SLAVE_SPS,
1032 .ib = (492 * 8) * 1000000UL,
1033 .ab = (492 * 8) * 100000UL,
1034 },
1035 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001036 .src = MSM_BUS_MASTER_SPDM,
1037 .dst = MSM_BUS_SLAVE_SPDM,
1038 .ib = 0,
1039 .ab = 0,
1040 },
1041};
1042
1043static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1044 {
1045 .src = MSM_BUS_MASTER_SPS,
1046 .dst = MSM_BUS_SLAVE_EBI_CH0,
1047 .ib = 0,
1048 .ab = 0,
1049 },
1050 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001051 .src = MSM_BUS_MASTER_SPS,
1052 .dst = MSM_BUS_SLAVE_SPS,
1053 .ib = 0,
1054 .ab = 0,
1055 },
1056 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001057 .src = MSM_BUS_MASTER_SPDM,
1058 .dst = MSM_BUS_SLAVE_SPDM,
1059 .ib = (64 * 8) * 1000000UL,
1060 .ab = (64 * 8) * 100000UL,
1061 },
1062};
1063
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001064static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1065 {
1066 .src = MSM_BUS_MASTER_SPS,
1067 .dst = MSM_BUS_SLAVE_EBI_CH0,
1068 .ib = (492 * 8) * 1000000UL,
1069 .ab = (492 * 8) * 100000UL,
1070 },
1071 {
1072 .src = MSM_BUS_MASTER_SPS,
1073 .dst = MSM_BUS_SLAVE_SPS,
1074 .ib = (492 * 8) * 1000000UL,
1075 .ab = (492 * 8) * 100000UL,
1076 },
1077 {
1078 .src = MSM_BUS_MASTER_SPDM,
1079 .dst = MSM_BUS_SLAVE_SPDM,
1080 .ib = (64 * 8) * 1000000UL,
1081 .ab = (64 * 8) * 100000UL,
1082 },
1083};
1084
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001085static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1086 {
1087 ARRAY_SIZE(qseecom_clks_init_vectors),
1088 qseecom_clks_init_vectors,
1089 },
1090 {
1091 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001092 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001093 },
1094 {
1095 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1096 qseecom_enable_sfpb_vectors,
1097 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001098 {
1099 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1100 qseecom_enable_dfab_sfpb_vectors,
1101 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001102};
1103
1104static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1105 qseecom_hw_bus_scale_usecases,
1106 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1107 .name = "qsee",
1108};
1109
1110static struct platform_device qseecom_device = {
1111 .name = "qseecom",
1112 .id = 0,
1113 .dev = {
1114 .platform_data = &qseecom_bus_pdata,
1115 },
1116};
1117#endif
1118
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001119#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1120 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1121 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1122 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1123
1124#define QCE_SIZE 0x10000
1125#define QCE_0_BASE 0x18500000
1126
1127#define QCE_HW_KEY_SUPPORT 0
1128#define QCE_SHA_HMAC_SUPPORT 1
1129#define QCE_SHARE_CE_RESOURCE 1
1130#define QCE_CE_SHARED 0
1131
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001132/* Begin Bus scaling definitions */
1133static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1134 {
1135 .src = MSM_BUS_MASTER_ADM_PORT0,
1136 .dst = MSM_BUS_SLAVE_EBI_CH0,
1137 .ab = 0,
1138 .ib = 0,
1139 },
1140 {
1141 .src = MSM_BUS_MASTER_ADM_PORT1,
1142 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1143 .ab = 0,
1144 .ib = 0,
1145 },
1146};
1147
1148static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1149 {
1150 .src = MSM_BUS_MASTER_ADM_PORT0,
1151 .dst = MSM_BUS_SLAVE_EBI_CH0,
1152 .ab = 70000000UL,
1153 .ib = 70000000UL,
1154 },
1155 {
1156 .src = MSM_BUS_MASTER_ADM_PORT1,
1157 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1158 .ab = 2480000000UL,
1159 .ib = 2480000000UL,
1160 },
1161};
1162
1163static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1164 {
1165 ARRAY_SIZE(crypto_hw_init_vectors),
1166 crypto_hw_init_vectors,
1167 },
1168 {
1169 ARRAY_SIZE(crypto_hw_active_vectors),
1170 crypto_hw_active_vectors,
1171 },
1172};
1173
1174static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1175 crypto_hw_bus_scale_usecases,
1176 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1177 .name = "cryptohw",
1178};
1179/* End Bus Scaling Definitions*/
1180
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001181static struct resource qcrypto_resources[] = {
1182 [0] = {
1183 .start = QCE_0_BASE,
1184 .end = QCE_0_BASE + QCE_SIZE - 1,
1185 .flags = IORESOURCE_MEM,
1186 },
1187 [1] = {
1188 .name = "crypto_channels",
1189 .start = DMOV_CE_IN_CHAN,
1190 .end = DMOV_CE_OUT_CHAN,
1191 .flags = IORESOURCE_DMA,
1192 },
1193 [2] = {
1194 .name = "crypto_crci_in",
1195 .start = DMOV_CE_IN_CRCI,
1196 .end = DMOV_CE_IN_CRCI,
1197 .flags = IORESOURCE_DMA,
1198 },
1199 [3] = {
1200 .name = "crypto_crci_out",
1201 .start = DMOV_CE_OUT_CRCI,
1202 .end = DMOV_CE_OUT_CRCI,
1203 .flags = IORESOURCE_DMA,
1204 },
1205};
1206
1207static struct resource qcedev_resources[] = {
1208 [0] = {
1209 .start = QCE_0_BASE,
1210 .end = QCE_0_BASE + QCE_SIZE - 1,
1211 .flags = IORESOURCE_MEM,
1212 },
1213 [1] = {
1214 .name = "crypto_channels",
1215 .start = DMOV_CE_IN_CHAN,
1216 .end = DMOV_CE_OUT_CHAN,
1217 .flags = IORESOURCE_DMA,
1218 },
1219 [2] = {
1220 .name = "crypto_crci_in",
1221 .start = DMOV_CE_IN_CRCI,
1222 .end = DMOV_CE_IN_CRCI,
1223 .flags = IORESOURCE_DMA,
1224 },
1225 [3] = {
1226 .name = "crypto_crci_out",
1227 .start = DMOV_CE_OUT_CRCI,
1228 .end = DMOV_CE_OUT_CRCI,
1229 .flags = IORESOURCE_DMA,
1230 },
1231};
1232
1233#endif
1234
1235#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1236 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1237
1238static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1239 .ce_shared = QCE_CE_SHARED,
1240 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1241 .hw_key_support = QCE_HW_KEY_SUPPORT,
1242 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001243 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001244};
1245
1246static struct platform_device qcrypto_device = {
1247 .name = "qcrypto",
1248 .id = 0,
1249 .num_resources = ARRAY_SIZE(qcrypto_resources),
1250 .resource = qcrypto_resources,
1251 .dev = {
1252 .coherent_dma_mask = DMA_BIT_MASK(32),
1253 .platform_data = &qcrypto_ce_hw_suppport,
1254 },
1255};
1256#endif
1257
1258#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1259 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1260
1261static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1262 .ce_shared = QCE_CE_SHARED,
1263 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1264 .hw_key_support = QCE_HW_KEY_SUPPORT,
1265 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001266 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001267};
1268
1269static struct platform_device qcedev_device = {
1270 .name = "qce",
1271 .id = 0,
1272 .num_resources = ARRAY_SIZE(qcedev_resources),
1273 .resource = qcedev_resources,
1274 .dev = {
1275 .coherent_dma_mask = DMA_BIT_MASK(32),
1276 .platform_data = &qcedev_ce_hw_suppport,
1277 },
1278};
1279#endif
1280
Joel King0cbf5d82012-05-24 15:21:38 -07001281static struct mdm_platform_data sglte_platform_data = {
1282 .mdm_version = "4.0",
1283 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001284 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001285 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001286 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001287 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001288 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001289};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001290
Joel Nider266a2642011-10-16 10:58:05 +02001291#define MSM_TSIF0_PHYS (0x18200000)
1292#define MSM_TSIF1_PHYS (0x18201000)
1293#define MSM_TSIF_SIZE (0x200)
1294#define MSM_TSPP_PHYS (0x18202000)
1295#define MSM_TSPP_SIZE (0x1000)
1296#define MSM_TSPP_BAM_PHYS (0x18204000)
1297#define MSM_TSPP_BAM_SIZE (0x2000)
1298
1299#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1300 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1301#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1302 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1303#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1304 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1305#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1306 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1307#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1308 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1309#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1310 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1311#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1312 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1313#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1314 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1315
1316static const struct msm_gpio tsif_gpios[] = {
1317 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1318 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1319 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1320 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1321 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1322 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1323 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1324 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1325};
1326
1327static struct resource tspp_resources[] = {
1328 [0] = {
1329 .flags = IORESOURCE_IRQ,
1330 .start = TSIF_TSPP_IRQ,
1331 .end = TSIF1_IRQ,
1332 },
1333 [1] = {
1334 .flags = IORESOURCE_MEM,
1335 .start = MSM_TSIF0_PHYS,
1336 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1337 },
1338 [2] = {
1339 .flags = IORESOURCE_MEM,
1340 .start = MSM_TSIF1_PHYS,
1341 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1342 },
1343 [3] = {
1344 .flags = IORESOURCE_MEM,
1345 .start = MSM_TSPP_PHYS,
1346 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1347 },
1348 [4] = {
1349 .flags = IORESOURCE_MEM,
1350 .start = MSM_TSPP_BAM_PHYS,
1351 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1352 },
1353};
1354
1355static struct msm_tspp_platform_data tspp_platform_data = {
1356 .num_gpios = ARRAY_SIZE(tsif_gpios),
1357 .gpios = tsif_gpios,
1358 .tsif_pclk = "tsif_pclk",
1359 .tsif_ref_clk = "tsif_ref_clk",
1360};
1361
1362static struct platform_device msm_device_tspp = {
1363 .name = "msm_tspp",
1364 .id = 0,
1365 .num_resources = ARRAY_SIZE(tspp_resources),
1366 .resource = tspp_resources,
1367 .dev = {
1368 .platform_data = &tspp_platform_data
1369 },
1370};
1371
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001372#define MSM_SHARED_RAM_PHYS 0x80000000
1373
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001374static void __init msm8960_map_io(void)
1375{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001376 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001377 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001378
1379 if (socinfo_init() < 0)
1380 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001381}
1382
1383static void __init msm8960_init_irq(void)
1384{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001385 struct msm_mpm_device_data *data = NULL;
1386
1387#ifdef CONFIG_MSM_MPM
1388 data = &msm8960_mpm_dev_data;
1389#endif
1390
1391 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001392 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001393 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001394}
1395
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001396static void __init msm8960_init_buses(void)
1397{
1398#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001399 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001400 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1401 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001402 msm_bus_apps_fabric.dev.platform_data =
1403 &msm_bus_8960_apps_fabric_pdata;
1404 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001405 if (cpu_is_msm8960ab()) {
1406 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1407 msm_bus_mm_fabric.dev.platform_data =
1408 &msm_bus_8960_sg_mm_fabric_pdata;
1409 } else {
1410 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1411 msm_bus_mm_fabric.dev.platform_data =
1412 &msm_bus_8960_mm_fabric_pdata;
1413 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001414 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1415 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001416#endif
1417}
1418
1419static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1420 .max_clock_speed = 15060000,
Kiran Gundac5fbd7f2012-07-30 13:22:39 +05301421 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001422};
1423
1424#ifdef CONFIG_USB_MSM_OTG_72K
1425static struct msm_otg_platform_data msm_otg_pdata;
1426#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301427static int wr_phy_init_seq[] = {
1428 0x44, 0x80, /* set VBUS valid threshold
1429 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301430 0x68, 0x81, /* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301431 0x14, 0x82, /* set preemphasis and rise/fall time */
1432 0x13, 0x83, /* set source impedance adjusment */
1433 -1};
1434
1435static int liquid_v1_phy_init_seq[] = {
1436 0x44, 0x80,/* set VBUS valid threshold
1437 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301438 0x6C, 0x81,/* update DC voltage level */
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301439 0x18, 0x82,/* set preemphasis and rise/fall time */
1440 0x23, 0x83,/* set source impedance sdjusment */
1441 -1};
1442
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301443static int sglte_phy_init_seq[] = {
1444 0x44, 0x80, /* set VBUS valid threshold
1445 and disconnect valid threshold */
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +05301446 0x6A, 0x81, /* update DC voltage level */
Mayank Ranaa61da7a2012-08-14 10:57:00 +05301447 0x24, 0x82, /* set preemphasis and rise/fall time */
1448 0x13, 0x83, /* set source impedance adjusment */
1449 -1};
1450
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301451#ifdef CONFIG_MSM_BUS_SCALING
1452/* Bandwidth requests (zero) if no vote placed */
1453static struct msm_bus_vectors usb_init_vectors[] = {
1454 {
1455 .src = MSM_BUS_MASTER_SPS,
1456 .dst = MSM_BUS_SLAVE_EBI_CH0,
1457 .ab = 0,
1458 .ib = 0,
1459 },
1460};
1461
1462/* Bus bandwidth requests in Bytes/sec */
1463static struct msm_bus_vectors usb_max_vectors[] = {
1464 {
1465 .src = MSM_BUS_MASTER_SPS,
1466 .dst = MSM_BUS_SLAVE_EBI_CH0,
1467 .ab = 60000000, /* At least 480Mbps on bus. */
1468 .ib = 960000000, /* MAX bursts rate */
1469 },
1470};
1471
1472static struct msm_bus_paths usb_bus_scale_usecases[] = {
1473 {
1474 ARRAY_SIZE(usb_init_vectors),
1475 usb_init_vectors,
1476 },
1477 {
1478 ARRAY_SIZE(usb_max_vectors),
1479 usb_max_vectors,
1480 },
1481};
1482
1483static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1484 usb_bus_scale_usecases,
1485 ARRAY_SIZE(usb_bus_scale_usecases),
1486 .name = "usb",
1487};
1488#endif
1489
Jack Pham87f202f2012-08-06 00:24:22 -07001490#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1491
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001492static struct msm_otg_platform_data msm_otg_pdata = {
1493 .mode = USB_OTG,
1494 .otg_control = OTG_PMIC_CONTROL,
1495 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001496 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301497 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301498#ifdef CONFIG_MSM_BUS_SCALING
1499 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001500 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301501#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301502#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1503 .mhl_dev_name = "sii8334",
1504#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001505};
1506#endif
1507
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301508#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301509#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301510static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1511 .strobe = 150,
1512 .data = 151,
1513};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301514
1515static struct smsc_hub_platform_data hsic_hub_pdata = {
1516 .hub_reset = HSIC_HUB_RESET_GPIO,
1517};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301518#else
1519static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301520static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301521#endif
1522
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301523static struct platform_device smsc_hub_device = {
1524 .name = "msm_smsc_hub",
1525 .id = -1,
1526 .dev = {
1527 .platform_data = &hsic_hub_pdata,
1528 },
1529};
1530
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001531#define PID_MAGIC_ID 0x71432909
1532#define SERIAL_NUM_MAGIC_ID 0x61945374
1533#define SERIAL_NUMBER_LENGTH 127
1534#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1535
1536struct magic_num_struct {
1537 uint32_t pid;
1538 uint32_t serial_num;
1539};
1540
1541struct dload_struct {
1542 uint32_t reserved1;
1543 uint32_t reserved2;
1544 uint32_t reserved3;
1545 uint16_t reserved4;
1546 uint16_t pid;
1547 char serial_number[SERIAL_NUMBER_LENGTH];
1548 uint16_t reserved5;
1549 struct magic_num_struct magic_struct;
1550};
1551
1552static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1553{
1554 struct dload_struct __iomem *dload = 0;
1555
1556 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1557 if (!dload) {
1558 pr_err("%s: cannot remap I/O memory region: %08x\n",
1559 __func__, DLOAD_USB_BASE_ADD);
1560 return -ENXIO;
1561 }
1562
1563 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1564 __func__, dload, pid, snum);
1565 /* update pid */
1566 dload->magic_struct.pid = PID_MAGIC_ID;
1567 dload->pid = pid;
1568
1569 /* update serial number */
1570 dload->magic_struct.serial_num = 0;
1571 if (!snum) {
1572 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1573 goto out;
1574 }
1575
1576 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001577 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001578out:
1579 iounmap(dload);
1580 return 0;
1581}
1582
1583static struct android_usb_platform_data android_usb_pdata = {
1584 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1585};
1586
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001587static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001588 .name = "android_usb",
1589 .id = -1,
1590 .dev = {
1591 .platform_data = &android_usb_pdata,
1592 },
1593};
1594
1595static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1596 0x03, 0x0f,
1597};
1598
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001599static uint8_t spm_retention_cmd_sequence[] __initdata = {
1600 0x00, 0x05, 0x03, 0x0D,
1601 0x0B, 0x00, 0x0f,
1602};
1603
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001604static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1605 0x00, 0x24, 0x54, 0x10,
1606 0x09, 0x03, 0x01,
1607 0x10, 0x54, 0x30, 0x0C,
1608 0x24, 0x30, 0x0f,
1609};
1610
1611static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1612 0x00, 0x24, 0x54, 0x10,
1613 0x09, 0x07, 0x01, 0x0B,
1614 0x10, 0x54, 0x30, 0x0C,
1615 0x24, 0x30, 0x0f,
1616};
1617
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001618static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
1619 [0] = {
1620 .mode = MSM_SPM_MODE_CLOCK_GATING,
1621 .notify_rpm = false,
1622 .cmd = spm_wfi_cmd_sequence,
1623 },
1624
1625 [1] = {
1626 .mode = MSM_SPM_MODE_POWER_RETENTION,
1627 .notify_rpm = false,
1628 .cmd = spm_retention_cmd_sequence,
1629 },
1630
1631 [2] = {
1632 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1633 .notify_rpm = false,
1634 .cmd = spm_power_collapse_without_rpm,
1635 },
1636 [3] = {
1637 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1638 .notify_rpm = true,
1639 .cmd = spm_power_collapse_with_rpm,
1640 },
1641};
1642
1643static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001644 [0] = {
1645 .mode = MSM_SPM_MODE_CLOCK_GATING,
1646 .notify_rpm = false,
1647 .cmd = spm_wfi_cmd_sequence,
1648 },
1649 [1] = {
1650 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1651 .notify_rpm = false,
1652 .cmd = spm_power_collapse_without_rpm,
1653 },
1654 [2] = {
1655 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1656 .notify_rpm = true,
1657 .cmd = spm_power_collapse_with_rpm,
1658 },
1659};
1660
1661static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1662 [0] = {
1663 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001664 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001665#if defined(CONFIG_MSM_AVS_HW)
Praveen Chidambaram631f2822012-03-16 12:08:42 -06001666 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x50589464,
1667 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001668#endif
1669 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001670 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
1671 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
1672 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001673 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001674 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
1675 .modes = msm_spm_boot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001676 },
1677 [1] = {
1678 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001679 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001680#if defined(CONFIG_MSM_AVS_HW)
Praveen Chidambaram631f2822012-03-16 12:08:42 -06001681 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x50589464,
1682 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683#endif
1684 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001685 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001686 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1687 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1688 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06001689 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
1690 .modes = msm_spm_nonboot_cpu_seq_list,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001691 },
1692};
1693
1694static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1695 0x00, 0x20, 0x03, 0x20,
1696 0x00, 0x0f,
1697};
1698
1699static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1700 0x00, 0x20, 0x34, 0x64,
1701 0x48, 0x07, 0x48, 0x20,
1702 0x50, 0x64, 0x04, 0x34,
1703 0x50, 0x0f,
1704};
1705static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1706 0x00, 0x10, 0x34, 0x64,
1707 0x48, 0x07, 0x48, 0x10,
1708 0x50, 0x64, 0x04, 0x34,
1709 0x50, 0x0F,
1710};
1711
1712static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1713 [0] = {
1714 .mode = MSM_SPM_L2_MODE_RETENTION,
1715 .notify_rpm = false,
1716 .cmd = l2_spm_wfi_cmd_sequence,
1717 },
1718 [1] = {
1719 .mode = MSM_SPM_L2_MODE_GDHS,
1720 .notify_rpm = true,
1721 .cmd = l2_spm_gdhs_cmd_sequence,
1722 },
1723 [2] = {
1724 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1725 .notify_rpm = true,
1726 .cmd = l2_spm_power_off_cmd_sequence,
1727 },
1728};
1729
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001730static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1731 [0] = {
1732 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001733 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001734 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001735 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1736 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1737 .modes = msm_spm_l2_seq_list,
1738 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1739 },
1740};
1741
Anirudh Ghayal15698162012-07-31 11:51:32 +05301742#define HAP_SHIFT_LVL_OE_GPIO 47
1743#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301744#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1745#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1746
1747static struct msm_xo_voter *xo_handle_d1;
1748
1749static int isa1200_power(int on)
1750{
1751 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301752 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301753
Anirudh Ghayal15698162012-07-31 11:51:32 +05301754 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1755 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1756
1757
1758 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301759
1760 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1761 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1762 if (rc < 0) {
1763 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1764 __func__, on ? "" : "de-", rc);
1765 goto err_xo_vote;
1766 }
1767
1768 return 0;
1769
1770err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301771 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301772 return rc;
1773}
1774
1775static int isa1200_dev_setup(bool enable)
1776{
1777 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301778 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301779
1780 struct pm_gpio hap_gpio_config = {
1781 .direction = PM_GPIO_DIR_OUT,
1782 .pull = PM_GPIO_PULL_NO,
1783 .out_strength = PM_GPIO_STRENGTH_HIGH,
1784 .function = PM_GPIO_FUNC_NORMAL,
1785 .inv_int_pol = 0,
1786 .vin_sel = 2,
1787 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1788 .output_value = 0,
1789 };
1790
Anirudh Ghayal15698162012-07-31 11:51:32 +05301791 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1792 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1793
Mohan Pallaka5e490392011-09-09 15:18:41 +05301794 if (enable == true) {
1795 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1796 if (rc) {
1797 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1798 __func__, PM_HAP_EN_GPIO, rc);
1799 return rc;
1800 }
1801
1802 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1803 if (rc) {
1804 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1805 __func__, PM_HAP_LEN_GPIO, rc);
1806 return rc;
1807 }
1808
Anirudh Ghayal15698162012-07-31 11:51:32 +05301809 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301810 if (rc) {
1811 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301812 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301813 return rc;
1814 }
1815
Anirudh Ghayal15698162012-07-31 11:51:32 +05301816 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301817 if (rc) {
1818 pr_err("%s: Unable to set direction\n", __func__);
1819 goto free_gpio;
1820 }
1821
1822 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1823 if (IS_ERR(xo_handle_d1)) {
1824 rc = PTR_ERR(xo_handle_d1);
1825 pr_err("%s: failed to get the handle for D1(%d)\n",
1826 __func__, rc);
1827 goto gpio_set_dir;
1828 }
1829 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301830 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301831
1832 msm_xo_put(xo_handle_d1);
1833 }
1834
1835 return 0;
1836
1837gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301838 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301839free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301840 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301841 return rc;
1842}
1843
1844static struct isa1200_regulator isa1200_reg_data[] = {
1845 {
1846 .name = "vcc_i2c",
1847 .min_uV = ISA_I2C_VTG_MIN_UV,
1848 .max_uV = ISA_I2C_VTG_MAX_UV,
1849 .load_uA = ISA_I2C_CURR_UA,
1850 },
1851};
1852
1853static struct isa1200_platform_data isa1200_1_pdata = {
1854 .name = "vibrator",
1855 .dev_setup = isa1200_dev_setup,
1856 .power_on = isa1200_power,
1857 .hap_en_gpio = PM_HAP_EN_GPIO,
1858 .hap_len_gpio = PM_HAP_LEN_GPIO,
1859 .max_timeout = 15000,
1860 .mode_ctrl = PWM_GEN_MODE,
1861 .pwm_fd = {
1862 .pwm_div = 256,
1863 },
1864 .is_erm = false,
1865 .smart_en = true,
1866 .ext_clk_en = true,
1867 .chip_en = 1,
1868 .regulator_info = isa1200_reg_data,
1869 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1870};
1871
1872static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1873 {
1874 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301875 },
1876};
1877
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001878#define CYTTSP_TS_GPIO_IRQ 11
1879#define CYTTSP_TS_SLEEP_GPIO 50
1880#define CYTTSP_TS_RESOUT_N_GPIO 52
1881
1882/*virtual key support */
1883static ssize_t tma340_vkeys_show(struct kobject *kobj,
1884 struct kobj_attribute *attr, char *buf)
1885{
1886 return snprintf(buf, 200,
1887 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1888 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1889 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1890 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1891 "\n");
1892}
1893
1894static struct kobj_attribute tma340_vkeys_attr = {
1895 .attr = {
1896 .mode = S_IRUGO,
1897 },
1898 .show = &tma340_vkeys_show,
1899};
1900
1901static struct attribute *tma340_properties_attrs[] = {
1902 &tma340_vkeys_attr.attr,
1903 NULL
1904};
1905
1906static struct attribute_group tma340_properties_attr_group = {
1907 .attrs = tma340_properties_attrs,
1908};
1909
1910
1911static int cyttsp_platform_init(struct i2c_client *client)
1912{
1913 int rc = 0;
1914 static struct kobject *tma340_properties_kobj;
1915
1916 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1917 tma340_properties_kobj = kobject_create_and_add("board_properties",
1918 NULL);
1919 if (tma340_properties_kobj)
1920 rc = sysfs_create_group(tma340_properties_kobj,
1921 &tma340_properties_attr_group);
1922 if (!tma340_properties_kobj || rc)
1923 pr_err("%s: failed to create board_properties\n",
1924 __func__);
1925
1926 return 0;
1927}
1928
1929static struct cyttsp_regulator regulator_data[] = {
1930 {
1931 .name = "vdd",
1932 .min_uV = CY_TMA300_VTG_MIN_UV,
1933 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301934 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1935 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001936 },
1937 /* TODO: Remove after runtime PM is enabled in I2C driver */
1938 {
1939 .name = "vcc_i2c",
1940 .min_uV = CY_I2C_VTG_MIN_UV,
1941 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301942 .hpm_load_uA = CY_I2C_CURR_UA,
1943 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001944 },
1945};
1946
1947static struct cyttsp_platform_data cyttsp_pdata = {
1948 .panel_maxx = 634,
1949 .panel_maxy = 1166,
1950 .disp_maxx = 616,
1951 .disp_maxy = 1023,
1952 .disp_minx = 0,
1953 .disp_miny = 16,
1954 .flags = 0x01,
1955 .gen = CY_GEN3, /* or */
1956 .use_st = CY_USE_ST,
1957 .use_mt = CY_USE_MT,
1958 .use_hndshk = CY_SEND_HNDSHK,
1959 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301960 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961 .use_gestures = CY_USE_GESTURES,
1962 .fw_fname = "cyttsp_8960_cdp.hex",
1963 /* activate up to 4 groups
1964 * and set active distance
1965 */
1966 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1967 CY_GEST_GRP3 | CY_GEST_GRP4 |
1968 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07001969 .act_intrvl = 10,
1970 .tch_tmout = 200,
1971 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001972 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
1973 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
1974 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1975 .regulator_info = regulator_data,
1976 .num_regulators = ARRAY_SIZE(regulator_data),
1977 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05301978 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001979};
1980
1981static struct i2c_board_info cyttsp_info[] __initdata = {
1982 {
1983 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1984 .platform_data = &cyttsp_pdata,
1985#ifndef CY_USE_TIMER
1986 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1987#endif /* CY_USE_TIMER */
1988 },
1989};
1990
Jing Lindc4413c2012-01-16 15:22:52 -08001991/* configuration data for mxt1386 */
1992static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05301993 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07001994 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05301995 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08001996 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07001997 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1999 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2001 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2002 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302003 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002004 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302005 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002006 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302007 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002008 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2009 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2010 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2011 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302012 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002013 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2014 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302015 /* T18 Object */
2016 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302017 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002018 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2019 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302020 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002021 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2022 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302023 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002024 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2025 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302026 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002027 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302028 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002029 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302030 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002031 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302032 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002033 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302034 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002035 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302036};
2037
Jing Lin33b007d2011-12-21 17:40:23 -08002038/* configuration data for mxt1386e using V1.0 firmware */
2039static const u8 mxt1386e_config_data_v1_0[] = {
2040 /* T6 Object */
2041 0, 0, 0, 0, 0, 0,
2042 /* T38 Object */
2043 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2044 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2045 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2046 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2047 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2048 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2049 0, 0, 0, 0,
2050 /* T7 Object */
2051 100, 16, 50,
2052 /* T8 Object */
2053 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2054 /* T9 Object */
2055 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2056 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2057 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2058 10, 5, 0, 0, 0,
2059 /* T18 Object */
2060 0, 0,
2061 /* T24 Object */
2062 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2063 0, 0, 0, 0, 0, 0, 0, 0, 0,
2064 /* T25 Object */
2065 3, 0, 60, 115, 156, 99,
2066 /* T27 Object */
2067 0, 0, 0, 0, 0, 0, 0,
2068 /* T40 Object */
2069 0, 0, 0, 0, 0,
2070 /* T42 Object */
2071 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2072 /* T43 Object */
2073 0, 0, 0, 0, 0, 0, 0,
2074 /* T46 Object */
2075 64, 0, 20, 20, 0, 0, 0, 0, 0,
2076 /* T47 Object */
2077 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2078 /* T48 Object */
2079 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2080 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2081 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2082 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2083 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2084 0, 0, 0, 0,
2085 /* T56 Object */
2086 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2087 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2088 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2089 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2090 2, 99, 33,
2091};
2092
2093/* configuration data for mxt1386e using V2.1 firmware */
2094static const u8 mxt1386e_config_data_v2_1[] = {
2095 /* T6 Object */
2096 0, 0, 0, 0, 0, 0,
2097 /* T38 Object */
Jing Lin4a8a3e42012-09-12 10:08:22 -07002098 12, 5, 0, 28, 8, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002099 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, 0, 0, 0, 0, 0, 0,
2102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2104 0, 0, 0, 0,
2105 /* T7 Object */
Jing Lin4a8a3e42012-09-12 10:08:22 -07002106 32, 16, 50,
Jing Lin33b007d2011-12-21 17:40:23 -08002107 /* T8 Object */
2108 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2109 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002110 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002111 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002112 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2113 10, 5, 0, 0, 0,
2114 /* T18 Object */
2115 0, 0,
2116 /* T24 Object */
2117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2118 0, 0, 0, 0, 0, 0, 0, 0, 0,
2119 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002120 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002121 /* T27 Object */
2122 0, 0, 0, 0, 0, 0, 0,
2123 /* T40 Object */
2124 0, 0, 0, 0, 0,
2125 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002126 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002127 /* T43 Object */
2128 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2129 16,
2130 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002131 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002132 /* T47 Object */
2133 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2134 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002135 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002136 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2137 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2138 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2139 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2140 0, 0, 0, 0,
2141 /* T56 Object */
2142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2146 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2147 255,
2148};
2149
Jing Lineec88ca2012-02-08 11:18:30 -08002150/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2151static const u8 mxt1386e_config_data_3d[] = {
2152 /* T6 Object */
2153 0, 0, 0, 0, 0, 0,
2154 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002155 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002156 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2157 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2158 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2161 0, 0, 0, 0,
2162 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002163 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002164 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002165 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002166 /* T9 Object */
2167 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2168 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002169 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2170 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002171 /* T18 Object */
2172 0, 0,
2173 /* T24 Object */
2174 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2175 0, 0, 0, 0, 0, 0, 0, 0, 0,
2176 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002177 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002178 /* T27 Object */
2179 0, 0, 0, 0, 0, 0, 0,
2180 /* T40 Object */
2181 0, 0, 0, 0, 0,
2182 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002183 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002184 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2186 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002187 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002188 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002189 /* T47 Object */
2190 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2191 /* T48 Object */
2192 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002193 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2194 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2195 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002196 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2197 0, 0, 0, 0,
2198 /* T56 Object */
2199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2200 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2201 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2202 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002203 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2204 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002205};
2206
Amy Maloche08266db2011-11-04 11:07:16 -07002207#define MXT_TS_GPIO_IRQ 11
2208#define MXT_TS_LDO_EN_GPIO 50
2209#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302210
2211static void mxt_init_hw_liquid(void)
2212{
2213 int rc;
2214
Mohan Pallaka50837382011-09-07 11:00:57 +05302215 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2216 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002217 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2218 __func__, MXT_TS_LDO_EN_GPIO);
2219 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302220 }
2221
2222 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2223 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002224 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2225 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302226 goto err_ldo_gpio_req;
2227 }
2228
Mohan Pallaka50837382011-09-07 11:00:57 +05302229 return;
2230
Mohan Pallaka50837382011-09-07 11:00:57 +05302231err_ldo_gpio_req:
2232 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302233}
2234
Jing Lineec88ca2012-02-08 11:18:30 -08002235static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002236 {
2237 .config = mxt1386_config_data,
2238 .config_length = ARRAY_SIZE(mxt1386_config_data),
2239 .family_id = 0xA0,
2240 .variant_id = 0x0,
2241 .version = 0x10,
2242 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002243 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002244 },
Jing Lin33b007d2011-12-21 17:40:23 -08002245 {
2246 .config = mxt1386e_config_data_v1_0,
2247 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2248 .family_id = 0xA0,
2249 .variant_id = 0x2,
2250 .version = 0x10,
2251 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002252 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002253 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002254 },
2255 {
2256 .config = mxt1386e_config_data_v2_1,
2257 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2258 .family_id = 0xA0,
2259 .variant_id = 0x7,
2260 .version = 0x21,
2261 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002262 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002263 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2264 },
2265 {
2266 /* The config data for V2.2.AA is the same as for V2.1.AA */
2267 .config = mxt1386e_config_data_v2_1,
2268 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2269 .family_id = 0xA0,
2270 .variant_id = 0x7,
2271 .version = 0x22,
2272 .build = 0xAA,
2273 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002274 },
Jing Lindc4413c2012-01-16 15:22:52 -08002275};
2276
Jing Lineec88ca2012-02-08 11:18:30 -08002277static struct mxt_platform_data mxt_platform_data_2d = {
2278 .config_array = mxt_config_array_2d,
2279 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002280 .panel_minx = 0,
2281 .panel_maxx = 1365,
2282 .panel_miny = 0,
2283 .panel_maxy = 767,
2284 .disp_minx = 0,
2285 .disp_maxx = 1365,
2286 .disp_miny = 0,
2287 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302288 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002289 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002290 .reset_gpio = MXT_TS_RESET_GPIO,
2291 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302292};
2293
Jing Lineec88ca2012-02-08 11:18:30 -08002294static struct mxt_config_info mxt_config_array_3d[] = {
2295 {
2296 .config = mxt1386e_config_data_3d,
2297 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2298 .family_id = 0xA0,
2299 .variant_id = 0x7,
2300 .version = 0x21,
2301 .build = 0xAA,
2302 },
2303};
2304
2305static struct mxt_platform_data mxt_platform_data_3d = {
2306 .config_array = mxt_config_array_3d,
2307 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002308 .panel_minx = 0,
2309 .panel_maxx = 1919,
2310 .panel_miny = 0,
2311 .panel_maxy = 1199,
2312 .disp_minx = 0,
2313 .disp_maxx = 1919,
2314 .disp_miny = 0,
2315 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002316 .irqflags = IRQF_TRIGGER_FALLING,
2317 .i2c_pull_up = true,
2318 .reset_gpio = MXT_TS_RESET_GPIO,
2319 .irq_gpio = MXT_TS_GPIO_IRQ,
2320};
2321
Mohan Pallaka50837382011-09-07 11:00:57 +05302322static struct i2c_board_info mxt_device_info[] __initdata = {
2323 {
2324 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302325 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2326 },
2327};
2328
Manoj Rao14648742012-03-30 19:42:12 -07002329static struct msm_mhl_platform_data mhl_platform_data = {
2330 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002331 .gpio_mhl_int = MHL_GPIO_INT,
2332 .gpio_mhl_reset = MHL_GPIO_RESET,
2333 .gpio_mhl_power = 0,
2334 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002335};
Manoj Rao14648742012-03-30 19:42:12 -07002336
Eugene Yasmand2316b82011-12-07 18:23:48 +02002337static struct i2c_board_info sii_device_info[] __initdata = {
2338 {
Manoj Rao14648742012-03-30 19:42:12 -07002339#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2340 /*
2341 * keeps SI 8334 as the default
2342 * MHL TX
2343 */
2344 I2C_BOARD_INFO("sii8334", 0x39),
2345 .platform_data = &mhl_platform_data,
2346#endif
2347#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002348 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002349 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002350#endif /* CONFIG_MSM_HDMI_MHL */
2351 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002352 },
2353};
2354
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002355static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2356 .clk_freq = 100000,
2357 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002358};
2359
2360static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2361 .clk_freq = 100000,
2362 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002363};
2364
2365static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2366 .clk_freq = 100000,
2367 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002368};
2369
2370static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2371 .clk_freq = 100000,
2372 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002373};
2374
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002375static struct ks8851_pdata spi_eth_pdata = {
2376 .irq_gpio = KS8851_IRQ_GPIO,
2377 .rst_gpio = KS8851_RST_GPIO,
2378};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002379
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302380static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002381 {
2382 .modalias = "ks8851",
2383 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2384 .max_speed_hz = 19200000,
2385 .bus_num = 0,
2386 .chip_select = 0,
2387 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002388 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002389 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302390};
2391static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002392 {
2393 .modalias = "dsi_novatek_3d_panel_spi",
2394 .max_speed_hz = 10800000,
2395 .bus_num = 0,
2396 .chip_select = 1,
2397 .mode = SPI_MODE_0,
2398 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002399};
2400
2401static struct platform_device msm_device_saw_core0 = {
2402 .name = "saw-regulator",
2403 .id = 0,
2404 .dev = {
2405 .platform_data = &msm_saw_regulator_pdata_s5,
2406 },
2407};
2408
2409static struct platform_device msm_device_saw_core1 = {
2410 .name = "saw-regulator",
2411 .id = 1,
2412 .dev = {
2413 .platform_data = &msm_saw_regulator_pdata_s6,
2414 },
2415};
2416
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002417static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002418 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002419 .tsens_factor = 1000,
2420 .hw_type = MSM_8960,
2421 .tsens_num_sensor = 5,
2422};
2423
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002424static struct platform_device msm_tsens_device = {
2425 .name = "tsens8960-tm",
2426 .id = -1,
2427};
2428
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002429static struct msm_thermal_data msm_thermal_pdata = {
2430 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002431 .poll_ms = 250,
2432 .limit_temp_degC = 60,
2433 .temp_hysteresis_degC = 10,
2434 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002435};
2436
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002437#ifdef CONFIG_MSM_FAKE_BATTERY
2438static struct platform_device fish_battery_device = {
2439 .name = "fish_battery",
2440};
2441#endif
2442
Binqiang Qiuf165c922012-08-15 18:00:18 -07002443#ifdef CONFIG_BATTERY_BCL
2444static struct platform_device battery_bcl_device = {
2445 .name = "battery_current_limit",
2446 .id = -1,
2447};
2448#endif
2449
David Collins26f05562011-06-20 09:56:28 -07002450static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002451 .name = GPIO_REGULATOR_DEV_NAME,
2452 .id = PM8921_MPP_PM_TO_SYS(7),
2453 .dev = {
2454 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2455 },
2456};
2457
David Collins26f05562011-06-20 09:56:28 -07002458static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002459 .name = GPIO_REGULATOR_DEV_NAME,
2460 .id = 91,
2461 .dev = {
2462 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2463 },
2464};
2465
David Collinsb10be1d2011-09-02 10:29:31 -07002466static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2467 .name = GPIO_REGULATOR_DEV_NAME,
2468 .id = PM8921_GPIO_PM_TO_SYS(17),
2469 .dev = {
2470 .platform_data =
2471 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2472 },
2473};
2474
David Collins35a78f52011-12-14 15:54:25 -08002475static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2476 .name = GPIO_REGULATOR_DEV_NAME,
2477 .id = PM8921_GPIO_PM_TO_SYS(42),
2478 .dev = {
2479 .platform_data =
2480 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2481 },
2482};
2483
David Collins26f05562011-06-20 09:56:28 -07002484static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2485 .name = "rpm-regulator",
2486 .id = -1,
2487 .dev = {
2488 .platform_data = &msm_rpm_regulator_pdata,
2489 },
2490};
Mayank Ranae009c922012-03-22 03:02:06 +05302491#ifdef CONFIG_SERIAL_MSM_HS
2492static int configure_uart_gpios(int on)
2493{
2494 int ret = 0, i;
2495 int uart_gpios[] = {93, 94, 95, 96};
2496
2497 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2498 if (on) {
2499 ret = gpio_request(uart_gpios[i], NULL);
2500 if (ret) {
2501 pr_err("%s: unable to request uart gpio[%d]\n",
2502 __func__, uart_gpios[i]);
2503 break;
2504 }
2505 } else {
2506 gpio_free(uart_gpios[i]);
2507 }
2508 }
2509
2510 if (ret && on && i)
2511 for (; i >= 0; i--)
2512 gpio_free(uart_gpios[i]);
2513 return ret;
2514}
2515
2516static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002517 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302518};
Mayank Rana1f02d952012-07-04 19:11:20 +05302519
2520static int configure_gsbi8_uart_gpios(int on)
2521{
2522 int ret = 0, i;
2523 int uart_gpios[] = {34, 35, 36, 37};
2524
2525 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2526 if (on) {
2527 ret = gpio_request(uart_gpios[i], NULL);
2528 if (ret) {
2529 pr_err("%s: unable to request uart gpio[%d]\n",
2530 __func__, uart_gpios[i]);
2531 break;
2532 }
2533 } else {
2534 gpio_free(uart_gpios[i]);
2535 }
2536 }
2537
2538 if (ret && on && i)
2539 for (; i >= 0; i--)
2540 gpio_free(uart_gpios[i]);
2541 return ret;
2542}
2543
2544static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2545 .gpio_config = configure_gsbi8_uart_gpios,
2546};
Mayank Ranae009c922012-03-22 03:02:06 +05302547#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302548static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302549static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2550#endif
David Collins26f05562011-06-20 09:56:28 -07002551
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302552#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin9baad172012-10-17 11:50:15 +08002553enum WLANBT_STATUS {
2554 WLANOFF_BTOFF = 1,
2555 WLANOFF_BTON,
2556 WLANON_BTOFF,
2557 WLANON_BTON
2558};
2559
2560static DEFINE_MUTEX(ath_wlanbt_mutex);
2561static int gpio_wlan_sys_rest_en = 26;
2562static int ath_wlanbt_status = WLANOFF_BTOFF;
2563
2564static int ath6kl_power_control(int on)
2565{
2566 int rc;
2567
2568 if (on) {
2569 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2570 if (rc) {
2571 pr_err("%s: unable to request gpio %d (%d)\n",
2572 __func__, gpio_wlan_sys_rest_en, rc);
2573 return rc;
2574 }
2575 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2576 msleep(200);
2577 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2578 msleep(100);
2579 } else {
2580 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2581 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2582 msleep(100);
2583 gpio_free(gpio_wlan_sys_rest_en);
2584 }
2585 return 0;
2586};
2587
2588static int ath6kl_wlan_power(int on)
2589{
2590 int ret = 0;
2591
2592 mutex_lock(&ath_wlanbt_mutex);
2593 if (on) {
2594 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2595 ret = ath6kl_power_control(1);
2596 ath_wlanbt_status = WLANON_BTOFF;
2597 } else if (ath_wlanbt_status == WLANOFF_BTON)
2598 ath_wlanbt_status = WLANON_BTON;
2599 } else {
2600 if (ath_wlanbt_status == WLANON_BTOFF) {
2601 ret = ath6kl_power_control(0);
2602 ath_wlanbt_status = WLANOFF_BTOFF;
2603 } else if (ath_wlanbt_status == WLANON_BTON)
2604 ath_wlanbt_status = WLANOFF_BTON;
2605 }
2606 mutex_unlock(&ath_wlanbt_mutex);
2607 pr_debug("%s on= %d, wlan_status= %d\n",
2608 __func__, on, ath_wlanbt_status);
2609 return ret;
2610};
2611
2612static struct wifi_platform_data ath6kl_wifi_control = {
2613 .set_power = ath6kl_wlan_power,
2614};
2615
2616static struct platform_device msm_wlan_power_device = {
2617 .name = "ath6kl_power",
2618 .dev = {
2619 .platform_data = &ath6kl_wifi_control,
2620 },
2621};
2622
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302623static struct resource bluesleep_resources[] = {
2624 {
2625 .name = "gpio_host_wake",
2626 .start = 27,
2627 .end = 27,
2628 .flags = IORESOURCE_IO,
2629 },
2630 {
2631 .name = "gpio_ext_wake",
2632 .start = 29,
2633 .end = 29,
2634 .flags = IORESOURCE_IO,
2635 },
2636 {
2637 .name = "host_wake",
2638 .start = MSM_GPIO_TO_INT(27),
2639 .end = MSM_GPIO_TO_INT(27),
2640 .flags = IORESOURCE_IRQ,
2641 },
2642};
2643
2644static struct platform_device msm_bluesleep_device = {
2645 .name = "bluesleep",
2646 .id = -1,
2647 .num_resources = ARRAY_SIZE(bluesleep_resources),
2648 .resource = bluesleep_resources,
2649};
2650
2651static struct platform_device msm_bt_power_device = {
2652 .name = "bt_power",
2653};
2654
Ming-yi Lin9baad172012-10-17 11:50:15 +08002655static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302656
2657static int bluetooth_power(int on)
2658{
2659 int rc;
2660
Ming-yi Lin9baad172012-10-17 11:50:15 +08002661 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302662 if (on) {
Ming-yi Lin9baad172012-10-17 11:50:15 +08002663 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2664 ath6kl_power_control(1);
2665 ath_wlanbt_status = WLANOFF_BTON;
2666 } else if (ath_wlanbt_status == WLANON_BTOFF)
2667 ath_wlanbt_status = WLANON_BTON;
2668
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302669 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2670 if (rc) {
2671 pr_err("%s: unable to request gpio %d (%d)\n",
2672 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin9baad172012-10-17 11:50:15 +08002673 mutex_unlock(&ath_wlanbt_mutex);
2674 return rc;
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302675 }
2676 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin9baad172012-10-17 11:50:15 +08002677 msleep(20);
2678 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302679 msleep(100);
2680 } else {
2681 gpio_set_value(gpio_bt_sys_rest_en, 0);
2682 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2683 msleep(100);
Ming-yi Lin9baad172012-10-17 11:50:15 +08002684 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondac4cfb692012-08-18 22:24:03 +05302685
Ming-yi Lin9baad172012-10-17 11:50:15 +08002686 if (ath_wlanbt_status == WLANOFF_BTON) {
2687 ath6kl_power_control(0);
2688 ath_wlanbt_status = WLANOFF_BTOFF;
2689 } else if (ath_wlanbt_status == WLANON_BTON)
2690 ath_wlanbt_status = WLANON_BTOFF;
2691 }
2692 mutex_unlock(&ath_wlanbt_mutex);
2693 pr_debug("%s on= %d, wlan_status= %d\n",
2694 __func__, on, ath_wlanbt_status);
2695 return 0;
2696};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302697
2698static void __init bt_power_init(void)
2699{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302700 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302701 return;
Ming-yi Lin9baad172012-10-17 11:50:15 +08002702};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302703#else
2704#define bt_power_init(x) do {} while (0)
2705#endif
2706
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002707static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002708 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002709 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302710 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002711 &msm_device_saw_core0,
2712 &msm_device_saw_core1,
2713 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002714 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002715 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002716 &msm8960_device_qup_spi_gsbi1,
2717 &msm8960_device_qup_i2c_gsbi3,
2718 &msm8960_device_qup_i2c_gsbi4,
2719 &msm8960_device_qup_i2c_gsbi10,
2720#ifndef CONFIG_MSM_DSPS
2721 &msm8960_device_qup_i2c_gsbi12,
2722#endif
2723 &msm_slim_ctrl,
2724 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302725#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2726 &msm_bluesleep_device,
2727 &msm_bt_power_device,
Ming-yi Lin9baad172012-10-17 11:50:15 +08002728 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302729#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002730#if defined(CONFIG_QSEECOM)
2731 &qseecom_device,
2732#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002733#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2734 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2735 &qcrypto_device,
2736#endif
2737
2738#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2739 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2740 &qcedev_device,
2741#endif
2742#ifdef CONFIG_MSM_ROTATOR
2743 &msm_rotator_device,
2744#endif
2745 &msm_device_sps,
2746#ifdef CONFIG_MSM_FAKE_BATTERY
2747 &fish_battery_device,
2748#endif
Binqiang Qiuf165c922012-08-15 18:00:18 -07002749#ifdef CONFIG_BATTERY_BCL
2750 &battery_bcl_device,
2751#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002752 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002753#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002754#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002755 &msm8960_android_pmem_device,
2756 &msm8960_android_pmem_adsp_device,
2757 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002758#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002759#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002760 &msm_device_bam_dmux,
2761 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002762#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2763#ifdef CONFIG_MSM_USE_TSIF1
2764 &msm_device_tsif[1],
2765#else
2766 &msm_device_tsif[0],
2767#endif
2768#endif
Joel Nider266a2642011-10-16 10:58:05 +02002769 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002770#ifdef CONFIG_HW_RANDOM_MSM
2771 &msm_device_rng,
2772#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002773#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002774 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002775#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002776 &msm8960_rpm_device,
2777 &msm8960_rpm_log_device,
2778 &msm8960_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302779 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002780 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002781 &coresight_tpiu_device,
2782 &coresight_etb_device,
2783 &coresight_funnel_device,
2784 &coresight_etm0_device,
2785 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002786 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002787 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002788 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002789 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002790 &msm8960_device_ebi1_ch0_erp,
2791 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002792 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002793 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002794 &msm_tsens_device,
Anji Jonnala6c2b6852012-09-21 13:34:44 +05302795 &msm8960_pc_cntr,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002796};
2797
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002798static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002799 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002800 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002801 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002802 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002803 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002804 &msm8960_device_otg,
2805 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002806 &msm_device_hsusb_host,
2807 &android_usb_device,
2808 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002809 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002810 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002811 &msm_pcm_routing,
2812 &msm_cpudai0,
2813 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002814 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002815 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002816 &msm_cpudai_hdmi_rx,
2817 &msm_cpudai_bt_rx,
2818 &msm_cpudai_bt_tx,
2819 &msm_cpudai_fm_rx,
2820 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002821 &msm_cpudai_auxpcm_rx,
2822 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002823 &msm_cpu_fe,
2824 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002825#ifdef CONFIG_MSM_GEMINI
2826 &msm8960_gemini_device,
2827#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002828#ifdef CONFIG_MSM_MERCURY
2829 &msm8960_mercury_device,
2830#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002831 &msm_voice,
2832 &msm_voip,
2833 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302834 &msm_cpudai_afe_01_rx,
2835 &msm_cpudai_afe_01_tx,
2836 &msm_cpudai_afe_02_rx,
2837 &msm_cpudai_afe_02_tx,
2838 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302839 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002840 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002841 &msm_cpudai_incall_record_rx,
2842 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002843 &msm_pcm_hostless,
2844 &msm_bus_apps_fabric,
2845 &msm_bus_sys_fabric,
2846 &msm_bus_mm_fabric,
2847 &msm_bus_sys_fpb,
2848 &msm_bus_cpss_fpb,
2849};
2850
2851static void __init msm8960_i2c_init(void)
2852{
Kiran Gundaaf3b3562012-08-31 14:00:05 +05302853 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
2854 msm8960_i2c_qup_gsbi4_pdata.keep_ahb_clk_on = 1;
2855
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002856 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2857 &msm8960_i2c_qup_gsbi4_pdata;
2858
2859 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2860 &msm8960_i2c_qup_gsbi3_pdata;
2861
2862 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2863 &msm8960_i2c_qup_gsbi10_pdata;
2864
2865 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2866 &msm8960_i2c_qup_gsbi12_pdata;
2867}
2868
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002869static void __init msm8960_gfx_init(void)
2870{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002871 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2872 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002873 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002874
Carter Coopera4a7ed22012-08-20 22:11:42 -06002875 /* Fixup data that needs to change based on GPU ID */
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002876 if (cpu_is_msm8960ab()) {
2877 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Carter Cooper9be5c4d2012-08-22 13:27:58 -06002878 /* 8960PRO nominal clock rate is 325Mhz instead of 320Mhz */
2879 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 325000000;
Carter Coopera4a7ed22012-08-20 22:11:42 -06002880 } else {
2881 kgsl_3d0_pdata->iommu_count = 1;
2882 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2883 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2884 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2885 }
2886 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2887 /* 8960v3 GPU registers returns 5 for patch release
2888 * but it should be 6, so dummy up the chipid here
2889 * based the platform type
2890 */
2891 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2892 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002893 }
Carter Cooper83e9dab2012-08-20 15:17:23 -06002894
2895 /* Register the 3D core */
2896 platform_device_register(&msm_kgsl_3d0);
2897
2898 /* Register the 2D cores if we are not 8960PRO */
2899 if (!cpu_is_msm8960ab()) {
2900 platform_device_register(&msm_kgsl_2d0);
2901 platform_device_register(&msm_kgsl_2d1);
2902 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002903}
2904
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302905static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002906 {
2907 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2908 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2909 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002910 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002911 },
2912
2913 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002914 MSM_PM_SLEEP_MODE_RETENTION,
2915 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2916 true,
2917 415, 715, 340827, 475,
2918 },
2919
2920 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002921 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2922 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2923 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002924 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002925 },
2926
2927 {
2928 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2929 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2930 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002931 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002932 },
2933
2934 {
2935 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002936 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2937 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002938 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002939 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002940
2941 {
2942 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2943 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2944 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002945 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002946 },
2947
2948 {
2949 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2950 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2951 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002952 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002953 },
2954
2955 {
2956 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2957 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2958 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002959 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002960 },
2961
2962 {
2963 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2964 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2965 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002966 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002967 },
2968};
2969
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002970
Praveen Chidambaram78499012011-11-01 17:15:17 -06002971static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2972 .levels = &msm_rpmrs_levels[0],
2973 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2974 .vdd_mem_levels = {
2975 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2976 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2977 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2978 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2979 },
2980 .vdd_dig_levels = {
2981 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2982 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2983 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2984 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2985 },
2986 .vdd_mask = 0x7FFFFF,
2987 .rpmrs_target_id = {
2988 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2989 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2990 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2991 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2992 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2993 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2994 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2995 },
2996};
2997
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002998static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2999 .mode = MSM_PM_BOOT_CONFIG_TZ,
3000};
3001
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003002#ifdef CONFIG_I2C
3003#define I2C_SURF 1
3004#define I2C_FFA (1 << 1)
3005#define I2C_RUMI (1 << 2)
3006#define I2C_SIM (1 << 3)
3007#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003008#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003009
3010struct i2c_registry {
3011 u8 machs;
3012 int bus;
3013 struct i2c_board_info *info;
3014 int len;
3015};
3016
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003017/* Sensors DSPS platform data */
3018#ifdef CONFIG_MSM_DSPS
3019#define DSPS_PIL_GENERIC_NAME "dsps"
3020#endif /* CONFIG_MSM_DSPS */
3021
3022static void __init msm8960_init_dsps(void)
3023{
3024#ifdef CONFIG_MSM_DSPS
3025 struct msm_dsps_platform_data *pdata =
3026 msm_dsps_device.dev.platform_data;
3027 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3028 pdata->gpios = NULL;
3029 pdata->gpios_num = 0;
3030
3031 platform_device_register(&msm_dsps_device);
3032#endif /* CONFIG_MSM_DSPS */
3033}
3034
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003035static int hsic_peripheral_status = 1;
3036static DEFINE_MUTEX(hsic_status_lock);
3037
3038void peripheral_connect()
3039{
3040 mutex_lock(&hsic_status_lock);
3041 if (hsic_peripheral_status)
3042 goto out;
3043 platform_device_add(&msm_device_hsic_host);
3044 hsic_peripheral_status = 1;
3045out:
3046 mutex_unlock(&hsic_status_lock);
3047}
3048EXPORT_SYMBOL(peripheral_connect);
3049
3050void peripheral_disconnect()
3051{
3052 mutex_lock(&hsic_status_lock);
3053 if (!hsic_peripheral_status)
3054 goto out;
3055 platform_device_del(&msm_device_hsic_host);
3056 hsic_peripheral_status = 0;
3057out:
3058 mutex_unlock(&hsic_status_lock);
3059}
3060EXPORT_SYMBOL(peripheral_disconnect);
3061
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303062static void __init msm8960_init_smsc_hub(void)
3063{
3064 uint32_t version = socinfo_get_version();
3065
3066 if (SOCINFO_VERSION_MAJOR(version) == 1)
3067 return;
3068
3069 if (machine_is_msm8960_liquid())
3070 platform_device_register(&smsc_hub_device);
3071}
3072
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003073static void __init msm8960_init_hsic(void)
3074{
3075#ifdef CONFIG_USB_EHCI_MSM_HSIC
3076 uint32_t version = socinfo_get_version();
3077
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003078 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003079 return;
3080
Joel King0cbf5d82012-05-24 15:21:38 -07003081 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003082 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003083#endif
3084}
3085
Amir Samuelov5137e392011-09-21 17:31:25 +03003086#ifdef CONFIG_ISL9519_CHARGER
3087static struct isl_platform_data isl_data __initdata = {
3088 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3089 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3090 .max_system_voltage = 4200,
3091 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003092 .chgcurrent = 1900,
3093 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003094 .input_current = 2048,
3095};
3096
3097static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3098 {
3099 I2C_BOARD_INFO("isl9519q", 0x9),
3100 .irq = 0, /* Not required when notify-by-pmic */
3101 .platform_data = &isl_data,
3102 },
3103};
3104#endif /* CONFIG_ISL9519_CHARGER */
3105
Amir Samuelov755616d2011-12-13 16:34:46 +02003106static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3107 {
3108 I2C_BOARD_INFO("sx1508q", 0x20),
3109 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3110 },
3111};
3112
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003113static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003114#ifdef CONFIG_ISL9519_CHARGER
3115 {
3116 I2C_LIQUID,
3117 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3118 isl_charger_i2c_info,
3119 ARRAY_SIZE(isl_charger_i2c_info),
3120 },
3121#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003122 {
3123 I2C_SURF | I2C_FFA | I2C_FLUID,
3124 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3125 cyttsp_info,
3126 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003127 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303128 {
3129 I2C_LIQUID,
3130 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3131 mxt_device_info,
3132 ARRAY_SIZE(mxt_device_info),
3133 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303134 {
Manoj Rao14648742012-03-30 19:42:12 -07003135 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303136 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003137 sii_device_info,
3138 ARRAY_SIZE(sii_device_info),
3139 },
3140 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303141 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003142 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303143 msm_isa1200_board_info,
3144 ARRAY_SIZE(msm_isa1200_board_info),
3145 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003146 {
3147 I2C_LIQUID,
3148 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3149 liquid_io_expander_i2c_info,
3150 ARRAY_SIZE(liquid_io_expander_i2c_info),
3151 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003152};
3153#endif /* CONFIG_I2C */
3154
3155static void __init register_i2c_devices(void)
3156{
3157#ifdef CONFIG_I2C
3158 u8 mach_mask = 0;
3159 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003160#ifdef CONFIG_MSM_CAMERA
3161 struct i2c_registry msm8960_camera_i2c_devices = {
3162 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3163 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3164 msm8960_camera_board_info.board_info,
3165 msm8960_camera_board_info.num_i2c_board_info,
3166 };
3167#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003168
3169 /* Build the matching 'supported_machs' bitmask */
3170 if (machine_is_msm8960_cdp())
3171 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003172 else if (machine_is_msm8960_fluid())
3173 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003174 else if (machine_is_msm8960_liquid())
3175 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003176 else if (machine_is_msm8960_mtp())
3177 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003178 else
3179 pr_err("unmatched machine ID in register_i2c_devices\n");
3180
Jing Lineec88ca2012-02-08 11:18:30 -08003181 if (machine_is_msm8960_liquid()) {
3182 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3183 mxt_device_info[0].platform_data =
3184 &mxt_platform_data_3d;
3185 else
3186 mxt_device_info[0].platform_data =
3187 &mxt_platform_data_2d;
3188 }
3189
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003190 /* Run the array and install devices as appropriate */
3191 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3192 if (msm8960_i2c_devices[i].machs & mach_mask)
3193 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3194 msm8960_i2c_devices[i].info,
3195 msm8960_i2c_devices[i].len);
3196 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003197
3198 if (!mhl_platform_data.gpio_mhl_power)
3199 pr_debug("mhl device configured for ext debug board\n");
3200
Kevin Chan09f4e662011-12-16 08:17:02 -08003201#ifdef CONFIG_MSM_CAMERA
3202 if (msm8960_camera_i2c_devices.machs & mach_mask)
3203 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3204 msm8960_camera_i2c_devices.info,
3205 msm8960_camera_i2c_devices.len);
3206#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003207#endif
3208}
3209
Siddartha Mohanadoss30447fe2012-09-26 09:42:32 -07003210static void __init msm8960_tsens_init(void)
3211{
3212 if (cpu_is_msm8960())
3213 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3214 return;
3215
3216 msm_tsens_early_init(&msm_tsens_pdata);
3217}
3218
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003219static void __init msm8960_reset_spm_avs(void)
3220{
3221 int i;
3222
3223 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3224 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3225 pdata->reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0;
3226 pdata->reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0;
3227 }
3228}
3229
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003230static void __init msm8960_cdp_init(void)
3231{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003232 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3233 pr_err("meminfo_init() failed!\n");
3234
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003235 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss30447fe2012-09-26 09:42:32 -07003236 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003237 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003238 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3239 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003240
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003241 regulator_suppress_info_printing();
3242 if (msm_xo_init())
3243 pr_err("Failed to initialize XO votes\n");
David Collinse68647e2012-09-04 15:44:19 -07003244 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003245 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003246 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303247 if (machine_is_msm8960_liquid())
3248 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003249 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303250 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3251 machine_is_msm8960_cdp()) {
Mayank Ranaa61da7a2012-08-14 10:57:00 +05303252 /* Due to availability of USB Switch in SGLTE Platform
3253 * it requires different HSUSB PHY settings compare to
3254 * 8960 MTP/CDP platform.
3255 */
3256 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3257 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3258 else
3259 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303260 } else if (machine_is_msm8960_liquid()) {
3261 msm_otg_pdata.phy_init_seq =
3262 liquid_v1_phy_init_seq;
3263 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003264 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303265 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303266 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303267 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3268 machine_is_msm8960_liquid())
3269 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003270 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003271 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3272 &msm8960_qup_spi_gsbi1_pdata;
3273 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303274 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3275 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003276
3277 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303278 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
3279 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303280 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003281 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003282 msm8960_gfx_init();
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003283
3284 if (cpu_is_msm8960ab())
3285 msm8960_reset_spm_avs();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003286 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3287 msm_spm_l2_init(msm_spm_l2_data);
Mahesh Sivasubramanianc5c82f42012-10-22 13:33:59 -06003288
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003289 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003290 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003291 if (machine_is_msm8960_liquid())
3292 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003293 if (machine_is_msm8960_cdp())
3294 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003295
3296 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3297 platform_device_register(&msm8960_device_uart_gsbi8);
3298 else
3299 platform_device_register(&msm8960_device_uart_gsbi5);
3300
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003301 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003302 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3303 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003304 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303305 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003306 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003307
Mayank Rana1f02d952012-07-04 19:11:20 +05303308 /* For 8960 Standalone External Bluetooth Interface */
3309 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3310 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3311 platform_device_register(&msm_device_uart_dm8);
3312 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003313 if (cpu_is_msm8960ab())
3314 platform_device_register(&msm8960ab_device_acpuclk);
3315 else
3316 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003317 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menon697e91b2012-08-20 15:25:50 -07003318 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003319
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003320 msm8960_pm8921_gpio_mpp_init();
Stephen Boyded035682012-09-13 12:41:31 -07003321 /* Don't add modem devices on APQ targets */
Stephen Boydbdb53f32012-06-05 18:39:47 -07003322 if (socinfo_get_id() != 124)
3323 platform_device_register(&msm_8960_q6_mss);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003324 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303325 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003326 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003327#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003328 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003329#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003330 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303331 if (machine_is_msm8960_liquid())
3332 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003333 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003334 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003335 slim_register_board_info(msm_slim_devices,
3336 ARRAY_SIZE(msm_slim_devices));
3337 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003338 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003339 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303340 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003341 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3342 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3343 platform_device_register(&mdm_sglte_device);
3344 }
Girish Mahadevan3bc98772012-08-15 10:01:27 -06003345 msm_pm_set_tz_retention_flag(1);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003346}
3347
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003348MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3349 .map_io = msm8960_map_io,
3350 .reserve = msm8960_reserve,
3351 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303352 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003353 .timer = &msm_timer,
3354 .init_machine = msm8960_cdp_init,
3355 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003356 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003357 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003358MACHINE_END
3359
3360MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3361 .map_io = msm8960_map_io,
3362 .reserve = msm8960_reserve,
3363 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303364 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003365 .timer = &msm_timer,
3366 .init_machine = msm8960_cdp_init,
3367 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003368 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003369 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003370MACHINE_END
3371
3372MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3373 .map_io = msm8960_map_io,
3374 .reserve = msm8960_reserve,
3375 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303376 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003377 .timer = &msm_timer,
3378 .init_machine = msm8960_cdp_init,
3379 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003380 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003381 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003382MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003383
3384MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3385 .map_io = msm8960_map_io,
3386 .reserve = msm8960_reserve,
3387 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303388 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003389 .timer = &msm_timer,
3390 .init_machine = msm8960_cdp_init,
3391 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003392 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003393 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003394MACHINE_END