blob: 1f67c1348123eab975aa7c6292acd69971a26f35 [file] [log] [blame]
Abhijeet Dharmapurikar7e37e6e2012-08-23 18:58:44 -07001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070022#include <linux/regulator/msm-gpio-regulator.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
29#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
Steve Mucklef132c6c2012-06-06 18:30:57 -070032#include <linux/cyttsp-qc.h>
Laura Abbott354d40f2012-08-03 17:32:09 -070033#include <linux/dma-contiguous.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Jack Cheung0b1987e2011-11-18 13:36:29 -080043#include <linux/memory.h>
Larry Bassel2d8b42d2012-03-12 10:41:26 -070044#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060045#include <linux/msm_thermal.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046
47#include <asm/mach-types.h>
48#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070049#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080050#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080052
53#include <mach/board.h>
Joel Nider266a2642011-10-16 10:58:05 +020054#include <mach/msm_tspp.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080055#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#include <mach/msm_spi.h>
Mayank Ranae009c922012-03-22 03:02:06 +053057#include <mach/msm_serial_hs.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058#ifdef CONFIG_USB_MSM_OTG_72K
59#include <mach/msm_hsusb.h>
60#else
61#include <linux/usb/msm_hsusb.h>
62#endif
63#include <linux/usb/android.h>
64#include <mach/usbdiag.h>
65#include <mach/socinfo.h>
66#include <mach/rpm.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070067#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068#include <mach/msm_bus_board.h>
69#include <mach/msm_memtypes.h>
70#include <mach/dma.h>
71#include <mach/msm_dsps.h>
72#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070073#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080074
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070075#ifdef CONFIG_WCD9310_CODEC
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053076#include <linux/mfd/wcd9xxx/core.h>
77#include <linux/mfd/wcd9xxx/pdata.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070078#endif
79
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +053080#include <linux/smsc3503.h>
Mitchel Humpherys9dc32cf2012-09-06 11:34:03 -070081#include <linux/msm_ion.h>
Laura Abbottd6183792011-08-19 13:42:24 -070082#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080083#include <mach/mdm2.h>
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -080084#include <mach/mdm-peripheral.h>
Laura Abbottf8c03b92012-02-16 14:57:58 -080085#include <mach/msm_rtb.h>
Laura Abbott306bcc22012-03-08 11:24:53 -080086#include <mach/msm_cache_dump.h>
87#include <mach/scm.h>
Olav Haugan8726caf2012-05-10 15:11:35 -070088#include <mach/iommu_domains.h>
Laura Abbottd6183792011-08-19 13:42:24 -070089
Jordan Crouse914de9b2012-07-09 13:49:46 -060090#include <mach/kgsl.h>
Larry Bassel41a055b2011-12-06 16:15:14 -080091#include <linux/fmem.h>
92
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080094#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#include "spm.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080097#include "board-8960.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080098#include "pm.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080099#include <mach/cpuidle.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700100#include "rpm_resources.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +0530101#include <mach/mpm.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 Lin2d43cd52012-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,
Laura Abbottadec9c72012-12-05 11:49:59 -0800366 .is_cma = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800367};
368
Laura Abbottb93525f2012-04-12 09:57:19 -0700369static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800370 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800371 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800372 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800373 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700374 .fixed_position = FIXED_HIGH,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800375};
376
Laura Abbottb93525f2012-04-12 09:57:19 -0700377static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800378 .adjacent_mem_id = INVALID_HEAP_ID,
379 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800380 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800381};
382
Laura Abbottb93525f2012-04-12 09:57:19 -0700383static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800384 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
385 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800386 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700387 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800388};
389#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800390
Laura Abbott354d40f2012-08-03 17:32:09 -0700391static u64 msm_dmamask = DMA_BIT_MASK(32);
392
393static struct platform_device ion_mm_heap_device = {
394 .name = "ion-mm-heap-device",
395 .id = -1,
396 .dev = {
397 .dma_mask = &msm_dmamask,
398 .coherent_dma_mask = DMA_BIT_MASK(32),
399 }
400};
401
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800402/**
403 * These heaps are listed in the order they will be allocated. Due to
404 * video hardware restrictions and content protection the FW heap has to
405 * be allocated adjacent (below) the MM heap and the MFC heap has to be
406 * allocated after the MM heap to ensure MFC heap is not more than 256MB
407 * away from the base address of the FW heap.
408 * However, the order of FW heap and MM heap doesn't matter since these
409 * two heaps are taken care of by separate code to ensure they are adjacent
410 * to each other.
411 * Don't swap the order unless you know what you are doing!
412 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700413struct ion_platform_heap msm8960_heaps[] = {
Laura Abbottd6183792011-08-19 13:42:24 -0700414 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800415 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700416 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700417 .name = ION_VMALLOC_HEAP_NAME,
418 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700419#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700420 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800421 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800422 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800423 .name = ION_MM_HEAP_NAME,
424 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700425 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700426 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott354d40f2012-08-03 17:32:09 -0700427 .priv = &ion_mm_heap_device.dev,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700428 },
Laura Abbott8c017362011-09-22 20:59:12 -0700429 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800430 .id = ION_MM_FIRMWARE_HEAP_ID,
431 .type = ION_HEAP_TYPE_CARVEOUT,
432 .name = ION_MM_FIRMWARE_HEAP_NAME,
433 .size = MSM_ION_MM_FW_SIZE,
434 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700435 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800436 },
437 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800438 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800439 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800440 .name = ION_MFC_HEAP_NAME,
441 .size = MSM_ION_MFC_SIZE,
442 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700443 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800444 },
Olav Haugan32594552012-03-13 11:40:05 -0700445#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800446 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800447 .id = ION_SF_HEAP_ID,
448 .type = ION_HEAP_TYPE_CARVEOUT,
449 .name = ION_SF_HEAP_NAME,
450 .size = MSM_ION_SF_SIZE,
451 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700452 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800453 },
Olav Haugan32594552012-03-13 11:40:05 -0700454#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800455 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800456 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700457 .type = ION_HEAP_TYPE_IOMMU,
458 .name = ION_IOMMU_HEAP_NAME,
459 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800460 {
461 .id = ION_QSECOM_HEAP_ID,
462 .type = ION_HEAP_TYPE_CARVEOUT,
463 .name = ION_QSECOM_HEAP_NAME,
464 .size = MSM_ION_QSECOM_SIZE,
465 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700466 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800467 },
Olav Haugan7355db02012-01-13 16:59:13 -0800468 {
469 .id = ION_AUDIO_HEAP_ID,
470 .type = ION_HEAP_TYPE_CARVEOUT,
471 .name = ION_AUDIO_HEAP_NAME,
472 .size = MSM_ION_AUDIO_SIZE,
473 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700474 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800475 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700476#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700477};
478
479static struct ion_platform_data msm8960_ion_pdata = {
480 .nr = MSM_ION_HEAP_NUM,
481 .heaps = msm8960_heaps,
Laura Abbottd6183792011-08-19 13:42:24 -0700482};
483
Laura Abbottb93525f2012-04-12 09:57:19 -0700484static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700485 .name = "ion-msm",
486 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700487 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700488};
489#endif
490
Laura Abbottb93525f2012-04-12 09:57:19 -0700491struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800492 .name = "fmem",
493 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700494 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800495};
496
Olav Haugan65f4bd82011-12-13 11:50:08 -0800497static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700498{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800499 unsigned int i;
500
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800501 if (!pmem_param_set) {
502 if (machine_is_msm8960_liquid())
503 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
504
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700505 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800506 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
507
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700508 if (machine_is_msm8960_liquid() ||
509 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700510 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
511 if (msm8960_ion_pdata.heaps[i].id ==
512 ION_SF_HEAP_ID) {
513 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800514 msm_ion_sf_size;
515 pr_debug("msm_ion_sf_size 0x%x\n",
516 msm_ion_sf_size);
517 break;
518 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800519 }
520 }
521 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800522}
523
524static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
525 unsigned long size)
526{
527 msm8960_reserve_table[mem_type].size += size;
528}
529
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700530static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
531{
532#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
533 int ret;
534
535 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
536 panic("fixed area size is larger than %dM\n",
537 MAX_FIXED_AREA_SIZE >> 20);
538
539 reserve_info->fixed_area_size = fixed_area_size;
540 reserve_info->fixed_area_start = MSM8960_FW_START;
541
542 ret = memblock_remove(reserve_info->fixed_area_start,
543 reserve_info->fixed_area_size);
544 BUG_ON(ret);
545#endif
546}
547
Olav Haugan65f4bd82011-12-13 11:50:08 -0800548/**
549 * Reserve memory for ION and calculate amount of reusable memory for fmem.
550 * We only reserve memory for heaps that are not reusable. However, we only
551 * support one reusable heap at the moment so we ignore the reusable flag for
552 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800553 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
554 * at a higher address than FW in addition to not more than 256MB away from the
555 * base address of the firmware. This means that if MM is reusable the other
556 * two heaps must be allocated in the same region as FW. This is handled by the
557 * mem_is_fmem flag in the platform data. In addition the MM heap must be
558 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800559 */
560static void __init reserve_ion_memory(void)
561{
562#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
563 unsigned int i;
Laura Abbott354d40f2012-08-03 17:32:09 -0700564 int ret;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700565 unsigned int fixed_size = 0;
566 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
567 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700568 unsigned long cma_alignment;
569 unsigned int low_use_cma = 0;
570 unsigned int middle_use_cma = 0;
571 unsigned int high_use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800572
573 adjust_mem_for_liquid();
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700574 fixed_low_size = 0;
575 fixed_middle_size = 0;
576 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800577
Laura Abbott354d40f2012-08-03 17:32:09 -0700578 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
579
Laura Abbottb93525f2012-04-12 09:57:19 -0700580 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700581 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700582 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700583 int align = SZ_4K;
584 int iommu_map_all = 0;
585 int adjacent_mem_id = INVALID_HEAP_ID;
Laura Abbott354d40f2012-08-03 17:32:09 -0700586 int use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800587
588 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700589 int fixed_position = NOT_FIXED;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700590
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700591 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800592 case ION_HEAP_TYPE_CP:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700593 fixed_position = ((struct ion_cp_heap_pdata *)
594 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700595 align = ((struct ion_cp_heap_pdata *)
596 heap->extra_data)->align;
597 iommu_map_all =
598 ((struct ion_cp_heap_pdata *)
599 heap->extra_data)->iommu_map_all;
Laura Abbott354d40f2012-08-03 17:32:09 -0700600 if (((struct ion_cp_heap_pdata *)
601 heap->extra_data)->is_cma) {
602 heap->size = ALIGN(heap->size,
603 cma_alignment);
604 use_cma = 1;
605 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800606 break;
Laura Abbott354d40f2012-08-03 17:32:09 -0700607 case ION_HEAP_TYPE_DMA:
608 use_cma = 1;
609 /* Purposely fall through here */
Olav Haugan65f4bd82011-12-13 11:50:08 -0800610 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700611 fixed_position = ((struct ion_co_heap_pdata *)
612 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700613 adjacent_mem_id = ((struct ion_co_heap_pdata *)
614 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700615 break;
616 default:
617 break;
618 }
619
Olav Haugan8726caf2012-05-10 15:11:35 -0700620 if (iommu_map_all) {
621 if (heap->size & (SZ_64K-1)) {
622 heap->size = ALIGN(heap->size, SZ_64K);
623 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
624 heap->name, heap->size);
625 }
626 }
627
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700628 if (fixed_position != NOT_FIXED)
629 fixed_size += heap->size;
630 else
631 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
632
Laura Abbott354d40f2012-08-03 17:32:09 -0700633 if (fixed_position == FIXED_LOW) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700634 fixed_low_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700635 low_use_cma = use_cma;
636 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700637 fixed_middle_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700638 middle_use_cma = use_cma;
639 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700640 fixed_high_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700641 high_use_cma = use_cma;
642 } else if (use_cma) {
643 /*
644 * Heaps that use CMA but are not part of the
645 * fixed set. Create wherever.
646 */
647 dma_declare_contiguous(
648 heap->priv,
649 heap->size,
650 0,
651 0xb0000000);
652 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700653 }
654 }
655
656 if (!fixed_size)
657 return;
658
Laura Abbott354d40f2012-08-03 17:32:09 -0700659 /*
660 * Given the setup for the fixed area, we can't round up all sizes.
661 * Some sizes must be set up exactly and aligned correctly. Incorrect
662 * alignments are considered a configuration issue
Larry Bassel4d4f4482012-04-04 11:26:09 -0700663 */
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700664
665 fixed_low_start = MSM8960_FIXED_AREA_START;
Laura Abbott354d40f2012-08-03 17:32:09 -0700666 if (low_use_cma) {
667 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
668 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
669 } else {
670 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
671 ret = memblock_remove(fixed_low_start,
672 fixed_low_size + HOLE_SIZE);
673 BUG_ON(ret);
674 }
675
Deepak Kotur35825522012-06-06 15:49:14 -0700676 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott354d40f2012-08-03 17:32:09 -0700677 if (middle_use_cma) {
678 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
679 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
680 } else {
681 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
682 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
683 BUG_ON(ret);
684 }
685
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700686 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700687 if (high_use_cma) {
688 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
689 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
690 } else {
691 /* This is the end of the fixed area so it's okay to round up */
692 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
693 ret = memblock_remove(fixed_high_start, fixed_high_size);
694 BUG_ON(ret);
695 }
696
697
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700698
Laura Abbottb93525f2012-04-12 09:57:19 -0700699 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
700 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700701
702 if (heap->extra_data) {
703 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700704 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700705
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700706 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700707 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700708 pdata =
709 (struct ion_cp_heap_pdata *)heap->extra_data;
710 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700711 break;
712 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbott354d40f2012-08-03 17:32:09 -0700713 case ION_HEAP_TYPE_DMA:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700714 fixed_position = ((struct ion_co_heap_pdata *)
715 heap->extra_data)->fixed_position;
716 break;
717 default:
718 break;
719 }
720
721 switch (fixed_position) {
722 case FIXED_LOW:
723 heap->base = fixed_low_start;
724 break;
725 case FIXED_MIDDLE:
726 heap->base = fixed_middle_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700727 if (middle_use_cma) {
728 ret = dma_declare_contiguous(
729 &ion_mm_heap_device.dev,
730 heap->size,
731 fixed_middle_start,
732 0xa0000000);
733 WARN_ON(ret);
734 }
Deepak Kotur35825522012-06-06 15:49:14 -0700735 pdata->secure_base = fixed_middle_start
736 - HOLE_SIZE;
737 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700738 break;
739 case FIXED_HIGH:
740 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800741 break;
742 default:
743 break;
744 }
745 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800746 }
Laura Abbottd6183792011-08-19 13:42:24 -0700747#endif
748}
Huaibin Yanga5419422011-12-08 23:52:10 -0800749
750static void __init reserve_mdp_memory(void)
751{
752 msm8960_mdp_writeback(msm8960_reserve_table);
753}
754
Stephen Boyd668d7652012-04-25 11:31:01 -0700755static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800756{
757#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800758 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800759
Laura Abbott155ab6f2012-05-25 08:52:18 -0700760 total = msm8960_cache_dump_pdata.l1_size +
761 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800762 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800763#endif
764}
765
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700766static void __init msm8960_calculate_reserve_sizes(void)
767{
768 size_pmem_devices();
769 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700770 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800771 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800772 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800773 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700774}
775
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700776static struct reserve_info msm8960_reserve_info __initdata = {
777 .memtype_reserve_table = msm8960_reserve_table,
778 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700779 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700780 .paddr_to_memtype = msm8960_paddr_to_memtype,
781};
782
Larry Basselb4126da2011-07-18 14:31:33 -0700783static int msm8960_memory_bank_size(void)
784{
785 return 1<<29;
786}
787
788static void __init locate_unstable_memory(void)
789{
790 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
791 unsigned long bank_size;
792 unsigned long low, high;
793
794 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700795 msm8960_reserve_info.bank_size = bank_size;
796
Larry Basselb4126da2011-07-18 14:31:33 -0700797 low = meminfo.bank[0].start;
798 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700799
800 /* Check if 32 bit overflow occured */
801 if (high < mb->start)
802 high = ~0UL;
803
Larry Bassel4d4f4482012-04-04 11:26:09 -0700804 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
805 panic("fixed area extends beyond end of memory\n");
806
Larry Basselb4126da2011-07-18 14:31:33 -0700807 low &= ~(bank_size - 1);
808
809 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700810 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800811
Larry Basselb8d61022012-02-24 10:49:45 -0800812#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800813 msm8960_reserve_info.low_unstable_address = mb->start -
814 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800815 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700816 pr_info("low unstable address %lx max size %lx bank size %lx\n",
817 msm8960_reserve_info.low_unstable_address,
818 msm8960_reserve_info.max_unstable_size,
819 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700820 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800821#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700822no_dmm:
823 msm8960_reserve_info.low_unstable_address = high;
824 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700825}
826
Larry Basselb830e182011-10-14 10:46:55 -0700827static void __init place_movable_zone(void)
828{
Larry Basselb8d61022012-02-24 10:49:45 -0800829#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700830 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
831 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
832 pr_info("movable zone start %lx size %lx\n",
833 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800834#endif
Larry Basselb830e182011-10-14 10:46:55 -0700835}
836
837static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700838{
839 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700840 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700841 place_movable_zone();
842}
843
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800844static char prim_panel_name[PANEL_NAME_MAX_LEN];
845static char ext_panel_name[PANEL_NAME_MAX_LEN];
846static int __init prim_display_setup(char *param)
847{
848 if (strnlen(param, PANEL_NAME_MAX_LEN))
849 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
850 return 0;
851}
852early_param("prim_display", prim_display_setup);
853
854static int __init ext_display_setup(char *param)
855{
856 if (strnlen(param, PANEL_NAME_MAX_LEN))
857 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
858 return 0;
859}
860early_param("ext_display", ext_display_setup);
861
Larry Basselb830e182011-10-14 10:46:55 -0700862static void __init msm8960_reserve(void)
863{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800864 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700865 msm_reserve();
866}
867
Larry Bassela4414b12011-08-04 11:11:02 -0700868static int msm8960_change_memory_power(u64 start, u64 size,
869 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700870{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700871 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700872}
873
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700874static void __init msm8960_allocate_memory_regions(void)
875{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800876 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700877}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800878
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700879#ifdef CONFIG_WCD9310_CODEC
880
881#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
882
Patrick Lai3043fba2011-08-01 14:15:57 -0700883/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
884 * 4 micbiases are used to power various analog and digital
885 * microphones operating at 1800 mV. Technically, all micbiases
886 * can source from single cfilter since all microphones operate
887 * at the same voltage level. The arrangement below is to make
888 * sure all cfilters are exercised. LDO_H regulator ouput level
889 * does not need to be as high as 2.85V. It is choosen for
890 * microphone sensitivity purpose.
891 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530892static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700893 .slimbus_slave_device = {
894 .name = "tabla-slave",
895 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
896 },
897 .irq = MSM_GPIO_TO_INT(62),
898 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530899 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700900 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700901 .micbias = {
902 .ldoh_v = TABLA_LDOH_2P85_V,
903 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700904 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700905 .cfilt3_mv = 1800,
906 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
907 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
908 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
909 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530910 },
911 .regulator = {
912 {
913 .name = "CDC_VDD_CP",
914 .min_uV = 1800000,
915 .max_uV = 1800000,
916 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
917 },
918 {
919 .name = "CDC_VDDA_RX",
920 .min_uV = 1800000,
921 .max_uV = 1800000,
922 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
923 },
924 {
925 .name = "CDC_VDDA_TX",
926 .min_uV = 1800000,
927 .max_uV = 1800000,
928 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
929 },
930 {
931 .name = "VDDIO_CDC",
932 .min_uV = 1800000,
933 .max_uV = 1800000,
934 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
935 },
936 {
937 .name = "VDDD_CDC_D",
938 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700939 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530940 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
941 },
942 {
943 .name = "CDC_VDDA_A_1P2V",
944 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700945 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530946 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
947 },
948 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700949};
950
951static struct slim_device msm_slim_tabla = {
952 .name = "tabla-slim",
953 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
954 .dev = {
955 .platform_data = &tabla_platform_data,
956 },
957};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530958
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530959static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530960 .slimbus_slave_device = {
961 .name = "tabla-slave",
962 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
963 },
964 .irq = MSM_GPIO_TO_INT(62),
965 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530966 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530967 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
968 .micbias = {
969 .ldoh_v = TABLA_LDOH_2P85_V,
970 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700971 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530972 .cfilt3_mv = 1800,
973 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
974 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
975 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
976 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530977 },
978 .regulator = {
979 {
980 .name = "CDC_VDD_CP",
981 .min_uV = 1800000,
982 .max_uV = 1800000,
983 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
984 },
985 {
986 .name = "CDC_VDDA_RX",
987 .min_uV = 1800000,
988 .max_uV = 1800000,
989 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
990 },
991 {
992 .name = "CDC_VDDA_TX",
993 .min_uV = 1800000,
994 .max_uV = 1800000,
995 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
996 },
997 {
998 .name = "VDDIO_CDC",
999 .min_uV = 1800000,
1000 .max_uV = 1800000,
1001 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1002 },
1003 {
1004 .name = "VDDD_CDC_D",
1005 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -07001006 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301007 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1008 },
1009 {
1010 .name = "CDC_VDDA_A_1P2V",
1011 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -07001012 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301013 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1014 },
1015 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301016};
1017
1018static struct slim_device msm_slim_tabla20 = {
1019 .name = "tabla2x-slim",
1020 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1021 .dev = {
1022 .platform_data = &tabla20_platform_data,
1023 },
1024};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001025#endif
1026
1027static struct slim_boardinfo msm_slim_devices[] = {
1028#ifdef CONFIG_WCD9310_CODEC
1029 {
1030 .bus_num = 1,
1031 .slim_slave = &msm_slim_tabla,
1032 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301033 {
1034 .bus_num = 1,
1035 .slim_slave = &msm_slim_tabla20,
1036 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001037#endif
1038 /* add more slimbus slaves as needed */
1039};
1040
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001041#define MSM_WCNSS_PHYS 0x03000000
1042#define MSM_WCNSS_SIZE 0x280000
1043
1044static struct resource resources_wcnss_wlan[] = {
1045 {
1046 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1047 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1048 .name = "wcnss_wlanrx_irq",
1049 .flags = IORESOURCE_IRQ,
1050 },
1051 {
1052 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1053 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1054 .name = "wcnss_wlantx_irq",
1055 .flags = IORESOURCE_IRQ,
1056 },
1057 {
1058 .start = MSM_WCNSS_PHYS,
1059 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1060 .name = "wcnss_mmio",
1061 .flags = IORESOURCE_MEM,
1062 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001063 {
1064 .start = 84,
1065 .end = 88,
1066 .name = "wcnss_gpios_5wire",
1067 .flags = IORESOURCE_IO,
1068 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001069};
1070
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001071static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1072 .has_48mhz_xo = 1,
1073};
1074
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001075static struct platform_device msm_device_wcnss_wlan = {
1076 .name = "wcnss_wlan",
1077 .id = 0,
1078 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1079 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001080 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001081};
1082
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001083#ifdef CONFIG_QSEECOM
1084/* qseecom bus scaling */
1085static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1086 {
1087 .src = MSM_BUS_MASTER_SPS,
1088 .dst = MSM_BUS_SLAVE_EBI_CH0,
1089 .ib = 0,
1090 .ab = 0,
1091 },
1092 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001093 .src = MSM_BUS_MASTER_SPS,
1094 .dst = MSM_BUS_SLAVE_SPS,
1095 .ib = 0,
1096 .ab = 0,
1097 },
1098 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001099 .src = MSM_BUS_MASTER_SPDM,
1100 .dst = MSM_BUS_SLAVE_SPDM,
1101 .ib = 0,
1102 .ab = 0,
1103 },
1104};
1105
1106static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1107 {
1108 .src = MSM_BUS_MASTER_SPS,
1109 .dst = MSM_BUS_SLAVE_EBI_CH0,
1110 .ib = (492 * 8) * 1000000UL,
1111 .ab = (492 * 8) * 100000UL,
1112 },
1113 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001114 .src = MSM_BUS_MASTER_SPS,
1115 .dst = MSM_BUS_SLAVE_SPS,
1116 .ib = (492 * 8) * 1000000UL,
1117 .ab = (492 * 8) * 100000UL,
1118 },
1119 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001120 .src = MSM_BUS_MASTER_SPDM,
1121 .dst = MSM_BUS_SLAVE_SPDM,
1122 .ib = 0,
1123 .ab = 0,
1124 },
1125};
1126
1127static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1128 {
1129 .src = MSM_BUS_MASTER_SPS,
1130 .dst = MSM_BUS_SLAVE_EBI_CH0,
1131 .ib = 0,
1132 .ab = 0,
1133 },
1134 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001135 .src = MSM_BUS_MASTER_SPS,
1136 .dst = MSM_BUS_SLAVE_SPS,
1137 .ib = 0,
1138 .ab = 0,
1139 },
1140 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001141 .src = MSM_BUS_MASTER_SPDM,
1142 .dst = MSM_BUS_SLAVE_SPDM,
1143 .ib = (64 * 8) * 1000000UL,
1144 .ab = (64 * 8) * 100000UL,
1145 },
1146};
1147
1148static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1149 {
1150 ARRAY_SIZE(qseecom_clks_init_vectors),
1151 qseecom_clks_init_vectors,
1152 },
1153 {
1154 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001155 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001156 },
1157 {
1158 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1159 qseecom_enable_sfpb_vectors,
1160 },
1161};
1162
1163static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1164 qseecom_hw_bus_scale_usecases,
1165 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1166 .name = "qsee",
1167};
1168
1169static struct platform_device qseecom_device = {
1170 .name = "qseecom",
1171 .id = 0,
1172 .dev = {
1173 .platform_data = &qseecom_bus_pdata,
1174 },
1175};
1176#endif
1177
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001178#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1179 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1180 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1181 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1182
1183#define QCE_SIZE 0x10000
1184#define QCE_0_BASE 0x18500000
1185
1186#define QCE_HW_KEY_SUPPORT 0
1187#define QCE_SHA_HMAC_SUPPORT 1
1188#define QCE_SHARE_CE_RESOURCE 1
1189#define QCE_CE_SHARED 0
1190
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001191/* Begin Bus scaling definitions */
1192static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1193 {
1194 .src = MSM_BUS_MASTER_ADM_PORT0,
1195 .dst = MSM_BUS_SLAVE_EBI_CH0,
1196 .ab = 0,
1197 .ib = 0,
1198 },
1199 {
1200 .src = MSM_BUS_MASTER_ADM_PORT1,
1201 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1202 .ab = 0,
1203 .ib = 0,
1204 },
1205};
1206
1207static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1208 {
1209 .src = MSM_BUS_MASTER_ADM_PORT0,
1210 .dst = MSM_BUS_SLAVE_EBI_CH0,
1211 .ab = 70000000UL,
1212 .ib = 70000000UL,
1213 },
1214 {
1215 .src = MSM_BUS_MASTER_ADM_PORT1,
1216 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1217 .ab = 2480000000UL,
1218 .ib = 2480000000UL,
1219 },
1220};
1221
1222static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1223 {
1224 ARRAY_SIZE(crypto_hw_init_vectors),
1225 crypto_hw_init_vectors,
1226 },
1227 {
1228 ARRAY_SIZE(crypto_hw_active_vectors),
1229 crypto_hw_active_vectors,
1230 },
1231};
1232
1233static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1234 crypto_hw_bus_scale_usecases,
1235 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1236 .name = "cryptohw",
1237};
1238/* End Bus Scaling Definitions*/
1239
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001240static struct resource qcrypto_resources[] = {
1241 [0] = {
1242 .start = QCE_0_BASE,
1243 .end = QCE_0_BASE + QCE_SIZE - 1,
1244 .flags = IORESOURCE_MEM,
1245 },
1246 [1] = {
1247 .name = "crypto_channels",
1248 .start = DMOV_CE_IN_CHAN,
1249 .end = DMOV_CE_OUT_CHAN,
1250 .flags = IORESOURCE_DMA,
1251 },
1252 [2] = {
1253 .name = "crypto_crci_in",
1254 .start = DMOV_CE_IN_CRCI,
1255 .end = DMOV_CE_IN_CRCI,
1256 .flags = IORESOURCE_DMA,
1257 },
1258 [3] = {
1259 .name = "crypto_crci_out",
1260 .start = DMOV_CE_OUT_CRCI,
1261 .end = DMOV_CE_OUT_CRCI,
1262 .flags = IORESOURCE_DMA,
1263 },
1264};
1265
1266static struct resource qcedev_resources[] = {
1267 [0] = {
1268 .start = QCE_0_BASE,
1269 .end = QCE_0_BASE + QCE_SIZE - 1,
1270 .flags = IORESOURCE_MEM,
1271 },
1272 [1] = {
1273 .name = "crypto_channels",
1274 .start = DMOV_CE_IN_CHAN,
1275 .end = DMOV_CE_OUT_CHAN,
1276 .flags = IORESOURCE_DMA,
1277 },
1278 [2] = {
1279 .name = "crypto_crci_in",
1280 .start = DMOV_CE_IN_CRCI,
1281 .end = DMOV_CE_IN_CRCI,
1282 .flags = IORESOURCE_DMA,
1283 },
1284 [3] = {
1285 .name = "crypto_crci_out",
1286 .start = DMOV_CE_OUT_CRCI,
1287 .end = DMOV_CE_OUT_CRCI,
1288 .flags = IORESOURCE_DMA,
1289 },
1290};
1291
1292#endif
1293
1294#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1295 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1296
1297static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1298 .ce_shared = QCE_CE_SHARED,
1299 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1300 .hw_key_support = QCE_HW_KEY_SUPPORT,
1301 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001302 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303};
1304
1305static struct platform_device qcrypto_device = {
1306 .name = "qcrypto",
1307 .id = 0,
1308 .num_resources = ARRAY_SIZE(qcrypto_resources),
1309 .resource = qcrypto_resources,
1310 .dev = {
1311 .coherent_dma_mask = DMA_BIT_MASK(32),
1312 .platform_data = &qcrypto_ce_hw_suppport,
1313 },
1314};
1315#endif
1316
1317#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1318 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1319
1320static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1321 .ce_shared = QCE_CE_SHARED,
1322 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1323 .hw_key_support = QCE_HW_KEY_SUPPORT,
1324 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001325 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326};
1327
1328static struct platform_device qcedev_device = {
1329 .name = "qce",
1330 .id = 0,
1331 .num_resources = ARRAY_SIZE(qcedev_resources),
1332 .resource = qcedev_resources,
1333 .dev = {
1334 .coherent_dma_mask = DMA_BIT_MASK(32),
1335 .platform_data = &qcedev_ce_hw_suppport,
1336 },
1337};
1338#endif
1339
Joel King0cbf5d82012-05-24 15:21:38 -07001340static struct mdm_platform_data sglte_platform_data = {
1341 .mdm_version = "4.0",
1342 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001343 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001344 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001345 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001346 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001347 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001348};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001349
Joel Nider266a2642011-10-16 10:58:05 +02001350#define MSM_TSIF0_PHYS (0x18200000)
1351#define MSM_TSIF1_PHYS (0x18201000)
1352#define MSM_TSIF_SIZE (0x200)
1353#define MSM_TSPP_PHYS (0x18202000)
1354#define MSM_TSPP_SIZE (0x1000)
1355#define MSM_TSPP_BAM_PHYS (0x18204000)
1356#define MSM_TSPP_BAM_SIZE (0x2000)
1357
1358#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1359 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1360#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1361 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1362#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1363 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1364#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1365 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1366#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1367 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1368#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1369 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1370#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1371 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1372#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1373 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1374
1375static const struct msm_gpio tsif_gpios[] = {
1376 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1377 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1378 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1379 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1380 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1381 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1382 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1383 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1384};
1385
1386static struct resource tspp_resources[] = {
1387 [0] = {
1388 .flags = IORESOURCE_IRQ,
1389 .start = TSIF_TSPP_IRQ,
1390 .end = TSIF1_IRQ,
1391 },
1392 [1] = {
1393 .flags = IORESOURCE_MEM,
1394 .start = MSM_TSIF0_PHYS,
1395 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1396 },
1397 [2] = {
1398 .flags = IORESOURCE_MEM,
1399 .start = MSM_TSIF1_PHYS,
1400 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1401 },
1402 [3] = {
1403 .flags = IORESOURCE_MEM,
1404 .start = MSM_TSPP_PHYS,
1405 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1406 },
1407 [4] = {
1408 .flags = IORESOURCE_MEM,
1409 .start = MSM_TSPP_BAM_PHYS,
1410 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1411 },
1412};
1413
1414static struct msm_tspp_platform_data tspp_platform_data = {
1415 .num_gpios = ARRAY_SIZE(tsif_gpios),
1416 .gpios = tsif_gpios,
1417 .tsif_pclk = "tsif_pclk",
1418 .tsif_ref_clk = "tsif_ref_clk",
1419};
1420
1421static struct platform_device msm_device_tspp = {
1422 .name = "msm_tspp",
1423 .id = 0,
1424 .num_resources = ARRAY_SIZE(tspp_resources),
1425 .resource = tspp_resources,
1426 .dev = {
1427 .platform_data = &tspp_platform_data
1428 },
1429};
1430
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001431#define MSM_SHARED_RAM_PHYS 0x80000000
1432
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001433static void __init msm8960_map_io(void)
1434{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001435 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001436 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001437
1438 if (socinfo_init() < 0)
1439 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001440}
1441
1442static void __init msm8960_init_irq(void)
1443{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001444 struct msm_mpm_device_data *data = NULL;
1445
1446#ifdef CONFIG_MSM_MPM
1447 data = &msm8960_mpm_dev_data;
1448#endif
1449
1450 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001451 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001452 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001453}
1454
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455static void __init msm8960_init_buses(void)
1456{
1457#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001458 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001459 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1460 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001461 msm_bus_apps_fabric.dev.platform_data =
1462 &msm_bus_8960_apps_fabric_pdata;
1463 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001464 if (cpu_is_msm8960ab()) {
1465 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1466 msm_bus_mm_fabric.dev.platform_data =
1467 &msm_bus_8960_sg_mm_fabric_pdata;
1468 } else {
1469 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1470 msm_bus_mm_fabric.dev.platform_data =
1471 &msm_bus_8960_mm_fabric_pdata;
1472 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001473 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1474 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001475#endif
1476}
1477
1478static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1479 .max_clock_speed = 15060000,
Kiran Gunda2b285652012-07-30 13:22:39 +05301480 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001481};
1482
1483#ifdef CONFIG_USB_MSM_OTG_72K
1484static struct msm_otg_platform_data msm_otg_pdata;
1485#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301486static int wr_phy_init_seq[] = {
1487 0x44, 0x80, /* set VBUS valid threshold
1488 and disconnect valid threshold */
1489 0x38, 0x81, /* update DC voltage level */
1490 0x14, 0x82, /* set preemphasis and rise/fall time */
1491 0x13, 0x83, /* set source impedance adjusment */
1492 -1};
1493
1494static int liquid_v1_phy_init_seq[] = {
1495 0x44, 0x80,/* set VBUS valid threshold
1496 and disconnect valid threshold */
1497 0x3C, 0x81,/* update DC voltage level */
1498 0x18, 0x82,/* set preemphasis and rise/fall time */
1499 0x23, 0x83,/* set source impedance sdjusment */
1500 -1};
1501
Mayank Ranaa1f507b2012-08-14 10:57:00 +05301502static int sglte_phy_init_seq[] = {
1503 0x44, 0x80, /* set VBUS valid threshold
1504 and disconnect valid threshold */
1505 0x3A, 0x81, /* update DC voltage level */
1506 0x24, 0x82, /* set preemphasis and rise/fall time */
1507 0x13, 0x83, /* set source impedance adjusment */
1508 -1};
1509
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301510#ifdef CONFIG_MSM_BUS_SCALING
1511/* Bandwidth requests (zero) if no vote placed */
1512static struct msm_bus_vectors usb_init_vectors[] = {
1513 {
1514 .src = MSM_BUS_MASTER_SPS,
1515 .dst = MSM_BUS_SLAVE_EBI_CH0,
1516 .ab = 0,
1517 .ib = 0,
1518 },
1519};
1520
1521/* Bus bandwidth requests in Bytes/sec */
1522static struct msm_bus_vectors usb_max_vectors[] = {
1523 {
1524 .src = MSM_BUS_MASTER_SPS,
1525 .dst = MSM_BUS_SLAVE_EBI_CH0,
1526 .ab = 60000000, /* At least 480Mbps on bus. */
1527 .ib = 960000000, /* MAX bursts rate */
1528 },
1529};
1530
1531static struct msm_bus_paths usb_bus_scale_usecases[] = {
1532 {
1533 ARRAY_SIZE(usb_init_vectors),
1534 usb_init_vectors,
1535 },
1536 {
1537 ARRAY_SIZE(usb_max_vectors),
1538 usb_max_vectors,
1539 },
1540};
1541
1542static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1543 usb_bus_scale_usecases,
1544 ARRAY_SIZE(usb_bus_scale_usecases),
1545 .name = "usb",
1546};
1547#endif
1548
Jack Pham87f202f2012-08-06 00:24:22 -07001549#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1550
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001551static struct msm_otg_platform_data msm_otg_pdata = {
1552 .mode = USB_OTG,
1553 .otg_control = OTG_PMIC_CONTROL,
1554 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001555 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301556 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301557#ifdef CONFIG_MSM_BUS_SCALING
1558 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001559 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301560#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301561#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1562 .mhl_dev_name = "sii8334",
1563#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001564};
1565#endif
1566
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301567#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301568#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301569static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1570 .strobe = 150,
1571 .data = 151,
1572};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301573
1574static struct smsc_hub_platform_data hsic_hub_pdata = {
1575 .hub_reset = HSIC_HUB_RESET_GPIO,
1576};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301577#else
1578static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301579static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301580#endif
1581
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301582static struct platform_device smsc_hub_device = {
1583 .name = "msm_smsc_hub",
1584 .id = -1,
1585 .dev = {
1586 .platform_data = &hsic_hub_pdata,
1587 },
1588};
1589
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001590#define PID_MAGIC_ID 0x71432909
1591#define SERIAL_NUM_MAGIC_ID 0x61945374
1592#define SERIAL_NUMBER_LENGTH 127
1593#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1594
1595struct magic_num_struct {
1596 uint32_t pid;
1597 uint32_t serial_num;
1598};
1599
1600struct dload_struct {
1601 uint32_t reserved1;
1602 uint32_t reserved2;
1603 uint32_t reserved3;
1604 uint16_t reserved4;
1605 uint16_t pid;
1606 char serial_number[SERIAL_NUMBER_LENGTH];
1607 uint16_t reserved5;
1608 struct magic_num_struct magic_struct;
1609};
1610
1611static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1612{
1613 struct dload_struct __iomem *dload = 0;
1614
1615 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1616 if (!dload) {
1617 pr_err("%s: cannot remap I/O memory region: %08x\n",
1618 __func__, DLOAD_USB_BASE_ADD);
1619 return -ENXIO;
1620 }
1621
1622 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1623 __func__, dload, pid, snum);
1624 /* update pid */
1625 dload->magic_struct.pid = PID_MAGIC_ID;
1626 dload->pid = pid;
1627
1628 /* update serial number */
1629 dload->magic_struct.serial_num = 0;
1630 if (!snum) {
1631 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1632 goto out;
1633 }
1634
1635 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001636 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001637out:
1638 iounmap(dload);
1639 return 0;
1640}
1641
1642static struct android_usb_platform_data android_usb_pdata = {
1643 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1644};
1645
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001646static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001647 .name = "android_usb",
1648 .id = -1,
1649 .dev = {
1650 .platform_data = &android_usb_pdata,
1651 },
1652};
1653
1654static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1655 0x03, 0x0f,
1656};
1657
1658static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1659 0x00, 0x24, 0x54, 0x10,
1660 0x09, 0x03, 0x01,
1661 0x10, 0x54, 0x30, 0x0C,
1662 0x24, 0x30, 0x0f,
1663};
1664
1665static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1666 0x00, 0x24, 0x54, 0x10,
1667 0x09, 0x07, 0x01, 0x0B,
1668 0x10, 0x54, 0x30, 0x0C,
1669 0x24, 0x30, 0x0f,
1670};
1671
1672static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1673 [0] = {
1674 .mode = MSM_SPM_MODE_CLOCK_GATING,
1675 .notify_rpm = false,
1676 .cmd = spm_wfi_cmd_sequence,
1677 },
1678 [1] = {
1679 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1680 .notify_rpm = false,
1681 .cmd = spm_power_collapse_without_rpm,
1682 },
1683 [2] = {
1684 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1685 .notify_rpm = true,
1686 .cmd = spm_power_collapse_with_rpm,
1687 },
1688};
1689
1690static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1691 [0] = {
1692 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001693 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001694#if defined(CONFIG_MSM_AVS_HW)
1695 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1696 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1697#endif
1698 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001699 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1701 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1702 .vctl_timeout_us = 50,
1703 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1704 .modes = msm_spm_seq_list,
1705 },
1706 [1] = {
1707 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001708 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001709#if defined(CONFIG_MSM_AVS_HW)
1710 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1711 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1712#endif
1713 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001714 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001715 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1716 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1717 .vctl_timeout_us = 50,
1718 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1719 .modes = msm_spm_seq_list,
1720 },
1721};
1722
1723static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1724 0x00, 0x20, 0x03, 0x20,
1725 0x00, 0x0f,
1726};
1727
1728static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1729 0x00, 0x20, 0x34, 0x64,
1730 0x48, 0x07, 0x48, 0x20,
1731 0x50, 0x64, 0x04, 0x34,
1732 0x50, 0x0f,
1733};
1734static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1735 0x00, 0x10, 0x34, 0x64,
1736 0x48, 0x07, 0x48, 0x10,
1737 0x50, 0x64, 0x04, 0x34,
1738 0x50, 0x0F,
1739};
1740
1741static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1742 [0] = {
1743 .mode = MSM_SPM_L2_MODE_RETENTION,
1744 .notify_rpm = false,
1745 .cmd = l2_spm_wfi_cmd_sequence,
1746 },
1747 [1] = {
1748 .mode = MSM_SPM_L2_MODE_GDHS,
1749 .notify_rpm = true,
1750 .cmd = l2_spm_gdhs_cmd_sequence,
1751 },
1752 [2] = {
1753 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1754 .notify_rpm = true,
1755 .cmd = l2_spm_power_off_cmd_sequence,
1756 },
1757};
1758
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001759static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1760 [0] = {
1761 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001762 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001763 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1765 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1766 .modes = msm_spm_l2_seq_list,
1767 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1768 },
1769};
1770
Anirudh Ghayal15698162012-07-31 11:51:32 +05301771#define HAP_SHIFT_LVL_OE_GPIO 47
1772#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301773#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1774#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1775
1776static struct msm_xo_voter *xo_handle_d1;
1777
1778static int isa1200_power(int on)
1779{
1780 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301781 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301782
Anirudh Ghayal15698162012-07-31 11:51:32 +05301783 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1784 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1785
1786
1787 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301788
1789 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1790 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1791 if (rc < 0) {
1792 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1793 __func__, on ? "" : "de-", rc);
1794 goto err_xo_vote;
1795 }
1796
1797 return 0;
1798
1799err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301800 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301801 return rc;
1802}
1803
1804static int isa1200_dev_setup(bool enable)
1805{
1806 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301807 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301808
1809 struct pm_gpio hap_gpio_config = {
1810 .direction = PM_GPIO_DIR_OUT,
1811 .pull = PM_GPIO_PULL_NO,
1812 .out_strength = PM_GPIO_STRENGTH_HIGH,
1813 .function = PM_GPIO_FUNC_NORMAL,
1814 .inv_int_pol = 0,
1815 .vin_sel = 2,
1816 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1817 .output_value = 0,
1818 };
1819
Anirudh Ghayal15698162012-07-31 11:51:32 +05301820 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1821 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1822
Mohan Pallaka5e490392011-09-09 15:18:41 +05301823 if (enable == true) {
1824 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1825 if (rc) {
1826 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1827 __func__, PM_HAP_EN_GPIO, rc);
1828 return rc;
1829 }
1830
1831 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1832 if (rc) {
1833 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1834 __func__, PM_HAP_LEN_GPIO, rc);
1835 return rc;
1836 }
1837
Anirudh Ghayal15698162012-07-31 11:51:32 +05301838 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301839 if (rc) {
1840 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301841 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301842 return rc;
1843 }
1844
Anirudh Ghayal15698162012-07-31 11:51:32 +05301845 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301846 if (rc) {
1847 pr_err("%s: Unable to set direction\n", __func__);
1848 goto free_gpio;
1849 }
1850
1851 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1852 if (IS_ERR(xo_handle_d1)) {
1853 rc = PTR_ERR(xo_handle_d1);
1854 pr_err("%s: failed to get the handle for D1(%d)\n",
1855 __func__, rc);
1856 goto gpio_set_dir;
1857 }
1858 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301859 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301860
1861 msm_xo_put(xo_handle_d1);
1862 }
1863
1864 return 0;
1865
1866gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301867 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301868free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301869 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301870 return rc;
1871}
1872
1873static struct isa1200_regulator isa1200_reg_data[] = {
1874 {
1875 .name = "vcc_i2c",
1876 .min_uV = ISA_I2C_VTG_MIN_UV,
1877 .max_uV = ISA_I2C_VTG_MAX_UV,
1878 .load_uA = ISA_I2C_CURR_UA,
1879 },
1880};
1881
1882static struct isa1200_platform_data isa1200_1_pdata = {
1883 .name = "vibrator",
1884 .dev_setup = isa1200_dev_setup,
1885 .power_on = isa1200_power,
1886 .hap_en_gpio = PM_HAP_EN_GPIO,
1887 .hap_len_gpio = PM_HAP_LEN_GPIO,
1888 .max_timeout = 15000,
1889 .mode_ctrl = PWM_GEN_MODE,
1890 .pwm_fd = {
1891 .pwm_div = 256,
1892 },
1893 .is_erm = false,
1894 .smart_en = true,
1895 .ext_clk_en = true,
1896 .chip_en = 1,
1897 .regulator_info = isa1200_reg_data,
1898 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1899};
1900
1901static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1902 {
1903 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301904 },
1905};
1906
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907#define CYTTSP_TS_GPIO_IRQ 11
1908#define CYTTSP_TS_SLEEP_GPIO 50
1909#define CYTTSP_TS_RESOUT_N_GPIO 52
1910
1911/*virtual key support */
1912static ssize_t tma340_vkeys_show(struct kobject *kobj,
1913 struct kobj_attribute *attr, char *buf)
1914{
1915 return snprintf(buf, 200,
1916 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1917 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1918 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1919 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1920 "\n");
1921}
1922
1923static struct kobj_attribute tma340_vkeys_attr = {
1924 .attr = {
1925 .mode = S_IRUGO,
1926 },
1927 .show = &tma340_vkeys_show,
1928};
1929
1930static struct attribute *tma340_properties_attrs[] = {
1931 &tma340_vkeys_attr.attr,
1932 NULL
1933};
1934
1935static struct attribute_group tma340_properties_attr_group = {
1936 .attrs = tma340_properties_attrs,
1937};
1938
1939
1940static int cyttsp_platform_init(struct i2c_client *client)
1941{
1942 int rc = 0;
1943 static struct kobject *tma340_properties_kobj;
1944
1945 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1946 tma340_properties_kobj = kobject_create_and_add("board_properties",
1947 NULL);
1948 if (tma340_properties_kobj)
1949 rc = sysfs_create_group(tma340_properties_kobj,
1950 &tma340_properties_attr_group);
1951 if (!tma340_properties_kobj || rc)
1952 pr_err("%s: failed to create board_properties\n",
1953 __func__);
1954
1955 return 0;
1956}
1957
1958static struct cyttsp_regulator regulator_data[] = {
1959 {
1960 .name = "vdd",
1961 .min_uV = CY_TMA300_VTG_MIN_UV,
1962 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301963 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1964 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001965 },
1966 /* TODO: Remove after runtime PM is enabled in I2C driver */
1967 {
1968 .name = "vcc_i2c",
1969 .min_uV = CY_I2C_VTG_MIN_UV,
1970 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301971 .hpm_load_uA = CY_I2C_CURR_UA,
1972 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001973 },
1974};
1975
1976static struct cyttsp_platform_data cyttsp_pdata = {
1977 .panel_maxx = 634,
1978 .panel_maxy = 1166,
1979 .disp_maxx = 616,
1980 .disp_maxy = 1023,
1981 .disp_minx = 0,
1982 .disp_miny = 16,
1983 .flags = 0x01,
1984 .gen = CY_GEN3, /* or */
1985 .use_st = CY_USE_ST,
1986 .use_mt = CY_USE_MT,
1987 .use_hndshk = CY_SEND_HNDSHK,
1988 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05301989 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001990 .use_gestures = CY_USE_GESTURES,
1991 .fw_fname = "cyttsp_8960_cdp.hex",
1992 /* activate up to 4 groups
1993 * and set active distance
1994 */
1995 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
1996 CY_GEST_GRP3 | CY_GEST_GRP4 |
1997 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07001998 .act_intrvl = 10,
1999 .tch_tmout = 200,
2000 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002001 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2002 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2003 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2004 .regulator_info = regulator_data,
2005 .num_regulators = ARRAY_SIZE(regulator_data),
2006 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302007 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002008};
2009
2010static struct i2c_board_info cyttsp_info[] __initdata = {
2011 {
2012 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2013 .platform_data = &cyttsp_pdata,
2014#ifndef CY_USE_TIMER
2015 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2016#endif /* CY_USE_TIMER */
2017 },
2018};
2019
Jing Lindc4413c2012-01-16 15:22:52 -08002020/* configuration data for mxt1386 */
2021static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05302022 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002023 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302024 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002025 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002026 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2027 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2029 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2030 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2031 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302032 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002033 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302034 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002035 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302036 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002037 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2038 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2039 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2040 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302041 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002042 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2043 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302044 /* T18 Object */
2045 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302046 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002047 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2048 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302049 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002050 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2051 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302052 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002053 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2054 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302055 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002056 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302057 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002058 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302059 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002060 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302061 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002062 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302063 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002064 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302065};
2066
Jing Lin33b007d2011-12-21 17:40:23 -08002067/* configuration data for mxt1386e using V1.0 firmware */
2068static const u8 mxt1386e_config_data_v1_0[] = {
2069 /* T6 Object */
2070 0, 0, 0, 0, 0, 0,
2071 /* T38 Object */
2072 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2075 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2076 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2077 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2078 0, 0, 0, 0,
2079 /* T7 Object */
2080 100, 16, 50,
2081 /* T8 Object */
2082 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2083 /* T9 Object */
2084 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2085 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2086 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2087 10, 5, 0, 0, 0,
2088 /* T18 Object */
2089 0, 0,
2090 /* T24 Object */
2091 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2092 0, 0, 0, 0, 0, 0, 0, 0, 0,
2093 /* T25 Object */
2094 3, 0, 60, 115, 156, 99,
2095 /* T27 Object */
2096 0, 0, 0, 0, 0, 0, 0,
2097 /* T40 Object */
2098 0, 0, 0, 0, 0,
2099 /* T42 Object */
2100 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2101 /* T43 Object */
2102 0, 0, 0, 0, 0, 0, 0,
2103 /* T46 Object */
2104 64, 0, 20, 20, 0, 0, 0, 0, 0,
2105 /* T47 Object */
2106 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2107 /* T48 Object */
2108 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2109 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2110 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2111 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2113 0, 0, 0, 0,
2114 /* T56 Object */
2115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2119 2, 99, 33,
2120};
2121
2122/* configuration data for mxt1386e using V2.1 firmware */
2123static const u8 mxt1386e_config_data_v2_1[] = {
2124 /* T6 Object */
2125 0, 0, 0, 0, 0, 0,
2126 /* T38 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002127 12, 4, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002128 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2129 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2130 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2132 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2133 0, 0, 0, 0,
2134 /* T7 Object */
2135 100, 16, 50,
2136 /* T8 Object */
2137 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2138 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002139 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002140 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002141 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2142 10, 5, 0, 0, 0,
2143 /* T18 Object */
2144 0, 0,
2145 /* T24 Object */
2146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2147 0, 0, 0, 0, 0, 0, 0, 0, 0,
2148 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002149 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002150 /* T27 Object */
2151 0, 0, 0, 0, 0, 0, 0,
2152 /* T40 Object */
2153 0, 0, 0, 0, 0,
2154 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002155 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002156 /* T43 Object */
2157 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2158 16,
2159 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002160 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002161 /* T47 Object */
2162 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2163 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002164 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002165 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2166 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2167 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2168 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2169 0, 0, 0, 0,
2170 /* T56 Object */
2171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2172 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2173 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2174 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2175 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2176 255,
2177};
2178
Jing Lineec88ca2012-02-08 11:18:30 -08002179/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2180static const u8 mxt1386e_config_data_3d[] = {
2181 /* T6 Object */
2182 0, 0, 0, 0, 0, 0,
2183 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002184 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2186 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2187 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2188 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2189 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2190 0, 0, 0, 0,
2191 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002192 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002193 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002194 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002195 /* T9 Object */
2196 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2197 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002198 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2199 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002200 /* T18 Object */
2201 0, 0,
2202 /* T24 Object */
2203 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2204 0, 0, 0, 0, 0, 0, 0, 0, 0,
2205 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002206 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002207 /* T27 Object */
2208 0, 0, 0, 0, 0, 0, 0,
2209 /* T40 Object */
2210 0, 0, 0, 0, 0,
2211 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002213 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2215 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002216 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002217 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002218 /* T47 Object */
2219 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2220 /* T48 Object */
2221 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002222 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2223 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2224 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2226 0, 0, 0, 0,
2227 /* T56 Object */
2228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2229 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2230 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002232 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2233 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002234};
2235
Amy Maloche08266db2011-11-04 11:07:16 -07002236#define MXT_TS_GPIO_IRQ 11
2237#define MXT_TS_LDO_EN_GPIO 50
2238#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302239
2240static void mxt_init_hw_liquid(void)
2241{
2242 int rc;
2243
Mohan Pallaka50837382011-09-07 11:00:57 +05302244 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2245 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002246 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2247 __func__, MXT_TS_LDO_EN_GPIO);
2248 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302249 }
2250
2251 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2252 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002253 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2254 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302255 goto err_ldo_gpio_req;
2256 }
2257
Mohan Pallaka50837382011-09-07 11:00:57 +05302258 return;
2259
Mohan Pallaka50837382011-09-07 11:00:57 +05302260err_ldo_gpio_req:
2261 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302262}
2263
Jing Lineec88ca2012-02-08 11:18:30 -08002264static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002265 {
2266 .config = mxt1386_config_data,
2267 .config_length = ARRAY_SIZE(mxt1386_config_data),
2268 .family_id = 0xA0,
2269 .variant_id = 0x0,
2270 .version = 0x10,
2271 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002272 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002273 },
Jing Lin33b007d2011-12-21 17:40:23 -08002274 {
2275 .config = mxt1386e_config_data_v1_0,
2276 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2277 .family_id = 0xA0,
2278 .variant_id = 0x2,
2279 .version = 0x10,
2280 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002281 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002282 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002283 },
2284 {
2285 .config = mxt1386e_config_data_v2_1,
2286 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2287 .family_id = 0xA0,
2288 .variant_id = 0x7,
2289 .version = 0x21,
2290 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002291 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002292 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2293 },
2294 {
2295 /* The config data for V2.2.AA is the same as for V2.1.AA */
2296 .config = mxt1386e_config_data_v2_1,
2297 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2298 .family_id = 0xA0,
2299 .variant_id = 0x7,
2300 .version = 0x22,
2301 .build = 0xAA,
2302 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002303 },
Jing Lindc4413c2012-01-16 15:22:52 -08002304};
2305
Jing Lineec88ca2012-02-08 11:18:30 -08002306static struct mxt_platform_data mxt_platform_data_2d = {
2307 .config_array = mxt_config_array_2d,
2308 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002309 .panel_minx = 0,
2310 .panel_maxx = 1365,
2311 .panel_miny = 0,
2312 .panel_maxy = 767,
2313 .disp_minx = 0,
2314 .disp_maxx = 1365,
2315 .disp_miny = 0,
2316 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302317 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002318 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002319 .reset_gpio = MXT_TS_RESET_GPIO,
2320 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302321};
2322
Jing Lineec88ca2012-02-08 11:18:30 -08002323static struct mxt_config_info mxt_config_array_3d[] = {
2324 {
2325 .config = mxt1386e_config_data_3d,
2326 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2327 .family_id = 0xA0,
2328 .variant_id = 0x7,
2329 .version = 0x21,
2330 .build = 0xAA,
2331 },
2332};
2333
2334static struct mxt_platform_data mxt_platform_data_3d = {
2335 .config_array = mxt_config_array_3d,
2336 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002337 .panel_minx = 0,
2338 .panel_maxx = 1919,
2339 .panel_miny = 0,
2340 .panel_maxy = 1199,
2341 .disp_minx = 0,
2342 .disp_maxx = 1919,
2343 .disp_miny = 0,
2344 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002345 .irqflags = IRQF_TRIGGER_FALLING,
2346 .i2c_pull_up = true,
2347 .reset_gpio = MXT_TS_RESET_GPIO,
2348 .irq_gpio = MXT_TS_GPIO_IRQ,
2349};
2350
Mohan Pallaka50837382011-09-07 11:00:57 +05302351static struct i2c_board_info mxt_device_info[] __initdata = {
2352 {
2353 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302354 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2355 },
2356};
2357
Manoj Rao14648742012-03-30 19:42:12 -07002358static struct msm_mhl_platform_data mhl_platform_data = {
2359 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002360 .gpio_mhl_int = MHL_GPIO_INT,
2361 .gpio_mhl_reset = MHL_GPIO_RESET,
2362 .gpio_mhl_power = 0,
2363 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002364};
Manoj Rao14648742012-03-30 19:42:12 -07002365
Eugene Yasmand2316b82011-12-07 18:23:48 +02002366static struct i2c_board_info sii_device_info[] __initdata = {
2367 {
Manoj Rao14648742012-03-30 19:42:12 -07002368#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2369 /*
2370 * keeps SI 8334 as the default
2371 * MHL TX
2372 */
2373 I2C_BOARD_INFO("sii8334", 0x39),
2374 .platform_data = &mhl_platform_data,
2375#endif
2376#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002377 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002378 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002379#endif /* CONFIG_MSM_HDMI_MHL */
2380 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002381 },
2382};
2383
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002384static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2385 .clk_freq = 100000,
2386 .src_clk_rate = 24000000,
Kiran Gundab4696c72012-08-16 18:37:46 +05302387 .keep_ahb_clk_on = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002388};
2389
2390static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2391 .clk_freq = 100000,
2392 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002393};
2394
2395static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2396 .clk_freq = 100000,
2397 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002398};
2399
2400static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2401 .clk_freq = 100000,
2402 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002403};
2404
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002405static struct ks8851_pdata spi_eth_pdata = {
2406 .irq_gpio = KS8851_IRQ_GPIO,
2407 .rst_gpio = KS8851_RST_GPIO,
2408};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002409
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302410static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002411 {
2412 .modalias = "ks8851",
2413 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2414 .max_speed_hz = 19200000,
2415 .bus_num = 0,
2416 .chip_select = 0,
2417 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002418 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002419 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302420};
2421static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002422 {
2423 .modalias = "dsi_novatek_3d_panel_spi",
2424 .max_speed_hz = 10800000,
2425 .bus_num = 0,
2426 .chip_select = 1,
2427 .mode = SPI_MODE_0,
2428 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002429};
2430
2431static struct platform_device msm_device_saw_core0 = {
2432 .name = "saw-regulator",
2433 .id = 0,
2434 .dev = {
2435 .platform_data = &msm_saw_regulator_pdata_s5,
2436 },
2437};
2438
2439static struct platform_device msm_device_saw_core1 = {
2440 .name = "saw-regulator",
2441 .id = 1,
2442 .dev = {
2443 .platform_data = &msm_saw_regulator_pdata_s6,
2444 },
2445};
2446
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002447static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002448 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002449 .tsens_factor = 1000,
2450 .hw_type = MSM_8960,
2451 .tsens_num_sensor = 5,
2452};
2453
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002454static struct platform_device msm_tsens_device = {
2455 .name = "tsens8960-tm",
2456 .id = -1,
2457};
2458
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002459static struct msm_thermal_data msm_thermal_pdata = {
2460 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002461 .poll_ms = 250,
2462 .limit_temp_degC = 60,
2463 .temp_hysteresis_degC = 10,
2464 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002465};
2466
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002467#ifdef CONFIG_MSM_FAKE_BATTERY
2468static struct platform_device fish_battery_device = {
2469 .name = "fish_battery",
2470};
2471#endif
2472
David Collins26f05562011-06-20 09:56:28 -07002473static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002474 .name = GPIO_REGULATOR_DEV_NAME,
2475 .id = PM8921_MPP_PM_TO_SYS(7),
2476 .dev = {
2477 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2478 },
2479};
2480
David Collins26f05562011-06-20 09:56:28 -07002481static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002482 .name = GPIO_REGULATOR_DEV_NAME,
2483 .id = 91,
2484 .dev = {
2485 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2486 },
2487};
2488
David Collinsb10be1d2011-09-02 10:29:31 -07002489static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2490 .name = GPIO_REGULATOR_DEV_NAME,
2491 .id = PM8921_GPIO_PM_TO_SYS(17),
2492 .dev = {
2493 .platform_data =
2494 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2495 },
2496};
2497
David Collins35a78f52011-12-14 15:54:25 -08002498static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2499 .name = GPIO_REGULATOR_DEV_NAME,
2500 .id = PM8921_GPIO_PM_TO_SYS(42),
2501 .dev = {
2502 .platform_data =
2503 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2504 },
2505};
2506
David Collins26f05562011-06-20 09:56:28 -07002507static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2508 .name = "rpm-regulator",
2509 .id = -1,
2510 .dev = {
2511 .platform_data = &msm_rpm_regulator_pdata,
2512 },
2513};
Mayank Ranae009c922012-03-22 03:02:06 +05302514#ifdef CONFIG_SERIAL_MSM_HS
2515static int configure_uart_gpios(int on)
2516{
2517 int ret = 0, i;
2518 int uart_gpios[] = {93, 94, 95, 96};
2519
2520 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2521 if (on) {
2522 ret = gpio_request(uart_gpios[i], NULL);
2523 if (ret) {
2524 pr_err("%s: unable to request uart gpio[%d]\n",
2525 __func__, uart_gpios[i]);
2526 break;
2527 }
2528 } else {
2529 gpio_free(uart_gpios[i]);
2530 }
2531 }
2532
2533 if (ret && on && i)
2534 for (; i >= 0; i--)
2535 gpio_free(uart_gpios[i]);
2536 return ret;
2537}
2538
2539static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002540 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302541};
Mayank Rana1f02d952012-07-04 19:11:20 +05302542
2543static int configure_gsbi8_uart_gpios(int on)
2544{
2545 int ret = 0, i;
2546 int uart_gpios[] = {34, 35, 36, 37};
2547
2548 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2549 if (on) {
2550 ret = gpio_request(uart_gpios[i], NULL);
2551 if (ret) {
2552 pr_err("%s: unable to request uart gpio[%d]\n",
2553 __func__, uart_gpios[i]);
2554 break;
2555 }
2556 } else {
2557 gpio_free(uart_gpios[i]);
2558 }
2559 }
2560
2561 if (ret && on && i)
2562 for (; i >= 0; i--)
2563 gpio_free(uart_gpios[i]);
2564 return ret;
2565}
2566
2567static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2568 .gpio_config = configure_gsbi8_uart_gpios,
2569};
Mayank Ranae009c922012-03-22 03:02:06 +05302570#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302571static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302572static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2573#endif
David Collins26f05562011-06-20 09:56:28 -07002574
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302575#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002576enum WLANBT_STATUS {
2577 WLANOFF_BTOFF = 1,
2578 WLANOFF_BTON,
2579 WLANON_BTOFF,
2580 WLANON_BTON
2581};
2582
2583static DEFINE_MUTEX(ath_wlanbt_mutex);
2584static int gpio_wlan_sys_rest_en = 26;
2585static int ath_wlanbt_status = WLANOFF_BTOFF;
2586
2587static int ath6kl_power_control(int on)
2588{
2589 int rc;
2590
2591 if (on) {
2592 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2593 if (rc) {
2594 pr_err("%s: unable to request gpio %d (%d)\n",
2595 __func__, gpio_wlan_sys_rest_en, rc);
2596 return rc;
2597 }
2598 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2599 msleep(200);
2600 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2601 msleep(100);
2602 } else {
2603 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2604 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2605 msleep(100);
2606 gpio_free(gpio_wlan_sys_rest_en);
2607 }
2608 return 0;
2609};
2610
2611static int ath6kl_wlan_power(int on)
2612{
2613 int ret = 0;
2614
2615 mutex_lock(&ath_wlanbt_mutex);
2616 if (on) {
2617 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2618 ret = ath6kl_power_control(1);
2619 ath_wlanbt_status = WLANON_BTOFF;
2620 } else if (ath_wlanbt_status == WLANOFF_BTON)
2621 ath_wlanbt_status = WLANON_BTON;
2622 } else {
2623 if (ath_wlanbt_status == WLANON_BTOFF) {
2624 ret = ath6kl_power_control(0);
2625 ath_wlanbt_status = WLANOFF_BTOFF;
2626 } else if (ath_wlanbt_status == WLANON_BTON)
2627 ath_wlanbt_status = WLANOFF_BTON;
2628 }
2629 mutex_unlock(&ath_wlanbt_mutex);
2630 pr_debug("%s on= %d, wlan_status= %d\n",
2631 __func__, on, ath_wlanbt_status);
2632 return ret;
2633};
2634
2635static struct wifi_platform_data ath6kl_wifi_control = {
2636 .set_power = ath6kl_wlan_power,
2637};
2638
2639static struct platform_device msm_wlan_power_device = {
2640 .name = "ath6kl_power",
2641 .dev = {
2642 .platform_data = &ath6kl_wifi_control,
2643 },
2644};
2645
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302646static struct resource bluesleep_resources[] = {
2647 {
2648 .name = "gpio_host_wake",
2649 .start = 27,
2650 .end = 27,
2651 .flags = IORESOURCE_IO,
2652 },
2653 {
2654 .name = "gpio_ext_wake",
2655 .start = 29,
2656 .end = 29,
2657 .flags = IORESOURCE_IO,
2658 },
2659 {
2660 .name = "host_wake",
2661 .start = MSM_GPIO_TO_INT(27),
2662 .end = MSM_GPIO_TO_INT(27),
2663 .flags = IORESOURCE_IRQ,
2664 },
2665};
2666
2667static struct platform_device msm_bluesleep_device = {
2668 .name = "bluesleep",
2669 .id = -1,
2670 .num_resources = ARRAY_SIZE(bluesleep_resources),
2671 .resource = bluesleep_resources,
2672};
2673
2674static struct platform_device msm_bt_power_device = {
2675 .name = "bt_power",
2676};
2677
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002678static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302679
2680static int bluetooth_power(int on)
2681{
2682 int rc;
2683
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002684 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302685 if (on) {
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002686 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2687 ath6kl_power_control(1);
2688 ath_wlanbt_status = WLANOFF_BTON;
2689 } else if (ath_wlanbt_status == WLANON_BTOFF)
2690 ath_wlanbt_status = WLANON_BTON;
2691
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302692 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2693 if (rc) {
2694 pr_err("%s: unable to request gpio %d (%d)\n",
2695 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002696 mutex_unlock(&ath_wlanbt_mutex);
2697 return rc;
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302698 }
2699 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002700 msleep(20);
2701 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302702 msleep(100);
2703 } else {
2704 gpio_set_value(gpio_bt_sys_rest_en, 0);
2705 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2706 msleep(100);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002707 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302708
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002709 if (ath_wlanbt_status == WLANOFF_BTON) {
2710 ath6kl_power_control(0);
2711 ath_wlanbt_status = WLANOFF_BTOFF;
2712 } else if (ath_wlanbt_status == WLANON_BTON)
2713 ath_wlanbt_status = WLANON_BTOFF;
2714 }
2715 mutex_unlock(&ath_wlanbt_mutex);
2716 pr_debug("%s on= %d, wlan_status= %d\n",
2717 __func__, on, ath_wlanbt_status);
2718 return 0;
2719};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302720
2721static void __init bt_power_init(void)
2722{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302723 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302724 return;
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002725};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302726#else
2727#define bt_power_init(x) do {} while (0)
2728#endif
2729
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002730static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002731 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002732 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302733 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002734 &msm_device_saw_core0,
2735 &msm_device_saw_core1,
2736 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002737 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002738 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002739 &msm8960_device_qup_spi_gsbi1,
2740 &msm8960_device_qup_i2c_gsbi3,
2741 &msm8960_device_qup_i2c_gsbi4,
2742 &msm8960_device_qup_i2c_gsbi10,
2743#ifndef CONFIG_MSM_DSPS
2744 &msm8960_device_qup_i2c_gsbi12,
2745#endif
2746 &msm_slim_ctrl,
2747 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302748#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2749 &msm_bluesleep_device,
2750 &msm_bt_power_device,
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002751 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302752#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002753#if defined(CONFIG_QSEECOM)
2754 &qseecom_device,
2755#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002756#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2757 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2758 &qcrypto_device,
2759#endif
2760
2761#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2762 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2763 &qcedev_device,
2764#endif
2765#ifdef CONFIG_MSM_ROTATOR
2766 &msm_rotator_device,
2767#endif
2768 &msm_device_sps,
2769#ifdef CONFIG_MSM_FAKE_BATTERY
2770 &fish_battery_device,
2771#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002772 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002773#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002774#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002775 &msm8960_android_pmem_device,
2776 &msm8960_android_pmem_adsp_device,
2777 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002778#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002779#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002780 &msm_device_bam_dmux,
2781 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002782#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2783#ifdef CONFIG_MSM_USE_TSIF1
2784 &msm_device_tsif[1],
2785#else
2786 &msm_device_tsif[0],
2787#endif
2788#endif
Joel Nider266a2642011-10-16 10:58:05 +02002789 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002790#ifdef CONFIG_HW_RANDOM_MSM
2791 &msm_device_rng,
2792#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002793#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002794 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002795#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002796 &msm8960_rpm_device,
2797 &msm8960_rpm_log_device,
2798 &msm8960_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302799 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002800 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002801 &coresight_tpiu_device,
2802 &coresight_etb_device,
2803 &coresight_funnel_device,
2804 &coresight_etm0_device,
2805 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002806 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002807 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002808 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002809 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002810 &msm8960_device_ebi1_ch0_erp,
2811 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002812 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002813 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002814 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002815};
2816
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002817static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002818 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002819 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002820 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002821 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002822 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002823 &msm8960_device_otg,
2824 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002825 &msm_device_hsusb_host,
2826 &android_usb_device,
2827 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002828 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002829 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002830 &msm_pcm_routing,
2831 &msm_cpudai0,
2832 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002833 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002834 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002835 &msm_cpudai_hdmi_rx,
2836 &msm_cpudai_bt_rx,
2837 &msm_cpudai_bt_tx,
2838 &msm_cpudai_fm_rx,
2839 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002840 &msm_cpudai_auxpcm_rx,
2841 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002842 &msm_cpu_fe,
2843 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002844#ifdef CONFIG_MSM_GEMINI
2845 &msm8960_gemini_device,
2846#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002847#ifdef CONFIG_MSM_MERCURY
2848 &msm8960_mercury_device,
2849#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002850 &msm_voice,
2851 &msm_voip,
2852 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302853 &msm_cpudai_afe_01_rx,
2854 &msm_cpudai_afe_01_tx,
2855 &msm_cpudai_afe_02_rx,
2856 &msm_cpudai_afe_02_tx,
2857 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302858 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002859 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002860 &msm_cpudai_incall_record_rx,
2861 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002862 &msm_pcm_hostless,
2863 &msm_bus_apps_fabric,
2864 &msm_bus_sys_fabric,
2865 &msm_bus_mm_fabric,
2866 &msm_bus_sys_fpb,
2867 &msm_bus_cpss_fpb,
2868};
2869
2870static void __init msm8960_i2c_init(void)
2871{
2872 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2873 &msm8960_i2c_qup_gsbi4_pdata;
2874
2875 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2876 &msm8960_i2c_qup_gsbi3_pdata;
2877
2878 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2879 &msm8960_i2c_qup_gsbi10_pdata;
2880
2881 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2882 &msm8960_i2c_qup_gsbi12_pdata;
2883}
2884
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002885static void __init msm8960_gfx_init(void)
2886{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002887 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2888 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002889 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002890
Carter Cooper3852cbb2012-08-20 22:11:42 -06002891 /* Fixup data that needs to change based on GPU ID */
Carter Cooperffe7ea12012-08-22 13:27:58 -06002892 if (cpu_is_msm8960ab()) {
2893 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Carter Cooper3852cbb2012-08-20 22:11:42 -06002894 /* 8960PRO nominal clock rate is 325Mhz instead of 320Mhz */
2895 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 325000000;
2896 } else {
2897 kgsl_3d0_pdata->iommu_count = 1;
2898 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2899 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2900 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2901 }
2902 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2903 /* 8960v3 GPU registers returns 5 for patch release
2904 * but it should be 6, so dummy up the chipid here
2905 * based the platform type
2906 */
2907 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2908 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002909 }
Carter Cooper6307eb992012-08-20 15:17:23 -06002910
2911 /* Register the 3D core */
2912 platform_device_register(&msm_kgsl_3d0);
2913
2914 /* Register the 2D cores if we are not 8960PRO */
2915 if (!cpu_is_msm8960ab()) {
2916 platform_device_register(&msm_kgsl_2d0);
2917 platform_device_register(&msm_kgsl_2d1);
2918 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002919}
2920
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302921static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002922 {
2923 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2924 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2925 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002926 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002927 },
2928
2929 {
2930 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2931 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2932 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002933 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002934 },
2935
2936 {
2937 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2938 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2939 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002940 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002941 },
2942
2943 {
2944 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002945 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2946 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002947 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002948 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002949
2950 {
2951 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2952 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2953 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002954 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002955 },
2956
2957 {
2958 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2959 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2960 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002961 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002962 },
2963
2964 {
2965 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2966 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2967 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002968 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002969 },
2970
2971 {
2972 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2973 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2974 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002975 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002976 },
2977};
2978
Praveen Chidambaram78499012011-11-01 17:15:17 -06002979static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2980 .levels = &msm_rpmrs_levels[0],
2981 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2982 .vdd_mem_levels = {
2983 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2984 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2985 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2986 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2987 },
2988 .vdd_dig_levels = {
2989 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2990 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2991 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2992 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2993 },
2994 .vdd_mask = 0x7FFFFF,
2995 .rpmrs_target_id = {
2996 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2997 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2998 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2999 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
3000 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
3001 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
3002 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
3003 },
3004};
3005
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003006static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
3007 .mode = MSM_PM_BOOT_CONFIG_TZ,
3008};
3009
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003010#ifdef CONFIG_I2C
3011#define I2C_SURF 1
3012#define I2C_FFA (1 << 1)
3013#define I2C_RUMI (1 << 2)
3014#define I2C_SIM (1 << 3)
3015#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003016#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003017
3018struct i2c_registry {
3019 u8 machs;
3020 int bus;
3021 struct i2c_board_info *info;
3022 int len;
3023};
3024
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003025/* Sensors DSPS platform data */
3026#ifdef CONFIG_MSM_DSPS
3027#define DSPS_PIL_GENERIC_NAME "dsps"
3028#endif /* CONFIG_MSM_DSPS */
3029
3030static void __init msm8960_init_dsps(void)
3031{
3032#ifdef CONFIG_MSM_DSPS
3033 struct msm_dsps_platform_data *pdata =
3034 msm_dsps_device.dev.platform_data;
3035 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3036 pdata->gpios = NULL;
3037 pdata->gpios_num = 0;
3038
3039 platform_device_register(&msm_dsps_device);
3040#endif /* CONFIG_MSM_DSPS */
3041}
3042
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003043static int hsic_peripheral_status = 1;
3044static DEFINE_MUTEX(hsic_status_lock);
3045
3046void peripheral_connect()
3047{
3048 mutex_lock(&hsic_status_lock);
3049 if (hsic_peripheral_status)
3050 goto out;
3051 platform_device_add(&msm_device_hsic_host);
3052 hsic_peripheral_status = 1;
3053out:
3054 mutex_unlock(&hsic_status_lock);
3055}
3056EXPORT_SYMBOL(peripheral_connect);
3057
3058void peripheral_disconnect()
3059{
3060 mutex_lock(&hsic_status_lock);
3061 if (!hsic_peripheral_status)
3062 goto out;
3063 platform_device_del(&msm_device_hsic_host);
3064 hsic_peripheral_status = 0;
3065out:
3066 mutex_unlock(&hsic_status_lock);
3067}
3068EXPORT_SYMBOL(peripheral_disconnect);
3069
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303070static void __init msm8960_init_smsc_hub(void)
3071{
3072 uint32_t version = socinfo_get_version();
3073
3074 if (SOCINFO_VERSION_MAJOR(version) == 1)
3075 return;
3076
3077 if (machine_is_msm8960_liquid())
3078 platform_device_register(&smsc_hub_device);
3079}
3080
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003081static void __init msm8960_init_hsic(void)
3082{
3083#ifdef CONFIG_USB_EHCI_MSM_HSIC
3084 uint32_t version = socinfo_get_version();
3085
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003086 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003087 return;
3088
Joel King0cbf5d82012-05-24 15:21:38 -07003089 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003090 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003091#endif
3092}
3093
Amir Samuelov5137e392011-09-21 17:31:25 +03003094#ifdef CONFIG_ISL9519_CHARGER
3095static struct isl_platform_data isl_data __initdata = {
3096 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3097 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3098 .max_system_voltage = 4200,
3099 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003100 .chgcurrent = 1900,
3101 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003102 .input_current = 2048,
3103};
3104
3105static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3106 {
3107 I2C_BOARD_INFO("isl9519q", 0x9),
3108 .irq = 0, /* Not required when notify-by-pmic */
3109 .platform_data = &isl_data,
3110 },
3111};
3112#endif /* CONFIG_ISL9519_CHARGER */
3113
Amir Samuelov755616d2011-12-13 16:34:46 +02003114static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3115 {
3116 I2C_BOARD_INFO("sx1508q", 0x20),
3117 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3118 },
3119};
3120
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003121static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003122#ifdef CONFIG_ISL9519_CHARGER
3123 {
3124 I2C_LIQUID,
3125 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3126 isl_charger_i2c_info,
3127 ARRAY_SIZE(isl_charger_i2c_info),
3128 },
3129#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003130 {
3131 I2C_SURF | I2C_FFA | I2C_FLUID,
3132 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3133 cyttsp_info,
3134 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003135 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303136 {
3137 I2C_LIQUID,
3138 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3139 mxt_device_info,
3140 ARRAY_SIZE(mxt_device_info),
3141 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303142 {
Manoj Rao14648742012-03-30 19:42:12 -07003143 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303144 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003145 sii_device_info,
3146 ARRAY_SIZE(sii_device_info),
3147 },
3148 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303149 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003150 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303151 msm_isa1200_board_info,
3152 ARRAY_SIZE(msm_isa1200_board_info),
3153 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003154 {
3155 I2C_LIQUID,
3156 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3157 liquid_io_expander_i2c_info,
3158 ARRAY_SIZE(liquid_io_expander_i2c_info),
3159 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003160};
3161#endif /* CONFIG_I2C */
3162
3163static void __init register_i2c_devices(void)
3164{
3165#ifdef CONFIG_I2C
3166 u8 mach_mask = 0;
3167 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003168#ifdef CONFIG_MSM_CAMERA
3169 struct i2c_registry msm8960_camera_i2c_devices = {
3170 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3171 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3172 msm8960_camera_board_info.board_info,
3173 msm8960_camera_board_info.num_i2c_board_info,
3174 };
3175#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003176
3177 /* Build the matching 'supported_machs' bitmask */
3178 if (machine_is_msm8960_cdp())
3179 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003180 else if (machine_is_msm8960_fluid())
3181 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003182 else if (machine_is_msm8960_liquid())
3183 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003184 else if (machine_is_msm8960_mtp())
3185 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003186 else
3187 pr_err("unmatched machine ID in register_i2c_devices\n");
3188
Jing Lineec88ca2012-02-08 11:18:30 -08003189 if (machine_is_msm8960_liquid()) {
3190 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3191 mxt_device_info[0].platform_data =
3192 &mxt_platform_data_3d;
3193 else
3194 mxt_device_info[0].platform_data =
3195 &mxt_platform_data_2d;
3196 }
3197
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003198 /* Run the array and install devices as appropriate */
3199 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3200 if (msm8960_i2c_devices[i].machs & mach_mask)
3201 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3202 msm8960_i2c_devices[i].info,
3203 msm8960_i2c_devices[i].len);
3204 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003205
3206 if (!mhl_platform_data.gpio_mhl_power)
3207 pr_debug("mhl device configured for ext debug board\n");
3208
Kevin Chan09f4e662011-12-16 08:17:02 -08003209#ifdef CONFIG_MSM_CAMERA
3210 if (msm8960_camera_i2c_devices.machs & mach_mask)
3211 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3212 msm8960_camera_i2c_devices.info,
3213 msm8960_camera_i2c_devices.len);
3214#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003215#endif
3216}
3217
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003218static void __init msm8960_tsens_init(void)
3219{
3220 if (cpu_is_msm8960())
3221 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3222 return;
3223
3224 msm_tsens_early_init(&msm_tsens_pdata);
3225}
3226
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003227static void __init msm8960_cdp_init(void)
3228{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003229 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3230 pr_err("meminfo_init() failed!\n");
3231
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003232 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003233 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003234 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003235 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3236 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003237
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003238 regulator_suppress_info_printing();
3239 if (msm_xo_init())
3240 pr_err("Failed to initialize XO votes\n");
David Collins4c93ce92012-09-04 15:44:19 -07003241 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003242 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003243 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303244 if (machine_is_msm8960_liquid())
3245 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003246 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303247 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3248 machine_is_msm8960_cdp()) {
Mayank Ranaa1f507b2012-08-14 10:57:00 +05303249 /* Due to availability of USB Switch in SGLTE Platform
3250 * it requires different HSUSB PHY settings compare to
3251 * 8960 MTP/CDP platform.
3252 */
3253 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3254 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3255 else
3256 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303257 } else if (machine_is_msm8960_liquid()) {
3258 msm_otg_pdata.phy_init_seq =
3259 liquid_v1_phy_init_seq;
3260 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003261 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303262 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303263 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303264 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3265 machine_is_msm8960_liquid())
3266 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003267 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003268 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3269 &msm8960_qup_spi_gsbi1_pdata;
3270 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303271 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3272 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003273
3274 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303275 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
3276 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303277 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003278 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003279 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003280 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3281 msm_spm_l2_init(msm_spm_l2_data);
3282 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003283 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003284 if (machine_is_msm8960_liquid())
3285 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003286 if (machine_is_msm8960_cdp())
3287 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003288
3289 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3290 platform_device_register(&msm8960_device_uart_gsbi8);
3291 else
3292 platform_device_register(&msm8960_device_uart_gsbi5);
3293
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003294 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003295 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3296 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003297 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303298 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003299 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003300
Mayank Rana1f02d952012-07-04 19:11:20 +05303301 /* For 8960 Standalone External Bluetooth Interface */
3302 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3303 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3304 platform_device_register(&msm_device_uart_dm8);
3305 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003306 if (cpu_is_msm8960ab())
3307 platform_device_register(&msm8960ab_device_acpuclk);
3308 else
3309 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003310 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menond4837f62012-08-20 15:25:50 -07003311 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003312
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003313 msm8960_pm8921_gpio_mpp_init();
Stephen Boyd0ea1b762012-09-13 12:41:31 -07003314 /* Don't add modem devices on APQ targets */
3315 if (socinfo_get_id() != 124) {
3316 platform_device_register(&msm_8960_q6_mss_fw);
3317 platform_device_register(&msm_8960_q6_mss_sw);
3318 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003319 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303320 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003321 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003322#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003323 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003324#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003325 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303326 if (machine_is_msm8960_liquid())
3327 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003328 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003329 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003330 slim_register_board_info(msm_slim_devices,
3331 ARRAY_SIZE(msm_slim_devices));
3332 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003333 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003334 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303335 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003336 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3337 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3338 platform_device_register(&mdm_sglte_device);
3339 }
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003340}
3341
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003342MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3343 .map_io = msm8960_map_io,
3344 .reserve = msm8960_reserve,
3345 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303346 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003347 .timer = &msm_timer,
3348 .init_machine = msm8960_cdp_init,
3349 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003350 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003351 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003352MACHINE_END
3353
3354MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3355 .map_io = msm8960_map_io,
3356 .reserve = msm8960_reserve,
3357 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303358 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003359 .timer = &msm_timer,
3360 .init_machine = msm8960_cdp_init,
3361 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003362 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003363 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003364MACHINE_END
3365
3366MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3367 .map_io = msm8960_map_io,
3368 .reserve = msm8960_reserve,
3369 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303370 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003371 .timer = &msm_timer,
3372 .init_machine = msm8960_cdp_init,
3373 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003374 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003375 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003376MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003377
3378MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3379 .map_io = msm8960_map_io,
3380 .reserve = msm8960_reserve,
3381 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303382 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003383 .timer = &msm_timer,
3384 .init_machine = msm8960_cdp_init,
3385 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003386 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003387 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003388MACHINE_END