blob: 87bd82d6af632b53f7e422c0cea12e01580abbaf [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,
Laura Abbott5249a052012-12-11 15:09:03 -0800367 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800368};
369
Laura Abbottb93525f2012-04-12 09:57:19 -0700370static struct ion_cp_heap_pdata cp_mfc_msm8960_ion_pdata = {
Olav Haugan0703dbf2011-12-19 17:53:38 -0800371 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugan42ebe712012-01-10 16:30:58 -0800372 .align = PAGE_SIZE,
Olav Haugan65f4bd82011-12-13 11:50:08 -0800373 .reusable = 0,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800374 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700375 .fixed_position = FIXED_HIGH,
Laura Abbott5249a052012-12-11 15:09:03 -0800376 .no_nonsecure_alloc = 1,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800377};
378
Laura Abbottb93525f2012-04-12 09:57:19 -0700379static struct ion_co_heap_pdata co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800380 .adjacent_mem_id = INVALID_HEAP_ID,
381 .align = PAGE_SIZE,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800382 .mem_is_fmem = 0,
Olav Haugan42ebe712012-01-10 16:30:58 -0800383};
384
Laura Abbottb93525f2012-04-12 09:57:19 -0700385static struct ion_co_heap_pdata fw_co_msm8960_ion_pdata = {
Olav Haugan42ebe712012-01-10 16:30:58 -0800386 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
387 .align = SZ_128K,
Olav Hauganf6dc7742012-02-15 09:11:55 -0800388 .mem_is_fmem = FMEM_ENABLED,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700389 .fixed_position = FIXED_LOW,
Olav Haugan0703dbf2011-12-19 17:53:38 -0800390};
391#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800392
Laura Abbott354d40f2012-08-03 17:32:09 -0700393static u64 msm_dmamask = DMA_BIT_MASK(32);
394
395static struct platform_device ion_mm_heap_device = {
396 .name = "ion-mm-heap-device",
397 .id = -1,
398 .dev = {
399 .dma_mask = &msm_dmamask,
400 .coherent_dma_mask = DMA_BIT_MASK(32),
401 }
402};
403
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800404/**
405 * These heaps are listed in the order they will be allocated. Due to
406 * video hardware restrictions and content protection the FW heap has to
407 * be allocated adjacent (below) the MM heap and the MFC heap has to be
408 * allocated after the MM heap to ensure MFC heap is not more than 256MB
409 * away from the base address of the FW heap.
410 * However, the order of FW heap and MM heap doesn't matter since these
411 * two heaps are taken care of by separate code to ensure they are adjacent
412 * to each other.
413 * Don't swap the order unless you know what you are doing!
414 */
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700415struct ion_platform_heap msm8960_heaps[] = {
Laura Abbottd6183792011-08-19 13:42:24 -0700416 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800417 .id = ION_SYSTEM_HEAP_ID,
Laura Abbottd6183792011-08-19 13:42:24 -0700418 .type = ION_HEAP_TYPE_SYSTEM,
Laura Abbottd6183792011-08-19 13:42:24 -0700419 .name = ION_VMALLOC_HEAP_NAME,
420 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700421#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700422 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800423 .id = ION_CP_MM_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800424 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800425 .name = ION_MM_HEAP_NAME,
426 .size = MSM_ION_MM_SIZE,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700427 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700428 .extra_data = (void *) &cp_mm_msm8960_ion_pdata,
Laura Abbott354d40f2012-08-03 17:32:09 -0700429 .priv = &ion_mm_heap_device.dev,
Laura Abbott2d1760b2011-09-29 21:31:24 -0700430 },
Laura Abbott8c017362011-09-22 20:59:12 -0700431 {
Olav Haugan42ebe712012-01-10 16:30:58 -0800432 .id = ION_MM_FIRMWARE_HEAP_ID,
433 .type = ION_HEAP_TYPE_CARVEOUT,
434 .name = ION_MM_FIRMWARE_HEAP_NAME,
435 .size = MSM_ION_MM_FW_SIZE,
436 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700437 .extra_data = (void *) &fw_co_msm8960_ion_pdata,
Olav Haugan42ebe712012-01-10 16:30:58 -0800438 },
439 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800440 .id = ION_CP_MFC_HEAP_ID,
Olav Haugan0a852512012-01-09 10:20:55 -0800441 .type = ION_HEAP_TYPE_CP,
Olav Hauganb5be7992011-11-18 14:29:02 -0800442 .name = ION_MFC_HEAP_NAME,
443 .size = MSM_ION_MFC_SIZE,
444 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700445 .extra_data = (void *) &cp_mfc_msm8960_ion_pdata,
Olav Hauganb5be7992011-11-18 14:29:02 -0800446 },
Olav Haugan32594552012-03-13 11:40:05 -0700447#ifndef CONFIG_MSM_IOMMU
Olav Hauganb5be7992011-11-18 14:29:02 -0800448 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800449 .id = ION_SF_HEAP_ID,
450 .type = ION_HEAP_TYPE_CARVEOUT,
451 .name = ION_SF_HEAP_NAME,
452 .size = MSM_ION_SF_SIZE,
453 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700454 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800455 },
Olav Haugan32594552012-03-13 11:40:05 -0700456#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800457 {
Olav Hauganb5be7992011-11-18 14:29:02 -0800458 .id = ION_IOMMU_HEAP_ID,
Laura Abbott8c017362011-09-22 20:59:12 -0700459 .type = ION_HEAP_TYPE_IOMMU,
460 .name = ION_IOMMU_HEAP_NAME,
461 },
Olav Haugan80854eb2012-01-12 12:00:23 -0800462 {
463 .id = ION_QSECOM_HEAP_ID,
464 .type = ION_HEAP_TYPE_CARVEOUT,
465 .name = ION_QSECOM_HEAP_NAME,
466 .size = MSM_ION_QSECOM_SIZE,
467 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700468 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan80854eb2012-01-12 12:00:23 -0800469 },
Olav Haugan7355db02012-01-13 16:59:13 -0800470 {
471 .id = ION_AUDIO_HEAP_ID,
472 .type = ION_HEAP_TYPE_CARVEOUT,
473 .name = ION_AUDIO_HEAP_NAME,
474 .size = MSM_ION_AUDIO_SIZE,
475 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700476 .extra_data = (void *) &co_msm8960_ion_pdata,
Olav Haugan7355db02012-01-13 16:59:13 -0800477 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700478#endif
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700479};
480
481static struct ion_platform_data msm8960_ion_pdata = {
482 .nr = MSM_ION_HEAP_NUM,
483 .heaps = msm8960_heaps,
Laura Abbottd6183792011-08-19 13:42:24 -0700484};
485
Laura Abbottb93525f2012-04-12 09:57:19 -0700486static struct platform_device msm8960_ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700487 .name = "ion-msm",
488 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700489 .dev = { .platform_data = &msm8960_ion_pdata },
Laura Abbottd6183792011-08-19 13:42:24 -0700490};
491#endif
492
Laura Abbottb93525f2012-04-12 09:57:19 -0700493struct platform_device msm8960_fmem_device = {
Larry Bassel41a055b2011-12-06 16:15:14 -0800494 .name = "fmem",
495 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700496 .dev = { .platform_data = &msm8960_fmem_pdata },
Larry Bassel41a055b2011-12-06 16:15:14 -0800497};
498
Olav Haugan65f4bd82011-12-13 11:50:08 -0800499static void __init adjust_mem_for_liquid(void)
Laura Abbottd6183792011-08-19 13:42:24 -0700500{
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800501 unsigned int i;
502
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800503 if (!pmem_param_set) {
504 if (machine_is_msm8960_liquid())
505 msm_ion_sf_size = MSM_LIQUID_ION_SF_SIZE;
506
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700507 if (msm8960_hdmi_as_primary_selected())
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800508 msm_ion_sf_size = MSM_HDMI_PRIM_ION_SF_SIZE;
509
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -0700510 if (machine_is_msm8960_liquid() ||
511 msm8960_hdmi_as_primary_selected()) {
Laura Abbottb93525f2012-04-12 09:57:19 -0700512 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
513 if (msm8960_ion_pdata.heaps[i].id ==
514 ION_SF_HEAP_ID) {
515 msm8960_ion_pdata.heaps[i].size =
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800516 msm_ion_sf_size;
517 pr_debug("msm_ion_sf_size 0x%x\n",
518 msm_ion_sf_size);
519 break;
520 }
Ravishangar Kalyanam671f5ce2011-12-06 20:25:29 -0800521 }
522 }
523 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800524}
525
526static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
527 unsigned long size)
528{
529 msm8960_reserve_table[mem_type].size += size;
530}
531
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700532static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
533{
534#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
535 int ret;
536
537 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
538 panic("fixed area size is larger than %dM\n",
539 MAX_FIXED_AREA_SIZE >> 20);
540
541 reserve_info->fixed_area_size = fixed_area_size;
542 reserve_info->fixed_area_start = MSM8960_FW_START;
543
544 ret = memblock_remove(reserve_info->fixed_area_start,
545 reserve_info->fixed_area_size);
546 BUG_ON(ret);
547#endif
548}
549
Olav Haugan65f4bd82011-12-13 11:50:08 -0800550/**
551 * Reserve memory for ION and calculate amount of reusable memory for fmem.
552 * We only reserve memory for heaps that are not reusable. However, we only
553 * support one reusable heap at the moment so we ignore the reusable flag for
554 * other than the first heap with reusable flag set. Also handle special case
Olav Hauganf6dc7742012-02-15 09:11:55 -0800555 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
556 * at a higher address than FW in addition to not more than 256MB away from the
557 * base address of the firmware. This means that if MM is reusable the other
558 * two heaps must be allocated in the same region as FW. This is handled by the
559 * mem_is_fmem flag in the platform data. In addition the MM heap must be
560 * adjacent to the FW heap for content protection purposes.
Olav Haugan65f4bd82011-12-13 11:50:08 -0800561 */
562static void __init reserve_ion_memory(void)
563{
564#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
565 unsigned int i;
Laura Abbott354d40f2012-08-03 17:32:09 -0700566 int ret;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700567 unsigned int fixed_size = 0;
568 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
569 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700570 unsigned long cma_alignment;
571 unsigned int low_use_cma = 0;
572 unsigned int middle_use_cma = 0;
573 unsigned int high_use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800574
575 adjust_mem_for_liquid();
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700576 fixed_low_size = 0;
577 fixed_middle_size = 0;
578 fixed_high_size = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800579
Laura Abbott354d40f2012-08-03 17:32:09 -0700580 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
581
Laura Abbottb93525f2012-04-12 09:57:19 -0700582 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
Olav Haugan8726caf2012-05-10 15:11:35 -0700583 struct ion_platform_heap *heap =
Laura Abbottb93525f2012-04-12 09:57:19 -0700584 &(msm8960_ion_pdata.heaps[i]);
Olav Haugan8726caf2012-05-10 15:11:35 -0700585 int align = SZ_4K;
586 int iommu_map_all = 0;
587 int adjacent_mem_id = INVALID_HEAP_ID;
Laura Abbott354d40f2012-08-03 17:32:09 -0700588 int use_cma = 0;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800589
590 if (heap->extra_data) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700591 int fixed_position = NOT_FIXED;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700592
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700593 switch ((int) heap->type) {
Olav Haugan65f4bd82011-12-13 11:50:08 -0800594 case ION_HEAP_TYPE_CP:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700595 fixed_position = ((struct ion_cp_heap_pdata *)
596 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700597 align = ((struct ion_cp_heap_pdata *)
598 heap->extra_data)->align;
599 iommu_map_all =
600 ((struct ion_cp_heap_pdata *)
601 heap->extra_data)->iommu_map_all;
Laura Abbott354d40f2012-08-03 17:32:09 -0700602 if (((struct ion_cp_heap_pdata *)
603 heap->extra_data)->is_cma) {
604 heap->size = ALIGN(heap->size,
605 cma_alignment);
606 use_cma = 1;
607 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800608 break;
Laura Abbott354d40f2012-08-03 17:32:09 -0700609 case ION_HEAP_TYPE_DMA:
610 use_cma = 1;
611 /* Purposely fall through here */
Olav Haugan65f4bd82011-12-13 11:50:08 -0800612 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700613 fixed_position = ((struct ion_co_heap_pdata *)
614 heap->extra_data)->fixed_position;
Olav Haugan8726caf2012-05-10 15:11:35 -0700615 adjacent_mem_id = ((struct ion_co_heap_pdata *)
616 heap->extra_data)->adjacent_mem_id;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700617 break;
618 default:
619 break;
620 }
621
Olav Haugan8726caf2012-05-10 15:11:35 -0700622 if (iommu_map_all) {
623 if (heap->size & (SZ_64K-1)) {
624 heap->size = ALIGN(heap->size, SZ_64K);
625 pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
626 heap->name, heap->size);
627 }
628 }
629
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700630 if (fixed_position != NOT_FIXED)
631 fixed_size += heap->size;
632 else
633 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
634
Laura Abbott354d40f2012-08-03 17:32:09 -0700635 if (fixed_position == FIXED_LOW) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700636 fixed_low_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700637 low_use_cma = use_cma;
638 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700639 fixed_middle_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700640 middle_use_cma = use_cma;
641 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700642 fixed_high_size += heap->size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700643 high_use_cma = use_cma;
644 } else if (use_cma) {
645 /*
646 * Heaps that use CMA but are not part of the
647 * fixed set. Create wherever.
648 */
649 dma_declare_contiguous(
650 heap->priv,
651 heap->size,
652 0,
653 0xb0000000);
654 }
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700655 }
656 }
657
658 if (!fixed_size)
659 return;
660
Laura Abbott354d40f2012-08-03 17:32:09 -0700661 /*
662 * Given the setup for the fixed area, we can't round up all sizes.
663 * Some sizes must be set up exactly and aligned correctly. Incorrect
664 * alignments are considered a configuration issue
Larry Bassel4d4f4482012-04-04 11:26:09 -0700665 */
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700666
667 fixed_low_start = MSM8960_FIXED_AREA_START;
Laura Abbott354d40f2012-08-03 17:32:09 -0700668 if (low_use_cma) {
669 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
670 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
671 } else {
672 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
673 ret = memblock_remove(fixed_low_start,
674 fixed_low_size + HOLE_SIZE);
675 BUG_ON(ret);
676 }
677
Deepak Kotur35825522012-06-06 15:49:14 -0700678 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott354d40f2012-08-03 17:32:09 -0700679 if (middle_use_cma) {
680 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
681 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
682 } else {
683 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
684 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
685 BUG_ON(ret);
686 }
687
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700688 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott354d40f2012-08-03 17:32:09 -0700689 if (high_use_cma) {
690 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
691 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
692 } else {
693 /* This is the end of the fixed area so it's okay to round up */
694 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
695 ret = memblock_remove(fixed_high_start, fixed_high_size);
696 BUG_ON(ret);
697 }
698
699
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700700
Laura Abbottb93525f2012-04-12 09:57:19 -0700701 for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
702 struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700703
704 if (heap->extra_data) {
705 int fixed_position = NOT_FIXED;
Steve Muckle75c34ca2012-06-12 14:27:40 -0700706 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700707
Mitchel Humpherysdc4d01d2012-09-13 10:53:22 -0700708 switch ((int) heap->type) {
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700709 case ION_HEAP_TYPE_CP:
Deepak Kotur35825522012-06-06 15:49:14 -0700710 pdata =
711 (struct ion_cp_heap_pdata *)heap->extra_data;
712 fixed_position = pdata->fixed_position;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700713 break;
714 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbott354d40f2012-08-03 17:32:09 -0700715 case ION_HEAP_TYPE_DMA:
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700716 fixed_position = ((struct ion_co_heap_pdata *)
717 heap->extra_data)->fixed_position;
718 break;
719 default:
720 break;
721 }
722
723 switch (fixed_position) {
724 case FIXED_LOW:
725 heap->base = fixed_low_start;
726 break;
727 case FIXED_MIDDLE:
728 heap->base = fixed_middle_start;
Laura Abbott354d40f2012-08-03 17:32:09 -0700729 if (middle_use_cma) {
730 ret = dma_declare_contiguous(
731 &ion_mm_heap_device.dev,
732 heap->size,
733 fixed_middle_start,
734 0xa0000000);
735 WARN_ON(ret);
736 }
Deepak Kotur35825522012-06-06 15:49:14 -0700737 pdata->secure_base = fixed_middle_start
738 - HOLE_SIZE;
739 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700740 break;
741 case FIXED_HIGH:
742 heap->base = fixed_high_start;
Olav Haugan65f4bd82011-12-13 11:50:08 -0800743 break;
744 default:
745 break;
746 }
747 }
Olav Haugan65f4bd82011-12-13 11:50:08 -0800748 }
Laura Abbottd6183792011-08-19 13:42:24 -0700749#endif
750}
Huaibin Yanga5419422011-12-08 23:52:10 -0800751
Laura Abbott5249a052012-12-11 15:09:03 -0800752static void ion_adjust_secure_allocation(void)
753{
754 int i;
755
756 for (i = 0; i < msm8960_ion_pdata.nr; i++) {
757 struct ion_platform_heap *heap =
758 &(msm8960_ion_pdata.heaps[i]);
759
760
761 if (heap->extra_data) {
762 switch ((int) heap->type) {
763 case ION_HEAP_TYPE_CP:
764 if (cpu_is_msm8960()) {
765 ((struct ion_cp_heap_pdata *)
766 heap->extra_data)->no_nonsecure_alloc =
767 0;
768 }
769
770 }
771 }
772 }
773}
774
Huaibin Yanga5419422011-12-08 23:52:10 -0800775static void __init reserve_mdp_memory(void)
776{
777 msm8960_mdp_writeback(msm8960_reserve_table);
778}
779
Stephen Boyd668d7652012-04-25 11:31:01 -0700780static void __init reserve_cache_dump_memory(void)
Laura Abbott306bcc22012-03-08 11:24:53 -0800781{
782#ifdef CONFIG_MSM_CACHE_DUMP
Laura Abbott306bcc22012-03-08 11:24:53 -0800783 unsigned int total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800784
Laura Abbott155ab6f2012-05-25 08:52:18 -0700785 total = msm8960_cache_dump_pdata.l1_size +
786 msm8960_cache_dump_pdata.l2_size;
Laura Abbott306bcc22012-03-08 11:24:53 -0800787 msm8960_reserve_table[MEMTYPE_EBI1].size += total;
Laura Abbott306bcc22012-03-08 11:24:53 -0800788#endif
789}
790
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700791static void __init msm8960_calculate_reserve_sizes(void)
792{
793 size_pmem_devices();
794 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700795 reserve_ion_memory();
Huaibin Yanga5419422011-12-08 23:52:10 -0800796 reserve_mdp_memory();
Laura Abbottf8c03b92012-02-16 14:57:58 -0800797 reserve_rtb_memory();
Laura Abbott306bcc22012-03-08 11:24:53 -0800798 reserve_cache_dump_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700799}
800
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700801static struct reserve_info msm8960_reserve_info __initdata = {
802 .memtype_reserve_table = msm8960_reserve_table,
803 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
Larry Bassel2d8b42d2012-03-12 10:41:26 -0700804 .reserve_fixed_area = msm8960_reserve_fixed_area,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700805 .paddr_to_memtype = msm8960_paddr_to_memtype,
806};
807
Larry Basselb4126da2011-07-18 14:31:33 -0700808static int msm8960_memory_bank_size(void)
809{
810 return 1<<29;
811}
812
813static void __init locate_unstable_memory(void)
814{
815 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
816 unsigned long bank_size;
817 unsigned long low, high;
818
819 bank_size = msm8960_memory_bank_size();
Larry Bassel4d4f4482012-04-04 11:26:09 -0700820 msm8960_reserve_info.bank_size = bank_size;
821
Larry Basselb4126da2011-07-18 14:31:33 -0700822 low = meminfo.bank[0].start;
823 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700824
825 /* Check if 32 bit overflow occured */
826 if (high < mb->start)
827 high = ~0UL;
828
Larry Bassel4d4f4482012-04-04 11:26:09 -0700829 if (high < MAX_FIXED_AREA_SIZE + MSM8960_FIXED_AREA_START)
830 panic("fixed area extends beyond end of memory\n");
831
Larry Basselb4126da2011-07-18 14:31:33 -0700832 low &= ~(bank_size - 1);
833
834 if (high - low <= bank_size)
Larry Bassel4d4f4482012-04-04 11:26:09 -0700835 goto no_dmm;
Larry Basselb8d61022012-02-24 10:49:45 -0800836
Larry Basselb8d61022012-02-24 10:49:45 -0800837#ifdef CONFIG_ENABLE_DMM
Jack Cheung60eaeab2012-01-09 16:40:26 -0800838 msm8960_reserve_info.low_unstable_address = mb->start -
839 MIN_MEMORY_BLOCK_SIZE + mb->size;
Jack Cheung0b1987e2011-11-18 13:36:29 -0800840 msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
Larry Basselb4126da2011-07-18 14:31:33 -0700841 pr_info("low unstable address %lx max size %lx bank size %lx\n",
842 msm8960_reserve_info.low_unstable_address,
843 msm8960_reserve_info.max_unstable_size,
844 msm8960_reserve_info.bank_size);
Larry Bassel4d4f4482012-04-04 11:26:09 -0700845 return;
Larry Basselb8d61022012-02-24 10:49:45 -0800846#endif
Larry Bassel4d4f4482012-04-04 11:26:09 -0700847no_dmm:
848 msm8960_reserve_info.low_unstable_address = high;
849 msm8960_reserve_info.max_unstable_size = 0;
Larry Basselb4126da2011-07-18 14:31:33 -0700850}
851
Larry Basselb830e182011-10-14 10:46:55 -0700852static void __init place_movable_zone(void)
853{
Larry Basselb8d61022012-02-24 10:49:45 -0800854#ifdef CONFIG_ENABLE_DMM
Larry Basselb830e182011-10-14 10:46:55 -0700855 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
856 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
857 pr_info("movable zone start %lx size %lx\n",
858 movable_reserved_start, movable_reserved_size);
Larry Basselb8d61022012-02-24 10:49:45 -0800859#endif
Larry Basselb830e182011-10-14 10:46:55 -0700860}
861
862static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700863{
864 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700865 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700866 place_movable_zone();
867}
868
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800869static char prim_panel_name[PANEL_NAME_MAX_LEN];
870static char ext_panel_name[PANEL_NAME_MAX_LEN];
871static int __init prim_display_setup(char *param)
872{
873 if (strnlen(param, PANEL_NAME_MAX_LEN))
874 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
875 return 0;
876}
877early_param("prim_display", prim_display_setup);
878
879static int __init ext_display_setup(char *param)
880{
881 if (strnlen(param, PANEL_NAME_MAX_LEN))
882 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
883 return 0;
884}
885early_param("ext_display", ext_display_setup);
886
Larry Basselb830e182011-10-14 10:46:55 -0700887static void __init msm8960_reserve(void)
888{
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -0800889 msm8960_set_display_params(prim_panel_name, ext_panel_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700890 msm_reserve();
891}
892
Larry Bassela4414b12011-08-04 11:11:02 -0700893static int msm8960_change_memory_power(u64 start, u64 size,
894 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700895{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700896 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700897}
898
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700899static void __init msm8960_allocate_memory_regions(void)
900{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800901 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700902}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800903
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700904#ifdef CONFIG_WCD9310_CODEC
905
906#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
907
Patrick Lai3043fba2011-08-01 14:15:57 -0700908/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
909 * 4 micbiases are used to power various analog and digital
910 * microphones operating at 1800 mV. Technically, all micbiases
911 * can source from single cfilter since all microphones operate
912 * at the same voltage level. The arrangement below is to make
913 * sure all cfilters are exercised. LDO_H regulator ouput level
914 * does not need to be as high as 2.85V. It is choosen for
915 * microphone sensitivity purpose.
916 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530917static struct wcd9xxx_pdata tabla_platform_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700918 .slimbus_slave_device = {
919 .name = "tabla-slave",
920 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
921 },
922 .irq = MSM_GPIO_TO_INT(62),
923 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530924 .num_irqs = NR_WCD9XXX_IRQS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700925 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700926 .micbias = {
927 .ldoh_v = TABLA_LDOH_2P85_V,
928 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700929 .cfilt2_mv = 2700,
Patrick Lai3043fba2011-08-01 14:15:57 -0700930 .cfilt3_mv = 1800,
931 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
932 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
933 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
934 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530935 },
936 .regulator = {
937 {
938 .name = "CDC_VDD_CP",
939 .min_uV = 1800000,
940 .max_uV = 1800000,
941 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
942 },
943 {
944 .name = "CDC_VDDA_RX",
945 .min_uV = 1800000,
946 .max_uV = 1800000,
947 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
948 },
949 {
950 .name = "CDC_VDDA_TX",
951 .min_uV = 1800000,
952 .max_uV = 1800000,
953 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
954 },
955 {
956 .name = "VDDIO_CDC",
957 .min_uV = 1800000,
958 .max_uV = 1800000,
959 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
960 },
961 {
962 .name = "VDDD_CDC_D",
963 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700964 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530965 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
966 },
967 {
968 .name = "CDC_VDDA_A_1P2V",
969 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -0700970 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530971 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
972 },
973 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700974};
975
976static struct slim_device msm_slim_tabla = {
977 .name = "tabla-slim",
978 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
979 .dev = {
980 .platform_data = &tabla_platform_data,
981 },
982};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530983
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530984static struct wcd9xxx_pdata tabla20_platform_data = {
Santosh Mardi60e19d92011-10-28 01:15:14 +0530985 .slimbus_slave_device = {
986 .name = "tabla-slave",
987 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
988 },
989 .irq = MSM_GPIO_TO_INT(62),
990 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530991 .num_irqs = NR_WCD9XXX_IRQS,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530992 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
993 .micbias = {
994 .ldoh_v = TABLA_LDOH_2P85_V,
995 .cfilt1_mv = 1800,
Joonwoo Parkcf473b42012-03-29 19:48:16 -0700996 .cfilt2_mv = 2700,
Santosh Mardi60e19d92011-10-28 01:15:14 +0530997 .cfilt3_mv = 1800,
998 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
999 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1000 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1001 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301002 },
1003 .regulator = {
1004 {
1005 .name = "CDC_VDD_CP",
1006 .min_uV = 1800000,
1007 .max_uV = 1800000,
1008 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1009 },
1010 {
1011 .name = "CDC_VDDA_RX",
1012 .min_uV = 1800000,
1013 .max_uV = 1800000,
1014 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1015 },
1016 {
1017 .name = "CDC_VDDA_TX",
1018 .min_uV = 1800000,
1019 .max_uV = 1800000,
1020 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1021 },
1022 {
1023 .name = "VDDIO_CDC",
1024 .min_uV = 1800000,
1025 .max_uV = 1800000,
1026 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1027 },
1028 {
1029 .name = "VDDD_CDC_D",
1030 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -07001031 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301032 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1033 },
1034 {
1035 .name = "CDC_VDDA_A_1P2V",
1036 .min_uV = 1225000,
David Collins8f2a1962012-05-18 09:47:59 -07001037 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301038 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1039 },
1040 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301041};
1042
1043static struct slim_device msm_slim_tabla20 = {
1044 .name = "tabla2x-slim",
1045 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1046 .dev = {
1047 .platform_data = &tabla20_platform_data,
1048 },
1049};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001050#endif
1051
1052static struct slim_boardinfo msm_slim_devices[] = {
1053#ifdef CONFIG_WCD9310_CODEC
1054 {
1055 .bus_num = 1,
1056 .slim_slave = &msm_slim_tabla,
1057 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05301058 {
1059 .bus_num = 1,
1060 .slim_slave = &msm_slim_tabla20,
1061 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001062#endif
1063 /* add more slimbus slaves as needed */
1064};
1065
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001066#define MSM_WCNSS_PHYS 0x03000000
1067#define MSM_WCNSS_SIZE 0x280000
1068
1069static struct resource resources_wcnss_wlan[] = {
1070 {
1071 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1072 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1073 .name = "wcnss_wlanrx_irq",
1074 .flags = IORESOURCE_IRQ,
1075 },
1076 {
1077 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1078 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1079 .name = "wcnss_wlantx_irq",
1080 .flags = IORESOURCE_IRQ,
1081 },
1082 {
1083 .start = MSM_WCNSS_PHYS,
1084 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1085 .name = "wcnss_mmio",
1086 .flags = IORESOURCE_MEM,
1087 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07001088 {
1089 .start = 84,
1090 .end = 88,
1091 .name = "wcnss_gpios_5wire",
1092 .flags = IORESOURCE_IO,
1093 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001094};
1095
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001096static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1097 .has_48mhz_xo = 1,
1098};
1099
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001100static struct platform_device msm_device_wcnss_wlan = {
1101 .name = "wcnss_wlan",
1102 .id = 0,
1103 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1104 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001105 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001106};
1107
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001108#ifdef CONFIG_QSEECOM
1109/* qseecom bus scaling */
1110static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1111 {
1112 .src = MSM_BUS_MASTER_SPS,
1113 .dst = MSM_BUS_SLAVE_EBI_CH0,
1114 .ib = 0,
1115 .ab = 0,
1116 },
1117 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001118 .src = MSM_BUS_MASTER_SPS,
1119 .dst = MSM_BUS_SLAVE_SPS,
1120 .ib = 0,
1121 .ab = 0,
1122 },
1123 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001124 .src = MSM_BUS_MASTER_SPDM,
1125 .dst = MSM_BUS_SLAVE_SPDM,
1126 .ib = 0,
1127 .ab = 0,
1128 },
1129};
1130
1131static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1132 {
1133 .src = MSM_BUS_MASTER_SPS,
1134 .dst = MSM_BUS_SLAVE_EBI_CH0,
1135 .ib = (492 * 8) * 1000000UL,
1136 .ab = (492 * 8) * 100000UL,
1137 },
1138 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001139 .src = MSM_BUS_MASTER_SPS,
1140 .dst = MSM_BUS_SLAVE_SPS,
1141 .ib = (492 * 8) * 1000000UL,
1142 .ab = (492 * 8) * 100000UL,
1143 },
1144 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001145 .src = MSM_BUS_MASTER_SPDM,
1146 .dst = MSM_BUS_SLAVE_SPDM,
1147 .ib = 0,
1148 .ab = 0,
1149 },
1150};
1151
1152static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1153 {
1154 .src = MSM_BUS_MASTER_SPS,
1155 .dst = MSM_BUS_SLAVE_EBI_CH0,
1156 .ib = 0,
1157 .ab = 0,
1158 },
1159 {
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001160 .src = MSM_BUS_MASTER_SPS,
1161 .dst = MSM_BUS_SLAVE_SPS,
1162 .ib = 0,
1163 .ab = 0,
1164 },
1165 {
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001166 .src = MSM_BUS_MASTER_SPDM,
1167 .dst = MSM_BUS_SLAVE_SPDM,
1168 .ib = (64 * 8) * 1000000UL,
1169 .ab = (64 * 8) * 100000UL,
1170 },
1171};
1172
1173static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1174 {
1175 ARRAY_SIZE(qseecom_clks_init_vectors),
1176 qseecom_clks_init_vectors,
1177 },
1178 {
1179 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu037942d2012-09-04 11:52:57 -07001180 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001181 },
1182 {
1183 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1184 qseecom_enable_sfpb_vectors,
1185 },
1186};
1187
1188static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1189 qseecom_hw_bus_scale_usecases,
1190 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1191 .name = "qsee",
1192};
1193
1194static struct platform_device qseecom_device = {
1195 .name = "qseecom",
1196 .id = 0,
1197 .dev = {
1198 .platform_data = &qseecom_bus_pdata,
1199 },
1200};
1201#endif
1202
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001203#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1204 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1205 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1206 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1207
1208#define QCE_SIZE 0x10000
1209#define QCE_0_BASE 0x18500000
1210
1211#define QCE_HW_KEY_SUPPORT 0
1212#define QCE_SHA_HMAC_SUPPORT 1
1213#define QCE_SHARE_CE_RESOURCE 1
1214#define QCE_CE_SHARED 0
1215
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001216/* Begin Bus scaling definitions */
1217static struct msm_bus_vectors crypto_hw_init_vectors[] = {
1218 {
1219 .src = MSM_BUS_MASTER_ADM_PORT0,
1220 .dst = MSM_BUS_SLAVE_EBI_CH0,
1221 .ab = 0,
1222 .ib = 0,
1223 },
1224 {
1225 .src = MSM_BUS_MASTER_ADM_PORT1,
1226 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1227 .ab = 0,
1228 .ib = 0,
1229 },
1230};
1231
1232static struct msm_bus_vectors crypto_hw_active_vectors[] = {
1233 {
1234 .src = MSM_BUS_MASTER_ADM_PORT0,
1235 .dst = MSM_BUS_SLAVE_EBI_CH0,
1236 .ab = 70000000UL,
1237 .ib = 70000000UL,
1238 },
1239 {
1240 .src = MSM_BUS_MASTER_ADM_PORT1,
1241 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1242 .ab = 2480000000UL,
1243 .ib = 2480000000UL,
1244 },
1245};
1246
1247static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
1248 {
1249 ARRAY_SIZE(crypto_hw_init_vectors),
1250 crypto_hw_init_vectors,
1251 },
1252 {
1253 ARRAY_SIZE(crypto_hw_active_vectors),
1254 crypto_hw_active_vectors,
1255 },
1256};
1257
1258static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
1259 crypto_hw_bus_scale_usecases,
1260 ARRAY_SIZE(crypto_hw_bus_scale_usecases),
1261 .name = "cryptohw",
1262};
1263/* End Bus Scaling Definitions*/
1264
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001265static struct resource qcrypto_resources[] = {
1266 [0] = {
1267 .start = QCE_0_BASE,
1268 .end = QCE_0_BASE + QCE_SIZE - 1,
1269 .flags = IORESOURCE_MEM,
1270 },
1271 [1] = {
1272 .name = "crypto_channels",
1273 .start = DMOV_CE_IN_CHAN,
1274 .end = DMOV_CE_OUT_CHAN,
1275 .flags = IORESOURCE_DMA,
1276 },
1277 [2] = {
1278 .name = "crypto_crci_in",
1279 .start = DMOV_CE_IN_CRCI,
1280 .end = DMOV_CE_IN_CRCI,
1281 .flags = IORESOURCE_DMA,
1282 },
1283 [3] = {
1284 .name = "crypto_crci_out",
1285 .start = DMOV_CE_OUT_CRCI,
1286 .end = DMOV_CE_OUT_CRCI,
1287 .flags = IORESOURCE_DMA,
1288 },
1289};
1290
1291static struct resource qcedev_resources[] = {
1292 [0] = {
1293 .start = QCE_0_BASE,
1294 .end = QCE_0_BASE + QCE_SIZE - 1,
1295 .flags = IORESOURCE_MEM,
1296 },
1297 [1] = {
1298 .name = "crypto_channels",
1299 .start = DMOV_CE_IN_CHAN,
1300 .end = DMOV_CE_OUT_CHAN,
1301 .flags = IORESOURCE_DMA,
1302 },
1303 [2] = {
1304 .name = "crypto_crci_in",
1305 .start = DMOV_CE_IN_CRCI,
1306 .end = DMOV_CE_IN_CRCI,
1307 .flags = IORESOURCE_DMA,
1308 },
1309 [3] = {
1310 .name = "crypto_crci_out",
1311 .start = DMOV_CE_OUT_CRCI,
1312 .end = DMOV_CE_OUT_CRCI,
1313 .flags = IORESOURCE_DMA,
1314 },
1315};
1316
1317#endif
1318
1319#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1320 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1321
1322static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1323 .ce_shared = QCE_CE_SHARED,
1324 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1325 .hw_key_support = QCE_HW_KEY_SUPPORT,
1326 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001327 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001328};
1329
1330static struct platform_device qcrypto_device = {
1331 .name = "qcrypto",
1332 .id = 0,
1333 .num_resources = ARRAY_SIZE(qcrypto_resources),
1334 .resource = qcrypto_resources,
1335 .dev = {
1336 .coherent_dma_mask = DMA_BIT_MASK(32),
1337 .platform_data = &qcrypto_ce_hw_suppport,
1338 },
1339};
1340#endif
1341
1342#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1343 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1344
1345static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1346 .ce_shared = QCE_CE_SHARED,
1347 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1348 .hw_key_support = QCE_HW_KEY_SUPPORT,
1349 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001350 .bus_scale_table = &crypto_hw_bus_scale_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001351};
1352
1353static struct platform_device qcedev_device = {
1354 .name = "qce",
1355 .id = 0,
1356 .num_resources = ARRAY_SIZE(qcedev_resources),
1357 .resource = qcedev_resources,
1358 .dev = {
1359 .coherent_dma_mask = DMA_BIT_MASK(32),
1360 .platform_data = &qcedev_ce_hw_suppport,
1361 },
1362};
1363#endif
1364
Joel King0cbf5d82012-05-24 15:21:38 -07001365static struct mdm_platform_data sglte_platform_data = {
1366 .mdm_version = "4.0",
1367 .ramdump_delay_ms = 1000,
Joel King63ce8332012-06-01 09:59:26 -07001368 .soft_reset_inverted = 1,
Joel King0cbf5d82012-05-24 15:21:38 -07001369 .peripheral_platform_device = NULL,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001370 .ramdump_timeout_ms = 600000,
Ameya Thakura98bde52012-06-28 18:55:19 -07001371 .no_powerdown_after_ramdumps = 1,
Ameya Thakur43248fd2012-07-10 18:50:52 -07001372 .image_upgrade_supported = 1,
Joel Kingb8352a12011-11-15 18:46:24 -08001373};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001374
Joel Nider266a2642011-10-16 10:58:05 +02001375#define MSM_TSIF0_PHYS (0x18200000)
1376#define MSM_TSIF1_PHYS (0x18201000)
1377#define MSM_TSIF_SIZE (0x200)
1378#define MSM_TSPP_PHYS (0x18202000)
1379#define MSM_TSPP_SIZE (0x1000)
1380#define MSM_TSPP_BAM_PHYS (0x18204000)
1381#define MSM_TSPP_BAM_SIZE (0x2000)
1382
1383#define TSIF_0_CLK GPIO_CFG(75, 1, GPIO_CFG_INPUT, \
1384 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1385#define TSIF_0_EN GPIO_CFG(76, 1, GPIO_CFG_INPUT, \
1386 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1387#define TSIF_0_DATA GPIO_CFG(77, 1, GPIO_CFG_INPUT, \
1388 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1389#define TSIF_0_SYNC GPIO_CFG(82, 1, GPIO_CFG_INPUT, \
1390 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1391#define TSIF_1_CLK GPIO_CFG(79, 1, GPIO_CFG_INPUT, \
1392 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1393#define TSIF_1_EN GPIO_CFG(80, 1, GPIO_CFG_INPUT, \
1394 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1395#define TSIF_1_DATA GPIO_CFG(81, 1, GPIO_CFG_INPUT, \
1396 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1397#define TSIF_1_SYNC GPIO_CFG(78, 1, GPIO_CFG_INPUT, \
1398 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
1399
1400static const struct msm_gpio tsif_gpios[] = {
1401 { .gpio_cfg = TSIF_0_CLK, .label = "tsif0_clk", },
1402 { .gpio_cfg = TSIF_0_EN, .label = "tsif0_en", },
1403 { .gpio_cfg = TSIF_0_DATA, .label = "tsif0_data", },
1404 { .gpio_cfg = TSIF_0_SYNC, .label = "tsif0_sync", },
1405 { .gpio_cfg = TSIF_1_CLK, .label = "tsif1_clk", },
1406 { .gpio_cfg = TSIF_1_EN, .label = "tsif1_en", },
1407 { .gpio_cfg = TSIF_1_DATA, .label = "tsif1_data", },
1408 { .gpio_cfg = TSIF_1_SYNC, .label = "tsif1_sync", },
1409};
1410
1411static struct resource tspp_resources[] = {
1412 [0] = {
1413 .flags = IORESOURCE_IRQ,
1414 .start = TSIF_TSPP_IRQ,
1415 .end = TSIF1_IRQ,
1416 },
1417 [1] = {
1418 .flags = IORESOURCE_MEM,
1419 .start = MSM_TSIF0_PHYS,
1420 .end = MSM_TSIF0_PHYS + MSM_TSIF_SIZE - 1,
1421 },
1422 [2] = {
1423 .flags = IORESOURCE_MEM,
1424 .start = MSM_TSIF1_PHYS,
1425 .end = MSM_TSIF1_PHYS + MSM_TSIF_SIZE - 1,
1426 },
1427 [3] = {
1428 .flags = IORESOURCE_MEM,
1429 .start = MSM_TSPP_PHYS,
1430 .end = MSM_TSPP_PHYS + MSM_TSPP_SIZE - 1,
1431 },
1432 [4] = {
1433 .flags = IORESOURCE_MEM,
1434 .start = MSM_TSPP_BAM_PHYS,
1435 .end = MSM_TSPP_BAM_PHYS + MSM_TSPP_BAM_SIZE - 1,
1436 },
1437};
1438
1439static struct msm_tspp_platform_data tspp_platform_data = {
1440 .num_gpios = ARRAY_SIZE(tsif_gpios),
1441 .gpios = tsif_gpios,
1442 .tsif_pclk = "tsif_pclk",
1443 .tsif_ref_clk = "tsif_ref_clk",
1444};
1445
1446static struct platform_device msm_device_tspp = {
1447 .name = "msm_tspp",
1448 .id = 0,
1449 .num_resources = ARRAY_SIZE(tspp_resources),
1450 .resource = tspp_resources,
1451 .dev = {
1452 .platform_data = &tspp_platform_data
1453 },
1454};
1455
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001456#define MSM_SHARED_RAM_PHYS 0x80000000
1457
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001458static void __init msm8960_map_io(void)
1459{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001460 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001461 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001462
1463 if (socinfo_init() < 0)
1464 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001465}
1466
1467static void __init msm8960_init_irq(void)
1468{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001469 struct msm_mpm_device_data *data = NULL;
1470
1471#ifdef CONFIG_MSM_MPM
1472 data = &msm8960_mpm_dev_data;
1473#endif
1474
1475 msm_mpm_irq_extn_init(data);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001476 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001477 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001478}
1479
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480static void __init msm8960_init_buses(void)
1481{
1482#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001483 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001484 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1485 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
Gagan Macae154c4b2011-10-05 19:24:43 -06001486 msm_bus_apps_fabric.dev.platform_data =
1487 &msm_bus_8960_apps_fabric_pdata;
1488 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
Gagan Mac680bfc02012-07-19 19:11:00 -06001489 if (cpu_is_msm8960ab()) {
1490 msm_bus_8960_sg_mm_fabric_pdata.rpm_enabled = 1;
1491 msm_bus_mm_fabric.dev.platform_data =
1492 &msm_bus_8960_sg_mm_fabric_pdata;
1493 } else {
1494 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1495 msm_bus_mm_fabric.dev.platform_data =
1496 &msm_bus_8960_mm_fabric_pdata;
1497 }
Gagan Macae154c4b2011-10-05 19:24:43 -06001498 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1499 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001500#endif
1501}
1502
1503static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1504 .max_clock_speed = 15060000,
Kiran Gunda2b285652012-07-30 13:22:39 +05301505 .infinite_mode = 0xFFC0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001506};
1507
1508#ifdef CONFIG_USB_MSM_OTG_72K
1509static struct msm_otg_platform_data msm_otg_pdata;
1510#else
Anji jonnalaa8b8d732011-12-06 10:03:24 +05301511static int wr_phy_init_seq[] = {
1512 0x44, 0x80, /* set VBUS valid threshold
1513 and disconnect valid threshold */
1514 0x38, 0x81, /* update DC voltage level */
1515 0x14, 0x82, /* set preemphasis and rise/fall time */
1516 0x13, 0x83, /* set source impedance adjusment */
1517 -1};
1518
1519static int liquid_v1_phy_init_seq[] = {
1520 0x44, 0x80,/* set VBUS valid threshold
1521 and disconnect valid threshold */
1522 0x3C, 0x81,/* update DC voltage level */
1523 0x18, 0x82,/* set preemphasis and rise/fall time */
1524 0x23, 0x83,/* set source impedance sdjusment */
1525 -1};
1526
Mayank Ranaa1f507b2012-08-14 10:57:00 +05301527static int sglte_phy_init_seq[] = {
1528 0x44, 0x80, /* set VBUS valid threshold
1529 and disconnect valid threshold */
1530 0x3A, 0x81, /* update DC voltage level */
1531 0x24, 0x82, /* set preemphasis and rise/fall time */
1532 0x13, 0x83, /* set source impedance adjusment */
1533 -1};
1534
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301535#ifdef CONFIG_MSM_BUS_SCALING
1536/* Bandwidth requests (zero) if no vote placed */
1537static struct msm_bus_vectors usb_init_vectors[] = {
1538 {
1539 .src = MSM_BUS_MASTER_SPS,
1540 .dst = MSM_BUS_SLAVE_EBI_CH0,
1541 .ab = 0,
1542 .ib = 0,
1543 },
1544};
1545
1546/* Bus bandwidth requests in Bytes/sec */
1547static struct msm_bus_vectors usb_max_vectors[] = {
1548 {
1549 .src = MSM_BUS_MASTER_SPS,
1550 .dst = MSM_BUS_SLAVE_EBI_CH0,
1551 .ab = 60000000, /* At least 480Mbps on bus. */
1552 .ib = 960000000, /* MAX bursts rate */
1553 },
1554};
1555
1556static struct msm_bus_paths usb_bus_scale_usecases[] = {
1557 {
1558 ARRAY_SIZE(usb_init_vectors),
1559 usb_init_vectors,
1560 },
1561 {
1562 ARRAY_SIZE(usb_max_vectors),
1563 usb_max_vectors,
1564 },
1565};
1566
1567static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
1568 usb_bus_scale_usecases,
1569 ARRAY_SIZE(usb_bus_scale_usecases),
1570 .name = "usb",
1571};
1572#endif
1573
Jack Pham87f202f2012-08-06 00:24:22 -07001574#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
1575
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001576static struct msm_otg_platform_data msm_otg_pdata = {
1577 .mode = USB_OTG,
1578 .otg_control = OTG_PMIC_CONTROL,
1579 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001580 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
Anji jonnala4e3e6772011-09-15 18:53:42 +05301581 .power_budget = 750,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301582#ifdef CONFIG_MSM_BUS_SCALING
1583 .bus_scale_table = &usb_bus_scale_pdata,
Jack Pham87f202f2012-08-06 00:24:22 -07001584 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Manu Gautamcd82e9d2011-12-20 14:17:28 +05301585#endif
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +05301586#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
1587 .mhl_dev_name = "sii8334",
1588#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001589};
1590#endif
1591
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301592#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301593#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301594static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1595 .strobe = 150,
1596 .data = 151,
1597};
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301598
1599static struct smsc_hub_platform_data hsic_hub_pdata = {
1600 .hub_reset = HSIC_HUB_RESET_GPIO,
1601};
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301602#else
1603static struct msm_hsic_host_platform_data msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301604static struct smsc_hub_platform_data hsic_hub_pdata;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301605#endif
1606
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05301607static struct platform_device smsc_hub_device = {
1608 .name = "msm_smsc_hub",
1609 .id = -1,
1610 .dev = {
1611 .platform_data = &hsic_hub_pdata,
1612 },
1613};
1614
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001615#define PID_MAGIC_ID 0x71432909
1616#define SERIAL_NUM_MAGIC_ID 0x61945374
1617#define SERIAL_NUMBER_LENGTH 127
1618#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1619
1620struct magic_num_struct {
1621 uint32_t pid;
1622 uint32_t serial_num;
1623};
1624
1625struct dload_struct {
1626 uint32_t reserved1;
1627 uint32_t reserved2;
1628 uint32_t reserved3;
1629 uint16_t reserved4;
1630 uint16_t pid;
1631 char serial_number[SERIAL_NUMBER_LENGTH];
1632 uint16_t reserved5;
1633 struct magic_num_struct magic_struct;
1634};
1635
1636static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1637{
1638 struct dload_struct __iomem *dload = 0;
1639
1640 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1641 if (!dload) {
1642 pr_err("%s: cannot remap I/O memory region: %08x\n",
1643 __func__, DLOAD_USB_BASE_ADD);
1644 return -ENXIO;
1645 }
1646
1647 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1648 __func__, dload, pid, snum);
1649 /* update pid */
1650 dload->magic_struct.pid = PID_MAGIC_ID;
1651 dload->pid = pid;
1652
1653 /* update serial number */
1654 dload->magic_struct.serial_num = 0;
1655 if (!snum) {
1656 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1657 goto out;
1658 }
1659
1660 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001661 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001662out:
1663 iounmap(dload);
1664 return 0;
1665}
1666
1667static struct android_usb_platform_data android_usb_pdata = {
1668 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1669};
1670
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001671static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001672 .name = "android_usb",
1673 .id = -1,
1674 .dev = {
1675 .platform_data = &android_usb_pdata,
1676 },
1677};
1678
1679static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1680 0x03, 0x0f,
1681};
1682
1683static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1684 0x00, 0x24, 0x54, 0x10,
1685 0x09, 0x03, 0x01,
1686 0x10, 0x54, 0x30, 0x0C,
1687 0x24, 0x30, 0x0f,
1688};
1689
1690static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1691 0x00, 0x24, 0x54, 0x10,
1692 0x09, 0x07, 0x01, 0x0B,
1693 0x10, 0x54, 0x30, 0x0C,
1694 0x24, 0x30, 0x0f,
1695};
1696
1697static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1698 [0] = {
1699 .mode = MSM_SPM_MODE_CLOCK_GATING,
1700 .notify_rpm = false,
1701 .cmd = spm_wfi_cmd_sequence,
1702 },
1703 [1] = {
1704 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1705 .notify_rpm = false,
1706 .cmd = spm_power_collapse_without_rpm,
1707 },
1708 [2] = {
1709 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1710 .notify_rpm = true,
1711 .cmd = spm_power_collapse_with_rpm,
1712 },
1713};
1714
1715static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1716 [0] = {
1717 .reg_base_addr = MSM_SAW0_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001718 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001719#if defined(CONFIG_MSM_AVS_HW)
1720 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1721 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1722#endif
1723 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001724 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001725 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1726 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1727 .vctl_timeout_us = 50,
1728 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1729 .modes = msm_spm_seq_list,
1730 },
1731 [1] = {
1732 .reg_base_addr = MSM_SAW1_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001733 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001734#if defined(CONFIG_MSM_AVS_HW)
1735 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1736 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1737#endif
1738 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001739 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001740 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1741 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1742 .vctl_timeout_us = 50,
1743 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1744 .modes = msm_spm_seq_list,
1745 },
1746};
1747
1748static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1749 0x00, 0x20, 0x03, 0x20,
1750 0x00, 0x0f,
1751};
1752
1753static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1754 0x00, 0x20, 0x34, 0x64,
1755 0x48, 0x07, 0x48, 0x20,
1756 0x50, 0x64, 0x04, 0x34,
1757 0x50, 0x0f,
1758};
1759static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1760 0x00, 0x10, 0x34, 0x64,
1761 0x48, 0x07, 0x48, 0x10,
1762 0x50, 0x64, 0x04, 0x34,
1763 0x50, 0x0F,
1764};
1765
1766static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1767 [0] = {
1768 .mode = MSM_SPM_L2_MODE_RETENTION,
1769 .notify_rpm = false,
1770 .cmd = l2_spm_wfi_cmd_sequence,
1771 },
1772 [1] = {
1773 .mode = MSM_SPM_L2_MODE_GDHS,
1774 .notify_rpm = true,
1775 .cmd = l2_spm_gdhs_cmd_sequence,
1776 },
1777 [2] = {
1778 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1779 .notify_rpm = true,
1780 .cmd = l2_spm_power_off_cmd_sequence,
1781 },
1782};
1783
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001784static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1785 [0] = {
1786 .reg_base_addr = MSM_SAW_L2_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001787 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07001788 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001789 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1790 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1791 .modes = msm_spm_l2_seq_list,
1792 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1793 },
1794};
1795
Anirudh Ghayal15698162012-07-31 11:51:32 +05301796#define HAP_SHIFT_LVL_OE_GPIO 47
1797#define HAP_SHIFT_LVL_OE_GPIO_SGLTE 89
Mohan Pallaka5e490392011-09-09 15:18:41 +05301798#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1799#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1800
1801static struct msm_xo_voter *xo_handle_d1;
1802
1803static int isa1200_power(int on)
1804{
1805 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301806 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301807
Anirudh Ghayal15698162012-07-31 11:51:32 +05301808 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1809 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1810
1811
1812 gpio_set_value(hap_oe_gpio, !!on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301813
1814 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1815 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1816 if (rc < 0) {
1817 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1818 __func__, on ? "" : "de-", rc);
1819 goto err_xo_vote;
1820 }
1821
1822 return 0;
1823
1824err_xo_vote:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301825 gpio_set_value(hap_oe_gpio, !on);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301826 return rc;
1827}
1828
1829static int isa1200_dev_setup(bool enable)
1830{
1831 int rc = 0;
Anirudh Ghayal15698162012-07-31 11:51:32 +05301832 int hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO;
Mohan Pallaka5e490392011-09-09 15:18:41 +05301833
1834 struct pm_gpio hap_gpio_config = {
1835 .direction = PM_GPIO_DIR_OUT,
1836 .pull = PM_GPIO_PULL_NO,
1837 .out_strength = PM_GPIO_STRENGTH_HIGH,
1838 .function = PM_GPIO_FUNC_NORMAL,
1839 .inv_int_pol = 0,
1840 .vin_sel = 2,
1841 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1842 .output_value = 0,
1843 };
1844
Anirudh Ghayal15698162012-07-31 11:51:32 +05301845 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
1846 hap_oe_gpio = HAP_SHIFT_LVL_OE_GPIO_SGLTE;
1847
Mohan Pallaka5e490392011-09-09 15:18:41 +05301848 if (enable == true) {
1849 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1850 if (rc) {
1851 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1852 __func__, PM_HAP_EN_GPIO, rc);
1853 return rc;
1854 }
1855
1856 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1857 if (rc) {
1858 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1859 __func__, PM_HAP_LEN_GPIO, rc);
1860 return rc;
1861 }
1862
Anirudh Ghayal15698162012-07-31 11:51:32 +05301863 rc = gpio_request(hap_oe_gpio, "hap_shft_lvl_oe");
Mohan Pallaka5e490392011-09-09 15:18:41 +05301864 if (rc) {
1865 pr_err("%s: unable to request gpio %d (%d)\n",
Anirudh Ghayal15698162012-07-31 11:51:32 +05301866 __func__, hap_oe_gpio, rc);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301867 return rc;
1868 }
1869
Anirudh Ghayal15698162012-07-31 11:51:32 +05301870 rc = gpio_direction_output(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301871 if (rc) {
1872 pr_err("%s: Unable to set direction\n", __func__);
1873 goto free_gpio;
1874 }
1875
1876 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1877 if (IS_ERR(xo_handle_d1)) {
1878 rc = PTR_ERR(xo_handle_d1);
1879 pr_err("%s: failed to get the handle for D1(%d)\n",
1880 __func__, rc);
1881 goto gpio_set_dir;
1882 }
1883 } else {
Anirudh Ghayal15698162012-07-31 11:51:32 +05301884 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301885
1886 msm_xo_put(xo_handle_d1);
1887 }
1888
1889 return 0;
1890
1891gpio_set_dir:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301892 gpio_set_value(hap_oe_gpio, 0);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301893free_gpio:
Anirudh Ghayal15698162012-07-31 11:51:32 +05301894 gpio_free(hap_oe_gpio);
Mohan Pallaka5e490392011-09-09 15:18:41 +05301895 return rc;
1896}
1897
1898static struct isa1200_regulator isa1200_reg_data[] = {
1899 {
1900 .name = "vcc_i2c",
1901 .min_uV = ISA_I2C_VTG_MIN_UV,
1902 .max_uV = ISA_I2C_VTG_MAX_UV,
1903 .load_uA = ISA_I2C_CURR_UA,
1904 },
1905};
1906
1907static struct isa1200_platform_data isa1200_1_pdata = {
1908 .name = "vibrator",
1909 .dev_setup = isa1200_dev_setup,
1910 .power_on = isa1200_power,
1911 .hap_en_gpio = PM_HAP_EN_GPIO,
1912 .hap_len_gpio = PM_HAP_LEN_GPIO,
1913 .max_timeout = 15000,
1914 .mode_ctrl = PWM_GEN_MODE,
1915 .pwm_fd = {
1916 .pwm_div = 256,
1917 },
1918 .is_erm = false,
1919 .smart_en = true,
1920 .ext_clk_en = true,
1921 .chip_en = 1,
1922 .regulator_info = isa1200_reg_data,
1923 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1924};
1925
1926static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1927 {
1928 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
Mohan Pallaka5e490392011-09-09 15:18:41 +05301929 },
1930};
1931
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001932#define CYTTSP_TS_GPIO_IRQ 11
1933#define CYTTSP_TS_SLEEP_GPIO 50
1934#define CYTTSP_TS_RESOUT_N_GPIO 52
1935
1936/*virtual key support */
1937static ssize_t tma340_vkeys_show(struct kobject *kobj,
1938 struct kobj_attribute *attr, char *buf)
1939{
1940 return snprintf(buf, 200,
1941 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1942 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1943 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1944 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1945 "\n");
1946}
1947
1948static struct kobj_attribute tma340_vkeys_attr = {
1949 .attr = {
1950 .mode = S_IRUGO,
1951 },
1952 .show = &tma340_vkeys_show,
1953};
1954
1955static struct attribute *tma340_properties_attrs[] = {
1956 &tma340_vkeys_attr.attr,
1957 NULL
1958};
1959
1960static struct attribute_group tma340_properties_attr_group = {
1961 .attrs = tma340_properties_attrs,
1962};
1963
1964
1965static int cyttsp_platform_init(struct i2c_client *client)
1966{
1967 int rc = 0;
1968 static struct kobject *tma340_properties_kobj;
1969
1970 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1971 tma340_properties_kobj = kobject_create_and_add("board_properties",
1972 NULL);
1973 if (tma340_properties_kobj)
1974 rc = sysfs_create_group(tma340_properties_kobj,
1975 &tma340_properties_attr_group);
1976 if (!tma340_properties_kobj || rc)
1977 pr_err("%s: failed to create board_properties\n",
1978 __func__);
1979
1980 return 0;
1981}
1982
1983static struct cyttsp_regulator regulator_data[] = {
1984 {
1985 .name = "vdd",
1986 .min_uV = CY_TMA300_VTG_MIN_UV,
1987 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301988 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1989 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001990 },
1991 /* TODO: Remove after runtime PM is enabled in I2C driver */
1992 {
1993 .name = "vcc_i2c",
1994 .min_uV = CY_I2C_VTG_MIN_UV,
1995 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05301996 .hpm_load_uA = CY_I2C_CURR_UA,
1997 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001998 },
1999};
2000
2001static struct cyttsp_platform_data cyttsp_pdata = {
2002 .panel_maxx = 634,
2003 .panel_maxy = 1166,
2004 .disp_maxx = 616,
2005 .disp_maxy = 1023,
2006 .disp_minx = 0,
2007 .disp_miny = 16,
2008 .flags = 0x01,
2009 .gen = CY_GEN3, /* or */
2010 .use_st = CY_USE_ST,
2011 .use_mt = CY_USE_MT,
2012 .use_hndshk = CY_SEND_HNDSHK,
2013 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302014 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002015 .use_gestures = CY_USE_GESTURES,
2016 .fw_fname = "cyttsp_8960_cdp.hex",
2017 /* activate up to 4 groups
2018 * and set active distance
2019 */
2020 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2021 CY_GEST_GRP3 | CY_GEST_GRP4 |
2022 CY_ACT_DIST,
Amy Maloche7b741b22012-06-14 14:37:22 -07002023 .act_intrvl = 10,
2024 .tch_tmout = 200,
2025 .lp_intrvl = 30,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002026 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2027 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2028 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2029 .regulator_info = regulator_data,
2030 .num_regulators = ARRAY_SIZE(regulator_data),
2031 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302032 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002033};
2034
2035static struct i2c_board_info cyttsp_info[] __initdata = {
2036 {
2037 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2038 .platform_data = &cyttsp_pdata,
2039#ifndef CY_USE_TIMER
2040 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2041#endif /* CY_USE_TIMER */
2042 },
2043};
2044
Jing Lindc4413c2012-01-16 15:22:52 -08002045/* configuration data for mxt1386 */
2046static const u8 mxt1386_config_data[] = {
Mohan Pallaka50837382011-09-07 11:00:57 +05302047 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002048 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302049 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002050 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002051 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2052 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2053 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2054 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2055 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2056 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302057 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002058 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302059 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002060 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302061 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002062 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2063 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2064 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2065 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302066 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002067 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2068 0,
Anirudh Ghayaldab4e0d2012-01-09 14:59:27 +05302069 /* T18 Object */
2070 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302071 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002072 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2073 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302074 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002075 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2076 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302077 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002078 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2079 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302080 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002081 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302082 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002083 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302084 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002085 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302086 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002087 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302088 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002089 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302090};
2091
Jing Lin33b007d2011-12-21 17:40:23 -08002092/* configuration data for mxt1386e using V1.0 firmware */
2093static const u8 mxt1386e_config_data_v1_0[] = {
2094 /* T6 Object */
2095 0, 0, 0, 0, 0, 0,
2096 /* T38 Object */
2097 12, 1, 0, 17, 1, 12, 0, 0, 0, 0,
2098 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2099 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2100 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2103 0, 0, 0, 0,
2104 /* T7 Object */
2105 100, 16, 50,
2106 /* T8 Object */
2107 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2108 /* T9 Object */
2109 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2110 0, 5, 5, 0, 10, 30, 10, 10, 255, 2,
2111 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2112 10, 5, 0, 0, 0,
2113 /* T18 Object */
2114 0, 0,
2115 /* T24 Object */
2116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2117 0, 0, 0, 0, 0, 0, 0, 0, 0,
2118 /* T25 Object */
2119 3, 0, 60, 115, 156, 99,
2120 /* T27 Object */
2121 0, 0, 0, 0, 0, 0, 0,
2122 /* T40 Object */
2123 0, 0, 0, 0, 0,
2124 /* T42 Object */
2125 2, 0, 255, 0, 255, 0, 0, 0, 0, 0,
2126 /* T43 Object */
2127 0, 0, 0, 0, 0, 0, 0,
2128 /* T46 Object */
2129 64, 0, 20, 20, 0, 0, 0, 0, 0,
2130 /* T47 Object */
2131 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2132 /* T48 Object */
2133 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
2134 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2135 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2136 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2137 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2138 0, 0, 0, 0,
2139 /* T56 Object */
2140 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2144 2, 99, 33,
2145};
2146
2147/* configuration data for mxt1386e using V2.1 firmware */
2148static const u8 mxt1386e_config_data_v2_1[] = {
2149 /* T6 Object */
2150 0, 0, 0, 0, 0, 0,
2151 /* T38 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002152 12, 4, 0, 5, 7, 12, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2156 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2157 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2158 0, 0, 0, 0,
2159 /* T7 Object */
2160 100, 16, 50,
2161 /* T8 Object */
2162 25, 0, 20, 20, 0, 0, 20, 50, 0, 0,
2163 /* T9 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002164 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Lina0bc4102012-07-06 17:03:45 -07002165 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Lin33b007d2011-12-21 17:40:23 -08002166 85, 5, 10, 10, 10, 10, 135, 55, 70, 40,
2167 10, 5, 0, 0, 0,
2168 /* T18 Object */
2169 0, 0,
2170 /* T24 Object */
2171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2172 0, 0, 0, 0, 0, 0, 0, 0, 0,
2173 /* T25 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002174 1, 0, 60, 115, 156, 99,
Jing Lin33b007d2011-12-21 17:40:23 -08002175 /* T27 Object */
2176 0, 0, 0, 0, 0, 0, 0,
2177 /* T40 Object */
2178 0, 0, 0, 0, 0,
2179 /* T42 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002180 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002181 /* T43 Object */
2182 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
2183 16,
2184 /* T46 Object */
Jing Lina0bc4102012-07-06 17:03:45 -07002185 64, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002186 /* T47 Object */
2187 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2188 /* T48 Object */
Jing Lin763f4772012-05-25 13:39:40 -07002189 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin33b007d2011-12-21 17:40:23 -08002190 48, 40, 0, 10, 10, 0, 0, 100, 10, 80,
2191 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2192 52, 0, 12, 0, 17, 0, 1, 0, 0, 0,
2193 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2194 0, 0, 0, 0,
2195 /* T56 Object */
2196 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2198 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2200 2, 99, 33, 0, 149, 24, 193, 255, 255, 255,
2201 255,
2202};
2203
Jing Lineec88ca2012-02-08 11:18:30 -08002204/* configuration data for mxt1386e on 3D SKU using V2.1 firmware */
2205static const u8 mxt1386e_config_data_3d[] = {
2206 /* T6 Object */
2207 0, 0, 0, 0, 0, 0,
2208 /* T38 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002209 13, 1, 0, 23, 2, 12, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2215 0, 0, 0, 0,
2216 /* T7 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002217 100, 10, 50,
Jing Lineec88ca2012-02-08 11:18:30 -08002218 /* T8 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002219 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002220 /* T9 Object */
2221 131, 0, 0, 26, 42, 0, 32, 80, 2, 5,
2222 0, 5, 5, 0, 10, 30, 10, 10, 175, 4,
Jing Lin66ba78b2012-02-24 21:25:12 -08002223 127, 7, 26, 21, 17, 19, 143, 35, 207, 40,
2224 20, 5, 54, 49, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002225 /* T18 Object */
2226 0, 0,
2227 /* T24 Object */
2228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2229 0, 0, 0, 0, 0, 0, 0, 0, 0,
2230 /* T25 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002231 0, 0, 72, 113, 168, 97,
Jing Lineec88ca2012-02-08 11:18:30 -08002232 /* T27 Object */
2233 0, 0, 0, 0, 0, 0, 0,
2234 /* T40 Object */
2235 0, 0, 0, 0, 0,
2236 /* T42 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002237 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002238 /* T43 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002239 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2240 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002241 /* T46 Object */
Jing Lin66ba78b2012-02-24 21:25:12 -08002242 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002243 /* T47 Object */
2244 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
2245 /* T48 Object */
2246 31, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002247 32, 50, 0, 10, 10, 0, 0, 100, 10, 90,
2248 0, 0, 0, 0, 0, 0, 0, 10, 1, 30,
2249 52, 10, 5, 0, 33, 0, 1, 0, 0, 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002250 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2251 0, 0, 0, 0,
2252 /* T56 Object */
2253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Lin66ba78b2012-02-24 21:25:12 -08002257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2258 0,
Jing Lineec88ca2012-02-08 11:18:30 -08002259};
2260
Amy Maloche08266db2011-11-04 11:07:16 -07002261#define MXT_TS_GPIO_IRQ 11
2262#define MXT_TS_LDO_EN_GPIO 50
2263#define MXT_TS_RESET_GPIO 52
Mohan Pallaka50837382011-09-07 11:00:57 +05302264
2265static void mxt_init_hw_liquid(void)
2266{
2267 int rc;
2268
Mohan Pallaka50837382011-09-07 11:00:57 +05302269 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2270 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002271 pr_err("%s: unable to request mxt_ldo_en_gpio [%d]\n",
2272 __func__, MXT_TS_LDO_EN_GPIO);
2273 return;
Mohan Pallaka50837382011-09-07 11:00:57 +05302274 }
2275
2276 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2277 if (rc) {
Amy Maloche08266db2011-11-04 11:07:16 -07002278 pr_err("%s: unable to set_direction for mxt_ldo_en_gpio [%d]\n",
2279 __func__, MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302280 goto err_ldo_gpio_req;
2281 }
2282
Mohan Pallaka50837382011-09-07 11:00:57 +05302283 return;
2284
Mohan Pallaka50837382011-09-07 11:00:57 +05302285err_ldo_gpio_req:
2286 gpio_free(MXT_TS_LDO_EN_GPIO);
Mohan Pallaka50837382011-09-07 11:00:57 +05302287}
2288
Jing Lineec88ca2012-02-08 11:18:30 -08002289static struct mxt_config_info mxt_config_array_2d[] = {
Jing Lindc4413c2012-01-16 15:22:52 -08002290 {
2291 .config = mxt1386_config_data,
2292 .config_length = ARRAY_SIZE(mxt1386_config_data),
2293 .family_id = 0xA0,
2294 .variant_id = 0x0,
2295 .version = 0x10,
2296 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002297 .bootldr_id = MXT_BOOTLOADER_ID_1386,
Jing Lindc4413c2012-01-16 15:22:52 -08002298 },
Jing Lin33b007d2011-12-21 17:40:23 -08002299 {
2300 .config = mxt1386e_config_data_v1_0,
2301 .config_length = ARRAY_SIZE(mxt1386e_config_data_v1_0),
2302 .family_id = 0xA0,
2303 .variant_id = 0x2,
2304 .version = 0x10,
2305 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002306 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002307 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
Jing Lin33b007d2011-12-21 17:40:23 -08002308 },
2309 {
2310 .config = mxt1386e_config_data_v2_1,
2311 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2312 .family_id = 0xA0,
2313 .variant_id = 0x7,
2314 .version = 0x21,
2315 .build = 0xAA,
Anirudh Ghayala77941e2012-02-23 19:12:26 -08002316 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Linaeaeed52012-03-26 14:57:15 -07002317 .fw_name = "atmel_8960_liquid_v2_2_AA.hex",
2318 },
2319 {
2320 /* The config data for V2.2.AA is the same as for V2.1.AA */
2321 .config = mxt1386e_config_data_v2_1,
2322 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
2323 .family_id = 0xA0,
2324 .variant_id = 0x7,
2325 .version = 0x22,
2326 .build = 0xAA,
2327 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin33b007d2011-12-21 17:40:23 -08002328 },
Jing Lindc4413c2012-01-16 15:22:52 -08002329};
2330
Jing Lineec88ca2012-02-08 11:18:30 -08002331static struct mxt_platform_data mxt_platform_data_2d = {
2332 .config_array = mxt_config_array_2d,
2333 .config_array_size = ARRAY_SIZE(mxt_config_array_2d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002334 .panel_minx = 0,
2335 .panel_maxx = 1365,
2336 .panel_miny = 0,
2337 .panel_maxy = 767,
2338 .disp_minx = 0,
2339 .disp_maxx = 1365,
2340 .disp_miny = 0,
2341 .disp_maxy = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302342 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002343 .i2c_pull_up = true,
Amy Maloche08266db2011-11-04 11:07:16 -07002344 .reset_gpio = MXT_TS_RESET_GPIO,
2345 .irq_gpio = MXT_TS_GPIO_IRQ,
Mohan Pallaka50837382011-09-07 11:00:57 +05302346};
2347
Jing Lineec88ca2012-02-08 11:18:30 -08002348static struct mxt_config_info mxt_config_array_3d[] = {
2349 {
2350 .config = mxt1386e_config_data_3d,
2351 .config_length = ARRAY_SIZE(mxt1386e_config_data_3d),
2352 .family_id = 0xA0,
2353 .variant_id = 0x7,
2354 .version = 0x21,
2355 .build = 0xAA,
2356 },
2357};
2358
2359static struct mxt_platform_data mxt_platform_data_3d = {
2360 .config_array = mxt_config_array_3d,
2361 .config_array_size = ARRAY_SIZE(mxt_config_array_3d),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08002362 .panel_minx = 0,
2363 .panel_maxx = 1919,
2364 .panel_miny = 0,
2365 .panel_maxy = 1199,
2366 .disp_minx = 0,
2367 .disp_maxx = 1919,
2368 .disp_miny = 0,
2369 .disp_maxy = 1199,
Jing Lineec88ca2012-02-08 11:18:30 -08002370 .irqflags = IRQF_TRIGGER_FALLING,
2371 .i2c_pull_up = true,
2372 .reset_gpio = MXT_TS_RESET_GPIO,
2373 .irq_gpio = MXT_TS_GPIO_IRQ,
2374};
2375
Mohan Pallaka50837382011-09-07 11:00:57 +05302376static struct i2c_board_info mxt_device_info[] __initdata = {
2377 {
2378 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
Mohan Pallaka50837382011-09-07 11:00:57 +05302379 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2380 },
2381};
2382
Manoj Rao14648742012-03-30 19:42:12 -07002383static struct msm_mhl_platform_data mhl_platform_data = {
2384 .irq = MSM_GPIO_TO_INT(4),
Manoj Raoc6d904c2012-06-22 00:32:14 -07002385 .gpio_mhl_int = MHL_GPIO_INT,
2386 .gpio_mhl_reset = MHL_GPIO_RESET,
2387 .gpio_mhl_power = 0,
2388 .gpio_hdmi_mhl_mux = 0,
Manoj Rao14648742012-03-30 19:42:12 -07002389};
Manoj Rao14648742012-03-30 19:42:12 -07002390
Eugene Yasmand2316b82011-12-07 18:23:48 +02002391static struct i2c_board_info sii_device_info[] __initdata = {
2392 {
Manoj Rao14648742012-03-30 19:42:12 -07002393#ifdef CONFIG_FB_MSM_HDMI_MHL_8334
2394 /*
2395 * keeps SI 8334 as the default
2396 * MHL TX
2397 */
2398 I2C_BOARD_INFO("sii8334", 0x39),
2399 .platform_data = &mhl_platform_data,
2400#endif
2401#ifdef CONFIG_FB_MSM_HDMI_MHL_9244
Eugene Yasmand2316b82011-12-07 18:23:48 +02002402 I2C_BOARD_INFO("Sil-9244", 0x39),
Eugene Yasmand2316b82011-12-07 18:23:48 +02002403 .irq = MSM_GPIO_TO_INT(15),
Manoj Rao14648742012-03-30 19:42:12 -07002404#endif /* CONFIG_MSM_HDMI_MHL */
2405 .flags = I2C_CLIENT_WAKE,
Eugene Yasmand2316b82011-12-07 18:23:48 +02002406 },
2407};
2408
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002409static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2410 .clk_freq = 100000,
2411 .src_clk_rate = 24000000,
Kiran Gundab4696c72012-08-16 18:37:46 +05302412 .keep_ahb_clk_on = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002413};
2414
2415static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2416 .clk_freq = 100000,
2417 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002418};
2419
2420static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2421 .clk_freq = 100000,
2422 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002423};
2424
2425static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2426 .clk_freq = 100000,
2427 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002428};
2429
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002430static struct ks8851_pdata spi_eth_pdata = {
2431 .irq_gpio = KS8851_IRQ_GPIO,
2432 .rst_gpio = KS8851_RST_GPIO,
2433};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002434
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302435static struct spi_board_info spi_eth_info[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002436 {
2437 .modalias = "ks8851",
2438 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2439 .max_speed_hz = 19200000,
2440 .bus_num = 0,
2441 .chip_select = 0,
2442 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002443 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002444 },
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05302445};
2446static struct spi_board_info spi_board_info[] __initdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002447 {
2448 .modalias = "dsi_novatek_3d_panel_spi",
2449 .max_speed_hz = 10800000,
2450 .bus_num = 0,
2451 .chip_select = 1,
2452 .mode = SPI_MODE_0,
2453 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002454};
2455
2456static struct platform_device msm_device_saw_core0 = {
2457 .name = "saw-regulator",
2458 .id = 0,
2459 .dev = {
2460 .platform_data = &msm_saw_regulator_pdata_s5,
2461 },
2462};
2463
2464static struct platform_device msm_device_saw_core1 = {
2465 .name = "saw-regulator",
2466 .id = 1,
2467 .dev = {
2468 .platform_data = &msm_saw_regulator_pdata_s6,
2469 },
2470};
2471
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002472static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08002473 .slope = {910, 910, 910, 910, 910},
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002474 .tsens_factor = 1000,
2475 .hw_type = MSM_8960,
2476 .tsens_num_sensor = 5,
2477};
2478
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002479static struct platform_device msm_tsens_device = {
2480 .name = "tsens8960-tm",
2481 .id = -1,
2482};
2483
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002484static struct msm_thermal_data msm_thermal_pdata = {
2485 .sensor_id = 0,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06002486 .poll_ms = 250,
2487 .limit_temp_degC = 60,
2488 .temp_hysteresis_degC = 10,
2489 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06002490};
2491
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002492#ifdef CONFIG_MSM_FAKE_BATTERY
2493static struct platform_device fish_battery_device = {
2494 .name = "fish_battery",
2495};
2496#endif
2497
David Collins26f05562011-06-20 09:56:28 -07002498static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002499 .name = GPIO_REGULATOR_DEV_NAME,
2500 .id = PM8921_MPP_PM_TO_SYS(7),
2501 .dev = {
2502 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2503 },
2504};
2505
David Collins26f05562011-06-20 09:56:28 -07002506static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002507 .name = GPIO_REGULATOR_DEV_NAME,
2508 .id = 91,
2509 .dev = {
2510 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2511 },
2512};
2513
David Collinsb10be1d2011-09-02 10:29:31 -07002514static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2515 .name = GPIO_REGULATOR_DEV_NAME,
2516 .id = PM8921_GPIO_PM_TO_SYS(17),
2517 .dev = {
2518 .platform_data =
2519 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2520 },
2521};
2522
David Collins35a78f52011-12-14 15:54:25 -08002523static struct platform_device msm8960_device_ext_otg_sw_vreg __devinitdata = {
2524 .name = GPIO_REGULATOR_DEV_NAME,
2525 .id = PM8921_GPIO_PM_TO_SYS(42),
2526 .dev = {
2527 .platform_data =
2528 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_OTG_SW],
2529 },
2530};
2531
David Collins26f05562011-06-20 09:56:28 -07002532static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2533 .name = "rpm-regulator",
2534 .id = -1,
2535 .dev = {
2536 .platform_data = &msm_rpm_regulator_pdata,
2537 },
2538};
Mayank Ranae009c922012-03-22 03:02:06 +05302539#ifdef CONFIG_SERIAL_MSM_HS
2540static int configure_uart_gpios(int on)
2541{
2542 int ret = 0, i;
2543 int uart_gpios[] = {93, 94, 95, 96};
2544
2545 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2546 if (on) {
2547 ret = gpio_request(uart_gpios[i], NULL);
2548 if (ret) {
2549 pr_err("%s: unable to request uart gpio[%d]\n",
2550 __func__, uart_gpios[i]);
2551 break;
2552 }
2553 } else {
2554 gpio_free(uart_gpios[i]);
2555 }
2556 }
2557
2558 if (ret && on && i)
2559 for (; i >= 0; i--)
2560 gpio_free(uart_gpios[i]);
2561 return ret;
2562}
2563
2564static struct msm_serial_hs_platform_data msm_uart_dm9_pdata = {
Mayank Ranad85a5082012-04-29 17:24:13 -07002565 .gpio_config = configure_uart_gpios,
Mayank Ranae009c922012-03-22 03:02:06 +05302566};
Mayank Rana1f02d952012-07-04 19:11:20 +05302567
2568static int configure_gsbi8_uart_gpios(int on)
2569{
2570 int ret = 0, i;
2571 int uart_gpios[] = {34, 35, 36, 37};
2572
2573 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2574 if (on) {
2575 ret = gpio_request(uart_gpios[i], NULL);
2576 if (ret) {
2577 pr_err("%s: unable to request uart gpio[%d]\n",
2578 __func__, uart_gpios[i]);
2579 break;
2580 }
2581 } else {
2582 gpio_free(uart_gpios[i]);
2583 }
2584 }
2585
2586 if (ret && on && i)
2587 for (; i >= 0; i--)
2588 gpio_free(uart_gpios[i]);
2589 return ret;
2590}
2591
2592static struct msm_serial_hs_platform_data msm_uart_dm8_pdata = {
2593 .gpio_config = configure_gsbi8_uart_gpios,
2594};
Mayank Ranae009c922012-03-22 03:02:06 +05302595#else
Mayank Rana1f02d952012-07-04 19:11:20 +05302596static struct msm_serial_hs_platform_data msm_uart_dm8_pdata;
Mayank Ranae009c922012-03-22 03:02:06 +05302597static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2598#endif
David Collins26f05562011-06-20 09:56:28 -07002599
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302600#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002601enum WLANBT_STATUS {
2602 WLANOFF_BTOFF = 1,
2603 WLANOFF_BTON,
2604 WLANON_BTOFF,
2605 WLANON_BTON
2606};
2607
2608static DEFINE_MUTEX(ath_wlanbt_mutex);
2609static int gpio_wlan_sys_rest_en = 26;
2610static int ath_wlanbt_status = WLANOFF_BTOFF;
2611
2612static int ath6kl_power_control(int on)
2613{
2614 int rc;
2615
2616 if (on) {
2617 rc = gpio_request(gpio_wlan_sys_rest_en, "wlan sys_rst_n");
2618 if (rc) {
2619 pr_err("%s: unable to request gpio %d (%d)\n",
2620 __func__, gpio_wlan_sys_rest_en, rc);
2621 return rc;
2622 }
2623 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 0);
2624 msleep(200);
2625 rc = gpio_direction_output(gpio_wlan_sys_rest_en, 1);
2626 msleep(100);
2627 } else {
2628 gpio_set_value(gpio_wlan_sys_rest_en, 0);
2629 rc = gpio_direction_input(gpio_wlan_sys_rest_en);
2630 msleep(100);
2631 gpio_free(gpio_wlan_sys_rest_en);
2632 }
2633 return 0;
2634};
2635
2636static int ath6kl_wlan_power(int on)
2637{
2638 int ret = 0;
2639
2640 mutex_lock(&ath_wlanbt_mutex);
2641 if (on) {
2642 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2643 ret = ath6kl_power_control(1);
2644 ath_wlanbt_status = WLANON_BTOFF;
2645 } else if (ath_wlanbt_status == WLANOFF_BTON)
2646 ath_wlanbt_status = WLANON_BTON;
2647 } else {
2648 if (ath_wlanbt_status == WLANON_BTOFF) {
2649 ret = ath6kl_power_control(0);
2650 ath_wlanbt_status = WLANOFF_BTOFF;
2651 } else if (ath_wlanbt_status == WLANON_BTON)
2652 ath_wlanbt_status = WLANOFF_BTON;
2653 }
2654 mutex_unlock(&ath_wlanbt_mutex);
2655 pr_debug("%s on= %d, wlan_status= %d\n",
2656 __func__, on, ath_wlanbt_status);
2657 return ret;
2658};
2659
2660static struct wifi_platform_data ath6kl_wifi_control = {
2661 .set_power = ath6kl_wlan_power,
2662};
2663
2664static struct platform_device msm_wlan_power_device = {
2665 .name = "ath6kl_power",
2666 .dev = {
2667 .platform_data = &ath6kl_wifi_control,
2668 },
2669};
2670
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302671static struct resource bluesleep_resources[] = {
2672 {
2673 .name = "gpio_host_wake",
2674 .start = 27,
2675 .end = 27,
2676 .flags = IORESOURCE_IO,
2677 },
2678 {
2679 .name = "gpio_ext_wake",
2680 .start = 29,
2681 .end = 29,
2682 .flags = IORESOURCE_IO,
2683 },
2684 {
2685 .name = "host_wake",
2686 .start = MSM_GPIO_TO_INT(27),
2687 .end = MSM_GPIO_TO_INT(27),
2688 .flags = IORESOURCE_IRQ,
2689 },
2690};
2691
2692static struct platform_device msm_bluesleep_device = {
2693 .name = "bluesleep",
2694 .id = -1,
2695 .num_resources = ARRAY_SIZE(bluesleep_resources),
2696 .resource = bluesleep_resources,
2697};
2698
2699static struct platform_device msm_bt_power_device = {
2700 .name = "bt_power",
2701};
2702
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002703static int gpio_bt_sys_rest_en = 28;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302704
2705static int bluetooth_power(int on)
2706{
2707 int rc;
2708
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002709 mutex_lock(&ath_wlanbt_mutex);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302710 if (on) {
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002711 if (ath_wlanbt_status == WLANOFF_BTOFF) {
2712 ath6kl_power_control(1);
2713 ath_wlanbt_status = WLANOFF_BTON;
2714 } else if (ath_wlanbt_status == WLANON_BTOFF)
2715 ath_wlanbt_status = WLANON_BTON;
2716
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302717 rc = gpio_request(gpio_bt_sys_rest_en, "bt sys_rst_n");
2718 if (rc) {
2719 pr_err("%s: unable to request gpio %d (%d)\n",
2720 __func__, gpio_bt_sys_rest_en, rc);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002721 mutex_unlock(&ath_wlanbt_mutex);
2722 return rc;
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302723 }
2724 rc = gpio_direction_output(gpio_bt_sys_rest_en, 0);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002725 msleep(20);
2726 rc = gpio_direction_output(gpio_bt_sys_rest_en, 1);
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302727 msleep(100);
2728 } else {
2729 gpio_set_value(gpio_bt_sys_rest_en, 0);
2730 rc = gpio_direction_input(gpio_bt_sys_rest_en);
2731 msleep(100);
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002732 gpio_free(gpio_bt_sys_rest_en);
Ram Mohan Korukondab07c2632012-08-18 22:24:03 +05302733
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002734 if (ath_wlanbt_status == WLANOFF_BTON) {
2735 ath6kl_power_control(0);
2736 ath_wlanbt_status = WLANOFF_BTOFF;
2737 } else if (ath_wlanbt_status == WLANON_BTON)
2738 ath_wlanbt_status = WLANON_BTOFF;
2739 }
2740 mutex_unlock(&ath_wlanbt_mutex);
2741 pr_debug("%s on= %d, wlan_status= %d\n",
2742 __func__, on, ath_wlanbt_status);
2743 return 0;
2744};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302745
2746static void __init bt_power_init(void)
2747{
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302748 msm_bt_power_device.dev.platform_data = &bluetooth_power;
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302749 return;
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002750};
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302751#else
2752#define bt_power_init(x) do {} while (0)
2753#endif
2754
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002755static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002756 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002757 &msm_device_smd,
Mayank Rana9f51f582011-08-04 18:35:59 +05302758 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002759 &msm_device_saw_core0,
2760 &msm_device_saw_core1,
2761 &msm8960_device_ext_5v_vreg,
David Collins87579612012-01-30 16:00:15 -08002762 &msm8960_device_ssbi_pmic,
David Collins96aa3e12012-02-29 10:31:34 -08002763 &msm8960_device_ext_otg_sw_vreg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002764 &msm8960_device_qup_spi_gsbi1,
2765 &msm8960_device_qup_i2c_gsbi3,
2766 &msm8960_device_qup_i2c_gsbi4,
2767 &msm8960_device_qup_i2c_gsbi10,
2768#ifndef CONFIG_MSM_DSPS
2769 &msm8960_device_qup_i2c_gsbi12,
2770#endif
2771 &msm_slim_ctrl,
2772 &msm_device_wcnss_wlan,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302773#if defined(CONFIG_BT) && defined(CONFIG_BT_HCIUART_ATH3K)
2774 &msm_bluesleep_device,
2775 &msm_bt_power_device,
Ming-yi Lin2d43cd52012-10-17 11:50:15 +08002776 &msm_wlan_power_device,
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05302777#endif
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002778#if defined(CONFIG_QSEECOM)
2779 &qseecom_device,
2780#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002781#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2782 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2783 &qcrypto_device,
2784#endif
2785
2786#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2787 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2788 &qcedev_device,
2789#endif
2790#ifdef CONFIG_MSM_ROTATOR
2791 &msm_rotator_device,
2792#endif
2793 &msm_device_sps,
2794#ifdef CONFIG_MSM_FAKE_BATTERY
2795 &fish_battery_device,
2796#endif
Laura Abbottb93525f2012-04-12 09:57:19 -07002797 &msm8960_fmem_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002798#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002799#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -07002800 &msm8960_android_pmem_device,
2801 &msm8960_android_pmem_adsp_device,
2802 &msm8960_android_pmem_audio_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002803#endif
Bharath Ramachandramurthy4a3fa912012-03-13 19:16:24 -07002804#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002805 &msm_device_bam_dmux,
2806 &msm_fm_platform_init,
Joel Nidera1261942011-09-12 16:30:09 +03002807#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
2808#ifdef CONFIG_MSM_USE_TSIF1
2809 &msm_device_tsif[1],
2810#else
2811 &msm_device_tsif[0],
2812#endif
2813#endif
Joel Nider266a2642011-10-16 10:58:05 +02002814 &msm_device_tspp,
Mona Hossain9c430e32011-07-27 11:04:47 -07002815#ifdef CONFIG_HW_RANDOM_MSM
2816 &msm_device_rng,
2817#endif
Laura Abbottd6183792011-08-19 13:42:24 -07002818#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002819 &msm8960_ion_dev,
Laura Abbottd6183792011-08-19 13:42:24 -07002820#endif
Praveen Chidambaram78499012011-11-01 17:15:17 -06002821 &msm8960_rpm_device,
2822 &msm8960_rpm_log_device,
2823 &msm8960_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +05302824 &msm8960_rpm_master_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002825 &msm_device_tz_log,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002826 &coresight_tpiu_device,
2827 &coresight_etb_device,
2828 &coresight_funnel_device,
2829 &coresight_etm0_device,
2830 &coresight_etm1_device,
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002831 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002832 &msm8960_device_watchdog,
Laura Abbottb93525f2012-04-12 09:57:19 -07002833 &msm8960_rtb_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002834 &msm8960_device_cache_erp,
Stepan Moskovchenkoc0557252012-06-07 17:39:14 -07002835 &msm8960_device_ebi1_ch0_erp,
2836 &msm8960_device_ebi1_ch1_erp,
Laura Abbottb93525f2012-04-12 09:57:19 -07002837 &msm8960_cache_dump_device,
Laura Abbott0577d7b2012-04-17 11:14:30 -07002838 &msm8960_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002839 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002840};
2841
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002842static struct platform_device *cdp_devices[] __initdata = {
Stephen Boydeb819882011-08-29 14:46:30 -07002843 &msm_8960_q6_lpass,
Stephen Boyd322a9922011-09-20 01:05:54 -07002844 &msm_8960_riva,
Stephen Boydd89eebe2011-09-28 23:28:11 -07002845 &msm_pil_tzapps,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002846 &msm_pil_dsps,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002847 &msm_pil_vidc,
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002848 &msm8960_device_otg,
2849 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002850 &msm_device_hsusb_host,
2851 &android_usb_device,
2852 &msm_pcm,
Kiran Kandi5e809b02012-01-31 00:24:33 -08002853 &msm_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002854 &msm_lowlatency_pcm,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002855 &msm_pcm_routing,
2856 &msm_cpudai0,
2857 &msm_cpudai1,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002858 &msm8960_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002859 &msm8960_cpudai_slimbus_2_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002860 &msm_cpudai_hdmi_rx,
2861 &msm_cpudai_bt_rx,
2862 &msm_cpudai_bt_tx,
2863 &msm_cpudai_fm_rx,
2864 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002865 &msm_cpudai_auxpcm_rx,
2866 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002867 &msm_cpu_fe,
2868 &msm_stub_codec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002869#ifdef CONFIG_MSM_GEMINI
2870 &msm8960_gemini_device,
2871#endif
Kalyani Oruganti465d1e12012-05-15 10:23:05 -07002872#ifdef CONFIG_MSM_MERCURY
2873 &msm8960_mercury_device,
2874#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002875 &msm_voice,
2876 &msm_voip,
2877 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302878 &msm_cpudai_afe_01_rx,
2879 &msm_cpudai_afe_01_tx,
2880 &msm_cpudai_afe_02_rx,
2881 &msm_cpudai_afe_02_tx,
2882 &msm_pcm_afe,
Asish Bhattacharya96bb6f42011-11-01 20:36:09 +05302883 &msm_compr_dsp,
Helen Zeng0705a5f2011-10-14 15:29:52 -07002884 &msm_cpudai_incall_music_rx,
Helen Zenge3d716a2011-10-14 16:32:16 -07002885 &msm_cpudai_incall_record_rx,
2886 &msm_cpudai_incall_record_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002887 &msm_pcm_hostless,
2888 &msm_bus_apps_fabric,
2889 &msm_bus_sys_fabric,
2890 &msm_bus_mm_fabric,
2891 &msm_bus_sys_fpb,
2892 &msm_bus_cpss_fpb,
2893};
2894
2895static void __init msm8960_i2c_init(void)
2896{
2897 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2898 &msm8960_i2c_qup_gsbi4_pdata;
2899
2900 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2901 &msm8960_i2c_qup_gsbi3_pdata;
2902
2903 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2904 &msm8960_i2c_qup_gsbi10_pdata;
2905
2906 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2907 &msm8960_i2c_qup_gsbi12_pdata;
2908}
2909
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002910static void __init msm8960_gfx_init(void)
2911{
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002912 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2913 msm_kgsl_3d0.dev.platform_data;
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002914 uint32_t soc_platform_version = socinfo_get_version();
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002915
Carter Cooper3852cbb2012-08-20 22:11:42 -06002916 /* Fixup data that needs to change based on GPU ID */
Carter Cooperffe7ea12012-08-22 13:27:58 -06002917 if (cpu_is_msm8960ab()) {
2918 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
Carter Cooper3852cbb2012-08-20 22:11:42 -06002919 /* 8960PRO nominal clock rate is 325Mhz instead of 320Mhz */
2920 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 325000000;
2921 } else {
2922 kgsl_3d0_pdata->iommu_count = 1;
2923 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2924 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2925 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
2926 }
2927 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
2928 /* 8960v3 GPU registers returns 5 for patch release
2929 * but it should be 6, so dummy up the chipid here
2930 * based the platform type
2931 */
2932 kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
2933 }
Jordan Crouse4815e9f2012-07-09 15:36:37 -06002934 }
Carter Cooper6307eb992012-08-20 15:17:23 -06002935
2936 /* Register the 3D core */
2937 platform_device_register(&msm_kgsl_3d0);
2938
2939 /* Register the 2D cores if we are not 8960PRO */
2940 if (!cpu_is_msm8960ab()) {
2941 platform_device_register(&msm_kgsl_2d0);
2942 platform_device_register(&msm_kgsl_2d1);
2943 }
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002944}
2945
Subhash Jadavani933e6a62011-12-26 18:05:04 +05302946static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002947 {
2948 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2949 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2950 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002951 1, 784, 180000, 100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002952 },
2953
2954 {
2955 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2956 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2957 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002958 1300, 228, 1200000, 2000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002959 },
2960
2961 {
2962 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2963 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2964 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002965 2000, 138, 1208400, 3200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002966 },
2967
2968 {
2969 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002970 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2971 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002972 6000, 119, 1850300, 9000,
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002973 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002974
2975 {
2976 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2977 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2978 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002979 9200, 68, 2839200, 16400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002980 },
2981
2982 {
2983 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2984 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2985 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002986 10300, 63, 3128000, 18200,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002987 },
2988
2989 {
2990 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2991 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2992 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002993 18000, 10, 4602600, 27000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002994 },
2995
2996 {
2997 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2998 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2999 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06003000 20000, 2, 5752000, 32000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003001 },
3002};
3003
Praveen Chidambaram78499012011-11-01 17:15:17 -06003004static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
3005 .levels = &msm_rpmrs_levels[0],
3006 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
3007 .vdd_mem_levels = {
3008 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
3009 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
3010 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
3011 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
3012 },
3013 .vdd_dig_levels = {
3014 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
3015 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
3016 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
3017 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
3018 },
3019 .vdd_mask = 0x7FFFFF,
3020 .rpmrs_target_id = {
3021 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
3022 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
3023 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
3024 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
3025 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
3026 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
3027 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
3028 },
3029};
3030
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003031static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
3032 .mode = MSM_PM_BOOT_CONFIG_TZ,
3033};
3034
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003035#ifdef CONFIG_I2C
3036#define I2C_SURF 1
3037#define I2C_FFA (1 << 1)
3038#define I2C_RUMI (1 << 2)
3039#define I2C_SIM (1 << 3)
3040#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003041#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003042
3043struct i2c_registry {
3044 u8 machs;
3045 int bus;
3046 struct i2c_board_info *info;
3047 int len;
3048};
3049
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003050/* Sensors DSPS platform data */
3051#ifdef CONFIG_MSM_DSPS
3052#define DSPS_PIL_GENERIC_NAME "dsps"
3053#endif /* CONFIG_MSM_DSPS */
3054
3055static void __init msm8960_init_dsps(void)
3056{
3057#ifdef CONFIG_MSM_DSPS
3058 struct msm_dsps_platform_data *pdata =
3059 msm_dsps_device.dev.platform_data;
3060 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3061 pdata->gpios = NULL;
3062 pdata->gpios_num = 0;
3063
3064 platform_device_register(&msm_dsps_device);
3065#endif /* CONFIG_MSM_DSPS */
3066}
3067
Vamsi Krishna6aa6b1f2011-12-14 22:55:20 -08003068static int hsic_peripheral_status = 1;
3069static DEFINE_MUTEX(hsic_status_lock);
3070
3071void peripheral_connect()
3072{
3073 mutex_lock(&hsic_status_lock);
3074 if (hsic_peripheral_status)
3075 goto out;
3076 platform_device_add(&msm_device_hsic_host);
3077 hsic_peripheral_status = 1;
3078out:
3079 mutex_unlock(&hsic_status_lock);
3080}
3081EXPORT_SYMBOL(peripheral_connect);
3082
3083void peripheral_disconnect()
3084{
3085 mutex_lock(&hsic_status_lock);
3086 if (!hsic_peripheral_status)
3087 goto out;
3088 platform_device_del(&msm_device_hsic_host);
3089 hsic_peripheral_status = 0;
3090out:
3091 mutex_unlock(&hsic_status_lock);
3092}
3093EXPORT_SYMBOL(peripheral_disconnect);
3094
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303095static void __init msm8960_init_smsc_hub(void)
3096{
3097 uint32_t version = socinfo_get_version();
3098
3099 if (SOCINFO_VERSION_MAJOR(version) == 1)
3100 return;
3101
3102 if (machine_is_msm8960_liquid())
3103 platform_device_register(&smsc_hub_device);
3104}
3105
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003106static void __init msm8960_init_hsic(void)
3107{
3108#ifdef CONFIG_USB_EHCI_MSM_HSIC
3109 uint32_t version = socinfo_get_version();
3110
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003111 if (SOCINFO_VERSION_MAJOR(version) == 1)
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003112 return;
3113
Joel King0cbf5d82012-05-24 15:21:38 -07003114 if (machine_is_msm8960_liquid())
Vamsi Krishnaf74d2edb2011-12-02 10:41:11 -08003115 platform_device_register(&msm_device_hsic_host);
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003116#endif
3117}
3118
Amir Samuelov5137e392011-09-21 17:31:25 +03003119#ifdef CONFIG_ISL9519_CHARGER
3120static struct isl_platform_data isl_data __initdata = {
3121 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3122 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3123 .max_system_voltage = 4200,
3124 .min_system_voltage = 3200,
Amir Samuelov95f49ff2012-01-29 09:14:08 +02003125 .chgcurrent = 1900,
3126 .term_current = 0,
Amir Samuelov5137e392011-09-21 17:31:25 +03003127 .input_current = 2048,
3128};
3129
3130static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3131 {
3132 I2C_BOARD_INFO("isl9519q", 0x9),
3133 .irq = 0, /* Not required when notify-by-pmic */
3134 .platform_data = &isl_data,
3135 },
3136};
3137#endif /* CONFIG_ISL9519_CHARGER */
3138
Amir Samuelov755616d2011-12-13 16:34:46 +02003139static struct i2c_board_info liquid_io_expander_i2c_info[] __initdata = {
3140 {
3141 I2C_BOARD_INFO("sx1508q", 0x20),
3142 .platform_data = &msm8960_sx150x_data[SX150X_LIQUID]
3143 },
3144};
3145
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003146static struct i2c_registry msm8960_i2c_devices[] __initdata = {
Amir Samuelov5137e392011-09-21 17:31:25 +03003147#ifdef CONFIG_ISL9519_CHARGER
3148 {
3149 I2C_LIQUID,
3150 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3151 isl_charger_i2c_info,
3152 ARRAY_SIZE(isl_charger_i2c_info),
3153 },
3154#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003155 {
3156 I2C_SURF | I2C_FFA | I2C_FLUID,
3157 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3158 cyttsp_info,
3159 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003160 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303161 {
3162 I2C_LIQUID,
3163 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3164 mxt_device_info,
3165 ARRAY_SIZE(mxt_device_info),
3166 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05303167 {
Manoj Rao14648742012-03-30 19:42:12 -07003168 I2C_SURF | I2C_FFA | I2C_LIQUID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303169 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003170 sii_device_info,
3171 ARRAY_SIZE(sii_device_info),
3172 },
3173 {
Anirudh Ghayal15698162012-07-31 11:51:32 +05303174 I2C_LIQUID | I2C_FFA,
Eugene Yasmand2316b82011-12-07 18:23:48 +02003175 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
Mohan Pallaka5e490392011-09-09 15:18:41 +05303176 msm_isa1200_board_info,
3177 ARRAY_SIZE(msm_isa1200_board_info),
3178 },
Amir Samuelov755616d2011-12-13 16:34:46 +02003179 {
3180 I2C_LIQUID,
3181 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3182 liquid_io_expander_i2c_info,
3183 ARRAY_SIZE(liquid_io_expander_i2c_info),
3184 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003185};
3186#endif /* CONFIG_I2C */
3187
3188static void __init register_i2c_devices(void)
3189{
3190#ifdef CONFIG_I2C
3191 u8 mach_mask = 0;
3192 int i;
Kevin Chan09f4e662011-12-16 08:17:02 -08003193#ifdef CONFIG_MSM_CAMERA
3194 struct i2c_registry msm8960_camera_i2c_devices = {
3195 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
3196 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3197 msm8960_camera_board_info.board_info,
3198 msm8960_camera_board_info.num_i2c_board_info,
3199 };
3200#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003201
3202 /* Build the matching 'supported_machs' bitmask */
3203 if (machine_is_msm8960_cdp())
3204 mach_mask = I2C_SURF;
Amy Maloche2d028032011-07-20 14:08:06 -07003205 else if (machine_is_msm8960_fluid())
3206 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003207 else if (machine_is_msm8960_liquid())
3208 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003209 else if (machine_is_msm8960_mtp())
3210 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003211 else
3212 pr_err("unmatched machine ID in register_i2c_devices\n");
3213
Jing Lineec88ca2012-02-08 11:18:30 -08003214 if (machine_is_msm8960_liquid()) {
3215 if (SOCINFO_VERSION_MAJOR(socinfo_get_platform_version()) == 3)
3216 mxt_device_info[0].platform_data =
3217 &mxt_platform_data_3d;
3218 else
3219 mxt_device_info[0].platform_data =
3220 &mxt_platform_data_2d;
3221 }
3222
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003223 /* Run the array and install devices as appropriate */
3224 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3225 if (msm8960_i2c_devices[i].machs & mach_mask)
3226 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3227 msm8960_i2c_devices[i].info,
3228 msm8960_i2c_devices[i].len);
3229 }
Manoj Raoc6d904c2012-06-22 00:32:14 -07003230
3231 if (!mhl_platform_data.gpio_mhl_power)
3232 pr_debug("mhl device configured for ext debug board\n");
3233
Kevin Chan09f4e662011-12-16 08:17:02 -08003234#ifdef CONFIG_MSM_CAMERA
3235 if (msm8960_camera_i2c_devices.machs & mach_mask)
3236 i2c_register_board_info(msm8960_camera_i2c_devices.bus,
3237 msm8960_camera_i2c_devices.info,
3238 msm8960_camera_i2c_devices.len);
3239#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003240#endif
3241}
3242
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003243static void __init msm8960_tsens_init(void)
3244{
3245 if (cpu_is_msm8960())
3246 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 1)
3247 return;
3248
3249 msm_tsens_early_init(&msm_tsens_pdata);
3250}
3251
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003252static void __init msm8960_cdp_init(void)
3253{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07003254 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3255 pr_err("meminfo_init() failed!\n");
3256
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003257 platform_device_register(&msm_gpio_device);
Siddartha Mohanadoss9e1417c2012-09-26 09:42:32 -07003258 msm8960_tsens_init();
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003259 msm_thermal_init(&msm_thermal_pdata);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003260 BUG_ON(msm_rpm_init(&msm8960_rpm_data));
3261 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07003262
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003263 regulator_suppress_info_printing();
3264 if (msm_xo_init())
3265 pr_err("Failed to initialize XO votes\n");
David Collins4c93ce92012-09-04 15:44:19 -07003266 configure_msm8960_power_grid();
David Collins26f05562011-06-20 09:56:28 -07003267 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003268 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05303269 if (machine_is_msm8960_liquid())
3270 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003271 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303272 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
3273 machine_is_msm8960_cdp()) {
Mayank Ranaa1f507b2012-08-14 10:57:00 +05303274 /* Due to availability of USB Switch in SGLTE Platform
3275 * it requires different HSUSB PHY settings compare to
3276 * 8960 MTP/CDP platform.
3277 */
3278 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3279 msm_otg_pdata.phy_init_seq = sglte_phy_init_seq;
3280 else
3281 msm_otg_pdata.phy_init_seq = wr_phy_init_seq;
Anji jonnalaa8b8d732011-12-06 10:03:24 +05303282 } else if (machine_is_msm8960_liquid()) {
3283 msm_otg_pdata.phy_init_seq =
3284 liquid_v1_phy_init_seq;
3285 }
Ofir Cohen94213a72012-05-03 14:26:32 +03003286 android_usb_pdata.swfi_latency =
Anji jonnalaa7c1c5c2011-12-12 12:20:36 +05303287 msm_rpmrs_levels[0].latency_us;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303288 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303289 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
3290 machine_is_msm8960_liquid())
3291 msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08003292 msm8960_init_gpiomux();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003293 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3294 &msm8960_qup_spi_gsbi1_pdata;
3295 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Anirudh Ghayal50137fb2012-07-31 16:58:53 +05303296 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE)
3297 spi_register_board_info(spi_eth_info, ARRAY_SIZE(spi_eth_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003298
3299 msm8960_init_pmic();
Anirudh Ghayal15698162012-07-31 11:51:32 +05303300 if (machine_is_msm8960_liquid() || (machine_is_msm8960_mtp() &&
3301 (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)))
Mohan Pallakaf69f0492011-11-21 13:08:33 +05303302 msm_isa1200_board_info[0].platform_data = &isa1200_1_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003303 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003304 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003305 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3306 msm_spm_l2_init(msm_spm_l2_data);
3307 msm8960_init_buses();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003308 platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
David Collinsb10be1d2011-09-02 10:29:31 -07003309 if (machine_is_msm8960_liquid())
3310 platform_device_register(&msm8960_device_ext_3p3v_vreg);
David Collinsd5a40732011-11-29 15:53:56 -08003311 if (machine_is_msm8960_cdp())
3312 platform_device_register(&msm8960_device_ext_l2_vreg);
Stepan Moskovchenko2b4b1cd2012-03-29 18:21:04 -07003313
3314 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
3315 platform_device_register(&msm8960_device_uart_gsbi8);
3316 else
3317 platform_device_register(&msm8960_device_uart_gsbi5);
3318
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003319 /* For 8960 Fusion 2.2 Primary IPC */
Mayank Ranad85a5082012-04-29 17:24:13 -07003320 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3321 msm_uart_dm9_pdata.wakeup_irq = gpio_to_irq(94); /* GSBI9(2) */
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003322 msm_device_uart_dm9.dev.platform_data = &msm_uart_dm9_pdata;
Mayank Rana77f83c22012-07-10 09:31:02 +05303323 platform_device_register(&msm_device_uart_dm9);
Mayank Ranad85a5082012-04-29 17:24:13 -07003324 }
Mayank Ranaa7f75a62012-04-21 10:09:42 -07003325
Mayank Rana1f02d952012-07-04 19:11:20 +05303326 /* For 8960 Standalone External Bluetooth Interface */
3327 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE) {
3328 msm_device_uart_dm8.dev.platform_data = &msm_uart_dm8_pdata;
3329 platform_device_register(&msm_device_uart_dm8);
3330 }
Patrick Daly6578e0c2012-07-19 18:50:02 -07003331 if (cpu_is_msm8960ab())
3332 platform_device_register(&msm8960ab_device_acpuclk);
3333 else
3334 platform_device_register(&msm8960_device_acpuclk);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003335 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Arun Menond4837f62012-08-20 15:25:50 -07003336 msm8960_add_vidc_device();
Patrick Daly6578e0c2012-07-19 18:50:02 -07003337
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08003338 msm8960_pm8921_gpio_mpp_init();
Stephen Boyd0ea1b762012-09-13 12:41:31 -07003339 /* Don't add modem devices on APQ targets */
3340 if (socinfo_get_id() != 124) {
3341 platform_device_register(&msm_8960_q6_mss_fw);
3342 platform_device_register(&msm_8960_q6_mss_sw);
3343 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003344 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vijayavardhan Vennapusaafbbb8f2012-04-13 16:28:45 +05303345 msm8960_init_smsc_hub();
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07003346 msm8960_init_hsic();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003347#ifdef CONFIG_MSM_CAMERA
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003348 msm8960_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003349#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003350 msm8960_init_mmc();
Mohan Pallaka50837382011-09-07 11:00:57 +05303351 if (machine_is_msm8960_liquid())
3352 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003353 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08003354 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003355 slim_register_board_info(msm_slim_devices,
3356 ARRAY_SIZE(msm_slim_devices));
3357 msm8960_init_dsps();
Larry Bassela7eadea2011-07-14 10:46:00 -07003358 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06003359 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Ram Mohan Korukondace14bd82012-07-11 13:55:52 +05303360 bt_power_init();
Joel King0cbf5d82012-05-24 15:21:38 -07003361 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
3362 mdm_sglte_device.dev.platform_data = &sglte_platform_data;
3363 platform_device_register(&mdm_sglte_device);
3364 }
Laura Abbott5249a052012-12-11 15:09:03 -08003365 ion_adjust_secure_allocation();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003366}
3367
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003368MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3369 .map_io = msm8960_map_io,
3370 .reserve = msm8960_reserve,
3371 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303372 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003373 .timer = &msm_timer,
3374 .init_machine = msm8960_cdp_init,
3375 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003376 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003377 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003378MACHINE_END
3379
3380MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3381 .map_io = msm8960_map_io,
3382 .reserve = msm8960_reserve,
3383 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303384 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003385 .timer = &msm_timer,
3386 .init_machine = msm8960_cdp_init,
3387 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003388 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003389 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003390MACHINE_END
3391
3392MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3393 .map_io = msm8960_map_io,
3394 .reserve = msm8960_reserve,
3395 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303396 .handle_irq = gic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003397 .timer = &msm_timer,
3398 .init_machine = msm8960_cdp_init,
3399 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003400 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003401 .restart = msm_restart,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003402MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003403
3404MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3405 .map_io = msm8960_map_io,
3406 .reserve = msm8960_reserve,
3407 .init_irq = msm8960_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05303408 .handle_irq = gic_handle_irq,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003409 .timer = &msm_timer,
3410 .init_machine = msm8960_cdp_init,
3411 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003412 .init_very_early = msm8960_early_memory,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003413 .restart = msm_restart,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003414MACHINE_END